]>
Commit | Line | Data |
---|---|---|
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__) | |
88 | const char *object_file_option = "-Wl,-input,"; | |
89 | const char *run_path_option = "-Wl,-rpath,"; | |
90 | int link_max = 10000; | |
91 | unsigned char objlist_file_supported = 1; | |
92 | char shared_libgnat_default = STATIC; | |
93 | unsigned char using_gnu_linker = 0; | |
94 | const char *object_library_extension = ".a"; | |
95 | ||
96 | #elif defined (sgi) | |
97 | const char *object_file_option = "-Wl,-objectlist,"; | |
98 | const char *run_path_option = "-Wl,-rpath,"; | |
99 | int link_max = 5000; | |
100 | unsigned char objlist_file_supported = 1; | |
101 | char shared_libgnat_default = SHARED; | |
102 | unsigned char using_gnu_linker = 0; | |
103 | const char *object_library_extension = ".a"; | |
104 | ||
105 | #elif defined (__WIN32) | |
106 | const char *object_file_option = ""; | |
107 | const char *run_path_option = ""; | |
108 | int link_max = 30000; | |
109 | unsigned char objlist_file_supported = 1; | |
110 | char shared_libgnat_default = STATIC; | |
111 | unsigned char using_gnu_linker = 1; | |
112 | const char *object_library_extension = ".a"; | |
113 | ||
114 | #elif defined (__INTERIX) | |
115 | const char *object_file_option = ""; | |
116 | const char *run_path_option = ""; | |
117 | int link_max = 5000; | |
118 | unsigned char objlist_file_supported = 1; | |
119 | char shared_libgnat_default = STATIC; | |
120 | unsigned char using_gnu_linker = 1; | |
121 | const char *object_library_extension = ".a"; | |
122 | ||
123 | #elif defined (hpux) | |
124 | const char *object_file_option = "-Wl,-c,"; | |
125 | const char *run_path_option = "-Wl,+b,"; | |
126 | int link_max = 5000; | |
127 | unsigned char objlist_file_supported = 1; | |
128 | char shared_libgnat_default = STATIC; | |
129 | unsigned char using_gnu_linker = 0; | |
130 | const char *object_library_extension = ".a"; | |
131 | ||
132 | #elif defined (_AIX) | |
133 | const char *object_file_option = "-Wl,-f,"; | |
134 | const char *run_path_option = ""; | |
135 | int link_max = 15000; | |
136 | cnonst unsigned char objlist_file_supported = 1; | |
137 | char shared_libgnat_default = STATIC; | |
138 | unsigned char using_gnu_linker = 0; | |
139 | const char *object_library_extension = ".a"; | |
140 | ||
141 | #elif defined (VMS) | |
142 | const char *object_file_option = ""; | |
143 | const char *run_path_option = ""; | |
144 | char shared_libgnat_default = SHARED; | |
145 | int link_max = 2147483647; | |
146 | unsigned char objlist_file_supported = 0; | |
147 | unsigned char using_gnu_linker = 0; | |
148 | const char *object_library_extension = ".olb"; | |
149 | ||
150 | #elif defined (sun) | |
151 | const char *object_file_option = ""; | |
152 | const char *run_path_option = "-R"; | |
153 | char shared_libgnat_default = STATIC; | |
154 | int link_max = 2147483647; | |
155 | unsigned char objlist_file_supported = 0; | |
156 | unsigned char using_gnu_linker = 0; | |
157 | const char *object_library_extension = ".a"; | |
158 | ||
159 | #elif defined (linux) | |
160 | const char *object_file_option = ""; | |
161 | const char *run_path_option = "-Wl,-rpath,"; | |
162 | char shared_libgnat_default = STATIC; | |
163 | int link_max = 2147483647; | |
164 | unsigned char objlist_file_supported = 0; | |
165 | unsigned char using_gnu_linker = 0; | |
166 | const char *object_library_extension = ".a"; | |
167 | ||
168 | #elif defined (__svr4__) && defined (i386) | |
169 | const char *object_file_option = ""; | |
170 | const char *run_path_option = ""; | |
171 | char shared_libgnat_default = STATIC; | |
172 | int link_max = 2147483647; | |
173 | unsigned char objlist_file_supported = 0; | |
174 | unsigned char using_gnu_linker = 0; | |
175 | const 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. */ | |
181 | const char *run_path_option = ""; | |
182 | const char *object_file_option = ""; | |
183 | char shared_libgnat_default = STATIC; | |
184 | int link_max = 2147483647; | |
185 | unsigned char objlist_file_supported = 0; | |
186 | unsigned char using_gnu_linker = 0; | |
187 | const char *object_library_extension = ".a"; | |
188 | #endif |