]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/link.c
[Ada] Bump copyright year
[thirdparty/gcc.git] / gcc / ada / link.c
CommitLineData
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
36extern "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 85const char *__gnat_object_file_option = "-Wl,@";
af4b9434
AC
86const char *__gnat_run_path_option = "";
87int __gnat_link_max = 30000;
88unsigned char __gnat_objlist_file_supported = 1;
89char __gnat_shared_libgnat_default = STATIC;
6528a7ed 90char __gnat_shared_libgcc_default = STATIC;
af4b9434 91const char *__gnat_object_library_extension = ".a";
3b81743f 92unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 93const char *__gnat_default_libgcc_subdir = "lib";
38cbfe40 94
7cd6e9f1 95#elif defined (__hpux__)
af4b9434
AC
96const char *__gnat_object_file_option = "-Wl,-c,";
97const char *__gnat_run_path_option = "-Wl,+b,";
98int __gnat_link_max = 5000;
99unsigned char __gnat_objlist_file_supported = 1;
100char __gnat_shared_libgnat_default = STATIC;
6528a7ed 101char __gnat_shared_libgcc_default = STATIC;
af4b9434 102const char *__gnat_object_library_extension = ".a";
3b81743f 103unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 104const 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 109const char *__gnat_object_file_option = "-Wl,@";
33c423c8 110const char *__gnat_run_path_option = "-Wl,-rpath,";
af4b9434 111char __gnat_shared_libgnat_default = STATIC;
6528a7ed 112char __gnat_shared_libgcc_default = STATIC;
c885d7a1
AC
113int __gnat_link_max = 8192;
114unsigned char __gnat_objlist_file_supported = 1;
33c423c8 115const char *__gnat_object_library_extension = ".a";
3b81743f 116unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 117const char *__gnat_default_libgcc_subdir = "lib";
38cbfe40 118
ee00428a 119#elif defined (__APPLE__)
93bcda23 120const char *__gnat_object_file_option = "-Wl,-filelist,";
ee00428a
AC
121const char *__gnat_run_path_option = "-Wl,-rpath,";
122char __gnat_shared_libgnat_default = STATIC;
6528a7ed 123char __gnat_shared_libgcc_default = SHARED;
ee00428a
AC
124int __gnat_link_max = 262144;
125unsigned char __gnat_objlist_file_supported = 1;
ee00428a 126const char *__gnat_object_library_extension = ".a";
3b81743f 127unsigned char __gnat_separate_run_path_options = 1;
3bb3f6d6 128const char *__gnat_default_libgcc_subdir = "lib";
ee00428a 129
329be64b 130#elif defined (__linux__) || defined (__GLIBC__)
b993039f 131const char *__gnat_object_file_option = "-Wl,@";
af4b9434
AC
132const char *__gnat_run_path_option = "-Wl,-rpath,";
133char __gnat_shared_libgnat_default = STATIC;
6528a7ed 134char __gnat_shared_libgcc_default = STATIC;
af4b9434
AC
135int __gnat_link_max = 8192;
136unsigned char __gnat_objlist_file_supported = 1;
af4b9434 137const char *__gnat_object_library_extension = ".a";
3b81743f 138unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 139#if defined (__x86_64)
8b1106fb 140# if defined (__LP64__)
3bb3f6d6 141const char *__gnat_default_libgcc_subdir = "lib64";
8b1106fb
L
142# else
143const char *__gnat_default_libgcc_subdir = "libx32";
144# endif
3bb3f6d6
AC
145#else
146const 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
153const char *__gnat_object_file_option = "-Wl,-f,";
154const char *__gnat_run_path_option = "";
155char __gnat_shared_libgnat_default = STATIC;
156char __gnat_shared_libgcc_default = STATIC;
157int __gnat_link_max = 15000;
6c56d9b8 158unsigned char __gnat_objlist_file_supported = 1;
ea10ca9c
AC
159const char *__gnat_object_library_extension = ".a";
160unsigned char __gnat_separate_run_path_options = 0;
161const 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 167const char *__gnat_object_file_option = "-Wl,@";
ea10ca9c 168const char *__gnat_run_path_option = "";
4fbad0ba
AC
169char __gnat_shared_libgnat_default = STATIC;
170char __gnat_shared_libgcc_default = STATIC;
171int __gnat_link_max = 8192;
172unsigned char __gnat_objlist_file_supported = 1;
4fbad0ba
AC
173const char *__gnat_object_library_extension = ".a";
174unsigned char __gnat_separate_run_path_options = 0;
175const char *__gnat_default_libgcc_subdir = "lib";
176
177#elif defined (VMS)
178const char *__gnat_object_file_option = "";
179const char *__gnat_run_path_option = "";
180char __gnat_shared_libgnat_default = STATIC;
181char __gnat_shared_libgcc_default = STATIC;
182int __gnat_link_max = 2147483647;
183unsigned char __gnat_objlist_file_supported = 0;
4fbad0ba
AC
184const char *__gnat_object_library_extension = ".olb";
185unsigned char __gnat_separate_run_path_options = 0;
186const char *__gnat_default_libgcc_subdir = "lib";
187
329be64b 188#elif defined (__sun__)
4fbad0ba
AC
189const char *__gnat_object_file_option = "";
190const char *__gnat_run_path_option = "-Wl,-R";
191char __gnat_shared_libgnat_default = STATIC;
192char __gnat_shared_libgcc_default = STATIC;
193int __gnat_link_max = 2147483647;
194unsigned char __gnat_objlist_file_supported = 0;
4fbad0ba
AC
195const char *__gnat_object_library_extension = ".a";
196unsigned char __gnat_separate_run_path_options = 0;
197#if defined (__sparc_v9__) || defined (__sparcv9)
198const char *__gnat_default_libgcc_subdir = "lib/sparcv9";
199#elif defined (__x86_64)
200const char *__gnat_default_libgcc_subdir = "lib/amd64";
201#else
202const char *__gnat_default_libgcc_subdir = "lib";
203#endif
204
329be64b 205#elif defined (__svr4__) && defined (__i386__)
af4b9434
AC
206const char *__gnat_object_file_option = "";
207const char *__gnat_run_path_option = "";
208char __gnat_shared_libgnat_default = STATIC;
6528a7ed 209char __gnat_shared_libgcc_default = STATIC;
af4b9434
AC
210int __gnat_link_max = 2147483647;
211unsigned char __gnat_objlist_file_supported = 0;
af4b9434 212const char *__gnat_object_library_extension = ".a";
3b81743f 213unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 214const 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
220const char *__gnat_run_path_option = "";
221const char *__gnat_object_file_option = "";
222char __gnat_shared_libgnat_default = STATIC;
6528a7ed 223char __gnat_shared_libgcc_default = STATIC;
af4b9434
AC
224int __gnat_link_max = 2147483647;
225unsigned char __gnat_objlist_file_supported = 0;
af4b9434 226const char *__gnat_object_library_extension = ".a";
3b81743f 227unsigned char __gnat_separate_run_path_options = 0;
3bb3f6d6 228const char *__gnat_default_libgcc_subdir = "lib";
38cbfe40 229#endif
9e9bd455
LG
230
231#ifdef __cplusplus
232}
233#endif