]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/link.c
New Language: Ada
[thirdparty/gcc.git] / gcc / ada / link.c
CommitLineData
83cce46b 1/****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * L I N K *
6 * *
7 * $Revision: 1.1 $
8 * *
9 * C Implementation File *
10 * *
11 * Copyright (C) 1992-2001, Free Software Foundation, Inc. *
12 * *
13 * GNAT is free software; you can redistribute it and/or modify it under *
14 * terms of the GNU General Public License as published by the Free Soft- *
15 * ware Foundation; either version 2, or (at your option) any later ver- *
16 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
17 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
19 * for more details. You should have received a copy of the GNU General *
20 * Public License distributed with GNAT; see file COPYING. If not, write *
21 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
22 * MA 02111-1307, USA. *
23 * *
24 * As a special exception, if you link this file with other files to *
25 * produce an executable, this file does not by itself cause the resulting *
26 * executable to be covered by the GNU General Public License. This except- *
27 * ion does not however invalidate any other reasons why the executable *
28 * file might be covered by the GNU Public License. *
29 * *
30 * GNAT was originally developed by the GNAT team at New York University. *
31 * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
32 * *
33 ****************************************************************************/
34
35/* This file contains parameterizations used by gnatlink.adb in handling */
36/* very long linker lines in systems where there are limitations on the */
37/* argument length when the command line is used to pass items to the */
38/* linker */
39
40#include <string.h>
41
42/* objlist_file_supported is set to 1 when the system linker allows */
43/* response file, that is a file that contains the list of object files. */
44/* This is useful on systems where the command line length is limited, */
45/* meaning that putting all the object files on the command line can */
46/* result in an unacceptable limit on the number of files. */
47
48/* object_file_option denotes the system dependent linker option which */
49/* allows object file names to be placed in a file and then passed to */
50/* the linker. object_file_option must be set if objlist_file_supported */
51/* is set to 1. */
52
53/* link_max is a conservative system specific threshold (in bytes) of the */
54/* argument length passed to the linker which will trigger a file being */
55/* used instead of the command line directly. If the argument length is */
56/* greater than this threshhold, then an objlist_file will be generated */
57/* and object_file_option and objlist_file_supported must be set. If */
58/* objlist_file_supported is set to 0 (unsupported), then link_max is */
59/* set to 2**31-1 so that the limit will never be exceeded. */
60
61/* run_path_option is the system dependent linker option which specifies */
62/* the run time path to use when loading dynamic libraries. This should */
63/* be set to the null string if the system does not support dynmamic */
64/* loading of libraries. */
65
66/* shared_libgnat_default gives the system dependent link method that */
67/* be used by default for linking libgnat (shared or static) */
68
69/* using_gnu_linker is set to 1 when the GNU linker is used under this */
70/* target. */
71
72/* RESPONSE FILE & GNU LINKER */
73/* -------------------------- */
74/* objlist_file_supported and using_gnu_link used together tell gnatlink */
75/* to generate a GNU style response file. Note that object_file_option */
76/* must be set to "" in this case, since no option is required for a */
77/* response file to be passed to GNU ld. With a GNU linker we use the */
78/* linker script to implement the response file feature. Any file passed */
79/* in the GNU ld command line with an unknown extension is supposed to be */
80/* a linker script. Each linker script augment the current configuration. */
81/* The format of such response file is as follow : */
82/* INPUT (obj1.p obj2.o ...) */
83
84#define SHARED 'H'
85#define STATIC 'T'
86
87#if defined (__osf__)
88const char *object_file_option = "-Wl,-input,";
89const char *run_path_option = "-Wl,-rpath,";
90int link_max = 10000;
91unsigned char objlist_file_supported = 1;
92char shared_libgnat_default = STATIC;
93unsigned char using_gnu_linker = 0;
94const char *object_library_extension = ".a";
95
96#elif defined (sgi)
97const char *object_file_option = "-Wl,-objectlist,";
98const char *run_path_option = "-Wl,-rpath,";
99int link_max = 5000;
100unsigned char objlist_file_supported = 1;
101char shared_libgnat_default = SHARED;
102unsigned char using_gnu_linker = 0;
103const char *object_library_extension = ".a";
104
105#elif defined (__WIN32)
106const char *object_file_option = "";
107const char *run_path_option = "";
108int link_max = 30000;
109unsigned char objlist_file_supported = 1;
110char shared_libgnat_default = STATIC;
111unsigned char using_gnu_linker = 1;
112const char *object_library_extension = ".a";
113
114#elif defined (__INTERIX)
115const char *object_file_option = "";
116const char *run_path_option = "";
117int link_max = 5000;
118unsigned char objlist_file_supported = 1;
119char shared_libgnat_default = STATIC;
120unsigned char using_gnu_linker = 1;
121const char *object_library_extension = ".a";
122
123#elif defined (hpux)
124const char *object_file_option = "-Wl,-c,";
125const char *run_path_option = "-Wl,+b,";
126int link_max = 5000;
127unsigned char objlist_file_supported = 1;
128char shared_libgnat_default = STATIC;
129unsigned char using_gnu_linker = 0;
130const char *object_library_extension = ".a";
131
132#elif defined (_AIX)
133const char *object_file_option = "-Wl,-f,";
134const char *run_path_option = "";
135int link_max = 15000;
136cnonst unsigned char objlist_file_supported = 1;
137char shared_libgnat_default = STATIC;
138unsigned char using_gnu_linker = 0;
139const char *object_library_extension = ".a";
140
141#elif defined (VMS)
142const char *object_file_option = "";
143const char *run_path_option = "";
144char shared_libgnat_default = SHARED;
145int link_max = 2147483647;
146unsigned char objlist_file_supported = 0;
147unsigned char using_gnu_linker = 0;
148const char *object_library_extension = ".olb";
149
150#elif defined (sun)
151const char *object_file_option = "";
152const char *run_path_option = "-R";
153char shared_libgnat_default = STATIC;
154int link_max = 2147483647;
155unsigned char objlist_file_supported = 0;
156unsigned char using_gnu_linker = 0;
157const char *object_library_extension = ".a";
158
159#elif defined (linux)
160const char *object_file_option = "";
161const char *run_path_option = "-Wl,-rpath,";
162char shared_libgnat_default = STATIC;
163int link_max = 2147483647;
164unsigned char objlist_file_supported = 0;
165unsigned char using_gnu_linker = 0;
166const char *object_library_extension = ".a";
167
168#elif defined (__svr4__) && defined (i386)
169const char *object_file_option = "";
170const char *run_path_option = "";
171char shared_libgnat_default = STATIC;
172int link_max = 2147483647;
173unsigned char objlist_file_supported = 0;
174unsigned char using_gnu_linker = 0;
175const char *object_library_extension = ".a";
176
177#else
178
179/* These are the default settings for all other systems. No response file
180 is supported, the shared library default is STATIC. */
181const char *run_path_option = "";
182const char *object_file_option = "";
183char shared_libgnat_default = STATIC;
184int link_max = 2147483647;
185unsigned char objlist_file_supported = 0;
186unsigned char using_gnu_linker = 0;
187const char *object_library_extension = ".a";
188#endif