]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/link.c
gnattools/
[thirdparty/gcc.git] / gcc / ada / link.c
CommitLineData
83cce46b 1/****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * L I N K *
6 * *
83cce46b 7 * C Implementation File *
8 * *
ee8f227a 9 * Copyright (C) 1992-2015, 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
36extern "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
5e0f2e2f 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
bfcff2f0 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
83cce46b 81#define SHARED 'H'
82#define STATIC 'T'
83
5641963c 84#if defined (__WIN32)
8ffcff2e 85const char *__gnat_object_file_option = "-Wl,@";
f270dc82 86const char *__gnat_run_path_option = "";
87int __gnat_link_max = 30000;
88unsigned char __gnat_objlist_file_supported = 1;
89char __gnat_shared_libgnat_default = STATIC;
d2697a05 90char __gnat_shared_libgcc_default = STATIC;
f270dc82 91const char *__gnat_object_library_extension = ".a";
5e0f2e2f 92unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 93const char *__gnat_default_libgcc_subdir = "lib";
83cce46b 94
21a87c1d 95#elif defined (__hpux__)
f270dc82 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;
d2697a05 101char __gnat_shared_libgcc_default = STATIC;
f270dc82 102const char *__gnat_object_library_extension = ".a";
5e0f2e2f 103unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 104const char *__gnat_default_libgcc_subdir = "lib";
83cce46b 105
87e3f630 106#elif defined (__FreeBSD__) || defined (__DragonFly__) \
107 || defined (__NetBSD__) || defined (__OpenBSD__)
8ffcff2e 108const char *__gnat_object_file_option = "-Wl,@";
eabcce03 109const char *__gnat_run_path_option = "-Wl,-rpath,";
f270dc82 110char __gnat_shared_libgnat_default = STATIC;
d2697a05 111char __gnat_shared_libgcc_default = STATIC;
44d43e97 112int __gnat_link_max = 8192;
113unsigned char __gnat_objlist_file_supported = 1;
eabcce03 114const char *__gnat_object_library_extension = ".a";
5e0f2e2f 115unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 116const char *__gnat_default_libgcc_subdir = "lib";
83cce46b 117
8a3d0a8f 118#elif defined (__APPLE__)
723bd332 119const char *__gnat_object_file_option = "-Wl,-filelist,";
8a3d0a8f 120const char *__gnat_run_path_option = "-Wl,-rpath,";
121char __gnat_shared_libgnat_default = STATIC;
d2697a05 122char __gnat_shared_libgcc_default = SHARED;
8a3d0a8f 123int __gnat_link_max = 262144;
124unsigned char __gnat_objlist_file_supported = 1;
8a3d0a8f 125const char *__gnat_object_library_extension = ".a";
5e0f2e2f 126unsigned char __gnat_separate_run_path_options = 1;
bfcff2f0 127const char *__gnat_default_libgcc_subdir = "lib";
8a3d0a8f 128
3d230452 129#elif defined (__linux__) || defined (__GLIBC__)
8ffcff2e 130const char *__gnat_object_file_option = "-Wl,@";
f270dc82 131const char *__gnat_run_path_option = "-Wl,-rpath,";
132char __gnat_shared_libgnat_default = STATIC;
d2697a05 133char __gnat_shared_libgcc_default = STATIC;
f270dc82 134int __gnat_link_max = 8192;
135unsigned char __gnat_objlist_file_supported = 1;
f270dc82 136const char *__gnat_object_library_extension = ".a";
5e0f2e2f 137unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 138#if defined (__x86_64)
70d595c8 139# if defined (__LP64__)
bfcff2f0 140const char *__gnat_default_libgcc_subdir = "lib64";
70d595c8 141# else
142const char *__gnat_default_libgcc_subdir = "libx32";
143# endif
bfcff2f0 144#else
145const char *__gnat_default_libgcc_subdir = "lib";
146#endif
83cce46b 147
ce9ee49d 148#elif defined (_AIX)
149/* On AIX, even when with GNU ld we use native linker switches. This is
150 particularly important for '-f' as it should be interpreted by collect2. */
151
152const char *__gnat_object_file_option = "-Wl,-f,";
153const char *__gnat_run_path_option = "";
154char __gnat_shared_libgnat_default = STATIC;
155char __gnat_shared_libgcc_default = STATIC;
156int __gnat_link_max = 15000;
55387e86 157unsigned char __gnat_objlist_file_supported = 1;
ce9ee49d 158const char *__gnat_object_library_extension = ".a";
159unsigned char __gnat_separate_run_path_options = 0;
160const char *__gnat_default_libgcc_subdir = "lib";
161
6cb4b973 162#elif (HAVE_GNU_LD)
163/* These are the settings for all systems that use gnu ld. GNU style response
164 file is supported, the shared library default is STATIC. */
165
8ffcff2e 166const char *__gnat_object_file_option = "-Wl,@";
ce9ee49d 167const char *__gnat_run_path_option = "";
6cb4b973 168char __gnat_shared_libgnat_default = STATIC;
169char __gnat_shared_libgcc_default = STATIC;
170int __gnat_link_max = 8192;
171unsigned char __gnat_objlist_file_supported = 1;
6cb4b973 172const char *__gnat_object_library_extension = ".a";
173unsigned char __gnat_separate_run_path_options = 0;
174const char *__gnat_default_libgcc_subdir = "lib";
175
176#elif defined (VMS)
177const char *__gnat_object_file_option = "";
178const char *__gnat_run_path_option = "";
179char __gnat_shared_libgnat_default = STATIC;
180char __gnat_shared_libgcc_default = STATIC;
181int __gnat_link_max = 2147483647;
182unsigned char __gnat_objlist_file_supported = 0;
6cb4b973 183const char *__gnat_object_library_extension = ".olb";
184unsigned char __gnat_separate_run_path_options = 0;
185const char *__gnat_default_libgcc_subdir = "lib";
186
3d230452 187#elif defined (__sun__)
6cb4b973 188const char *__gnat_object_file_option = "";
189const char *__gnat_run_path_option = "-Wl,-R";
190char __gnat_shared_libgnat_default = STATIC;
191char __gnat_shared_libgcc_default = STATIC;
192int __gnat_link_max = 2147483647;
193unsigned char __gnat_objlist_file_supported = 0;
6cb4b973 194const char *__gnat_object_library_extension = ".a";
195unsigned char __gnat_separate_run_path_options = 0;
196#if defined (__sparc_v9__) || defined (__sparcv9)
197const char *__gnat_default_libgcc_subdir = "lib/sparcv9";
198#elif defined (__x86_64)
199const char *__gnat_default_libgcc_subdir = "lib/amd64";
200#else
201const char *__gnat_default_libgcc_subdir = "lib";
202#endif
203
3d230452 204#elif defined (__svr4__) && defined (__i386__)
f270dc82 205const char *__gnat_object_file_option = "";
206const char *__gnat_run_path_option = "";
207char __gnat_shared_libgnat_default = STATIC;
d2697a05 208char __gnat_shared_libgcc_default = STATIC;
f270dc82 209int __gnat_link_max = 2147483647;
210unsigned char __gnat_objlist_file_supported = 0;
f270dc82 211const char *__gnat_object_library_extension = ".a";
5e0f2e2f 212unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 213const char *__gnat_default_libgcc_subdir = "lib";
83cce46b 214
215#else
216
217/* These are the default settings for all other systems. No response file
218 is supported, the shared library default is STATIC. */
f270dc82 219const char *__gnat_run_path_option = "";
220const char *__gnat_object_file_option = "";
221char __gnat_shared_libgnat_default = STATIC;
d2697a05 222char __gnat_shared_libgcc_default = STATIC;
f270dc82 223int __gnat_link_max = 2147483647;
224unsigned char __gnat_objlist_file_supported = 0;
f270dc82 225const char *__gnat_object_library_extension = ".a";
5e0f2e2f 226unsigned char __gnat_separate_run_path_options = 0;
bfcff2f0 227const char *__gnat_default_libgcc_subdir = "lib";
83cce46b 228#endif
becb63f5 229
230#ifdef __cplusplus
231}
232#endif