1 |
145 |
khays |
/* Parse options for the GNU linker.
|
2 |
|
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
3 |
166 |
khays |
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
|
4 |
145 |
khays |
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of the GNU Binutils.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program; if not, write to the Free Software
|
20 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
21 |
|
|
MA 02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#include "sysdep.h"
|
24 |
|
|
#include "bfd.h"
|
25 |
|
|
#include "bfdver.h"
|
26 |
|
|
#include "libiberty.h"
|
27 |
|
|
#include <stdio.h>
|
28 |
|
|
#include <string.h>
|
29 |
|
|
#include "safe-ctype.h"
|
30 |
|
|
#include "getopt.h"
|
31 |
|
|
#include "bfdlink.h"
|
32 |
|
|
#include "ld.h"
|
33 |
|
|
#include "ldmain.h"
|
34 |
|
|
#include "ldmisc.h"
|
35 |
|
|
#include "ldexp.h"
|
36 |
|
|
#include "ldlang.h"
|
37 |
|
|
#include <ldgram.h>
|
38 |
|
|
#include "ldlex.h"
|
39 |
|
|
#include "ldfile.h"
|
40 |
|
|
#include "ldver.h"
|
41 |
|
|
#include "ldemul.h"
|
42 |
|
|
#include "demangle.h"
|
43 |
|
|
#ifdef ENABLE_PLUGINS
|
44 |
|
|
#include "plugin.h"
|
45 |
|
|
#endif /* ENABLE_PLUGINS */
|
46 |
|
|
|
47 |
|
|
#ifndef PATH_SEPARATOR
|
48 |
|
|
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
|
49 |
|
|
#define PATH_SEPARATOR ';'
|
50 |
|
|
#else
|
51 |
|
|
#define PATH_SEPARATOR ':'
|
52 |
|
|
#endif
|
53 |
|
|
#endif
|
54 |
|
|
|
55 |
|
|
/* Somewhere above, sys/stat.h got included . . . . */
|
56 |
|
|
#if !defined(S_ISDIR) && defined(S_IFDIR)
|
57 |
|
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
58 |
|
|
#endif
|
59 |
|
|
|
60 |
|
|
static void set_default_dirlist (char *);
|
61 |
|
|
static void set_section_start (char *, char *);
|
62 |
|
|
static void set_segment_start (const char *, char *);
|
63 |
|
|
static void help (void);
|
64 |
|
|
|
65 |
|
|
/* Codes used for the long options with no short synonyms. 150 isn't
|
66 |
|
|
special; it's just an arbitrary non-ASCII char value. */
|
67 |
|
|
enum option_values
|
68 |
|
|
{
|
69 |
|
|
OPTION_ASSERT = 150,
|
70 |
|
|
OPTION_CALL_SHARED,
|
71 |
|
|
OPTION_CREF,
|
72 |
|
|
OPTION_DEFSYM,
|
73 |
|
|
OPTION_DEMANGLE,
|
74 |
|
|
OPTION_DYNAMIC_LINKER,
|
75 |
|
|
OPTION_SYSROOT,
|
76 |
|
|
OPTION_EB,
|
77 |
|
|
OPTION_EL,
|
78 |
|
|
OPTION_EMBEDDED_RELOCS,
|
79 |
|
|
OPTION_EXPORT_DYNAMIC,
|
80 |
|
|
OPTION_NO_EXPORT_DYNAMIC,
|
81 |
|
|
OPTION_HELP,
|
82 |
|
|
OPTION_IGNORE,
|
83 |
|
|
OPTION_MAP,
|
84 |
|
|
OPTION_NO_DEMANGLE,
|
85 |
|
|
OPTION_NO_KEEP_MEMORY,
|
86 |
|
|
OPTION_NO_WARN_MISMATCH,
|
87 |
|
|
OPTION_NO_WARN_SEARCH_MISMATCH,
|
88 |
|
|
OPTION_NOINHIBIT_EXEC,
|
89 |
|
|
OPTION_NON_SHARED,
|
90 |
|
|
OPTION_NO_WHOLE_ARCHIVE,
|
91 |
|
|
OPTION_OFORMAT,
|
92 |
|
|
OPTION_RELAX,
|
93 |
|
|
OPTION_NO_RELAX,
|
94 |
|
|
OPTION_RETAIN_SYMBOLS_FILE,
|
95 |
|
|
OPTION_RPATH,
|
96 |
|
|
OPTION_RPATH_LINK,
|
97 |
|
|
OPTION_SHARED,
|
98 |
|
|
OPTION_SONAME,
|
99 |
|
|
OPTION_SORT_COMMON,
|
100 |
|
|
OPTION_SORT_SECTION,
|
101 |
|
|
OPTION_STATS,
|
102 |
|
|
OPTION_SYMBOLIC,
|
103 |
|
|
OPTION_SYMBOLIC_FUNCTIONS,
|
104 |
|
|
OPTION_TASK_LINK,
|
105 |
|
|
OPTION_TBSS,
|
106 |
|
|
OPTION_TDATA,
|
107 |
|
|
OPTION_TTEXT,
|
108 |
|
|
OPTION_TTEXT_SEGMENT,
|
109 |
|
|
OPTION_TRADITIONAL_FORMAT,
|
110 |
|
|
OPTION_UR,
|
111 |
|
|
OPTION_VERBOSE,
|
112 |
|
|
OPTION_VERSION,
|
113 |
|
|
OPTION_VERSION_SCRIPT,
|
114 |
|
|
OPTION_VERSION_EXPORTS_SECTION,
|
115 |
|
|
OPTION_DYNAMIC_LIST,
|
116 |
|
|
OPTION_DYNAMIC_LIST_CPP_NEW,
|
117 |
|
|
OPTION_DYNAMIC_LIST_CPP_TYPEINFO,
|
118 |
|
|
OPTION_DYNAMIC_LIST_DATA,
|
119 |
|
|
OPTION_WARN_COMMON,
|
120 |
|
|
OPTION_WARN_CONSTRUCTORS,
|
121 |
|
|
OPTION_WARN_FATAL,
|
122 |
|
|
OPTION_NO_WARN_FATAL,
|
123 |
|
|
OPTION_WARN_MULTIPLE_GP,
|
124 |
|
|
OPTION_WARN_ONCE,
|
125 |
|
|
OPTION_WARN_SECTION_ALIGN,
|
126 |
|
|
OPTION_SPLIT_BY_RELOC,
|
127 |
|
|
OPTION_SPLIT_BY_FILE ,
|
128 |
|
|
OPTION_WHOLE_ARCHIVE,
|
129 |
|
|
OPTION_ADD_DT_NEEDED_FOR_DYNAMIC,
|
130 |
|
|
OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC,
|
131 |
|
|
OPTION_ADD_DT_NEEDED_FOR_REGULAR,
|
132 |
|
|
OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR,
|
133 |
|
|
OPTION_WRAP,
|
134 |
|
|
OPTION_FORCE_EXE_SUFFIX,
|
135 |
|
|
OPTION_GC_SECTIONS,
|
136 |
|
|
OPTION_NO_GC_SECTIONS,
|
137 |
|
|
OPTION_PRINT_GC_SECTIONS,
|
138 |
|
|
OPTION_NO_PRINT_GC_SECTIONS,
|
139 |
|
|
OPTION_HASH_SIZE,
|
140 |
|
|
OPTION_CHECK_SECTIONS,
|
141 |
|
|
OPTION_NO_CHECK_SECTIONS,
|
142 |
|
|
OPTION_NO_UNDEFINED,
|
143 |
|
|
OPTION_INIT,
|
144 |
|
|
OPTION_FINI,
|
145 |
|
|
OPTION_SECTION_START,
|
146 |
|
|
OPTION_UNIQUE,
|
147 |
|
|
OPTION_TARGET_HELP,
|
148 |
|
|
OPTION_ALLOW_SHLIB_UNDEFINED,
|
149 |
|
|
OPTION_NO_ALLOW_SHLIB_UNDEFINED,
|
150 |
|
|
OPTION_ALLOW_MULTIPLE_DEFINITION,
|
151 |
|
|
OPTION_NO_UNDEFINED_VERSION,
|
152 |
|
|
OPTION_DEFAULT_SYMVER,
|
153 |
|
|
OPTION_DEFAULT_IMPORTED_SYMVER,
|
154 |
|
|
OPTION_DISCARD_NONE,
|
155 |
|
|
OPTION_SPARE_DYNAMIC_TAGS,
|
156 |
|
|
OPTION_NO_DEFINE_COMMON,
|
157 |
|
|
OPTION_NOSTDLIB,
|
158 |
|
|
OPTION_NO_OMAGIC,
|
159 |
|
|
OPTION_STRIP_DISCARDED,
|
160 |
|
|
OPTION_NO_STRIP_DISCARDED,
|
161 |
|
|
OPTION_ACCEPT_UNKNOWN_INPUT_ARCH,
|
162 |
|
|
OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH,
|
163 |
|
|
OPTION_PIE,
|
164 |
|
|
OPTION_UNRESOLVED_SYMBOLS,
|
165 |
|
|
OPTION_WARN_UNRESOLVED_SYMBOLS,
|
166 |
|
|
OPTION_ERROR_UNRESOLVED_SYMBOLS,
|
167 |
|
|
OPTION_WARN_SHARED_TEXTREL,
|
168 |
|
|
OPTION_WARN_ALTERNATE_EM,
|
169 |
|
|
OPTION_REDUCE_MEMORY_OVERHEADS,
|
170 |
|
|
#ifdef ENABLE_PLUGINS
|
171 |
|
|
OPTION_PLUGIN,
|
172 |
|
|
OPTION_PLUGIN_OPT,
|
173 |
|
|
#endif /* ENABLE_PLUGINS */
|
174 |
|
|
OPTION_DEFAULT_SCRIPT,
|
175 |
157 |
khays |
OPTION_PRINT_OUTPUT_FORMAT,
|
176 |
145 |
khays |
};
|
177 |
|
|
|
178 |
|
|
/* The long options. This structure is used for both the option
|
179 |
|
|
parsing and the help text. */
|
180 |
|
|
|
181 |
|
|
enum control_enum {
|
182 |
|
|
/* Use one dash before long option name. */
|
183 |
|
|
ONE_DASH,
|
184 |
|
|
/* Use two dashes before long option name. */
|
185 |
|
|
TWO_DASHES,
|
186 |
|
|
/* Only accept two dashes before the long option name.
|
187 |
|
|
This is an overloading of the use of this enum, since originally it
|
188 |
|
|
was only intended to tell the --help display function how to display
|
189 |
|
|
the long option name. This feature was added in order to resolve
|
190 |
|
|
the confusion about the -omagic command line switch. Is it setting
|
191 |
|
|
the output file name to "magic" or is it setting the NMAGIC flag on
|
192 |
|
|
the output ? It has been decided that it is setting the output file
|
193 |
|
|
name, and that if you want to set the NMAGIC flag you should use -N
|
194 |
|
|
or --omagic. */
|
195 |
|
|
EXACTLY_TWO_DASHES,
|
196 |
|
|
/* Don't mention this option in --help output. */
|
197 |
|
|
NO_HELP
|
198 |
|
|
};
|
199 |
|
|
|
200 |
|
|
struct ld_option
|
201 |
|
|
{
|
202 |
|
|
/* The long option information. */
|
203 |
|
|
struct option opt;
|
204 |
|
|
/* The short option with the same meaning ('\0' if none). */
|
205 |
|
|
char shortopt;
|
206 |
|
|
/* The name of the argument (NULL if none). */
|
207 |
|
|
const char *arg;
|
208 |
|
|
/* The documentation string. If this is NULL, this is a synonym for
|
209 |
|
|
the previous option. */
|
210 |
|
|
const char *doc;
|
211 |
|
|
enum control_enum control;
|
212 |
|
|
};
|
213 |
|
|
|
214 |
|
|
static const struct ld_option ld_options[] =
|
215 |
|
|
{
|
216 |
|
|
{ {NULL, required_argument, NULL, '\0'},
|
217 |
|
|
'a', N_("KEYWORD"), N_("Shared library control for HP/UX compatibility"),
|
218 |
|
|
ONE_DASH },
|
219 |
|
|
{ {"architecture", required_argument, NULL, 'A'},
|
220 |
|
|
'A', N_("ARCH"), N_("Set architecture") , TWO_DASHES },
|
221 |
|
|
{ {"format", required_argument, NULL, 'b'},
|
222 |
|
|
'b', N_("TARGET"), N_("Specify target for following input files"),
|
223 |
|
|
TWO_DASHES },
|
224 |
|
|
{ {"mri-script", required_argument, NULL, 'c'},
|
225 |
|
|
'c', N_("FILE"), N_("Read MRI format linker script"), TWO_DASHES },
|
226 |
|
|
{ {"dc", no_argument, NULL, 'd'},
|
227 |
|
|
'd', NULL, N_("Force common symbols to be defined"), ONE_DASH },
|
228 |
|
|
{ {"dp", no_argument, NULL, 'd'},
|
229 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
230 |
|
|
{ {"entry", required_argument, NULL, 'e'},
|
231 |
|
|
'e', N_("ADDRESS"), N_("Set start address"), TWO_DASHES },
|
232 |
|
|
{ {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC},
|
233 |
|
|
'E', NULL, N_("Export all dynamic symbols"), TWO_DASHES },
|
234 |
|
|
{ {"no-export-dynamic", no_argument, NULL, OPTION_NO_EXPORT_DYNAMIC},
|
235 |
|
|
'\0', NULL, N_("Undo the effect of --export-dynamic"), TWO_DASHES },
|
236 |
|
|
{ {"EB", no_argument, NULL, OPTION_EB},
|
237 |
|
|
'\0', NULL, N_("Link big-endian objects"), ONE_DASH },
|
238 |
|
|
{ {"EL", no_argument, NULL, OPTION_EL},
|
239 |
|
|
'\0', NULL, N_("Link little-endian objects"), ONE_DASH },
|
240 |
|
|
{ {"auxiliary", required_argument, NULL, 'f'},
|
241 |
|
|
'f', N_("SHLIB"), N_("Auxiliary filter for shared object symbol table"),
|
242 |
|
|
TWO_DASHES },
|
243 |
|
|
{ {"filter", required_argument, NULL, 'F'},
|
244 |
|
|
'F', N_("SHLIB"), N_("Filter for shared object symbol table"),
|
245 |
|
|
TWO_DASHES },
|
246 |
|
|
{ {NULL, no_argument, NULL, '\0'},
|
247 |
|
|
'g', NULL, N_("Ignored"), ONE_DASH },
|
248 |
|
|
{ {"gpsize", required_argument, NULL, 'G'},
|
249 |
|
|
'G', N_("SIZE"), N_("Small data size (if no size, same as --shared)"),
|
250 |
|
|
TWO_DASHES },
|
251 |
|
|
{ {"soname", required_argument, NULL, OPTION_SONAME},
|
252 |
|
|
'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH },
|
253 |
|
|
{ {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER},
|
254 |
|
|
'I', N_("PROGRAM"), N_("Set PROGRAM as the dynamic linker to use"),
|
255 |
|
|
TWO_DASHES },
|
256 |
|
|
{ {"library", required_argument, NULL, 'l'},
|
257 |
|
|
'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES },
|
258 |
|
|
{ {"library-path", required_argument, NULL, 'L'},
|
259 |
|
|
'L', N_("DIRECTORY"), N_("Add DIRECTORY to library search path"),
|
260 |
|
|
TWO_DASHES },
|
261 |
|
|
{ {"sysroot=<DIRECTORY>", required_argument, NULL, OPTION_SYSROOT},
|
262 |
|
|
'\0', NULL, N_("Override the default sysroot location"), TWO_DASHES },
|
263 |
|
|
{ {NULL, required_argument, NULL, '\0'},
|
264 |
|
|
'm', N_("EMULATION"), N_("Set emulation"), ONE_DASH },
|
265 |
|
|
{ {"print-map", no_argument, NULL, 'M'},
|
266 |
|
|
'M', NULL, N_("Print map file on standard output"), TWO_DASHES },
|
267 |
|
|
{ {"nmagic", no_argument, NULL, 'n'},
|
268 |
|
|
'n', NULL, N_("Do not page align data"), TWO_DASHES },
|
269 |
|
|
{ {"omagic", no_argument, NULL, 'N'},
|
270 |
|
|
'N', NULL, N_("Do not page align data, do not make text readonly"),
|
271 |
|
|
EXACTLY_TWO_DASHES },
|
272 |
|
|
{ {"no-omagic", no_argument, NULL, OPTION_NO_OMAGIC},
|
273 |
|
|
'\0', NULL, N_("Page align data, make text readonly"),
|
274 |
|
|
EXACTLY_TWO_DASHES },
|
275 |
|
|
{ {"output", required_argument, NULL, 'o'},
|
276 |
|
|
'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES },
|
277 |
|
|
{ {NULL, required_argument, NULL, '\0'},
|
278 |
|
|
'O', NULL, N_("Optimize output file"), ONE_DASH },
|
279 |
|
|
#ifdef ENABLE_PLUGINS
|
280 |
|
|
{ {"plugin", required_argument, NULL, OPTION_PLUGIN},
|
281 |
|
|
'\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH },
|
282 |
|
|
{ {"plugin-opt", required_argument, NULL, OPTION_PLUGIN_OPT},
|
283 |
|
|
'\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH },
|
284 |
|
|
{ {"flto", optional_argument, NULL, OPTION_IGNORE},
|
285 |
|
|
'\0', NULL, N_("Ignored for GCC LTO option compatibility"),
|
286 |
|
|
ONE_DASH },
|
287 |
|
|
{ {"flto-partition=", required_argument, NULL, OPTION_IGNORE},
|
288 |
|
|
'\0', NULL, N_("Ignored for GCC LTO option compatibility"),
|
289 |
|
|
ONE_DASH },
|
290 |
|
|
#endif /* ENABLE_PLUGINS */
|
291 |
|
|
{ {"Qy", no_argument, NULL, OPTION_IGNORE},
|
292 |
|
|
'\0', NULL, N_("Ignored for SVR4 compatibility"), ONE_DASH },
|
293 |
|
|
{ {"emit-relocs", no_argument, NULL, 'q'},
|
294 |
|
|
'q', NULL, "Generate relocations in final output", TWO_DASHES },
|
295 |
|
|
{ {"relocatable", no_argument, NULL, 'r'},
|
296 |
|
|
'r', NULL, N_("Generate relocatable output"), TWO_DASHES },
|
297 |
|
|
{ {NULL, no_argument, NULL, '\0'},
|
298 |
|
|
'i', NULL, NULL, ONE_DASH },
|
299 |
|
|
{ {"just-symbols", required_argument, NULL, 'R'},
|
300 |
|
|
'R', N_("FILE"), N_("Just link symbols (if directory, same as --rpath)"),
|
301 |
|
|
TWO_DASHES },
|
302 |
|
|
{ {"strip-all", no_argument, NULL, 's'},
|
303 |
|
|
's', NULL, N_("Strip all symbols"), TWO_DASHES },
|
304 |
|
|
{ {"strip-debug", no_argument, NULL, 'S'},
|
305 |
|
|
'S', NULL, N_("Strip debugging symbols"), TWO_DASHES },
|
306 |
|
|
{ {"strip-discarded", no_argument, NULL, OPTION_STRIP_DISCARDED},
|
307 |
|
|
'\0', NULL, N_("Strip symbols in discarded sections"), TWO_DASHES },
|
308 |
|
|
{ {"no-strip-discarded", no_argument, NULL, OPTION_NO_STRIP_DISCARDED},
|
309 |
|
|
'\0', NULL, N_("Do not strip symbols in discarded sections"), TWO_DASHES },
|
310 |
|
|
{ {"trace", no_argument, NULL, 't'},
|
311 |
|
|
't', NULL, N_("Trace file opens"), TWO_DASHES },
|
312 |
|
|
{ {"script", required_argument, NULL, 'T'},
|
313 |
|
|
'T', N_("FILE"), N_("Read linker script"), TWO_DASHES },
|
314 |
|
|
{ {"default-script", required_argument, NULL, OPTION_DEFAULT_SCRIPT},
|
315 |
|
|
'\0', N_("FILE"), N_("Read default linker script"), TWO_DASHES },
|
316 |
|
|
{ {"dT", required_argument, NULL, OPTION_DEFAULT_SCRIPT},
|
317 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
318 |
|
|
{ {"undefined", required_argument, NULL, 'u'},
|
319 |
|
|
'u', N_("SYMBOL"), N_("Start with undefined reference to SYMBOL"),
|
320 |
|
|
TWO_DASHES },
|
321 |
|
|
{ {"unique", optional_argument, NULL, OPTION_UNIQUE},
|
322 |
|
|
'\0', N_("[=SECTION]"),
|
323 |
|
|
N_("Don't merge input [SECTION | orphan] sections"), TWO_DASHES },
|
324 |
|
|
{ {"Ur", no_argument, NULL, OPTION_UR},
|
325 |
|
|
'\0', NULL, N_("Build global constructor/destructor tables"), ONE_DASH },
|
326 |
|
|
{ {"version", no_argument, NULL, OPTION_VERSION},
|
327 |
|
|
'v', NULL, N_("Print version information"), TWO_DASHES },
|
328 |
|
|
{ {NULL, no_argument, NULL, '\0'},
|
329 |
|
|
'V', NULL, N_("Print version and emulation information"), ONE_DASH },
|
330 |
|
|
{ {"discard-all", no_argument, NULL, 'x'},
|
331 |
|
|
'x', NULL, N_("Discard all local symbols"), TWO_DASHES },
|
332 |
|
|
{ {"discard-locals", no_argument, NULL, 'X'},
|
333 |
|
|
'X', NULL, N_("Discard temporary local symbols (default)"), TWO_DASHES },
|
334 |
|
|
{ {"discard-none", no_argument, NULL, OPTION_DISCARD_NONE},
|
335 |
|
|
'\0', NULL, N_("Don't discard any local symbols"), TWO_DASHES },
|
336 |
|
|
{ {"trace-symbol", required_argument, NULL, 'y'},
|
337 |
|
|
'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
|
338 |
|
|
{ {NULL, required_argument, NULL, '\0'},
|
339 |
|
|
'Y', N_("PATH"), N_("Default search path for Solaris compatibility"),
|
340 |
|
|
ONE_DASH },
|
341 |
|
|
{ {"start-group", no_argument, NULL, '('},
|
342 |
|
|
'(', NULL, N_("Start a group"), TWO_DASHES },
|
343 |
|
|
{ {"end-group", no_argument, NULL, ')'},
|
344 |
|
|
')', NULL, N_("End a group"), TWO_DASHES },
|
345 |
|
|
{ {"accept-unknown-input-arch", no_argument, NULL,
|
346 |
|
|
OPTION_ACCEPT_UNKNOWN_INPUT_ARCH},
|
347 |
|
|
'\0', NULL,
|
348 |
|
|
N_("Accept input files whose architecture cannot be determined"),
|
349 |
|
|
TWO_DASHES },
|
350 |
|
|
{ {"no-accept-unknown-input-arch", no_argument, NULL,
|
351 |
|
|
OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH},
|
352 |
|
|
'\0', NULL, N_("Reject input files whose architecture is unknown"),
|
353 |
|
|
TWO_DASHES },
|
354 |
|
|
|
355 |
|
|
/* The next two options are deprecated because of their similarity to
|
356 |
|
|
--as-needed and --no-as-needed. They have been replaced by
|
357 |
|
|
--copy-dt-needed-entries and --no-copy-dt-needed-entries. */
|
358 |
|
|
{ {"add-needed", no_argument, NULL, OPTION_ADD_DT_NEEDED_FOR_DYNAMIC},
|
359 |
|
|
'\0', NULL, NULL, NO_HELP },
|
360 |
|
|
{ {"no-add-needed", no_argument, NULL, OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC},
|
361 |
|
|
'\0', NULL, NULL, NO_HELP },
|
362 |
|
|
|
363 |
|
|
{ {"as-needed", no_argument, NULL, OPTION_ADD_DT_NEEDED_FOR_REGULAR},
|
364 |
|
|
'\0', NULL, N_("Only set DT_NEEDED for following dynamic libs if used"),
|
365 |
|
|
TWO_DASHES },
|
366 |
|
|
{ {"no-as-needed", no_argument, NULL, OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR},
|
367 |
|
|
'\0', NULL, N_("Always set DT_NEEDED for dynamic libraries mentioned on\n"
|
368 |
|
|
" the command line"),
|
369 |
|
|
TWO_DASHES },
|
370 |
|
|
{ {"assert", required_argument, NULL, OPTION_ASSERT},
|
371 |
|
|
'\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH },
|
372 |
|
|
{ {"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED},
|
373 |
|
|
'\0', NULL, N_("Link against shared libraries"), ONE_DASH },
|
374 |
|
|
{ {"dy", no_argument, NULL, OPTION_CALL_SHARED},
|
375 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
376 |
|
|
{ {"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
|
377 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
378 |
|
|
{ {"Bstatic", no_argument, NULL, OPTION_NON_SHARED},
|
379 |
|
|
'\0', NULL, N_("Do not link against shared libraries"), ONE_DASH },
|
380 |
|
|
{ {"dn", no_argument, NULL, OPTION_NON_SHARED},
|
381 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
382 |
|
|
{ {"non_shared", no_argument, NULL, OPTION_NON_SHARED},
|
383 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
384 |
|
|
{ {"static", no_argument, NULL, OPTION_NON_SHARED},
|
385 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
386 |
|
|
{ {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
|
387 |
|
|
'\0', NULL, N_("Bind global references locally"), ONE_DASH },
|
388 |
|
|
{ {"Bsymbolic-functions", no_argument, NULL, OPTION_SYMBOLIC_FUNCTIONS},
|
389 |
|
|
'\0', NULL, N_("Bind global function references locally"), ONE_DASH },
|
390 |
|
|
{ {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS},
|
391 |
|
|
'\0', NULL, N_("Check section addresses for overlaps (default)"),
|
392 |
|
|
TWO_DASHES },
|
393 |
|
|
{ {"no-check-sections", no_argument, NULL, OPTION_NO_CHECK_SECTIONS},
|
394 |
|
|
'\0', NULL, N_("Do not check section addresses for overlaps"),
|
395 |
|
|
TWO_DASHES },
|
396 |
|
|
{ {"copy-dt-needed-entries", no_argument, NULL,
|
397 |
|
|
OPTION_ADD_DT_NEEDED_FOR_DYNAMIC},
|
398 |
|
|
'\0', NULL, N_("Copy DT_NEEDED links mentioned inside DSOs that follow"),
|
399 |
|
|
TWO_DASHES },
|
400 |
|
|
{ {"no-copy-dt-needed-entries", no_argument, NULL,
|
401 |
|
|
OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC},
|
402 |
|
|
'\0', NULL, N_("Do not copy DT_NEEDED links mentioned inside DSOs that follow"),
|
403 |
|
|
TWO_DASHES },
|
404 |
|
|
|
405 |
|
|
{ {"cref", no_argument, NULL, OPTION_CREF},
|
406 |
|
|
'\0', NULL, N_("Output cross reference table"), TWO_DASHES },
|
407 |
|
|
{ {"defsym", required_argument, NULL, OPTION_DEFSYM},
|
408 |
|
|
'\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES },
|
409 |
|
|
{ {"demangle", optional_argument, NULL, OPTION_DEMANGLE},
|
410 |
|
|
'\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"),
|
411 |
|
|
TWO_DASHES },
|
412 |
|
|
{ {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS},
|
413 |
|
|
'\0', NULL, N_("Generate embedded relocs"), TWO_DASHES},
|
414 |
|
|
{ {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL},
|
415 |
|
|
'\0', NULL, N_("Treat warnings as errors"),
|
416 |
|
|
TWO_DASHES },
|
417 |
|
|
{ {"no-fatal-warnings", no_argument, NULL, OPTION_NO_WARN_FATAL},
|
418 |
|
|
'\0', NULL, N_("Do not treat warnings as errors (default)"),
|
419 |
|
|
TWO_DASHES },
|
420 |
|
|
{ {"fini", required_argument, NULL, OPTION_FINI},
|
421 |
|
|
'\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH },
|
422 |
|
|
{ {"force-exe-suffix", no_argument, NULL, OPTION_FORCE_EXE_SUFFIX},
|
423 |
|
|
'\0', NULL, N_("Force generation of file with .exe suffix"), TWO_DASHES},
|
424 |
|
|
{ {"gc-sections", no_argument, NULL, OPTION_GC_SECTIONS},
|
425 |
|
|
'\0', NULL, N_("Remove unused sections (on some targets)"),
|
426 |
|
|
TWO_DASHES },
|
427 |
|
|
{ {"no-gc-sections", no_argument, NULL, OPTION_NO_GC_SECTIONS},
|
428 |
|
|
'\0', NULL, N_("Don't remove unused sections (default)"),
|
429 |
|
|
TWO_DASHES },
|
430 |
|
|
{ {"print-gc-sections", no_argument, NULL, OPTION_PRINT_GC_SECTIONS},
|
431 |
|
|
'\0', NULL, N_("List removed unused sections on stderr"),
|
432 |
|
|
TWO_DASHES },
|
433 |
|
|
{ {"no-print-gc-sections", no_argument, NULL, OPTION_NO_PRINT_GC_SECTIONS},
|
434 |
|
|
'\0', NULL, N_("Do not list removed unused sections"),
|
435 |
|
|
TWO_DASHES },
|
436 |
|
|
{ {"hash-size=<NUMBER>", required_argument, NULL, OPTION_HASH_SIZE},
|
437 |
|
|
'\0', NULL, N_("Set default hash table size close to <NUMBER>"),
|
438 |
|
|
TWO_DASHES },
|
439 |
|
|
{ {"help", no_argument, NULL, OPTION_HELP},
|
440 |
|
|
'\0', NULL, N_("Print option help"), TWO_DASHES },
|
441 |
|
|
{ {"init", required_argument, NULL, OPTION_INIT},
|
442 |
|
|
'\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH },
|
443 |
|
|
{ {"Map", required_argument, NULL, OPTION_MAP},
|
444 |
|
|
'\0', N_("FILE"), N_("Write a map file"), ONE_DASH },
|
445 |
|
|
{ {"no-define-common", no_argument, NULL, OPTION_NO_DEFINE_COMMON},
|
446 |
|
|
'\0', NULL, N_("Do not define Common storage"), TWO_DASHES },
|
447 |
|
|
{ {"no-demangle", no_argument, NULL, OPTION_NO_DEMANGLE },
|
448 |
|
|
'\0', NULL, N_("Do not demangle symbol names"), TWO_DASHES },
|
449 |
|
|
{ {"no-keep-memory", no_argument, NULL, OPTION_NO_KEEP_MEMORY},
|
450 |
|
|
'\0', NULL, N_("Use less memory and more disk I/O"), TWO_DASHES },
|
451 |
|
|
{ {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED},
|
452 |
|
|
'\0', NULL, N_("Do not allow unresolved references in object files"),
|
453 |
|
|
TWO_DASHES },
|
454 |
|
|
{ {"allow-shlib-undefined", no_argument, NULL, OPTION_ALLOW_SHLIB_UNDEFINED},
|
455 |
|
|
'\0', NULL, N_("Allow unresolved references in shared libraries"),
|
456 |
|
|
TWO_DASHES },
|
457 |
|
|
{ {"no-allow-shlib-undefined", no_argument, NULL,
|
458 |
|
|
OPTION_NO_ALLOW_SHLIB_UNDEFINED},
|
459 |
|
|
'\0', NULL, N_("Do not allow unresolved references in shared libs"),
|
460 |
|
|
TWO_DASHES },
|
461 |
|
|
{ {"allow-multiple-definition", no_argument, NULL,
|
462 |
|
|
OPTION_ALLOW_MULTIPLE_DEFINITION},
|
463 |
|
|
'\0', NULL, N_("Allow multiple definitions"), TWO_DASHES },
|
464 |
|
|
{ {"no-undefined-version", no_argument, NULL, OPTION_NO_UNDEFINED_VERSION},
|
465 |
|
|
'\0', NULL, N_("Disallow undefined version"), TWO_DASHES },
|
466 |
|
|
{ {"default-symver", no_argument, NULL, OPTION_DEFAULT_SYMVER},
|
467 |
|
|
'\0', NULL, N_("Create default symbol version"), TWO_DASHES },
|
468 |
|
|
{ {"default-imported-symver", no_argument, NULL,
|
469 |
|
|
OPTION_DEFAULT_IMPORTED_SYMVER},
|
470 |
|
|
'\0', NULL, N_("Create default symbol version for imported symbols"),
|
471 |
|
|
TWO_DASHES },
|
472 |
|
|
{ {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH},
|
473 |
|
|
'\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES},
|
474 |
|
|
{ {"no-warn-search-mismatch", no_argument, NULL,
|
475 |
|
|
OPTION_NO_WARN_SEARCH_MISMATCH},
|
476 |
|
|
'\0', NULL, N_("Don't warn on finding an incompatible library"),
|
477 |
|
|
TWO_DASHES},
|
478 |
|
|
{ {"no-whole-archive", no_argument, NULL, OPTION_NO_WHOLE_ARCHIVE},
|
479 |
|
|
'\0', NULL, N_("Turn off --whole-archive"), TWO_DASHES },
|
480 |
|
|
{ {"noinhibit-exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC},
|
481 |
|
|
'\0', NULL, N_("Create an output file even if errors occur"),
|
482 |
|
|
TWO_DASHES },
|
483 |
|
|
{ {"noinhibit_exec", no_argument, NULL, OPTION_NOINHIBIT_EXEC},
|
484 |
|
|
'\0', NULL, NULL, NO_HELP },
|
485 |
|
|
{ {"nostdlib", no_argument, NULL, OPTION_NOSTDLIB},
|
486 |
|
|
'\0', NULL, N_("Only use library directories specified on\n"
|
487 |
|
|
" the command line"),
|
488 |
|
|
ONE_DASH },
|
489 |
|
|
{ {"oformat", required_argument, NULL, OPTION_OFORMAT},
|
490 |
|
|
'\0', N_("TARGET"), N_("Specify target of output file"),
|
491 |
|
|
EXACTLY_TWO_DASHES },
|
492 |
157 |
khays |
{ {"print-output-format", no_argument, NULL, OPTION_PRINT_OUTPUT_FORMAT},
|
493 |
|
|
'\0', NULL, N_("Print default output format"), TWO_DASHES },
|
494 |
145 |
khays |
{ {"qmagic", no_argument, NULL, OPTION_IGNORE},
|
495 |
|
|
'\0', NULL, N_("Ignored for Linux compatibility"), ONE_DASH },
|
496 |
|
|
{ {"reduce-memory-overheads", no_argument, NULL,
|
497 |
|
|
OPTION_REDUCE_MEMORY_OVERHEADS},
|
498 |
|
|
'\0', NULL, N_("Reduce memory overheads, possibly taking much longer"),
|
499 |
|
|
TWO_DASHES },
|
500 |
|
|
{ {"relax", no_argument, NULL, OPTION_RELAX},
|
501 |
|
|
'\0', NULL, N_("Reduce code size by using target specific optimizations"), TWO_DASHES },
|
502 |
|
|
{ {"no-relax", no_argument, NULL, OPTION_NO_RELAX},
|
503 |
|
|
'\0', NULL, N_("Do not use relaxation techniques to reduce code size"), TWO_DASHES },
|
504 |
|
|
{ {"retain-symbols-file", required_argument, NULL,
|
505 |
|
|
OPTION_RETAIN_SYMBOLS_FILE},
|
506 |
|
|
'\0', N_("FILE"), N_("Keep only symbols listed in FILE"), TWO_DASHES },
|
507 |
|
|
{ {"rpath", required_argument, NULL, OPTION_RPATH},
|
508 |
|
|
'\0', N_("PATH"), N_("Set runtime shared library search path"), ONE_DASH },
|
509 |
|
|
{ {"rpath-link", required_argument, NULL, OPTION_RPATH_LINK},
|
510 |
|
|
'\0', N_("PATH"), N_("Set link time shared library search path"),
|
511 |
|
|
ONE_DASH },
|
512 |
|
|
{ {"shared", no_argument, NULL, OPTION_SHARED},
|
513 |
|
|
'\0', NULL, N_("Create a shared library"), ONE_DASH },
|
514 |
|
|
{ {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD. */
|
515 |
|
|
'\0', NULL, NULL, ONE_DASH },
|
516 |
|
|
{ {"pie", no_argument, NULL, OPTION_PIE},
|
517 |
|
|
'\0', NULL, N_("Create a position independent executable"), ONE_DASH },
|
518 |
|
|
{ {"pic-executable", no_argument, NULL, OPTION_PIE},
|
519 |
|
|
'\0', NULL, NULL, TWO_DASHES },
|
520 |
|
|
{ {"sort-common", optional_argument, NULL, OPTION_SORT_COMMON},
|
521 |
|
|
'\0', N_("[=ascending|descending]"),
|
522 |
|
|
N_("Sort common symbols by alignment [in specified order]"),
|
523 |
|
|
TWO_DASHES },
|
524 |
|
|
{ {"sort_common", no_argument, NULL, OPTION_SORT_COMMON},
|
525 |
|
|
'\0', NULL, NULL, NO_HELP },
|
526 |
|
|
{ {"sort-section", required_argument, NULL, OPTION_SORT_SECTION},
|
527 |
|
|
'\0', N_("name|alignment"),
|
528 |
|
|
N_("Sort sections by name or maximum alignment"), TWO_DASHES },
|
529 |
|
|
{ {"spare-dynamic-tags", required_argument, NULL, OPTION_SPARE_DYNAMIC_TAGS},
|
530 |
|
|
'\0', N_("COUNT"), N_("How many tags to reserve in .dynamic section"),
|
531 |
|
|
TWO_DASHES },
|
532 |
|
|
{ {"split-by-file", optional_argument, NULL, OPTION_SPLIT_BY_FILE},
|
533 |
|
|
'\0', N_("[=SIZE]"), N_("Split output sections every SIZE octets"),
|
534 |
|
|
TWO_DASHES },
|
535 |
|
|
{ {"split-by-reloc", optional_argument, NULL, OPTION_SPLIT_BY_RELOC},
|
536 |
|
|
'\0', N_("[=COUNT]"), N_("Split output sections every COUNT relocs"),
|
537 |
|
|
TWO_DASHES },
|
538 |
|
|
{ {"stats", no_argument, NULL, OPTION_STATS},
|
539 |
|
|
'\0', NULL, N_("Print memory usage statistics"), TWO_DASHES },
|
540 |
|
|
{ {"target-help", no_argument, NULL, OPTION_TARGET_HELP},
|
541 |
|
|
'\0', NULL, N_("Display target specific options"), TWO_DASHES },
|
542 |
|
|
{ {"task-link", required_argument, NULL, OPTION_TASK_LINK},
|
543 |
|
|
'\0', N_("SYMBOL"), N_("Do task level linking"), TWO_DASHES },
|
544 |
|
|
{ {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT},
|
545 |
|
|
'\0', NULL, N_("Use same format as native linker"), TWO_DASHES },
|
546 |
|
|
{ {"section-start", required_argument, NULL, OPTION_SECTION_START},
|
547 |
|
|
'\0', N_("SECTION=ADDRESS"), N_("Set address of named section"),
|
548 |
|
|
TWO_DASHES },
|
549 |
|
|
{ {"Tbss", required_argument, NULL, OPTION_TBSS},
|
550 |
|
|
'\0', N_("ADDRESS"), N_("Set address of .bss section"), ONE_DASH },
|
551 |
|
|
{ {"Tdata", required_argument, NULL, OPTION_TDATA},
|
552 |
|
|
'\0', N_("ADDRESS"), N_("Set address of .data section"), ONE_DASH },
|
553 |
|
|
{ {"Ttext", required_argument, NULL, OPTION_TTEXT},
|
554 |
|
|
'\0', N_("ADDRESS"), N_("Set address of .text section"), ONE_DASH },
|
555 |
|
|
{ {"Ttext-segment", required_argument, NULL, OPTION_TTEXT_SEGMENT},
|
556 |
|
|
'\0', N_("ADDRESS"), N_("Set address of text segment"), ONE_DASH },
|
557 |
|
|
{ {"unresolved-symbols=<method>", required_argument, NULL,
|
558 |
|
|
OPTION_UNRESOLVED_SYMBOLS},
|
559 |
|
|
'\0', NULL, N_("How to handle unresolved symbols. <method> is:\n"
|
560 |
|
|
" ignore-all, report-all, ignore-in-object-files,\n"
|
561 |
|
|
" ignore-in-shared-libs"),
|
562 |
|
|
TWO_DASHES },
|
563 |
|
|
{ {"verbose", optional_argument, NULL, OPTION_VERBOSE},
|
564 |
|
|
'\0', N_("[=NUMBER]"),
|
565 |
|
|
N_("Output lots of information during link"), TWO_DASHES },
|
566 |
|
|
{ {"dll-verbose", no_argument, NULL, OPTION_VERBOSE}, /* Linux. */
|
567 |
|
|
'\0', NULL, NULL, NO_HELP },
|
568 |
|
|
{ {"version-script", required_argument, NULL, OPTION_VERSION_SCRIPT },
|
569 |
|
|
'\0', N_("FILE"), N_("Read version information script"), TWO_DASHES },
|
570 |
|
|
{ {"version-exports-section", required_argument, NULL,
|
571 |
|
|
OPTION_VERSION_EXPORTS_SECTION },
|
572 |
|
|
'\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n"
|
573 |
|
|
" SYMBOL as the version."),
|
574 |
|
|
TWO_DASHES },
|
575 |
|
|
{ {"dynamic-list-data", no_argument, NULL, OPTION_DYNAMIC_LIST_DATA},
|
576 |
|
|
'\0', NULL, N_("Add data symbols to dynamic list"), TWO_DASHES },
|
577 |
|
|
{ {"dynamic-list-cpp-new", no_argument, NULL, OPTION_DYNAMIC_LIST_CPP_NEW},
|
578 |
|
|
'\0', NULL, N_("Use C++ operator new/delete dynamic list"), TWO_DASHES },
|
579 |
|
|
{ {"dynamic-list-cpp-typeinfo", no_argument, NULL, OPTION_DYNAMIC_LIST_CPP_TYPEINFO},
|
580 |
|
|
'\0', NULL, N_("Use C++ typeinfo dynamic list"), TWO_DASHES },
|
581 |
|
|
{ {"dynamic-list", required_argument, NULL, OPTION_DYNAMIC_LIST},
|
582 |
|
|
'\0', N_("FILE"), N_("Read dynamic list"), TWO_DASHES },
|
583 |
|
|
{ {"warn-common", no_argument, NULL, OPTION_WARN_COMMON},
|
584 |
|
|
'\0', NULL, N_("Warn about duplicate common symbols"), TWO_DASHES },
|
585 |
|
|
{ {"warn-constructors", no_argument, NULL, OPTION_WARN_CONSTRUCTORS},
|
586 |
|
|
'\0', NULL, N_("Warn if global constructors/destructors are seen"),
|
587 |
|
|
TWO_DASHES },
|
588 |
|
|
{ {"warn-multiple-gp", no_argument, NULL, OPTION_WARN_MULTIPLE_GP},
|
589 |
|
|
'\0', NULL, N_("Warn if the multiple GP values are used"), TWO_DASHES },
|
590 |
|
|
{ {"warn-once", no_argument, NULL, OPTION_WARN_ONCE},
|
591 |
|
|
'\0', NULL, N_("Warn only once per undefined symbol"), TWO_DASHES },
|
592 |
|
|
{ {"warn-section-align", no_argument, NULL, OPTION_WARN_SECTION_ALIGN},
|
593 |
|
|
'\0', NULL, N_("Warn if start of section changes due to alignment"),
|
594 |
|
|
TWO_DASHES },
|
595 |
|
|
{ {"warn-shared-textrel", no_argument, NULL, OPTION_WARN_SHARED_TEXTREL},
|
596 |
|
|
'\0', NULL, N_("Warn if shared object has DT_TEXTREL"),
|
597 |
|
|
TWO_DASHES },
|
598 |
|
|
{ {"warn-alternate-em", no_argument, NULL, OPTION_WARN_ALTERNATE_EM},
|
599 |
|
|
'\0', NULL, N_("Warn if an object has alternate ELF machine code"),
|
600 |
|
|
TWO_DASHES },
|
601 |
|
|
{ {"warn-unresolved-symbols", no_argument, NULL,
|
602 |
|
|
OPTION_WARN_UNRESOLVED_SYMBOLS},
|
603 |
|
|
'\0', NULL, N_("Report unresolved symbols as warnings"), TWO_DASHES },
|
604 |
|
|
{ {"error-unresolved-symbols", no_argument, NULL,
|
605 |
|
|
OPTION_ERROR_UNRESOLVED_SYMBOLS},
|
606 |
|
|
'\0', NULL, N_("Report unresolved symbols as errors"), TWO_DASHES },
|
607 |
|
|
{ {"whole-archive", no_argument, NULL, OPTION_WHOLE_ARCHIVE},
|
608 |
|
|
'\0', NULL, N_("Include all objects from following archives"),
|
609 |
|
|
TWO_DASHES },
|
610 |
|
|
{ {"wrap", required_argument, NULL, OPTION_WRAP},
|
611 |
|
|
'\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES },
|
612 |
|
|
};
|
613 |
|
|
|
614 |
|
|
#define OPTION_COUNT ARRAY_SIZE (ld_options)
|
615 |
|
|
|
616 |
|
|
void
|
617 |
|
|
parse_args (unsigned argc, char **argv)
|
618 |
|
|
{
|
619 |
|
|
unsigned i;
|
620 |
|
|
int is, il, irl;
|
621 |
|
|
int ingroup = 0;
|
622 |
|
|
char *default_dirlist = NULL;
|
623 |
|
|
char *shortopts;
|
624 |
|
|
struct option *longopts;
|
625 |
|
|
struct option *really_longopts;
|
626 |
|
|
int last_optind;
|
627 |
|
|
enum report_method how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
|
628 |
|
|
|
629 |
|
|
shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
|
630 |
|
|
longopts = (struct option *)
|
631 |
|
|
xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
|
632 |
|
|
really_longopts = (struct option *)
|
633 |
|
|
malloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
|
634 |
|
|
|
635 |
|
|
/* Starting the short option string with '-' is for programs that
|
636 |
|
|
expect options and other ARGV-elements in any order and that care about
|
637 |
|
|
the ordering of the two. We describe each non-option ARGV-element
|
638 |
|
|
as if it were the argument of an option with character code 1. */
|
639 |
|
|
shortopts[0] = '-';
|
640 |
|
|
is = 1;
|
641 |
|
|
il = 0;
|
642 |
|
|
irl = 0;
|
643 |
|
|
for (i = 0; i < OPTION_COUNT; i++)
|
644 |
|
|
{
|
645 |
|
|
if (ld_options[i].shortopt != '\0')
|
646 |
|
|
{
|
647 |
|
|
shortopts[is] = ld_options[i].shortopt;
|
648 |
|
|
++is;
|
649 |
|
|
if (ld_options[i].opt.has_arg == required_argument
|
650 |
|
|
|| ld_options[i].opt.has_arg == optional_argument)
|
651 |
|
|
{
|
652 |
|
|
shortopts[is] = ':';
|
653 |
|
|
++is;
|
654 |
|
|
if (ld_options[i].opt.has_arg == optional_argument)
|
655 |
|
|
{
|
656 |
|
|
shortopts[is] = ':';
|
657 |
|
|
++is;
|
658 |
|
|
}
|
659 |
|
|
}
|
660 |
|
|
}
|
661 |
|
|
if (ld_options[i].opt.name != NULL)
|
662 |
|
|
{
|
663 |
|
|
if (ld_options[i].control == EXACTLY_TWO_DASHES)
|
664 |
|
|
{
|
665 |
|
|
really_longopts[irl] = ld_options[i].opt;
|
666 |
|
|
++irl;
|
667 |
|
|
}
|
668 |
|
|
else
|
669 |
|
|
{
|
670 |
|
|
longopts[il] = ld_options[i].opt;
|
671 |
|
|
++il;
|
672 |
|
|
}
|
673 |
|
|
}
|
674 |
|
|
}
|
675 |
|
|
shortopts[is] = '\0';
|
676 |
|
|
longopts[il].name = NULL;
|
677 |
|
|
really_longopts[irl].name = NULL;
|
678 |
|
|
|
679 |
|
|
ldemul_add_options (is, &shortopts, il, &longopts, irl, &really_longopts);
|
680 |
|
|
|
681 |
|
|
/* The -G option is ambiguous on different platforms. Sometimes it
|
682 |
|
|
specifies the largest data size to put into the small data
|
683 |
|
|
section. Sometimes it is equivalent to --shared. Unfortunately,
|
684 |
|
|
the first form takes an argument, while the second does not.
|
685 |
|
|
|
686 |
|
|
We need to permit the --shared form because on some platforms,
|
687 |
|
|
such as Solaris, gcc -shared will pass -G to the linker.
|
688 |
|
|
|
689 |
|
|
To permit either usage, we look through the argument list. If we
|
690 |
|
|
find -G not followed by a number, we change it into --shared.
|
691 |
|
|
This will work for most normal cases. */
|
692 |
|
|
for (i = 1; i < argc; i++)
|
693 |
|
|
if (strcmp (argv[i], "-G") == 0
|
694 |
|
|
&& (i + 1 >= argc
|
695 |
|
|
|| ! ISDIGIT (argv[i + 1][0])))
|
696 |
|
|
argv[i] = (char *) "--shared";
|
697 |
|
|
|
698 |
|
|
/* Because we permit long options to start with a single dash, and
|
699 |
|
|
we have a --library option, and the -l option is conventionally
|
700 |
|
|
used with an immediately following argument, we can have bad
|
701 |
|
|
results if somebody tries to use -l with a library whose name
|
702 |
|
|
happens to start with "ibrary", as in -li. We avoid problems by
|
703 |
|
|
simply turning -l into --library. This means that users will
|
704 |
|
|
have to use two dashes in order to use --library, which is OK
|
705 |
|
|
since that's how it is documented.
|
706 |
|
|
|
707 |
|
|
FIXME: It's possible that this problem can arise for other short
|
708 |
|
|
options as well, although the user does always have the recourse
|
709 |
|
|
of adding a space between the option and the argument. */
|
710 |
|
|
for (i = 1; i < argc; i++)
|
711 |
|
|
{
|
712 |
|
|
if (argv[i][0] == '-'
|
713 |
|
|
&& argv[i][1] == 'l'
|
714 |
|
|
&& argv[i][2] != '\0')
|
715 |
|
|
{
|
716 |
|
|
char *n;
|
717 |
|
|
|
718 |
|
|
n = (char *) xmalloc (strlen (argv[i]) + 20);
|
719 |
|
|
sprintf (n, "--library=%s", argv[i] + 2);
|
720 |
|
|
argv[i] = n;
|
721 |
|
|
}
|
722 |
|
|
}
|
723 |
|
|
|
724 |
|
|
last_optind = -1;
|
725 |
|
|
while (1)
|
726 |
|
|
{
|
727 |
|
|
int longind;
|
728 |
|
|
int optc;
|
729 |
166 |
khays |
static unsigned int defsym_count;
|
730 |
145 |
khays |
|
731 |
|
|
/* Using last_optind lets us avoid calling ldemul_parse_args
|
732 |
|
|
multiple times on a single option, which would lead to
|
733 |
|
|
confusion in the internal static variables maintained by
|
734 |
|
|
getopt. This could otherwise happen for an argument like
|
735 |
|
|
-nx, in which the -n is parsed as a single option, and we
|
736 |
|
|
loop around to pick up the -x. */
|
737 |
|
|
if (optind != last_optind)
|
738 |
|
|
if (ldemul_parse_args (argc, argv))
|
739 |
|
|
continue;
|
740 |
|
|
|
741 |
|
|
/* getopt_long_only is like getopt_long, but '-' as well as '--'
|
742 |
|
|
can indicate a long option. */
|
743 |
|
|
opterr = 0;
|
744 |
|
|
last_optind = optind;
|
745 |
|
|
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
|
746 |
|
|
if (optc == '?')
|
747 |
|
|
{
|
748 |
|
|
optind = last_optind;
|
749 |
|
|
optc = getopt_long (argc, argv, "-", really_longopts, &longind);
|
750 |
|
|
}
|
751 |
|
|
|
752 |
|
|
if (ldemul_handle_option (optc))
|
753 |
|
|
continue;
|
754 |
|
|
|
755 |
|
|
if (optc == -1)
|
756 |
|
|
break;
|
757 |
|
|
|
758 |
|
|
switch (optc)
|
759 |
|
|
{
|
760 |
|
|
case '?':
|
761 |
|
|
einfo (_("%P: unrecognized option '%s'\n"), argv[last_optind]);
|
762 |
|
|
/* Fall through. */
|
763 |
|
|
|
764 |
|
|
default:
|
765 |
|
|
einfo (_("%P%F: use the --help option for usage information\n"));
|
766 |
|
|
|
767 |
|
|
case 1: /* File name. */
|
768 |
|
|
lang_add_input_file (optarg, lang_input_file_is_file_enum, NULL);
|
769 |
|
|
break;
|
770 |
|
|
|
771 |
|
|
case OPTION_IGNORE:
|
772 |
|
|
break;
|
773 |
|
|
case 'a':
|
774 |
|
|
/* For HP/UX compatibility. Actually -a shared should mean
|
775 |
|
|
``use only shared libraries'' but, then, we don't
|
776 |
|
|
currently support shared libraries on HP/UX anyhow. */
|
777 |
|
|
if (strcmp (optarg, "archive") == 0)
|
778 |
|
|
config.dynamic_link = FALSE;
|
779 |
|
|
else if (strcmp (optarg, "shared") == 0
|
780 |
|
|
|| strcmp (optarg, "default") == 0)
|
781 |
|
|
config.dynamic_link = TRUE;
|
782 |
|
|
else
|
783 |
|
|
einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg);
|
784 |
|
|
break;
|
785 |
|
|
case OPTION_ASSERT:
|
786 |
|
|
/* FIXME: We just ignore these, but we should handle them. */
|
787 |
|
|
if (strcmp (optarg, "definitions") == 0)
|
788 |
|
|
;
|
789 |
|
|
else if (strcmp (optarg, "nodefinitions") == 0)
|
790 |
|
|
;
|
791 |
|
|
else if (strcmp (optarg, "nosymbolic") == 0)
|
792 |
|
|
;
|
793 |
|
|
else if (strcmp (optarg, "pure-text") == 0)
|
794 |
|
|
;
|
795 |
|
|
else
|
796 |
|
|
einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg);
|
797 |
|
|
break;
|
798 |
|
|
case 'A':
|
799 |
|
|
ldfile_add_arch (optarg);
|
800 |
|
|
break;
|
801 |
|
|
case 'b':
|
802 |
|
|
lang_add_target (optarg);
|
803 |
|
|
break;
|
804 |
|
|
case 'c':
|
805 |
|
|
ldfile_open_command_file (optarg);
|
806 |
|
|
parser_input = input_mri_script;
|
807 |
|
|
yyparse ();
|
808 |
|
|
break;
|
809 |
|
|
case OPTION_CALL_SHARED:
|
810 |
|
|
config.dynamic_link = TRUE;
|
811 |
|
|
break;
|
812 |
|
|
case OPTION_NON_SHARED:
|
813 |
|
|
config.dynamic_link = FALSE;
|
814 |
|
|
break;
|
815 |
|
|
case OPTION_CREF:
|
816 |
|
|
command_line.cref = TRUE;
|
817 |
|
|
link_info.notice_all = TRUE;
|
818 |
|
|
break;
|
819 |
|
|
case 'd':
|
820 |
|
|
command_line.force_common_definition = TRUE;
|
821 |
|
|
break;
|
822 |
|
|
case OPTION_DEFSYM:
|
823 |
|
|
lex_string = optarg;
|
824 |
166 |
khays |
lex_redirect (optarg, "--defsym", ++defsym_count);
|
825 |
145 |
khays |
parser_input = input_defsym;
|
826 |
|
|
yyparse ();
|
827 |
|
|
lex_string = NULL;
|
828 |
|
|
break;
|
829 |
|
|
case OPTION_DEMANGLE:
|
830 |
|
|
demangling = TRUE;
|
831 |
|
|
if (optarg != NULL)
|
832 |
|
|
{
|
833 |
|
|
enum demangling_styles style;
|
834 |
|
|
|
835 |
|
|
style = cplus_demangle_name_to_style (optarg);
|
836 |
|
|
if (style == unknown_demangling)
|
837 |
|
|
einfo (_("%F%P: unknown demangling style `%s'"),
|
838 |
|
|
optarg);
|
839 |
|
|
|
840 |
|
|
cplus_demangle_set_style (style);
|
841 |
|
|
}
|
842 |
|
|
break;
|
843 |
|
|
case 'I': /* Used on Solaris. */
|
844 |
|
|
case OPTION_DYNAMIC_LINKER:
|
845 |
|
|
command_line.interpreter = optarg;
|
846 |
|
|
break;
|
847 |
|
|
case OPTION_SYSROOT:
|
848 |
|
|
/* Already handled in ldmain.c. */
|
849 |
|
|
break;
|
850 |
|
|
case OPTION_EB:
|
851 |
|
|
command_line.endian = ENDIAN_BIG;
|
852 |
|
|
break;
|
853 |
|
|
case OPTION_EL:
|
854 |
|
|
command_line.endian = ENDIAN_LITTLE;
|
855 |
|
|
break;
|
856 |
|
|
case OPTION_EMBEDDED_RELOCS:
|
857 |
|
|
command_line.embedded_relocs = TRUE;
|
858 |
|
|
break;
|
859 |
|
|
case OPTION_EXPORT_DYNAMIC:
|
860 |
|
|
case 'E': /* HP/UX compatibility. */
|
861 |
|
|
link_info.export_dynamic = TRUE;
|
862 |
|
|
break;
|
863 |
|
|
case OPTION_NO_EXPORT_DYNAMIC:
|
864 |
|
|
link_info.export_dynamic = FALSE;
|
865 |
|
|
break;
|
866 |
|
|
case 'e':
|
867 |
|
|
lang_add_entry (optarg, TRUE);
|
868 |
|
|
break;
|
869 |
|
|
case 'f':
|
870 |
|
|
if (command_line.auxiliary_filters == NULL)
|
871 |
|
|
{
|
872 |
|
|
command_line.auxiliary_filters = (char **)
|
873 |
|
|
xmalloc (2 * sizeof (char *));
|
874 |
|
|
command_line.auxiliary_filters[0] = optarg;
|
875 |
|
|
command_line.auxiliary_filters[1] = NULL;
|
876 |
|
|
}
|
877 |
|
|
else
|
878 |
|
|
{
|
879 |
|
|
int c;
|
880 |
|
|
char **p;
|
881 |
|
|
|
882 |
|
|
c = 0;
|
883 |
|
|
for (p = command_line.auxiliary_filters; *p != NULL; p++)
|
884 |
|
|
++c;
|
885 |
|
|
command_line.auxiliary_filters = (char **)
|
886 |
|
|
xrealloc (command_line.auxiliary_filters,
|
887 |
|
|
(c + 2) * sizeof (char *));
|
888 |
|
|
command_line.auxiliary_filters[c] = optarg;
|
889 |
|
|
command_line.auxiliary_filters[c + 1] = NULL;
|
890 |
|
|
}
|
891 |
|
|
break;
|
892 |
|
|
case 'F':
|
893 |
|
|
command_line.filter_shlib = optarg;
|
894 |
|
|
break;
|
895 |
|
|
case OPTION_FORCE_EXE_SUFFIX:
|
896 |
|
|
command_line.force_exe_suffix = TRUE;
|
897 |
|
|
break;
|
898 |
|
|
case 'G':
|
899 |
|
|
{
|
900 |
|
|
char *end;
|
901 |
|
|
g_switch_value = strtoul (optarg, &end, 0);
|
902 |
|
|
if (*end)
|
903 |
|
|
einfo (_("%P%F: invalid number `%s'\n"), optarg);
|
904 |
|
|
}
|
905 |
|
|
break;
|
906 |
|
|
case 'g':
|
907 |
|
|
/* Ignore. */
|
908 |
|
|
break;
|
909 |
|
|
case OPTION_GC_SECTIONS:
|
910 |
|
|
link_info.gc_sections = TRUE;
|
911 |
|
|
break;
|
912 |
|
|
case OPTION_PRINT_GC_SECTIONS:
|
913 |
|
|
link_info.print_gc_sections = TRUE;
|
914 |
|
|
break;
|
915 |
|
|
case OPTION_HELP:
|
916 |
|
|
help ();
|
917 |
|
|
xexit (0);
|
918 |
|
|
break;
|
919 |
|
|
case 'L':
|
920 |
|
|
ldfile_add_library_path (optarg, TRUE);
|
921 |
|
|
break;
|
922 |
|
|
case 'l':
|
923 |
|
|
lang_add_input_file (optarg, lang_input_file_is_l_enum, NULL);
|
924 |
|
|
break;
|
925 |
|
|
case 'M':
|
926 |
|
|
config.map_filename = "-";
|
927 |
|
|
break;
|
928 |
|
|
case 'm':
|
929 |
|
|
/* Ignore. Was handled in a pre-parse. */
|
930 |
|
|
break;
|
931 |
|
|
case OPTION_MAP:
|
932 |
|
|
config.map_filename = optarg;
|
933 |
|
|
break;
|
934 |
|
|
case 'N':
|
935 |
|
|
config.text_read_only = FALSE;
|
936 |
|
|
config.magic_demand_paged = FALSE;
|
937 |
|
|
config.dynamic_link = FALSE;
|
938 |
|
|
break;
|
939 |
|
|
case OPTION_NO_OMAGIC:
|
940 |
|
|
config.text_read_only = TRUE;
|
941 |
|
|
config.magic_demand_paged = TRUE;
|
942 |
|
|
/* NB/ Does not set dynamic_link to TRUE.
|
943 |
|
|
Use --call-shared or -Bdynamic for this. */
|
944 |
|
|
break;
|
945 |
|
|
case 'n':
|
946 |
|
|
config.magic_demand_paged = FALSE;
|
947 |
|
|
config.dynamic_link = FALSE;
|
948 |
|
|
break;
|
949 |
|
|
case OPTION_NO_DEFINE_COMMON:
|
950 |
|
|
command_line.inhibit_common_definition = TRUE;
|
951 |
|
|
break;
|
952 |
|
|
case OPTION_NO_DEMANGLE:
|
953 |
|
|
demangling = FALSE;
|
954 |
|
|
break;
|
955 |
|
|
case OPTION_NO_GC_SECTIONS:
|
956 |
|
|
link_info.gc_sections = FALSE;
|
957 |
|
|
break;
|
958 |
|
|
case OPTION_NO_PRINT_GC_SECTIONS:
|
959 |
|
|
link_info.print_gc_sections = FALSE;
|
960 |
|
|
break;
|
961 |
|
|
case OPTION_NO_KEEP_MEMORY:
|
962 |
|
|
link_info.keep_memory = FALSE;
|
963 |
|
|
break;
|
964 |
|
|
case OPTION_NO_UNDEFINED:
|
965 |
|
|
link_info.unresolved_syms_in_objects
|
966 |
|
|
= how_to_report_unresolved_symbols;
|
967 |
|
|
break;
|
968 |
|
|
case OPTION_ALLOW_SHLIB_UNDEFINED:
|
969 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
|
970 |
|
|
break;
|
971 |
|
|
case OPTION_NO_ALLOW_SHLIB_UNDEFINED:
|
972 |
|
|
link_info.unresolved_syms_in_shared_libs
|
973 |
|
|
= how_to_report_unresolved_symbols;
|
974 |
|
|
break;
|
975 |
|
|
case OPTION_UNRESOLVED_SYMBOLS:
|
976 |
|
|
if (strcmp (optarg, "ignore-all") == 0)
|
977 |
|
|
{
|
978 |
|
|
link_info.unresolved_syms_in_objects = RM_IGNORE;
|
979 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
|
980 |
|
|
}
|
981 |
|
|
else if (strcmp (optarg, "report-all") == 0)
|
982 |
|
|
{
|
983 |
|
|
link_info.unresolved_syms_in_objects
|
984 |
|
|
= how_to_report_unresolved_symbols;
|
985 |
|
|
link_info.unresolved_syms_in_shared_libs
|
986 |
|
|
= how_to_report_unresolved_symbols;
|
987 |
|
|
}
|
988 |
|
|
else if (strcmp (optarg, "ignore-in-object-files") == 0)
|
989 |
|
|
{
|
990 |
|
|
link_info.unresolved_syms_in_objects = RM_IGNORE;
|
991 |
|
|
link_info.unresolved_syms_in_shared_libs
|
992 |
|
|
= how_to_report_unresolved_symbols;
|
993 |
|
|
}
|
994 |
|
|
else if (strcmp (optarg, "ignore-in-shared-libs") == 0)
|
995 |
|
|
{
|
996 |
|
|
link_info.unresolved_syms_in_objects
|
997 |
|
|
= how_to_report_unresolved_symbols;
|
998 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
|
999 |
|
|
}
|
1000 |
|
|
else
|
1001 |
|
|
einfo (_("%P%F: bad --unresolved-symbols option: %s\n"), optarg);
|
1002 |
|
|
break;
|
1003 |
|
|
case OPTION_WARN_UNRESOLVED_SYMBOLS:
|
1004 |
|
|
how_to_report_unresolved_symbols = RM_GENERATE_WARNING;
|
1005 |
|
|
if (link_info.unresolved_syms_in_objects == RM_GENERATE_ERROR)
|
1006 |
|
|
link_info.unresolved_syms_in_objects = RM_GENERATE_WARNING;
|
1007 |
|
|
if (link_info.unresolved_syms_in_shared_libs == RM_GENERATE_ERROR)
|
1008 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_GENERATE_WARNING;
|
1009 |
|
|
break;
|
1010 |
|
|
|
1011 |
|
|
case OPTION_ERROR_UNRESOLVED_SYMBOLS:
|
1012 |
|
|
how_to_report_unresolved_symbols = RM_GENERATE_ERROR;
|
1013 |
|
|
if (link_info.unresolved_syms_in_objects == RM_GENERATE_WARNING)
|
1014 |
|
|
link_info.unresolved_syms_in_objects = RM_GENERATE_ERROR;
|
1015 |
|
|
if (link_info.unresolved_syms_in_shared_libs == RM_GENERATE_WARNING)
|
1016 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_GENERATE_ERROR;
|
1017 |
|
|
break;
|
1018 |
|
|
case OPTION_ALLOW_MULTIPLE_DEFINITION:
|
1019 |
|
|
link_info.allow_multiple_definition = TRUE;
|
1020 |
|
|
break;
|
1021 |
|
|
case OPTION_NO_UNDEFINED_VERSION:
|
1022 |
|
|
link_info.allow_undefined_version = FALSE;
|
1023 |
|
|
break;
|
1024 |
|
|
case OPTION_DEFAULT_SYMVER:
|
1025 |
|
|
link_info.create_default_symver = TRUE;
|
1026 |
|
|
break;
|
1027 |
|
|
case OPTION_DEFAULT_IMPORTED_SYMVER:
|
1028 |
|
|
link_info.default_imported_symver = TRUE;
|
1029 |
|
|
break;
|
1030 |
|
|
case OPTION_NO_WARN_MISMATCH:
|
1031 |
|
|
command_line.warn_mismatch = FALSE;
|
1032 |
|
|
break;
|
1033 |
|
|
case OPTION_NO_WARN_SEARCH_MISMATCH:
|
1034 |
|
|
command_line.warn_search_mismatch = FALSE;
|
1035 |
|
|
break;
|
1036 |
|
|
case OPTION_NOINHIBIT_EXEC:
|
1037 |
|
|
force_make_executable = TRUE;
|
1038 |
|
|
break;
|
1039 |
|
|
case OPTION_NOSTDLIB:
|
1040 |
|
|
config.only_cmd_line_lib_dirs = TRUE;
|
1041 |
|
|
break;
|
1042 |
|
|
case OPTION_NO_WHOLE_ARCHIVE:
|
1043 |
|
|
whole_archive = FALSE;
|
1044 |
|
|
break;
|
1045 |
|
|
case 'O':
|
1046 |
|
|
/* FIXME "-O<non-digits> <value>" used to set the address of
|
1047 |
|
|
section <non-digits>. Was this for compatibility with
|
1048 |
|
|
something, or can we create a new option to do that
|
1049 |
|
|
(with a syntax similar to -defsym)?
|
1050 |
|
|
getopt can't handle two args to an option without kludges. */
|
1051 |
|
|
|
1052 |
|
|
/* Enable optimizations of output files. */
|
1053 |
|
|
link_info.optimize = strtoul (optarg, NULL, 0) ? TRUE : FALSE;
|
1054 |
|
|
break;
|
1055 |
|
|
case 'o':
|
1056 |
|
|
lang_add_output (optarg, 0);
|
1057 |
|
|
break;
|
1058 |
|
|
case OPTION_OFORMAT:
|
1059 |
|
|
lang_add_output_format (optarg, NULL, NULL, 0);
|
1060 |
|
|
break;
|
1061 |
157 |
khays |
case OPTION_PRINT_OUTPUT_FORMAT:
|
1062 |
|
|
command_line.print_output_format = TRUE;
|
1063 |
|
|
break;
|
1064 |
145 |
khays |
#ifdef ENABLE_PLUGINS
|
1065 |
|
|
case OPTION_PLUGIN:
|
1066 |
|
|
if (plugin_opt_plugin (optarg))
|
1067 |
|
|
einfo (_("%P%F: %s: error loading plugin\n"),
|
1068 |
|
|
plugin_error_plugin ());
|
1069 |
|
|
break;
|
1070 |
|
|
case OPTION_PLUGIN_OPT:
|
1071 |
|
|
if (plugin_opt_plugin_arg (optarg))
|
1072 |
|
|
einfo(_("%P%F: bad -plugin-opt option\n"));
|
1073 |
|
|
break;
|
1074 |
|
|
#endif /* ENABLE_PLUGINS */
|
1075 |
|
|
case 'q':
|
1076 |
|
|
link_info.emitrelocations = TRUE;
|
1077 |
|
|
break;
|
1078 |
|
|
case 'i':
|
1079 |
|
|
case 'r':
|
1080 |
|
|
if (optind == last_optind)
|
1081 |
|
|
/* This can happen if the user put "-rpath,a" on the command
|
1082 |
|
|
line. (Or something similar. The comma is important).
|
1083 |
|
|
Getopt becomes confused and thinks that this is a -r option
|
1084 |
|
|
but it cannot parse the text after the -r so it refuses to
|
1085 |
|
|
increment the optind counter. Detect this case and issue
|
1086 |
|
|
an error message here. We cannot just make this a warning,
|
1087 |
|
|
increment optind, and continue because getopt is too confused
|
1088 |
|
|
and will seg-fault the next time around. */
|
1089 |
|
|
einfo(_("%P%F: bad -rpath option\n"));
|
1090 |
|
|
|
1091 |
|
|
link_info.relocatable = TRUE;
|
1092 |
|
|
config.build_constructors = FALSE;
|
1093 |
|
|
config.magic_demand_paged = FALSE;
|
1094 |
|
|
config.text_read_only = FALSE;
|
1095 |
|
|
config.dynamic_link = FALSE;
|
1096 |
|
|
break;
|
1097 |
|
|
case 'R':
|
1098 |
|
|
/* The GNU linker traditionally uses -R to mean to include
|
1099 |
|
|
only the symbols from a file. The Solaris linker uses -R
|
1100 |
|
|
to set the path used by the runtime linker to find
|
1101 |
|
|
libraries. This is the GNU linker -rpath argument. We
|
1102 |
|
|
try to support both simultaneously by checking the file
|
1103 |
|
|
named. If it is a directory, rather than a regular file,
|
1104 |
|
|
we assume -rpath was meant. */
|
1105 |
|
|
{
|
1106 |
|
|
struct stat s;
|
1107 |
|
|
|
1108 |
|
|
if (stat (optarg, &s) >= 0
|
1109 |
|
|
&& ! S_ISDIR (s.st_mode))
|
1110 |
|
|
{
|
1111 |
|
|
lang_add_input_file (optarg,
|
1112 |
|
|
lang_input_file_is_symbols_only_enum,
|
1113 |
|
|
NULL);
|
1114 |
|
|
break;
|
1115 |
|
|
}
|
1116 |
|
|
}
|
1117 |
|
|
/* Fall through. */
|
1118 |
|
|
case OPTION_RPATH:
|
1119 |
|
|
if (command_line.rpath == NULL)
|
1120 |
|
|
command_line.rpath = xstrdup (optarg);
|
1121 |
|
|
else
|
1122 |
|
|
{
|
1123 |
|
|
size_t rpath_len = strlen (command_line.rpath);
|
1124 |
|
|
size_t optarg_len = strlen (optarg);
|
1125 |
|
|
char *buf;
|
1126 |
|
|
char *cp = command_line.rpath;
|
1127 |
|
|
|
1128 |
|
|
/* First see whether OPTARG is already in the path. */
|
1129 |
|
|
do
|
1130 |
|
|
{
|
1131 |
|
|
if (strncmp (optarg, cp, optarg_len) == 0
|
1132 |
|
|
&& (cp[optarg_len] == 0
|
1133 |
|
|
|| cp[optarg_len] == config.rpath_separator))
|
1134 |
|
|
/* We found it. */
|
1135 |
|
|
break;
|
1136 |
|
|
|
1137 |
|
|
/* Not yet found. */
|
1138 |
|
|
cp = strchr (cp, config.rpath_separator);
|
1139 |
|
|
if (cp != NULL)
|
1140 |
|
|
++cp;
|
1141 |
|
|
}
|
1142 |
|
|
while (cp != NULL);
|
1143 |
|
|
|
1144 |
|
|
if (cp == NULL)
|
1145 |
|
|
{
|
1146 |
|
|
buf = (char *) xmalloc (rpath_len + optarg_len + 2);
|
1147 |
|
|
sprintf (buf, "%s%c%s", command_line.rpath,
|
1148 |
|
|
config.rpath_separator, optarg);
|
1149 |
|
|
free (command_line.rpath);
|
1150 |
|
|
command_line.rpath = buf;
|
1151 |
|
|
}
|
1152 |
|
|
}
|
1153 |
|
|
break;
|
1154 |
|
|
case OPTION_RPATH_LINK:
|
1155 |
|
|
if (command_line.rpath_link == NULL)
|
1156 |
|
|
command_line.rpath_link = xstrdup (optarg);
|
1157 |
|
|
else
|
1158 |
|
|
{
|
1159 |
|
|
char *buf;
|
1160 |
|
|
|
1161 |
|
|
buf = (char *) xmalloc (strlen (command_line.rpath_link)
|
1162 |
|
|
+ strlen (optarg)
|
1163 |
|
|
+ 2);
|
1164 |
|
|
sprintf (buf, "%s%c%s", command_line.rpath_link,
|
1165 |
|
|
config.rpath_separator, optarg);
|
1166 |
|
|
free (command_line.rpath_link);
|
1167 |
|
|
command_line.rpath_link = buf;
|
1168 |
|
|
}
|
1169 |
|
|
break;
|
1170 |
|
|
case OPTION_NO_RELAX:
|
1171 |
|
|
DISABLE_RELAXATION;
|
1172 |
|
|
break;
|
1173 |
|
|
case OPTION_RELAX:
|
1174 |
|
|
ENABLE_RELAXATION;
|
1175 |
|
|
break;
|
1176 |
|
|
case OPTION_RETAIN_SYMBOLS_FILE:
|
1177 |
|
|
add_keepsyms_file (optarg);
|
1178 |
|
|
break;
|
1179 |
|
|
case 'S':
|
1180 |
|
|
link_info.strip = strip_debugger;
|
1181 |
|
|
break;
|
1182 |
|
|
case 's':
|
1183 |
|
|
link_info.strip = strip_all;
|
1184 |
|
|
break;
|
1185 |
|
|
case OPTION_STRIP_DISCARDED:
|
1186 |
|
|
link_info.strip_discarded = TRUE;
|
1187 |
|
|
break;
|
1188 |
|
|
case OPTION_NO_STRIP_DISCARDED:
|
1189 |
|
|
link_info.strip_discarded = FALSE;
|
1190 |
|
|
break;
|
1191 |
|
|
case OPTION_SHARED:
|
1192 |
|
|
if (config.has_shared)
|
1193 |
|
|
{
|
1194 |
|
|
link_info.shared = TRUE;
|
1195 |
|
|
/* When creating a shared library, the default
|
1196 |
|
|
behaviour is to ignore any unresolved references. */
|
1197 |
|
|
if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
|
1198 |
|
|
link_info.unresolved_syms_in_objects = RM_IGNORE;
|
1199 |
|
|
if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
|
1200 |
|
|
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
|
1201 |
|
|
}
|
1202 |
|
|
else
|
1203 |
|
|
einfo (_("%P%F: -shared not supported\n"));
|
1204 |
|
|
break;
|
1205 |
|
|
case OPTION_PIE:
|
1206 |
|
|
if (config.has_shared)
|
1207 |
|
|
{
|
1208 |
|
|
link_info.shared = TRUE;
|
1209 |
|
|
link_info.pie = TRUE;
|
1210 |
|
|
}
|
1211 |
|
|
else
|
1212 |
|
|
einfo (_("%P%F: -pie not supported\n"));
|
1213 |
|
|
break;
|
1214 |
|
|
case 'h': /* Used on Solaris. */
|
1215 |
|
|
case OPTION_SONAME:
|
1216 |
|
|
command_line.soname = optarg;
|
1217 |
|
|
break;
|
1218 |
|
|
case OPTION_SORT_COMMON:
|
1219 |
|
|
if (optarg == NULL
|
1220 |
|
|
|| strcmp (optarg, N_("descending")) == 0)
|
1221 |
|
|
config.sort_common = sort_descending;
|
1222 |
|
|
else if (strcmp (optarg, N_("ascending")) == 0)
|
1223 |
|
|
config.sort_common = sort_ascending;
|
1224 |
|
|
else
|
1225 |
|
|
einfo (_("%P%F: invalid common section sorting option: %s\n"),
|
1226 |
|
|
optarg);
|
1227 |
|
|
break;
|
1228 |
|
|
case OPTION_SORT_SECTION:
|
1229 |
|
|
if (strcmp (optarg, N_("name")) == 0)
|
1230 |
|
|
sort_section = by_name;
|
1231 |
|
|
else if (strcmp (optarg, N_("alignment")) == 0)
|
1232 |
|
|
sort_section = by_alignment;
|
1233 |
|
|
else
|
1234 |
|
|
einfo (_("%P%F: invalid section sorting option: %s\n"),
|
1235 |
|
|
optarg);
|
1236 |
|
|
break;
|
1237 |
|
|
case OPTION_STATS:
|
1238 |
|
|
config.stats = TRUE;
|
1239 |
|
|
break;
|
1240 |
|
|
case OPTION_SYMBOLIC:
|
1241 |
|
|
command_line.symbolic = symbolic;
|
1242 |
|
|
break;
|
1243 |
|
|
case OPTION_SYMBOLIC_FUNCTIONS:
|
1244 |
|
|
command_line.symbolic = symbolic_functions;
|
1245 |
|
|
break;
|
1246 |
|
|
case 't':
|
1247 |
|
|
trace_files = TRUE;
|
1248 |
|
|
break;
|
1249 |
|
|
case 'T':
|
1250 |
|
|
previous_script_handle = saved_script_handle;
|
1251 |
|
|
ldfile_open_command_file (optarg);
|
1252 |
|
|
parser_input = input_script;
|
1253 |
|
|
yyparse ();
|
1254 |
|
|
previous_script_handle = NULL;
|
1255 |
|
|
break;
|
1256 |
|
|
case OPTION_DEFAULT_SCRIPT:
|
1257 |
|
|
command_line.default_script = optarg;
|
1258 |
|
|
break;
|
1259 |
|
|
case OPTION_SECTION_START:
|
1260 |
|
|
{
|
1261 |
|
|
char *optarg2;
|
1262 |
|
|
char *sec_name;
|
1263 |
|
|
int len;
|
1264 |
|
|
|
1265 |
|
|
/* Check for <something>=<somthing>... */
|
1266 |
|
|
optarg2 = strchr (optarg, '=');
|
1267 |
|
|
if (optarg2 == NULL)
|
1268 |
|
|
einfo (_("%P%F: invalid argument to option"
|
1269 |
|
|
" \"--section-start\"\n"));
|
1270 |
|
|
|
1271 |
|
|
optarg2++;
|
1272 |
|
|
|
1273 |
|
|
/* So far so good. Are all the args present? */
|
1274 |
|
|
if ((*optarg == '\0') || (*optarg2 == '\0'))
|
1275 |
|
|
einfo (_("%P%F: missing argument(s) to option"
|
1276 |
|
|
" \"--section-start\"\n"));
|
1277 |
|
|
|
1278 |
|
|
/* We must copy the section name as set_section_start
|
1279 |
|
|
doesn't do it for us. */
|
1280 |
|
|
len = optarg2 - optarg;
|
1281 |
|
|
sec_name = (char *) xmalloc (len);
|
1282 |
|
|
memcpy (sec_name, optarg, len - 1);
|
1283 |
|
|
sec_name[len - 1] = 0;
|
1284 |
|
|
|
1285 |
|
|
/* Then set it... */
|
1286 |
|
|
set_section_start (sec_name, optarg2);
|
1287 |
|
|
}
|
1288 |
|
|
break;
|
1289 |
|
|
case OPTION_TARGET_HELP:
|
1290 |
|
|
/* Mention any target specific options. */
|
1291 |
|
|
ldemul_list_emulation_options (stdout);
|
1292 |
|
|
exit (0);
|
1293 |
|
|
case OPTION_TBSS:
|
1294 |
|
|
set_segment_start (".bss", optarg);
|
1295 |
|
|
break;
|
1296 |
|
|
case OPTION_TDATA:
|
1297 |
|
|
set_segment_start (".data", optarg);
|
1298 |
|
|
break;
|
1299 |
|
|
case OPTION_TTEXT:
|
1300 |
|
|
set_segment_start (".text", optarg);
|
1301 |
|
|
break;
|
1302 |
|
|
case OPTION_TTEXT_SEGMENT:
|
1303 |
|
|
set_segment_start (".text-segment", optarg);
|
1304 |
|
|
break;
|
1305 |
|
|
case OPTION_TRADITIONAL_FORMAT:
|
1306 |
|
|
link_info.traditional_format = TRUE;
|
1307 |
|
|
break;
|
1308 |
|
|
case OPTION_TASK_LINK:
|
1309 |
|
|
link_info.task_link = TRUE;
|
1310 |
|
|
/* Fall through - do an implied -r option. */
|
1311 |
|
|
case OPTION_UR:
|
1312 |
|
|
link_info.relocatable = TRUE;
|
1313 |
|
|
config.build_constructors = TRUE;
|
1314 |
|
|
config.magic_demand_paged = FALSE;
|
1315 |
|
|
config.text_read_only = FALSE;
|
1316 |
|
|
config.dynamic_link = FALSE;
|
1317 |
|
|
break;
|
1318 |
|
|
case 'u':
|
1319 |
|
|
ldlang_add_undef (optarg, TRUE);
|
1320 |
|
|
break;
|
1321 |
|
|
case OPTION_UNIQUE:
|
1322 |
|
|
if (optarg != NULL)
|
1323 |
|
|
lang_add_unique (optarg);
|
1324 |
|
|
else
|
1325 |
|
|
config.unique_orphan_sections = TRUE;
|
1326 |
|
|
break;
|
1327 |
|
|
case OPTION_VERBOSE:
|
1328 |
|
|
ldversion (1);
|
1329 |
|
|
version_printed = TRUE;
|
1330 |
|
|
trace_file_tries = TRUE;
|
1331 |
|
|
overflow_cutoff_limit = -2;
|
1332 |
|
|
if (optarg != NULL)
|
1333 |
|
|
{
|
1334 |
|
|
char *end;
|
1335 |
|
|
int level ATTRIBUTE_UNUSED = strtoul (optarg, &end, 0);
|
1336 |
|
|
if (*end)
|
1337 |
|
|
einfo (_("%P%F: invalid number `%s'\n"), optarg);
|
1338 |
|
|
#ifdef ENABLE_PLUGINS
|
1339 |
|
|
report_plugin_symbols = level > 1;
|
1340 |
|
|
#endif /* ENABLE_PLUGINS */
|
1341 |
|
|
}
|
1342 |
|
|
break;
|
1343 |
|
|
case 'v':
|
1344 |
|
|
ldversion (0);
|
1345 |
|
|
version_printed = TRUE;
|
1346 |
|
|
break;
|
1347 |
|
|
case 'V':
|
1348 |
|
|
ldversion (1);
|
1349 |
|
|
version_printed = TRUE;
|
1350 |
|
|
break;
|
1351 |
|
|
case OPTION_VERSION:
|
1352 |
|
|
ldversion (2);
|
1353 |
|
|
xexit (0);
|
1354 |
|
|
break;
|
1355 |
|
|
case OPTION_VERSION_SCRIPT:
|
1356 |
|
|
/* This option indicates a small script that only specifies
|
1357 |
|
|
version information. Read it, but don't assume that
|
1358 |
|
|
we've seen a linker script. */
|
1359 |
|
|
{
|
1360 |
|
|
FILE *hold_script_handle;
|
1361 |
|
|
|
1362 |
|
|
hold_script_handle = saved_script_handle;
|
1363 |
|
|
ldfile_open_command_file (optarg);
|
1364 |
|
|
saved_script_handle = hold_script_handle;
|
1365 |
|
|
parser_input = input_version_script;
|
1366 |
|
|
yyparse ();
|
1367 |
|
|
}
|
1368 |
|
|
break;
|
1369 |
|
|
case OPTION_VERSION_EXPORTS_SECTION:
|
1370 |
|
|
/* This option records a version symbol to be applied to the
|
1371 |
|
|
symbols listed for export to be found in the object files
|
1372 |
|
|
.exports sections. */
|
1373 |
|
|
command_line.version_exports_section = optarg;
|
1374 |
|
|
break;
|
1375 |
|
|
case OPTION_DYNAMIC_LIST_DATA:
|
1376 |
|
|
command_line.dynamic_list = dynamic_list_data;
|
1377 |
|
|
if (command_line.symbolic == symbolic)
|
1378 |
|
|
command_line.symbolic = symbolic_unset;
|
1379 |
|
|
break;
|
1380 |
|
|
case OPTION_DYNAMIC_LIST_CPP_TYPEINFO:
|
1381 |
|
|
lang_append_dynamic_list_cpp_typeinfo ();
|
1382 |
|
|
if (command_line.dynamic_list != dynamic_list_data)
|
1383 |
|
|
command_line.dynamic_list = dynamic_list;
|
1384 |
|
|
if (command_line.symbolic == symbolic)
|
1385 |
|
|
command_line.symbolic = symbolic_unset;
|
1386 |
|
|
break;
|
1387 |
|
|
case OPTION_DYNAMIC_LIST_CPP_NEW:
|
1388 |
|
|
lang_append_dynamic_list_cpp_new ();
|
1389 |
|
|
if (command_line.dynamic_list != dynamic_list_data)
|
1390 |
|
|
command_line.dynamic_list = dynamic_list;
|
1391 |
|
|
if (command_line.symbolic == symbolic)
|
1392 |
|
|
command_line.symbolic = symbolic_unset;
|
1393 |
|
|
break;
|
1394 |
|
|
case OPTION_DYNAMIC_LIST:
|
1395 |
|
|
/* This option indicates a small script that only specifies
|
1396 |
|
|
a dynamic list. Read it, but don't assume that we've
|
1397 |
|
|
seen a linker script. */
|
1398 |
|
|
{
|
1399 |
|
|
FILE *hold_script_handle;
|
1400 |
|
|
|
1401 |
|
|
hold_script_handle = saved_script_handle;
|
1402 |
|
|
ldfile_open_command_file (optarg);
|
1403 |
|
|
saved_script_handle = hold_script_handle;
|
1404 |
|
|
parser_input = input_dynamic_list;
|
1405 |
|
|
yyparse ();
|
1406 |
|
|
}
|
1407 |
|
|
if (command_line.dynamic_list != dynamic_list_data)
|
1408 |
|
|
command_line.dynamic_list = dynamic_list;
|
1409 |
|
|
if (command_line.symbolic == symbolic)
|
1410 |
|
|
command_line.symbolic = symbolic_unset;
|
1411 |
|
|
break;
|
1412 |
|
|
case OPTION_WARN_COMMON:
|
1413 |
|
|
config.warn_common = TRUE;
|
1414 |
|
|
break;
|
1415 |
|
|
case OPTION_WARN_CONSTRUCTORS:
|
1416 |
|
|
config.warn_constructors = TRUE;
|
1417 |
|
|
break;
|
1418 |
|
|
case OPTION_WARN_FATAL:
|
1419 |
|
|
config.fatal_warnings = TRUE;
|
1420 |
|
|
break;
|
1421 |
|
|
case OPTION_NO_WARN_FATAL:
|
1422 |
|
|
config.fatal_warnings = FALSE;
|
1423 |
|
|
break;
|
1424 |
|
|
case OPTION_WARN_MULTIPLE_GP:
|
1425 |
|
|
config.warn_multiple_gp = TRUE;
|
1426 |
|
|
break;
|
1427 |
|
|
case OPTION_WARN_ONCE:
|
1428 |
|
|
config.warn_once = TRUE;
|
1429 |
|
|
break;
|
1430 |
|
|
case OPTION_WARN_SECTION_ALIGN:
|
1431 |
|
|
config.warn_section_align = TRUE;
|
1432 |
|
|
break;
|
1433 |
|
|
case OPTION_WARN_SHARED_TEXTREL:
|
1434 |
|
|
link_info.warn_shared_textrel = TRUE;
|
1435 |
|
|
break;
|
1436 |
|
|
case OPTION_WARN_ALTERNATE_EM:
|
1437 |
|
|
link_info.warn_alternate_em = TRUE;
|
1438 |
|
|
break;
|
1439 |
|
|
case OPTION_WHOLE_ARCHIVE:
|
1440 |
|
|
whole_archive = TRUE;
|
1441 |
|
|
break;
|
1442 |
|
|
case OPTION_ADD_DT_NEEDED_FOR_DYNAMIC:
|
1443 |
|
|
add_DT_NEEDED_for_dynamic = TRUE;
|
1444 |
|
|
break;
|
1445 |
|
|
case OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC:
|
1446 |
|
|
add_DT_NEEDED_for_dynamic = FALSE;
|
1447 |
|
|
break;
|
1448 |
|
|
case OPTION_ADD_DT_NEEDED_FOR_REGULAR:
|
1449 |
|
|
add_DT_NEEDED_for_regular = TRUE;
|
1450 |
|
|
break;
|
1451 |
|
|
case OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR:
|
1452 |
|
|
add_DT_NEEDED_for_regular = FALSE;
|
1453 |
|
|
break;
|
1454 |
|
|
case OPTION_WRAP:
|
1455 |
|
|
add_wrap (optarg);
|
1456 |
|
|
break;
|
1457 |
|
|
case OPTION_DISCARD_NONE:
|
1458 |
|
|
link_info.discard = discard_none;
|
1459 |
|
|
break;
|
1460 |
|
|
case 'X':
|
1461 |
|
|
link_info.discard = discard_l;
|
1462 |
|
|
break;
|
1463 |
|
|
case 'x':
|
1464 |
|
|
link_info.discard = discard_all;
|
1465 |
|
|
break;
|
1466 |
|
|
case 'Y':
|
1467 |
|
|
if (CONST_STRNEQ (optarg, "P,"))
|
1468 |
|
|
optarg += 2;
|
1469 |
|
|
if (default_dirlist != NULL)
|
1470 |
|
|
free (default_dirlist);
|
1471 |
|
|
default_dirlist = xstrdup (optarg);
|
1472 |
|
|
break;
|
1473 |
|
|
case 'y':
|
1474 |
|
|
add_ysym (optarg);
|
1475 |
|
|
break;
|
1476 |
|
|
case OPTION_SPARE_DYNAMIC_TAGS:
|
1477 |
|
|
link_info.spare_dynamic_tags = strtoul (optarg, NULL, 0);
|
1478 |
|
|
break;
|
1479 |
|
|
case OPTION_SPLIT_BY_RELOC:
|
1480 |
|
|
if (optarg != NULL)
|
1481 |
|
|
config.split_by_reloc = strtoul (optarg, NULL, 0);
|
1482 |
|
|
else
|
1483 |
|
|
config.split_by_reloc = 32768;
|
1484 |
|
|
break;
|
1485 |
|
|
case OPTION_SPLIT_BY_FILE:
|
1486 |
|
|
if (optarg != NULL)
|
1487 |
|
|
config.split_by_file = bfd_scan_vma (optarg, NULL, 0);
|
1488 |
|
|
else
|
1489 |
|
|
config.split_by_file = 1;
|
1490 |
|
|
break;
|
1491 |
|
|
case OPTION_CHECK_SECTIONS:
|
1492 |
|
|
command_line.check_section_addresses = 1;
|
1493 |
|
|
break;
|
1494 |
|
|
case OPTION_NO_CHECK_SECTIONS:
|
1495 |
|
|
command_line.check_section_addresses = 0;
|
1496 |
|
|
break;
|
1497 |
|
|
case OPTION_ACCEPT_UNKNOWN_INPUT_ARCH:
|
1498 |
|
|
command_line.accept_unknown_input_arch = TRUE;
|
1499 |
|
|
break;
|
1500 |
|
|
case OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH:
|
1501 |
|
|
command_line.accept_unknown_input_arch = FALSE;
|
1502 |
|
|
break;
|
1503 |
|
|
case '(':
|
1504 |
|
|
lang_enter_group ();
|
1505 |
|
|
ingroup++;
|
1506 |
|
|
break;
|
1507 |
|
|
case ')':
|
1508 |
|
|
if (! ingroup)
|
1509 |
|
|
einfo (_("%P%F: group ended before it began (--help for usage)\n"));
|
1510 |
|
|
|
1511 |
|
|
lang_leave_group ();
|
1512 |
|
|
ingroup--;
|
1513 |
|
|
break;
|
1514 |
|
|
|
1515 |
|
|
case OPTION_INIT:
|
1516 |
|
|
link_info.init_function = optarg;
|
1517 |
|
|
break;
|
1518 |
|
|
|
1519 |
|
|
case OPTION_FINI:
|
1520 |
|
|
link_info.fini_function = optarg;
|
1521 |
|
|
break;
|
1522 |
|
|
|
1523 |
|
|
case OPTION_REDUCE_MEMORY_OVERHEADS:
|
1524 |
|
|
link_info.reduce_memory_overheads = TRUE;
|
1525 |
|
|
if (config.hash_table_size == 0)
|
1526 |
|
|
config.hash_table_size = 1021;
|
1527 |
|
|
break;
|
1528 |
|
|
|
1529 |
|
|
case OPTION_HASH_SIZE:
|
1530 |
|
|
{
|
1531 |
|
|
bfd_size_type new_size;
|
1532 |
|
|
|
1533 |
|
|
new_size = strtoul (optarg, NULL, 0);
|
1534 |
|
|
if (new_size)
|
1535 |
|
|
config.hash_table_size = new_size;
|
1536 |
|
|
else
|
1537 |
|
|
einfo (_("%P%X: --hash-size needs a numeric argument\n"));
|
1538 |
|
|
}
|
1539 |
|
|
break;
|
1540 |
|
|
}
|
1541 |
|
|
}
|
1542 |
|
|
|
1543 |
|
|
while (ingroup)
|
1544 |
|
|
{
|
1545 |
|
|
lang_leave_group ();
|
1546 |
|
|
ingroup--;
|
1547 |
|
|
}
|
1548 |
|
|
|
1549 |
|
|
if (default_dirlist != NULL)
|
1550 |
|
|
{
|
1551 |
|
|
set_default_dirlist (default_dirlist);
|
1552 |
|
|
free (default_dirlist);
|
1553 |
|
|
}
|
1554 |
|
|
|
1555 |
|
|
if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
|
1556 |
|
|
/* FIXME: Should we allow emulations a chance to set this ? */
|
1557 |
|
|
link_info.unresolved_syms_in_objects = how_to_report_unresolved_symbols;
|
1558 |
|
|
|
1559 |
|
|
if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
|
1560 |
|
|
/* FIXME: Should we allow emulations a chance to set this ? */
|
1561 |
|
|
link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;
|
1562 |
|
|
|
1563 |
163 |
khays |
if (link_info.relocatable)
|
1564 |
|
|
{
|
1565 |
|
|
if (command_line.check_section_addresses < 0)
|
1566 |
|
|
command_line.check_section_addresses = 0;
|
1567 |
|
|
if (link_info.shared)
|
1568 |
|
|
einfo (_("%P%F: -r and -shared may not be used together\n"));
|
1569 |
|
|
}
|
1570 |
|
|
|
1571 |
|
|
/* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
|
1572 |
|
|
--dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
|
1573 |
|
|
--dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
|
1574 |
|
|
for shared libraries. -Bsymbolic overrides all others and vice
|
1575 |
|
|
versa. */
|
1576 |
|
|
switch (command_line.symbolic)
|
1577 |
|
|
{
|
1578 |
|
|
case symbolic_unset:
|
1579 |
|
|
break;
|
1580 |
|
|
case symbolic:
|
1581 |
|
|
/* -Bsymbolic is for shared library only. */
|
1582 |
|
|
if (link_info.shared)
|
1583 |
|
|
{
|
1584 |
|
|
link_info.symbolic = TRUE;
|
1585 |
|
|
/* Should we free the unused memory? */
|
1586 |
|
|
link_info.dynamic_list = NULL;
|
1587 |
|
|
command_line.dynamic_list = dynamic_list_unset;
|
1588 |
|
|
}
|
1589 |
|
|
break;
|
1590 |
|
|
case symbolic_functions:
|
1591 |
|
|
/* -Bsymbolic-functions is for shared library only. */
|
1592 |
|
|
if (link_info.shared)
|
1593 |
|
|
command_line.dynamic_list = dynamic_list_data;
|
1594 |
|
|
break;
|
1595 |
|
|
}
|
1596 |
|
|
|
1597 |
|
|
switch (command_line.dynamic_list)
|
1598 |
|
|
{
|
1599 |
|
|
case dynamic_list_unset:
|
1600 |
|
|
break;
|
1601 |
|
|
case dynamic_list_data:
|
1602 |
|
|
link_info.dynamic_data = TRUE;
|
1603 |
|
|
case dynamic_list:
|
1604 |
|
|
link_info.dynamic = TRUE;
|
1605 |
|
|
break;
|
1606 |
|
|
}
|
1607 |
|
|
|
1608 |
|
|
if (! link_info.shared)
|
1609 |
|
|
{
|
1610 |
|
|
if (command_line.filter_shlib)
|
1611 |
|
|
einfo (_("%P%F: -F may not be used without -shared\n"));
|
1612 |
|
|
if (command_line.auxiliary_filters)
|
1613 |
|
|
einfo (_("%P%F: -f may not be used without -shared\n"));
|
1614 |
|
|
}
|
1615 |
|
|
|
1616 |
|
|
if (! link_info.shared || link_info.pie)
|
1617 |
|
|
link_info.executable = TRUE;
|
1618 |
|
|
|
1619 |
|
|
/* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
|
1620 |
|
|
don't see how else this can be handled, since in this case we
|
1621 |
|
|
must preserve all externally visible symbols. */
|
1622 |
|
|
if (link_info.relocatable && link_info.strip == strip_all)
|
1623 |
|
|
{
|
1624 |
|
|
link_info.strip = strip_debugger;
|
1625 |
|
|
if (link_info.discard == discard_sec_merge)
|
1626 |
|
|
link_info.discard = discard_all;
|
1627 |
|
|
}
|
1628 |
145 |
khays |
}
|
1629 |
|
|
|
1630 |
|
|
/* Add the (colon-separated) elements of DIRLIST_PTR to the
|
1631 |
|
|
library search path. */
|
1632 |
|
|
|
1633 |
|
|
static void
|
1634 |
|
|
set_default_dirlist (char *dirlist_ptr)
|
1635 |
|
|
{
|
1636 |
|
|
char *p;
|
1637 |
|
|
|
1638 |
|
|
while (1)
|
1639 |
|
|
{
|
1640 |
|
|
p = strchr (dirlist_ptr, PATH_SEPARATOR);
|
1641 |
|
|
if (p != NULL)
|
1642 |
|
|
*p = '\0';
|
1643 |
|
|
if (*dirlist_ptr != '\0')
|
1644 |
|
|
ldfile_add_library_path (dirlist_ptr, TRUE);
|
1645 |
|
|
if (p == NULL)
|
1646 |
|
|
break;
|
1647 |
|
|
dirlist_ptr = p + 1;
|
1648 |
|
|
}
|
1649 |
|
|
}
|
1650 |
|
|
|
1651 |
|
|
static void
|
1652 |
|
|
set_section_start (char *sect, char *valstr)
|
1653 |
|
|
{
|
1654 |
|
|
const char *end;
|
1655 |
|
|
bfd_vma val = bfd_scan_vma (valstr, &end, 16);
|
1656 |
|
|
if (*end)
|
1657 |
|
|
einfo (_("%P%F: invalid hex number `%s'\n"), valstr);
|
1658 |
|
|
lang_section_start (sect, exp_intop (val), NULL);
|
1659 |
|
|
}
|
1660 |
|
|
|
1661 |
|
|
static void
|
1662 |
|
|
set_segment_start (const char *section, char *valstr)
|
1663 |
|
|
{
|
1664 |
|
|
const char *name;
|
1665 |
|
|
const char *end;
|
1666 |
|
|
segment_type *seg;
|
1667 |
|
|
|
1668 |
|
|
bfd_vma val = bfd_scan_vma (valstr, &end, 16);
|
1669 |
|
|
if (*end)
|
1670 |
|
|
einfo (_("%P%F: invalid hex number `%s'\n"), valstr);
|
1671 |
|
|
/* If we already have an entry for this segment, update the existing
|
1672 |
|
|
value. */
|
1673 |
|
|
name = section + 1;
|
1674 |
|
|
for (seg = segments; seg; seg = seg->next)
|
1675 |
|
|
if (strcmp (seg->name, name) == 0)
|
1676 |
|
|
{
|
1677 |
|
|
seg->value = val;
|
1678 |
|
|
return;
|
1679 |
|
|
}
|
1680 |
|
|
/* There was no existing value so we must create a new segment
|
1681 |
|
|
entry. */
|
1682 |
|
|
seg = (segment_type *) stat_alloc (sizeof (*seg));
|
1683 |
|
|
seg->name = name;
|
1684 |
|
|
seg->value = val;
|
1685 |
|
|
seg->used = FALSE;
|
1686 |
|
|
/* Add it to the linked list of segments. */
|
1687 |
|
|
seg->next = segments;
|
1688 |
|
|
segments = seg;
|
1689 |
|
|
/* Historically, -Ttext and friends set the base address of a
|
1690 |
|
|
particular section. For backwards compatibility, we still do
|
1691 |
|
|
that. If a SEGMENT_START directive is seen, the section address
|
1692 |
|
|
assignment will be disabled. */
|
1693 |
|
|
lang_section_start (section, exp_intop (val), seg);
|
1694 |
|
|
}
|
1695 |
|
|
|
1696 |
|
|
|
1697 |
|
|
/* Print help messages for the options. */
|
1698 |
|
|
|
1699 |
|
|
static void
|
1700 |
|
|
help (void)
|
1701 |
|
|
{
|
1702 |
|
|
unsigned i;
|
1703 |
|
|
const char **targets, **pp;
|
1704 |
|
|
int len;
|
1705 |
|
|
|
1706 |
|
|
printf (_("Usage: %s [options] file...\n"), program_name);
|
1707 |
|
|
|
1708 |
|
|
printf (_("Options:\n"));
|
1709 |
|
|
for (i = 0; i < OPTION_COUNT; i++)
|
1710 |
|
|
{
|
1711 |
|
|
if (ld_options[i].doc != NULL)
|
1712 |
|
|
{
|
1713 |
|
|
bfd_boolean comma;
|
1714 |
|
|
unsigned j;
|
1715 |
|
|
|
1716 |
|
|
printf (" ");
|
1717 |
|
|
|
1718 |
|
|
comma = FALSE;
|
1719 |
|
|
len = 2;
|
1720 |
|
|
|
1721 |
|
|
j = i;
|
1722 |
|
|
do
|
1723 |
|
|
{
|
1724 |
|
|
if (ld_options[j].shortopt != '\0'
|
1725 |
|
|
&& ld_options[j].control != NO_HELP)
|
1726 |
|
|
{
|
1727 |
|
|
printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
|
1728 |
|
|
len += (comma ? 2 : 0) + 2;
|
1729 |
|
|
if (ld_options[j].arg != NULL)
|
1730 |
|
|
{
|
1731 |
|
|
if (ld_options[j].opt.has_arg != optional_argument)
|
1732 |
|
|
{
|
1733 |
|
|
printf (" ");
|
1734 |
|
|
++len;
|
1735 |
|
|
}
|
1736 |
|
|
printf ("%s", _(ld_options[j].arg));
|
1737 |
|
|
len += strlen (_(ld_options[j].arg));
|
1738 |
|
|
}
|
1739 |
|
|
comma = TRUE;
|
1740 |
|
|
}
|
1741 |
|
|
++j;
|
1742 |
|
|
}
|
1743 |
|
|
while (j < OPTION_COUNT && ld_options[j].doc == NULL);
|
1744 |
|
|
|
1745 |
|
|
j = i;
|
1746 |
|
|
do
|
1747 |
|
|
{
|
1748 |
|
|
if (ld_options[j].opt.name != NULL
|
1749 |
|
|
&& ld_options[j].control != NO_HELP)
|
1750 |
|
|
{
|
1751 |
|
|
int two_dashes =
|
1752 |
|
|
(ld_options[j].control == TWO_DASHES
|
1753 |
|
|
|| ld_options[j].control == EXACTLY_TWO_DASHES);
|
1754 |
|
|
|
1755 |
|
|
printf ("%s-%s%s",
|
1756 |
|
|
comma ? ", " : "",
|
1757 |
|
|
two_dashes ? "-" : "",
|
1758 |
|
|
ld_options[j].opt.name);
|
1759 |
|
|
len += ((comma ? 2 : 0)
|
1760 |
|
|
+ 1
|
1761 |
|
|
+ (two_dashes ? 1 : 0)
|
1762 |
|
|
+ strlen (ld_options[j].opt.name));
|
1763 |
|
|
if (ld_options[j].arg != NULL)
|
1764 |
|
|
{
|
1765 |
|
|
printf (" %s", _(ld_options[j].arg));
|
1766 |
|
|
len += 1 + strlen (_(ld_options[j].arg));
|
1767 |
|
|
}
|
1768 |
|
|
comma = TRUE;
|
1769 |
|
|
}
|
1770 |
|
|
++j;
|
1771 |
|
|
}
|
1772 |
|
|
while (j < OPTION_COUNT && ld_options[j].doc == NULL);
|
1773 |
|
|
|
1774 |
|
|
if (len >= 30)
|
1775 |
|
|
{
|
1776 |
|
|
printf ("\n");
|
1777 |
|
|
len = 0;
|
1778 |
|
|
}
|
1779 |
|
|
|
1780 |
|
|
for (; len < 30; len++)
|
1781 |
|
|
putchar (' ');
|
1782 |
|
|
|
1783 |
|
|
printf ("%s\n", _(ld_options[i].doc));
|
1784 |
|
|
}
|
1785 |
|
|
}
|
1786 |
|
|
printf (_(" @FILE"));
|
1787 |
|
|
for (len = strlen (" @FILE"); len < 30; len++)
|
1788 |
|
|
putchar (' ');
|
1789 |
|
|
printf (_("Read options from FILE\n"));
|
1790 |
|
|
|
1791 |
|
|
/* Note: Various tools (such as libtool) depend upon the
|
1792 |
|
|
format of the listings below - do not change them. */
|
1793 |
|
|
/* xgettext:c-format */
|
1794 |
|
|
printf (_("%s: supported targets:"), program_name);
|
1795 |
|
|
targets = bfd_target_list ();
|
1796 |
|
|
for (pp = targets; *pp != NULL; pp++)
|
1797 |
|
|
printf (" %s", *pp);
|
1798 |
|
|
free (targets);
|
1799 |
|
|
printf ("\n");
|
1800 |
|
|
|
1801 |
|
|
/* xgettext:c-format */
|
1802 |
|
|
printf (_("%s: supported emulations: "), program_name);
|
1803 |
|
|
ldemul_list_emulations (stdout);
|
1804 |
|
|
printf ("\n");
|
1805 |
|
|
|
1806 |
|
|
/* xgettext:c-format */
|
1807 |
|
|
printf (_("%s: emulation specific options:\n"), program_name);
|
1808 |
|
|
ldemul_list_emulation_options (stdout);
|
1809 |
|
|
printf ("\n");
|
1810 |
|
|
|
1811 |
|
|
if (REPORT_BUGS_TO[0])
|
1812 |
|
|
printf (_("Report bugs to %s\n"), REPORT_BUGS_TO);
|
1813 |
|
|
}
|