Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / ada / link.c
blob339762bbaf1c1de16b0db935a090790204588496
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * L I N K *
6 * *
7 * C Implementation File *
8 * *
9 * Copyright (C) 1992-2004, 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 2, 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. See the GNU General Public License *
17 * for more details. You should have received a copy of the GNU General *
18 * Public License distributed with GNAT; see file COPYING. If not, write *
19 * to the Free Software Foundation, 51 Franklin Street, Fifth Floor, *
20 * Boston, MA 02110-1301, USA. *
21 * *
22 * As a special exception, if you link this file with other files to *
23 * produce an executable, this file does not by itself cause the resulting *
24 * executable to be covered by the GNU General Public License. This except- *
25 * ion does not however invalidate any other reasons why the executable *
26 * file might be covered by the GNU Public License. *
27 * *
28 * GNAT was originally developed by the GNAT team at New York University. *
29 * Extensive contributions were provided by Ada Core Technologies Inc. *
30 * *
31 ****************************************************************************/
33 /* This file contains host-specific parameters describing the behavior */
34 /* of the linker. It is used by gnatlink as well as all tools that use */
35 /* Mlib. */
37 #include <string.h>
39 /* objlist_file_supported is set to 1 when the system linker allows */
40 /* response file, that is a file that contains the list of object files. */
41 /* This is useful on systems where the command line length is limited, */
42 /* meaning that putting all the object files on the command line can */
43 /* result in an unacceptable limit on the number of files. */
45 /* object_file_option denotes the system dependent linker option which */
46 /* allows object file names to be placed in a file and then passed to */
47 /* the linker. object_file_option must be set if objlist_file_supported */
48 /* is set to 1. */
50 /* link_max is a conservative system specific threshold (in bytes) of the */
51 /* argument length passed to the linker which will trigger a file being */
52 /* used instead of the command line directly. If the argument length is */
53 /* greater than this threshhold, then an objlist_file will be generated */
54 /* and object_file_option and objlist_file_supported must be set. If */
55 /* objlist_file_supported is set to 0 (unsupported), then link_max is */
56 /* set to 2**31-1 so that the limit will never be exceeded. */
58 /* run_path_option is the system dependent linker option which specifies */
59 /* the run time path to use when loading dynamic libraries. This should */
60 /* be set to the null string if the system does not support dynmamic */
61 /* loading of libraries. */
63 /* shared_libgnat_default gives the system dependent link method that */
64 /* be used by default for linking libgnat (shared or static) */
66 /* using_gnu_linker is set to 1 when the GNU linker is used under this */
67 /* target. */
69 /* RESPONSE FILE & GNU LINKER */
70 /* -------------------------- */
71 /* objlist_file_supported and using_gnu_link used together tell gnatlink */
72 /* to generate a GNU style response file. Note that object_file_option */
73 /* must be set to "" in this case, since no option is required for a */
74 /* response file to be passed to GNU ld. With a GNU linker we use the */
75 /* linker script to implement the response file feature. Any file passed */
76 /* in the GNU ld command line with an unknown extension is supposed to be */
77 /* a linker script. Each linker script augment the current configuration. */
78 /* The format of such response file is as follow : */
79 /* INPUT (obj1.p obj2.o ...) */
81 #define SHARED 'H'
82 #define STATIC 'T'
84 #if defined (__osf__)
85 const char *__gnat_object_file_option = "-Wl,-input,";
86 const char *__gnat_run_path_option = "-Wl,-rpath,";
87 int __gnat_link_max = 10000;
88 unsigned char __gnat_objlist_file_supported = 1;
89 char __gnat_shared_libgnat_default = STATIC;
90 unsigned char __gnat_using_gnu_linker = 0;
91 const char *__gnat_object_library_extension = ".a";
93 #elif defined (sgi)
94 const char *__gnat_object_file_option = "-Wl,-objectlist,";
95 const char *__gnat_run_path_option = "-Wl,-rpath,";
96 int __gnat_link_max = 5000;
97 unsigned char __gnat_objlist_file_supported = 1;
98 char __gnat_shared_libgnat_default = STATIC;
99 unsigned char __gnat_using_gnu_linker = 0;
100 const char *__gnat_object_library_extension = ".a";
102 #elif defined (__WIN32)
103 const char *__gnat_object_file_option = "";
104 const char *__gnat_run_path_option = "";
105 int __gnat_link_max = 30000;
106 unsigned char __gnat_objlist_file_supported = 1;
107 char __gnat_shared_libgnat_default = STATIC;
108 unsigned char __gnat_using_gnu_linker = 1;
109 const char *__gnat_object_library_extension = ".a";
111 #elif defined (__INTERIX)
112 const char *__gnat_object_file_option = "";
113 const char *__gnat_run_path_option = "";
114 int __gnat_link_max = 5000;
115 unsigned char __gnat_objlist_file_supported = 1;
116 char __gnat_shared_libgnat_default = STATIC;
117 unsigned char __gnat_using_gnu_linker = 1;
118 const char *__gnat_object_library_extension = ".a";
120 #elif defined (__hpux__)
121 const char *__gnat_object_file_option = "-Wl,-c,";
122 const char *__gnat_run_path_option = "-Wl,+b,";
123 int __gnat_link_max = 5000;
124 unsigned char __gnat_objlist_file_supported = 1;
125 char __gnat_shared_libgnat_default = STATIC;
126 unsigned char __gnat_using_gnu_linker = 0;
127 const char *__gnat_object_library_extension = ".a";
129 #elif defined (_AIX)
130 const char *__gnat_object_file_option = "-Wl,-f,";
131 const char *__gnat_run_path_option = "";
132 int __gnat_link_max = 15000;
133 const unsigned char __gnat_objlist_file_supported = 1;
134 char __gnat_shared_libgnat_default = STATIC;
135 unsigned char __gnat_using_gnu_linker = 0;
136 const char *__gnat_object_library_extension = ".a";
138 #elif defined (VMS)
139 const char *__gnat_object_file_option = "";
140 const char *__gnat_run_path_option = "";
141 char __gnat_shared_libgnat_default = STATIC;
142 int __gnat_link_max = 2147483647;
143 unsigned char __gnat_objlist_file_supported = 0;
144 unsigned char __gnat_using_gnu_linker = 0;
145 const char *__gnat_object_library_extension = ".olb";
147 #elif defined (sun)
148 const char *__gnat_object_file_option = "";
149 const char *__gnat_run_path_option = "-Wl,-R";
150 char __gnat_shared_libgnat_default = STATIC;
151 int __gnat_link_max = 2147483647;
152 unsigned char __gnat_objlist_file_supported = 0;
153 unsigned char __gnat_using_gnu_linker = 0;
154 const char *__gnat_object_library_extension = ".a";
156 #elif defined (__FreeBSD__)
157 char *__gnat_object_file_option = "";
158 char *__gnat_run_path_option = "-Wl,-rpath,";
159 char __gnat_shared_libgnat_default = STATIC;
160 int __gnat_link_max = 8192;
161 unsigned char __gnat_objlist_file_supported = 1;
162 unsigned char __gnat_using_gnu_linker = 1;
163 char *__gnat_object_library_extension = ".a";
165 #elif defined (linux)
166 const char *__gnat_object_file_option = "";
167 const char *__gnat_run_path_option = "-Wl,-rpath,";
168 char __gnat_shared_libgnat_default = STATIC;
169 int __gnat_link_max = 8192;
170 unsigned char __gnat_objlist_file_supported = 1;
171 unsigned char __gnat_using_gnu_linker = 1;
172 const char *__gnat_object_library_extension = ".a";
174 #elif defined (__svr4__) && defined (i386)
175 const char *__gnat_object_file_option = "";
176 const char *__gnat_run_path_option = "";
177 char __gnat_shared_libgnat_default = STATIC;
178 int __gnat_link_max = 2147483647;
179 unsigned char __gnat_objlist_file_supported = 0;
180 unsigned char __gnat_using_gnu_linker = 0;
181 const char *__gnat_object_library_extension = ".a";
183 #else
185 /* These are the default settings for all other systems. No response file
186 is supported, the shared library default is STATIC. */
187 const char *__gnat_run_path_option = "";
188 const char *__gnat_object_file_option = "";
189 char __gnat_shared_libgnat_default = STATIC;
190 int __gnat_link_max = 2147483647;
191 unsigned char __gnat_objlist_file_supported = 0;
192 unsigned char __gnat_using_gnu_linker = 0;
193 const char *__gnat_object_library_extension = ".a";
194 #endif