1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
7 * C Implementation File *
9 * Copyright (C) 1992-2009, Free Software Foundation, Inc. *
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. *
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. *
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/>. *
27 * GNAT was originally developed by the GNAT team at New York University. *
28 * Extensive contributions were provided by Ada Core Technologies Inc. *
30 ****************************************************************************/
32 /* This file contains host-specific parameters describing the behavior */
33 /* of the linker. It is used by gnatlink as well as all tools that use */
38 /* objlist_file_supported is set to 1 when the system linker allows */
39 /* response file, that is a file that contains the list of object files. */
40 /* This is useful on systems where the command line length is limited, */
41 /* meaning that putting all the object files on the command line can */
42 /* result in an unacceptable limit on the number of files. */
44 /* object_file_option denotes the system dependent linker option which */
45 /* allows object file names to be placed in a file and then passed to */
46 /* the linker. object_file_option must be set if objlist_file_supported */
49 /* link_max is a conservative system specific threshold (in bytes) of the */
50 /* argument length passed to the linker which will trigger a file being */
51 /* used instead of the command line directly. If the argument length is */
52 /* greater than this threshold, then an objlist_file will be generated */
53 /* and object_file_option and objlist_file_supported must be set. If */
54 /* objlist_file_supported is set to 0 (unsupported), then link_max is */
55 /* set to 2**31-1 so that the limit will never be exceeded. */
57 /* run_path_option is the system dependent linker option which specifies */
58 /* the run time path to use when loading dynamic libraries. This should */
59 /* be set to the null string if the system does not support dynamic */
60 /* loading of libraries. */
62 /* shared_libgnat_default gives the system dependent link method that */
63 /* be used by default for linking libgnat (shared or static) */
65 /* using_gnu_linker is set to 1 when the GNU linker is used under this */
68 /* separate_run_path_options is set to 1 when separate "rpath" arguments */
69 /* must be passed to the linker for each directory in the rpath. */
71 /* RESPONSE FILE & GNU LINKER */
72 /* -------------------------- */
73 /* objlist_file_supported and using_gnu_link used together tell gnatlink */
74 /* to generate a GNU style response file. Note that object_file_option */
75 /* must be set to "" in this case, since no option is required for a */
76 /* response file to be passed to GNU ld. With a GNU linker we use the */
77 /* linker script to implement the response file feature. Any file passed */
78 /* in the GNU ld command line with an unknown extension is supposed to be */
79 /* a linker script. Each linker script augment the current configuration. */
80 /* The format of such response file is as follow : */
81 /* INPUT (obj1.p obj2.o ...) */
87 const char *__gnat_object_file_option
= "-Wl,-input,";
88 const char *__gnat_run_path_option
= "-Wl,-rpath,";
89 int __gnat_link_max
= 10000;
90 unsigned char __gnat_objlist_file_supported
= 1;
91 char __gnat_shared_libgnat_default
= STATIC
;
92 unsigned char __gnat_using_gnu_linker
= 0;
93 const char *__gnat_object_library_extension
= ".a";
94 unsigned char __gnat_separate_run_path_options
= 0;
97 const char *__gnat_object_file_option
= "-Wl,-objectlist,";
98 const char *__gnat_run_path_option
= "-Wl,-rpath,";
99 int __gnat_link_max
= 5000;
100 unsigned char __gnat_objlist_file_supported
= 1;
101 char __gnat_shared_libgnat_default
= STATIC
;
102 unsigned char __gnat_using_gnu_linker
= 0;
103 const char *__gnat_object_library_extension
= ".a";
104 unsigned char __gnat_separate_run_path_options
= 0;
106 #elif defined (__WIN32)
107 const char *__gnat_object_file_option
= "";
108 const char *__gnat_run_path_option
= "";
109 int __gnat_link_max
= 30000;
110 unsigned char __gnat_objlist_file_supported
= 1;
111 char __gnat_shared_libgnat_default
= STATIC
;
112 unsigned char __gnat_using_gnu_linker
= 1;
113 const char *__gnat_object_library_extension
= ".a";
114 unsigned char __gnat_separate_run_path_options
= 0;
116 #elif defined (__hpux__)
117 const char *__gnat_object_file_option
= "-Wl,-c,";
118 const char *__gnat_run_path_option
= "-Wl,+b,";
119 int __gnat_link_max
= 5000;
120 unsigned char __gnat_objlist_file_supported
= 1;
121 char __gnat_shared_libgnat_default
= STATIC
;
122 unsigned char __gnat_using_gnu_linker
= 0;
123 const char *__gnat_object_library_extension
= ".a";
124 unsigned char __gnat_separate_run_path_options
= 0;
127 const char *__gnat_object_file_option
= "-Wl,-f,";
128 const char *__gnat_run_path_option
= "";
129 int __gnat_link_max
= 15000;
130 const unsigned char __gnat_objlist_file_supported
= 1;
131 char __gnat_shared_libgnat_default
= STATIC
;
132 unsigned char __gnat_using_gnu_linker
= 0;
133 const char *__gnat_object_library_extension
= ".a";
134 unsigned char __gnat_separate_run_path_options
= 0;
137 const char *__gnat_object_file_option
= "";
138 const char *__gnat_run_path_option
= "";
139 char __gnat_shared_libgnat_default
= STATIC
;
140 int __gnat_link_max
= 2147483647;
141 unsigned char __gnat_objlist_file_supported
= 0;
142 unsigned char __gnat_using_gnu_linker
= 0;
143 const char *__gnat_object_library_extension
= ".olb";
144 unsigned char __gnat_separate_run_path_options
= 0;
147 const char *__gnat_object_file_option
= "";
148 const char *__gnat_run_path_option
= "-Wl,-R";
149 char __gnat_shared_libgnat_default
= STATIC
;
150 int __gnat_link_max
= 2147483647;
151 unsigned char __gnat_objlist_file_supported
= 0;
152 unsigned char __gnat_using_gnu_linker
= 0;
153 const char *__gnat_object_library_extension
= ".a";
154 unsigned char __gnat_separate_run_path_options
= 0;
156 #elif defined (__FreeBSD__)
157 const char *__gnat_object_file_option
= "";
158 const char *__gnat_run_path_option
= "-Wl,-rpath,";
159 char __gnat_shared_libgnat_default
= STATIC
;
160 int __gnat_link_max
= 8192;
161 unsigned char __gnat_objlist_file_supported
= 1;
162 unsigned char __gnat_using_gnu_linker
= 1;
163 const char *__gnat_object_library_extension
= ".a";
164 unsigned char __gnat_separate_run_path_options
= 0;
166 #elif defined (__APPLE__)
167 const char *__gnat_object_file_option
= "-Wl,-filelist,";
168 const char *__gnat_run_path_option
= "-Wl,-rpath,";
169 char __gnat_shared_libgnat_default
= STATIC
;
170 int __gnat_link_max
= 262144;
171 unsigned char __gnat_objlist_file_supported
= 1;
172 unsigned char __gnat_using_gnu_linker
= 0;
173 const char *__gnat_object_library_extension
= ".a";
174 unsigned char __gnat_separate_run_path_options
= 1;
176 #elif defined (linux) || defined(__GLIBC__)
177 const char *__gnat_object_file_option
= "";
178 const char *__gnat_run_path_option
= "-Wl,-rpath,";
179 char __gnat_shared_libgnat_default
= STATIC
;
180 int __gnat_link_max
= 8192;
181 unsigned char __gnat_objlist_file_supported
= 1;
182 unsigned char __gnat_using_gnu_linker
= 1;
183 const char *__gnat_object_library_extension
= ".a";
184 unsigned char __gnat_separate_run_path_options
= 0;
186 #elif defined (__svr4__) && defined (i386)
187 const char *__gnat_object_file_option
= "";
188 const char *__gnat_run_path_option
= "";
189 char __gnat_shared_libgnat_default
= STATIC
;
190 int __gnat_link_max
= 2147483647;
191 unsigned char __gnat_objlist_file_supported
= 0;
192 unsigned char __gnat_using_gnu_linker
= 0;
193 const char *__gnat_object_library_extension
= ".a";
194 unsigned char __gnat_separate_run_path_options
= 0;
198 /* These are the default settings for all other systems. No response file
199 is supported, the shared library default is STATIC. */
200 const char *__gnat_run_path_option
= "";
201 const char *__gnat_object_file_option
= "";
202 char __gnat_shared_libgnat_default
= STATIC
;
203 int __gnat_link_max
= 2147483647;
204 unsigned char __gnat_objlist_file_supported
= 0;
205 unsigned char __gnat_using_gnu_linker
= 0;
206 const char *__gnat_object_library_extension
= ".a";
207 unsigned char __gnat_separate_run_path_options
= 0;