* config/sh/sh.c (sh_gimplify_va_arg_expr): Don't call
[official-gcc.git] / gcc / ada / link.c
blob62dd683f1c79fc97ad90d96d1dde39acb9a75cd1
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * L I N K *
6 * *
7 * C Implementation File *
8 * *
9 * Copyright (C) 1992-2009, 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 ****************************************************************************/
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 */
34 /* Mlib. */
36 #include <string.h>
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 */
47 /* is set to 1. */
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 /* shared_libgcc_default gives the system dependent link method that */
66 /* be used by default for linking libgcc (shared or static) */
68 /* using_gnu_linker is set to 1 when the GNU linker is used under this */
69 /* target. */
71 /* separate_run_path_options is set to 1 when separate "rpath" arguments */
72 /* must be passed to the linker for each directory in the rpath. */
74 /* default_libgcc_subdir is the subdirectory name (from the installation */
75 /* root) where we may find a shared libgcc to use by default. */
77 /* RESPONSE FILE & GNU LINKER */
78 /* -------------------------- */
79 /* objlist_file_supported and using_gnu_link used together tell gnatlink */
80 /* to generate a GNU style response file. Note that object_file_option */
81 /* must be set to "" in this case, since no option is required for a */
82 /* response file to be passed to GNU ld. With a GNU linker we use the */
83 /* linker script to implement the response file feature. Any file passed */
84 /* in the GNU ld command line with an unknown extension is supposed to be */
85 /* a linker script. Each linker script augment the current configuration. */
86 /* The format of such response file is as follow : */
87 /* INPUT (obj1.p obj2.o ...) */
89 #define SHARED 'H'
90 #define STATIC 'T'
92 #if defined (__osf__)
93 const char *__gnat_object_file_option = "-Wl,-input,";
94 const char *__gnat_run_path_option = "-Wl,-rpath,";
95 int __gnat_link_max = 10000;
96 unsigned char __gnat_objlist_file_supported = 1;
97 char __gnat_shared_libgnat_default = STATIC;
98 char __gnat_shared_libgcc_default = STATIC;
99 unsigned char __gnat_using_gnu_linker = 0;
100 const char *__gnat_object_library_extension = ".a";
101 unsigned char __gnat_separate_run_path_options = 0;
102 const char *__gnat_default_libgcc_subdir = "lib";
104 #elif defined (sgi)
105 const char *__gnat_object_file_option = "-Wl,-objectlist,";
106 const char *__gnat_run_path_option = "-Wl,-rpath,";
107 int __gnat_link_max = 5000;
108 unsigned char __gnat_objlist_file_supported = 1;
109 char __gnat_shared_libgnat_default = STATIC;
110 char __gnat_shared_libgcc_default = STATIC;
111 unsigned char __gnat_using_gnu_linker = 0;
112 const char *__gnat_object_library_extension = ".a";
113 unsigned char __gnat_separate_run_path_options = 0;
115 /* The libgcc_s locations have changed in GCC 4. The n32 version used
116 to be in "lib", it moved to "lib32" and "lib" became the home of
117 the o32 version. We are targetting n32 by default, so ... */
118 #if __GNUC__ < 4
119 const char *__gnat_default_libgcc_subdir = "lib";
120 #else
121 const char *__gnat_default_libgcc_subdir = "lib32";
122 #endif
124 #elif defined (__WIN32)
125 const char *__gnat_object_file_option = "";
126 const char *__gnat_run_path_option = "";
127 int __gnat_link_max = 30000;
128 unsigned char __gnat_objlist_file_supported = 1;
129 char __gnat_shared_libgnat_default = STATIC;
130 char __gnat_shared_libgcc_default = STATIC;
131 unsigned char __gnat_using_gnu_linker = 1;
132 const char *__gnat_object_library_extension = ".a";
133 unsigned char __gnat_separate_run_path_options = 0;
134 const char *__gnat_default_libgcc_subdir = "lib";
136 #elif defined (__hpux__)
137 const char *__gnat_object_file_option = "-Wl,-c,";
138 const char *__gnat_run_path_option = "-Wl,+b,";
139 int __gnat_link_max = 5000;
140 unsigned char __gnat_objlist_file_supported = 1;
141 char __gnat_shared_libgnat_default = STATIC;
142 char __gnat_shared_libgcc_default = STATIC;
143 unsigned char __gnat_using_gnu_linker = 0;
144 const char *__gnat_object_library_extension = ".a";
145 unsigned char __gnat_separate_run_path_options = 0;
146 const char *__gnat_default_libgcc_subdir = "lib";
148 #elif defined (_AIX)
149 const char *__gnat_object_file_option = "-Wl,-f,";
150 const char *__gnat_run_path_option = "";
151 int __gnat_link_max = 15000;
152 const unsigned char __gnat_objlist_file_supported = 1;
153 char __gnat_shared_libgnat_default = STATIC;
154 char __gnat_shared_libgcc_default = STATIC;
155 unsigned char __gnat_using_gnu_linker = 0;
156 const char *__gnat_object_library_extension = ".a";
157 unsigned char __gnat_separate_run_path_options = 0;
158 const char *__gnat_default_libgcc_subdir = "lib";
160 #elif defined (VMS)
161 const char *__gnat_object_file_option = "";
162 const char *__gnat_run_path_option = "";
163 char __gnat_shared_libgnat_default = STATIC;
164 char __gnat_shared_libgcc_default = STATIC;
165 int __gnat_link_max = 2147483647;
166 unsigned char __gnat_objlist_file_supported = 0;
167 unsigned char __gnat_using_gnu_linker = 0;
168 const char *__gnat_object_library_extension = ".olb";
169 unsigned char __gnat_separate_run_path_options = 0;
170 const char *__gnat_default_libgcc_subdir = "lib";
172 #elif defined (sun)
173 const char *__gnat_object_file_option = "";
174 const char *__gnat_run_path_option = "-Wl,-R";
175 char __gnat_shared_libgnat_default = STATIC;
176 char __gnat_shared_libgcc_default = STATIC;
177 int __gnat_link_max = 2147483647;
178 unsigned char __gnat_objlist_file_supported = 0;
179 unsigned char __gnat_using_gnu_linker = 0;
180 const char *__gnat_object_library_extension = ".a";
181 unsigned char __gnat_separate_run_path_options = 0;
182 #if defined (__sparc_v9__) || defined (__sparcv9)
183 const char *__gnat_default_libgcc_subdir = "lib/sparcv9";
184 #elif defined (__x86_64)
185 const char *__gnat_default_libgcc_subdir = "lib/amd64";
186 #else
187 const char *__gnat_default_libgcc_subdir = "lib";
188 #endif
190 #elif defined (__FreeBSD__)
191 const char *__gnat_object_file_option = "";
192 const char *__gnat_run_path_option = "-Wl,-rpath,";
193 char __gnat_shared_libgnat_default = STATIC;
194 char __gnat_shared_libgcc_default = STATIC;
195 int __gnat_link_max = 8192;
196 unsigned char __gnat_objlist_file_supported = 1;
197 unsigned char __gnat_using_gnu_linker = 1;
198 const char *__gnat_object_library_extension = ".a";
199 unsigned char __gnat_separate_run_path_options = 0;
200 const char *__gnat_default_libgcc_subdir = "lib";
202 #elif defined (__APPLE__)
203 const char *__gnat_object_file_option = "-Wl,-filelist,";
204 const char *__gnat_run_path_option = "-Wl,-rpath,";
205 char __gnat_shared_libgnat_default = STATIC;
206 char __gnat_shared_libgcc_default = SHARED;
207 int __gnat_link_max = 262144;
208 unsigned char __gnat_objlist_file_supported = 1;
209 unsigned char __gnat_using_gnu_linker = 0;
210 const char *__gnat_object_library_extension = ".a";
211 unsigned char __gnat_separate_run_path_options = 1;
212 const char *__gnat_default_libgcc_subdir = "lib";
214 #elif defined (linux) || defined(__GLIBC__)
215 const char *__gnat_object_file_option = "";
216 const char *__gnat_run_path_option = "-Wl,-rpath,";
217 char __gnat_shared_libgnat_default = STATIC;
218 char __gnat_shared_libgcc_default = STATIC;
219 int __gnat_link_max = 8192;
220 unsigned char __gnat_objlist_file_supported = 1;
221 unsigned char __gnat_using_gnu_linker = 1;
222 const char *__gnat_object_library_extension = ".a";
223 unsigned char __gnat_separate_run_path_options = 0;
224 #if defined (__x86_64)
225 const char *__gnat_default_libgcc_subdir = "lib64";
226 #else
227 const char *__gnat_default_libgcc_subdir = "lib";
228 #endif
230 #elif defined (__svr4__) && defined (i386)
231 const char *__gnat_object_file_option = "";
232 const char *__gnat_run_path_option = "";
233 char __gnat_shared_libgnat_default = STATIC;
234 char __gnat_shared_libgcc_default = STATIC;
235 int __gnat_link_max = 2147483647;
236 unsigned char __gnat_objlist_file_supported = 0;
237 unsigned char __gnat_using_gnu_linker = 0;
238 const char *__gnat_object_library_extension = ".a";
239 unsigned char __gnat_separate_run_path_options = 0;
240 const char *__gnat_default_libgcc_subdir = "lib";
242 #else
244 /* These are the default settings for all other systems. No response file
245 is supported, the shared library default is STATIC. */
246 const char *__gnat_run_path_option = "";
247 const char *__gnat_object_file_option = "";
248 char __gnat_shared_libgnat_default = STATIC;
249 char __gnat_shared_libgcc_default = STATIC;
250 int __gnat_link_max = 2147483647;
251 unsigned char __gnat_objlist_file_supported = 0;
252 unsigned char __gnat_using_gnu_linker = 0;
253 const char *__gnat_object_library_extension = ".a";
254 unsigned char __gnat_separate_run_path_options = 0;
255 const char *__gnat_default_libgcc_subdir = "lib";
256 #endif