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