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