]>
Commit | Line | Data |
---|---|---|
83cce46b | 1 | /**************************************************************************** |
2 | * * | |
3 | * GNAT COMPILER COMPONENTS * | |
4 | * * | |
5 | * L I N K * | |
6 | * * | |
83cce46b | 7 | * C Implementation File * |
8 | * * | |
126b6848 | 9 | * Copyright (C) 1992-2012, Free Software Foundation, Inc. * |
83cce46b | 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- * | |
6bc9506f | 13 | * ware Foundation; either version 3, or (at your option) any later ver- * |
83cce46b | 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 * | |
6bc9506f | 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/>. * | |
83cce46b | 26 | * * |
27 | * GNAT was originally developed by the GNAT team at New York University. * | |
e78e8c8e | 28 | * Extensive contributions were provided by Ada Core Technologies Inc. * |
83cce46b | 29 | * * |
30 | ****************************************************************************/ | |
31 | ||
becb63f5 | 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 | |
83cce46b | 38 | |
9b94c9e7 | 39 | #ifdef IN_GCC |
6cb4b973 | 40 | #include "auto-host.h" |
9b94c9e7 | 41 | #endif |
83cce46b | 42 | |
d0c9584a | 43 | #include <string.h> |
44 | ||
83cce46b | 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 */ | |
27f48659 | 59 | /* greater than this threshold, then an objlist_file will be generated */ |
83cce46b | 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 */ | |
27f48659 | 66 | /* be set to the null string if the system does not support dynamic */ |
83cce46b | 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 | ||
d2697a05 | 72 | /* shared_libgcc_default gives the system dependent link method that */ |
6fb3c314 | 73 | /* be used by default for linking libgcc (shared or static) */ |
d2697a05 | 74 | |
83cce46b | 75 | /* using_gnu_linker is set to 1 when the GNU linker is used under this */ |
76 | /* target. */ | |
77 | ||
5e0f2e2f | 78 | /* separate_run_path_options is set to 1 when separate "rpath" arguments */ |
79 | /* must be passed to the linker for each directory in the rpath. */ | |
80 | ||
bfcff2f0 | 81 | /* default_libgcc_subdir is the subdirectory name (from the installation */ |
82 | /* root) where we may find a shared libgcc to use by default. */ | |
83 | ||
83cce46b | 84 | /* RESPONSE FILE & GNU LINKER */ |
85 | /* -------------------------- */ | |
86 | /* objlist_file_supported and using_gnu_link used together tell gnatlink */ | |
87 | /* to generate a GNU style response file. Note that object_file_option */ | |
88 | /* must be set to "" in this case, since no option is required for a */ | |
89 | /* response file to be passed to GNU ld. With a GNU linker we use the */ | |
90 | /* linker script to implement the response file feature. Any file passed */ | |
91 | /* in the GNU ld command line with an unknown extension is supposed to be */ | |
92 | /* a linker script. Each linker script augment the current configuration. */ | |
93 | /* The format of such response file is as follow : */ | |
94 | /* INPUT (obj1.p obj2.o ...) */ | |
95 | ||
96 | #define SHARED 'H' | |
97 | #define STATIC 'T' | |
98 | ||
5641963c | 99 | #if defined (__WIN32) |
f270dc82 | 100 | const char *__gnat_object_file_option = ""; |
101 | const char *__gnat_run_path_option = ""; | |
102 | int __gnat_link_max = 30000; | |
103 | unsigned char __gnat_objlist_file_supported = 1; | |
104 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 105 | char __gnat_shared_libgcc_default = STATIC; |
f270dc82 | 106 | unsigned char __gnat_using_gnu_linker = 1; |
107 | const char *__gnat_object_library_extension = ".a"; | |
5e0f2e2f | 108 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 109 | const char *__gnat_default_libgcc_subdir = "lib"; |
83cce46b | 110 | |
21a87c1d | 111 | #elif defined (__hpux__) |
f270dc82 | 112 | const char *__gnat_object_file_option = "-Wl,-c,"; |
113 | const char *__gnat_run_path_option = "-Wl,+b,"; | |
114 | int __gnat_link_max = 5000; | |
115 | unsigned char __gnat_objlist_file_supported = 1; | |
116 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 117 | char __gnat_shared_libgcc_default = STATIC; |
f270dc82 | 118 | unsigned char __gnat_using_gnu_linker = 0; |
119 | const char *__gnat_object_library_extension = ".a"; | |
5e0f2e2f | 120 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 121 | const char *__gnat_default_libgcc_subdir = "lib"; |
83cce46b | 122 | |
c73904bb | 123 | #elif defined (__FreeBSD__) |
eabcce03 | 124 | const char *__gnat_object_file_option = ""; |
125 | const char *__gnat_run_path_option = "-Wl,-rpath,"; | |
f270dc82 | 126 | char __gnat_shared_libgnat_default = STATIC; |
d2697a05 | 127 | char __gnat_shared_libgcc_default = STATIC; |
44d43e97 | 128 | int __gnat_link_max = 8192; |
129 | unsigned char __gnat_objlist_file_supported = 1; | |
130 | unsigned char __gnat_using_gnu_linker = 1; | |
eabcce03 | 131 | const char *__gnat_object_library_extension = ".a"; |
5e0f2e2f | 132 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 133 | const char *__gnat_default_libgcc_subdir = "lib"; |
83cce46b | 134 | |
8a3d0a8f | 135 | #elif defined (__APPLE__) |
723bd332 | 136 | const char *__gnat_object_file_option = "-Wl,-filelist,"; |
8a3d0a8f | 137 | const char *__gnat_run_path_option = "-Wl,-rpath,"; |
138 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 139 | char __gnat_shared_libgcc_default = SHARED; |
8a3d0a8f | 140 | int __gnat_link_max = 262144; |
141 | unsigned char __gnat_objlist_file_supported = 1; | |
723bd332 | 142 | unsigned char __gnat_using_gnu_linker = 0; |
8a3d0a8f | 143 | const char *__gnat_object_library_extension = ".a"; |
5e0f2e2f | 144 | unsigned char __gnat_separate_run_path_options = 1; |
bfcff2f0 | 145 | const char *__gnat_default_libgcc_subdir = "lib"; |
8a3d0a8f | 146 | |
9d093602 | 147 | #elif defined (linux) || defined(__GLIBC__) |
f270dc82 | 148 | const char *__gnat_object_file_option = ""; |
149 | const char *__gnat_run_path_option = "-Wl,-rpath,"; | |
150 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 151 | char __gnat_shared_libgcc_default = STATIC; |
f270dc82 | 152 | int __gnat_link_max = 8192; |
153 | unsigned char __gnat_objlist_file_supported = 1; | |
154 | unsigned char __gnat_using_gnu_linker = 1; | |
155 | const char *__gnat_object_library_extension = ".a"; | |
5e0f2e2f | 156 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 157 | #if defined (__x86_64) |
70d595c8 | 158 | # if defined (__LP64__) |
bfcff2f0 | 159 | const char *__gnat_default_libgcc_subdir = "lib64"; |
70d595c8 | 160 | # else |
161 | const char *__gnat_default_libgcc_subdir = "libx32"; | |
162 | # endif | |
bfcff2f0 | 163 | #else |
164 | const char *__gnat_default_libgcc_subdir = "lib"; | |
165 | #endif | |
83cce46b | 166 | |
ce9ee49d | 167 | #elif defined (_AIX) |
168 | /* On AIX, even when with GNU ld we use native linker switches. This is | |
169 | particularly important for '-f' as it should be interpreted by collect2. */ | |
170 | ||
171 | const char *__gnat_object_file_option = "-Wl,-f,"; | |
172 | const char *__gnat_run_path_option = ""; | |
173 | char __gnat_shared_libgnat_default = STATIC; | |
174 | char __gnat_shared_libgcc_default = STATIC; | |
175 | int __gnat_link_max = 15000; | |
176 | const unsigned char __gnat_objlist_file_supported = 1; | |
177 | unsigned char __gnat_using_gnu_linker = 0; | |
178 | const char *__gnat_object_library_extension = ".a"; | |
179 | unsigned char __gnat_separate_run_path_options = 0; | |
180 | const char *__gnat_default_libgcc_subdir = "lib"; | |
181 | ||
6cb4b973 | 182 | #elif (HAVE_GNU_LD) |
183 | /* These are the settings for all systems that use gnu ld. GNU style response | |
184 | file is supported, the shared library default is STATIC. */ | |
185 | ||
6cb4b973 | 186 | const char *__gnat_object_file_option = ""; |
ce9ee49d | 187 | const char *__gnat_run_path_option = ""; |
6cb4b973 | 188 | char __gnat_shared_libgnat_default = STATIC; |
189 | char __gnat_shared_libgcc_default = STATIC; | |
190 | int __gnat_link_max = 8192; | |
191 | unsigned char __gnat_objlist_file_supported = 1; | |
192 | unsigned char __gnat_using_gnu_linker = 1; | |
193 | const char *__gnat_object_library_extension = ".a"; | |
194 | unsigned char __gnat_separate_run_path_options = 0; | |
195 | const char *__gnat_default_libgcc_subdir = "lib"; | |
196 | ||
197 | #elif defined (VMS) | |
198 | const char *__gnat_object_file_option = ""; | |
199 | const char *__gnat_run_path_option = ""; | |
200 | char __gnat_shared_libgnat_default = STATIC; | |
201 | char __gnat_shared_libgcc_default = STATIC; | |
202 | int __gnat_link_max = 2147483647; | |
203 | unsigned char __gnat_objlist_file_supported = 0; | |
204 | unsigned char __gnat_using_gnu_linker = 0; | |
205 | const char *__gnat_object_library_extension = ".olb"; | |
206 | unsigned char __gnat_separate_run_path_options = 0; | |
207 | const char *__gnat_default_libgcc_subdir = "lib"; | |
208 | ||
209 | #elif defined (sun) | |
210 | const char *__gnat_object_file_option = ""; | |
211 | const char *__gnat_run_path_option = "-Wl,-R"; | |
212 | char __gnat_shared_libgnat_default = STATIC; | |
213 | char __gnat_shared_libgcc_default = STATIC; | |
214 | int __gnat_link_max = 2147483647; | |
215 | unsigned char __gnat_objlist_file_supported = 0; | |
216 | unsigned char __gnat_using_gnu_linker = 0; | |
217 | const char *__gnat_object_library_extension = ".a"; | |
218 | unsigned char __gnat_separate_run_path_options = 0; | |
219 | #if defined (__sparc_v9__) || defined (__sparcv9) | |
220 | const char *__gnat_default_libgcc_subdir = "lib/sparcv9"; | |
221 | #elif defined (__x86_64) | |
222 | const char *__gnat_default_libgcc_subdir = "lib/amd64"; | |
223 | #else | |
224 | const char *__gnat_default_libgcc_subdir = "lib"; | |
225 | #endif | |
226 | ||
83cce46b | 227 | #elif defined (__svr4__) && defined (i386) |
f270dc82 | 228 | const char *__gnat_object_file_option = ""; |
229 | const char *__gnat_run_path_option = ""; | |
230 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 231 | char __gnat_shared_libgcc_default = STATIC; |
f270dc82 | 232 | int __gnat_link_max = 2147483647; |
233 | unsigned char __gnat_objlist_file_supported = 0; | |
234 | unsigned char __gnat_using_gnu_linker = 0; | |
235 | const char *__gnat_object_library_extension = ".a"; | |
5e0f2e2f | 236 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 237 | const char *__gnat_default_libgcc_subdir = "lib"; |
83cce46b | 238 | |
239 | #else | |
240 | ||
241 | /* These are the default settings for all other systems. No response file | |
242 | is supported, the shared library default is STATIC. */ | |
f270dc82 | 243 | const char *__gnat_run_path_option = ""; |
244 | const char *__gnat_object_file_option = ""; | |
245 | char __gnat_shared_libgnat_default = STATIC; | |
d2697a05 | 246 | char __gnat_shared_libgcc_default = STATIC; |
f270dc82 | 247 | int __gnat_link_max = 2147483647; |
248 | unsigned char __gnat_objlist_file_supported = 0; | |
249 | unsigned char __gnat_using_gnu_linker = 0; | |
250 | const char *__gnat_object_library_extension = ".a"; | |
5e0f2e2f | 251 | unsigned char __gnat_separate_run_path_options = 0; |
bfcff2f0 | 252 | const char *__gnat_default_libgcc_subdir = "lib"; |
83cce46b | 253 | #endif |
becb63f5 | 254 | |
255 | #ifdef __cplusplus | |
256 | } | |
257 | #endif |