]>
Commit | Line | Data |
---|---|---|
38cbfe40 RK |
1 | /**************************************************************************** |
2 | * * | |
3 | * GNAT COMPILER COMPONENTS * | |
4 | * * | |
5 | * L I N K * | |
6 | * * | |
38cbfe40 RK |
7 | * C Implementation File * |
8 | * * | |
4b490c1e | 9 | * Copyright (C) 1992-2020, Free Software Foundation, Inc. * |
38cbfe40 RK |
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- * | |
748086b7 | 13 | * ware Foundation; either version 3, or (at your option) any later ver- * |
38cbfe40 RK |
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 * | |
748086b7 JJ |
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/>. * | |
38cbfe40 RK |
26 | * * |
27 | * GNAT was originally developed by the GNAT team at New York University. * | |
71ff80dc | 28 | * Extensive contributions were provided by Ada Core Technologies Inc. * |
38cbfe40 RK |
29 | * * |
30 | ****************************************************************************/ | |
31 | ||
9e9bd455 LG |
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 | |
38cbfe40 | 38 | |
f9adb9d4 | 39 | #ifdef IN_GCC |
4fbad0ba | 40 | #include "auto-host.h" |
f9adb9d4 | 41 | #endif |
38cbfe40 | 42 | |
2ee06322 RO |
43 | #include <string.h> |
44 | ||
38cbfe40 RK |
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 */ | |
dec55d76 | 59 | /* greater than this threshold, then an objlist_file will be generated */ |
38cbfe40 RK |
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 */ | |
dec55d76 | 66 | /* be set to the null string if the system does not support dynamic */ |
38cbfe40 RK |
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 | ||
6528a7ed | 72 | /* shared_libgcc_default gives the system dependent link method that */ |
308e6f3a | 73 | /* be used by default for linking libgcc (shared or static) */ |
6528a7ed | 74 | |
3b81743f NS |
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 | ||
3bb3f6d6 AC |
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 | ||
38cbfe40 RK |
81 | #define SHARED 'H' |
82 | #define STATIC 'T' | |
83 | ||
b24513a1 | 84 | #if defined (__WIN32) |
b993039f | 85 | const char *__gnat_object_file_option = "-Wl,@"; |
af4b9434 AC |
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; | |
6528a7ed | 90 | char __gnat_shared_libgcc_default = STATIC; |
af4b9434 | 91 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 92 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 93 | const char *__gnat_default_libgcc_subdir = "lib"; |
38cbfe40 | 94 | |
7cd6e9f1 | 95 | #elif defined (__hpux__) |
af4b9434 AC |
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; | |
6528a7ed | 101 | char __gnat_shared_libgcc_default = STATIC; |
af4b9434 | 102 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 103 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 104 | const char *__gnat_default_libgcc_subdir = "lib"; |
38cbfe40 | 105 | |
90af5990 | 106 | #elif defined (__FreeBSD__) || defined (__DragonFly__) \ |
5759c56d | 107 | || defined (__NetBSD__) || defined (__OpenBSD__) \ |
3ec54569 | 108 | || defined (__QNX__) |
b993039f | 109 | const char *__gnat_object_file_option = "-Wl,@"; |
33c423c8 | 110 | const char *__gnat_run_path_option = "-Wl,-rpath,"; |
af4b9434 | 111 | char __gnat_shared_libgnat_default = STATIC; |
6528a7ed | 112 | char __gnat_shared_libgcc_default = STATIC; |
c885d7a1 AC |
113 | int __gnat_link_max = 8192; |
114 | unsigned char __gnat_objlist_file_supported = 1; | |
33c423c8 | 115 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 116 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 117 | const char *__gnat_default_libgcc_subdir = "lib"; |
38cbfe40 | 118 | |
ee00428a | 119 | #elif defined (__APPLE__) |
93bcda23 | 120 | const char *__gnat_object_file_option = "-Wl,-filelist,"; |
ee00428a AC |
121 | const char *__gnat_run_path_option = "-Wl,-rpath,"; |
122 | char __gnat_shared_libgnat_default = STATIC; | |
6528a7ed | 123 | char __gnat_shared_libgcc_default = SHARED; |
ee00428a AC |
124 | int __gnat_link_max = 262144; |
125 | unsigned char __gnat_objlist_file_supported = 1; | |
ee00428a | 126 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 127 | unsigned char __gnat_separate_run_path_options = 1; |
3bb3f6d6 | 128 | const char *__gnat_default_libgcc_subdir = "lib"; |
ee00428a | 129 | |
329be64b | 130 | #elif defined (__linux__) || defined (__GLIBC__) |
b993039f | 131 | const char *__gnat_object_file_option = "-Wl,@"; |
af4b9434 AC |
132 | const char *__gnat_run_path_option = "-Wl,-rpath,"; |
133 | char __gnat_shared_libgnat_default = STATIC; | |
6528a7ed | 134 | char __gnat_shared_libgcc_default = STATIC; |
af4b9434 AC |
135 | int __gnat_link_max = 8192; |
136 | unsigned char __gnat_objlist_file_supported = 1; | |
af4b9434 | 137 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 138 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 139 | #if defined (__x86_64) |
8b1106fb | 140 | # if defined (__LP64__) |
3bb3f6d6 | 141 | const char *__gnat_default_libgcc_subdir = "lib64"; |
8b1106fb L |
142 | # else |
143 | const char *__gnat_default_libgcc_subdir = "libx32"; | |
144 | # endif | |
3bb3f6d6 AC |
145 | #else |
146 | const char *__gnat_default_libgcc_subdir = "lib"; | |
147 | #endif | |
38cbfe40 | 148 | |
ea10ca9c AC |
149 | #elif defined (_AIX) |
150 | /* On AIX, even when with GNU ld we use native linker switches. This is | |
151 | particularly important for '-f' as it should be interpreted by collect2. */ | |
152 | ||
153 | const char *__gnat_object_file_option = "-Wl,-f,"; | |
154 | const char *__gnat_run_path_option = ""; | |
155 | char __gnat_shared_libgnat_default = STATIC; | |
156 | char __gnat_shared_libgcc_default = STATIC; | |
157 | int __gnat_link_max = 15000; | |
6c56d9b8 | 158 | unsigned char __gnat_objlist_file_supported = 1; |
ea10ca9c AC |
159 | const char *__gnat_object_library_extension = ".a"; |
160 | unsigned char __gnat_separate_run_path_options = 0; | |
161 | const char *__gnat_default_libgcc_subdir = "lib"; | |
162 | ||
4fbad0ba AC |
163 | #elif (HAVE_GNU_LD) |
164 | /* These are the settings for all systems that use gnu ld. GNU style response | |
165 | file is supported, the shared library default is STATIC. */ | |
166 | ||
b993039f | 167 | const char *__gnat_object_file_option = "-Wl,@"; |
ea10ca9c | 168 | const char *__gnat_run_path_option = ""; |
4fbad0ba AC |
169 | char __gnat_shared_libgnat_default = STATIC; |
170 | char __gnat_shared_libgcc_default = STATIC; | |
171 | int __gnat_link_max = 8192; | |
172 | unsigned char __gnat_objlist_file_supported = 1; | |
4fbad0ba AC |
173 | const char *__gnat_object_library_extension = ".a"; |
174 | unsigned char __gnat_separate_run_path_options = 0; | |
175 | const char *__gnat_default_libgcc_subdir = "lib"; | |
176 | ||
177 | #elif defined (VMS) | |
178 | const char *__gnat_object_file_option = ""; | |
179 | const char *__gnat_run_path_option = ""; | |
180 | char __gnat_shared_libgnat_default = STATIC; | |
181 | char __gnat_shared_libgcc_default = STATIC; | |
182 | int __gnat_link_max = 2147483647; | |
183 | unsigned char __gnat_objlist_file_supported = 0; | |
4fbad0ba AC |
184 | const char *__gnat_object_library_extension = ".olb"; |
185 | unsigned char __gnat_separate_run_path_options = 0; | |
186 | const char *__gnat_default_libgcc_subdir = "lib"; | |
187 | ||
329be64b | 188 | #elif defined (__sun__) |
4fbad0ba AC |
189 | const char *__gnat_object_file_option = ""; |
190 | const char *__gnat_run_path_option = "-Wl,-R"; | |
191 | char __gnat_shared_libgnat_default = STATIC; | |
192 | char __gnat_shared_libgcc_default = STATIC; | |
193 | int __gnat_link_max = 2147483647; | |
194 | unsigned char __gnat_objlist_file_supported = 0; | |
4fbad0ba AC |
195 | const char *__gnat_object_library_extension = ".a"; |
196 | unsigned char __gnat_separate_run_path_options = 0; | |
197 | #if defined (__sparc_v9__) || defined (__sparcv9) | |
198 | const char *__gnat_default_libgcc_subdir = "lib/sparcv9"; | |
199 | #elif defined (__x86_64) | |
200 | const char *__gnat_default_libgcc_subdir = "lib/amd64"; | |
201 | #else | |
202 | const char *__gnat_default_libgcc_subdir = "lib"; | |
203 | #endif | |
204 | ||
329be64b | 205 | #elif defined (__svr4__) && defined (__i386__) |
af4b9434 AC |
206 | const char *__gnat_object_file_option = ""; |
207 | const char *__gnat_run_path_option = ""; | |
208 | char __gnat_shared_libgnat_default = STATIC; | |
6528a7ed | 209 | char __gnat_shared_libgcc_default = STATIC; |
af4b9434 AC |
210 | int __gnat_link_max = 2147483647; |
211 | unsigned char __gnat_objlist_file_supported = 0; | |
af4b9434 | 212 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 213 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 214 | const char *__gnat_default_libgcc_subdir = "lib"; |
38cbfe40 RK |
215 | |
216 | #else | |
217 | ||
218 | /* These are the default settings for all other systems. No response file | |
219 | is supported, the shared library default is STATIC. */ | |
af4b9434 AC |
220 | const char *__gnat_run_path_option = ""; |
221 | const char *__gnat_object_file_option = ""; | |
222 | char __gnat_shared_libgnat_default = STATIC; | |
6528a7ed | 223 | char __gnat_shared_libgcc_default = STATIC; |
af4b9434 AC |
224 | int __gnat_link_max = 2147483647; |
225 | unsigned char __gnat_objlist_file_supported = 0; | |
af4b9434 | 226 | const char *__gnat_object_library_extension = ".a"; |
3b81743f | 227 | unsigned char __gnat_separate_run_path_options = 0; |
3bb3f6d6 | 228 | const char *__gnat_default_libgcc_subdir = "lib"; |
38cbfe40 | 229 | #endif |
9e9bd455 LG |
230 | |
231 | #ifdef __cplusplus | |
232 | } | |
233 | #endif |