1 /**************************************************************************** 2 * * 3 * GNAT COMPILER COMPONENTS * 4 * * 5 * L I N K * 6 * * 7 * C Implementation File * 8 * * 9 * Copyright (C) 1992-2015, Free Software Foundation, Inc. * 10 * * 11 * GNAT is free software; you can redistribute it and/or modify it under * 12 * terms of the GNU General Public License as published by the Free Soft- * 13 * ware Foundation; either version 3, or (at your option) any later ver- * 14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- * 15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 * or FITNESS FOR A PARTICULAR PURPOSE. * 17 * * 18 * As a special exception under Section 7 of GPL version 3, you are granted * 19 * additional permissions described in the GCC Runtime Library Exception, * 20 * version 3.1, as published by the Free Software Foundation. * 21 * * 22 * You should have received a copy of the GNU General Public License and * 23 * a copy of the GCC Runtime Library Exception along with this program; * 24 * see the files COPYING3 and COPYING.RUNTIME respectively. If not, see * 25 * <http://www.gnu.org/licenses/>. * 26 * * 27 * GNAT was originally developed by the GNAT team at New York University. * 28 * Extensive contributions were provided by Ada Core Technologies Inc. * 29 * * 30 ****************************************************************************/ 31 32 /* This file contains host-specific parameters describing the behavior of the 33 linker. It is used by gnatlink as well as all tools that use Mlib. */ 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 #ifdef IN_GCC 40 #include "auto-host.h" 41 #endif 42 43 #include <string.h> 44 45 /* objlist_file_supported is set to 1 when the system linker allows */ 46 /* response file, that is a file that contains the list of object files. */ 47 /* This is useful on systems where the command line length is limited, */ 48 /* meaning that putting all the object files on the command line can */ 49 /* result in an unacceptable limit on the number of files. */ 50 51 /* object_file_option denotes the system dependent linker option which */ 52 /* allows object file names to be placed in a file and then passed to */ 53 /* the linker. object_file_option must be set if objlist_file_supported */ 54 /* is set to 1. */ 55 56 /* link_max is a conservative system specific threshold (in bytes) of the */ 57 /* argument length passed to the linker which will trigger a file being */ 58 /* used instead of the command line directly. If the argument length is */ 59 /* greater than this threshold, then an objlist_file will be generated */ 60 /* and object_file_option and objlist_file_supported must be set. If */ 61 /* objlist_file_supported is set to 0 (unsupported), then link_max is */ 62 /* set to 2**31-1 so that the limit will never be exceeded. */ 63 64 /* run_path_option is the system dependent linker option which specifies */ 65 /* the run time path to use when loading dynamic libraries. This should */ 66 /* be set to the null string if the system does not support dynamic */ 67 /* loading of libraries. */ 68 69 /* shared_libgnat_default gives the system dependent link method that */ 70 /* be used by default for linking libgnat (shared or static) */ 71 72 /* shared_libgcc_default gives the system dependent link method that */ 73 /* be used by default for linking libgcc (shared or static) */ 74 75 /* separate_run_path_options is set to 1 when separate "rpath" arguments */ 76 /* must be passed to the linker for each directory in the rpath. */ 77 78 /* default_libgcc_subdir is the subdirectory name (from the installation */ 79 /* root) where we may find a shared libgcc to use by default. */ 80 81 #define SHARED 'H' 82 #define STATIC 'T' 83 84 #if defined (__WIN32) 85 const char *__gnat_object_file_option = "-Wl,@"; 86 const char *__gnat_run_path_option = ""; 87 int __gnat_link_max = 30000; 88 unsigned char __gnat_objlist_file_supported = 1; 89 char __gnat_shared_libgnat_default = STATIC; 90 char __gnat_shared_libgcc_default = STATIC; 91 const char *__gnat_object_library_extension = ".a"; 92 unsigned char __gnat_separate_run_path_options = 0; 93 const char *__gnat_default_libgcc_subdir = "lib"; 94 95 #elif defined (__hpux__) 96 const char *__gnat_object_file_option = "-Wl,-c,"; 97 const char *__gnat_run_path_option = "-Wl,+b,"; 98 int __gnat_link_max = 5000; 99 unsigned char __gnat_objlist_file_supported = 1; 100 char __gnat_shared_libgnat_default = STATIC; 101 char __gnat_shared_libgcc_default = STATIC; 102 const char *__gnat_object_library_extension = ".a"; 103 unsigned char __gnat_separate_run_path_options = 0; 104 const char *__gnat_default_libgcc_subdir = "lib"; 105 106 #elif defined (__FreeBSD__) || defined (__DragonFly__) \ 107 || defined (__NetBSD__) || defined (__OpenBSD__) 108 const char *__gnat_object_file_option = "-Wl,@"; 109 const char *__gnat_run_path_option = "-Wl,-rpath,"; 110 char __gnat_shared_libgnat_default = STATIC; 111 char __gnat_shared_libgcc_default = STATIC; 112 int __gnat_link_max = 8192; 113 unsigned char __gnat_objlist_file_supported = 1; 114 const char *__gnat_object_library_extension = ".a"; 115 unsigned char __gnat_separate_run_path_options = 0; 116 const char *__gnat_default_libgcc_subdir = "lib"; 117 118 #elif defined (__APPLE__) 119 const char *__gnat_object_file_option = "-Wl,-filelist,"; 120 const char *__gnat_run_path_option = "-Wl,-rpath,"; 121 char __gnat_shared_libgnat_default = STATIC; 122 char __gnat_shared_libgcc_default = SHARED; 123 int __gnat_link_max = 262144; 124 unsigned char __gnat_objlist_file_supported = 1; 125 const char *__gnat_object_library_extension = ".a"; 126 unsigned char __gnat_separate_run_path_options = 1; 127 const char *__gnat_default_libgcc_subdir = "lib"; 128 129 #elif defined (__linux__) || defined (__GLIBC__) 130 const char *__gnat_object_file_option = "-Wl,@"; 131 const char *__gnat_run_path_option = "-Wl,-rpath,"; 132 char __gnat_shared_libgnat_default = STATIC; 133 char __gnat_shared_libgcc_default = STATIC; 134 int __gnat_link_max = 8192; 135 unsigned char __gnat_objlist_file_supported = 1; 136 const char *__gnat_object_library_extension = ".a"; 137 unsigned char __gnat_separate_run_path_options = 0; 138 #if defined (__x86_64) 139 # if defined (__LP64__) 140 const char *__gnat_default_libgcc_subdir = "lib64"; 141 # else 142 const char *__gnat_default_libgcc_subdir = "libx32"; 143 # endif 144 #else 145 const char *__gnat_default_libgcc_subdir = "lib"; 146 #endif 147 148 #elif defined (_AIX) 149 /* On AIX, even when with GNU ld we use native linker switches. This is 150 particularly important for '-f' as it should be interpreted by collect2. */ 151 152 const char *__gnat_object_file_option = "-Wl,-f,"; 153 const char *__gnat_run_path_option = ""; 154 char __gnat_shared_libgnat_default = STATIC; 155 char __gnat_shared_libgcc_default = STATIC; 156 int __gnat_link_max = 15000; 157 unsigned char __gnat_objlist_file_supported = 1; 158 const char *__gnat_object_library_extension = ".a"; 159 unsigned char __gnat_separate_run_path_options = 0; 160 const char *__gnat_default_libgcc_subdir = "lib"; 161 162 #elif (HAVE_GNU_LD) 163 /* These are the settings for all systems that use gnu ld. GNU style response 164 file is supported, the shared library default is STATIC. */ 165 166 const char *__gnat_object_file_option = "-Wl,@"; 167 const char *__gnat_run_path_option = ""; 168 char __gnat_shared_libgnat_default = STATIC; 169 char __gnat_shared_libgcc_default = STATIC; 170 int __gnat_link_max = 8192; 171 unsigned char __gnat_objlist_file_supported = 1; 172 const char *__gnat_object_library_extension = ".a"; 173 unsigned char __gnat_separate_run_path_options = 0; 174 const char *__gnat_default_libgcc_subdir = "lib"; 175 176 #elif defined (VMS) 177 const char *__gnat_object_file_option = ""; 178 const char *__gnat_run_path_option = ""; 179 char __gnat_shared_libgnat_default = STATIC; 180 char __gnat_shared_libgcc_default = STATIC; 181 int __gnat_link_max = 2147483647; 182 unsigned char __gnat_objlist_file_supported = 0; 183 const char *__gnat_object_library_extension = ".olb"; 184 unsigned char __gnat_separate_run_path_options = 0; 185 const char *__gnat_default_libgcc_subdir = "lib"; 186 187 #elif defined (__sun__) 188 const char *__gnat_object_file_option = ""; 189 const char *__gnat_run_path_option = "-Wl,-R"; 190 char __gnat_shared_libgnat_default = STATIC; 191 char __gnat_shared_libgcc_default = STATIC; 192 int __gnat_link_max = 2147483647; 193 unsigned char __gnat_objlist_file_supported = 0; 194 const char *__gnat_object_library_extension = ".a"; 195 unsigned char __gnat_separate_run_path_options = 0; 196 #if defined (__sparc_v9__) || defined (__sparcv9) 197 const char *__gnat_default_libgcc_subdir = "lib/sparcv9"; 198 #elif defined (__x86_64) 199 const char *__gnat_default_libgcc_subdir = "lib/amd64"; 200 #else 201 const char *__gnat_default_libgcc_subdir = "lib"; 202 #endif 203 204 #elif defined (__svr4__) && defined (__i386__) 205 const char *__gnat_object_file_option = ""; 206 const char *__gnat_run_path_option = ""; 207 char __gnat_shared_libgnat_default = STATIC; 208 char __gnat_shared_libgcc_default = STATIC; 209 int __gnat_link_max = 2147483647; 210 unsigned char __gnat_objlist_file_supported = 0; 211 const char *__gnat_object_library_extension = ".a"; 212 unsigned char __gnat_separate_run_path_options = 0; 213 const char *__gnat_default_libgcc_subdir = "lib"; 214 215 #else 216 217 /* These are the default settings for all other systems. No response file 218 is supported, the shared library default is STATIC. */ 219 const char *__gnat_run_path_option = ""; 220 const char *__gnat_object_file_option = ""; 221 char __gnat_shared_libgnat_default = STATIC; 222 char __gnat_shared_libgcc_default = STATIC; 223 int __gnat_link_max = 2147483647; 224 unsigned char __gnat_objlist_file_supported = 0; 225 const char *__gnat_object_library_extension = ".a"; 226 unsigned char __gnat_separate_run_path_options = 0; 227 const char *__gnat_default_libgcc_subdir = "lib"; 228 #endif 229 230 #ifdef __cplusplus 231 } 232 #endif 233