1 /* Parse options for the GNU linker.
2 Copyright (C) 1991-2015 Free Software Foundation, Inc.
4 This file is part of the GNU Binutils.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
24 #include "libiberty.h"
27 #include "safe-ctype.h"
43 #endif /* ENABLE_PLUGINS */
45 #ifndef PATH_SEPARATOR
46 #if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__))
47 #define PATH_SEPARATOR ';'
49 #define PATH_SEPARATOR ':'
53 /* Somewhere above, sys/stat.h got included . . . . */
54 #if !defined(S_ISDIR) && defined(S_IFDIR)
55 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
58 static void set_default_dirlist (char *);
59 static void set_section_start (char *, char *);
60 static void set_segment_start (const char *, char *);
61 static void help (void);
63 /* The long options. This structure is used for both the option
64 parsing and the help text. */
67 /* Use one dash before long option name. */
69 /* Use two dashes before long option name. */
71 /* Only accept two dashes before the long option name.
72 This is an overloading of the use of this enum, since originally it
73 was only intended to tell the --help display function how to display
74 the long option name. This feature was added in order to resolve
75 the confusion about the -omagic command line switch. Is it setting
76 the output file name to "magic" or is it setting the NMAGIC flag on
77 the output ? It has been decided that it is setting the output file
78 name, and that if you want to set the NMAGIC flag you should use -N
81 /* Don't mention this option in --help output. */
87 /* The long option information. */
89 /* The short option with the same meaning ('\0' if none). */
91 /* The name of the argument (NULL if none). */
93 /* The documentation string. If this is NULL, this is a synonym for
94 the previous option. */
96 enum control_enum control
;
99 static const struct ld_option ld_options
[] =
101 { {NULL
, required_argument
, NULL
, '\0'},
102 'a', N_("KEYWORD"), N_("Shared library control for HP/UX compatibility"),
104 { {"architecture", required_argument
, NULL
, 'A'},
105 'A', N_("ARCH"), N_("Set architecture") , TWO_DASHES
},
106 { {"format", required_argument
, NULL
, 'b'},
107 'b', N_("TARGET"), N_("Specify target for following input files"),
109 { {"mri-script", required_argument
, NULL
, 'c'},
110 'c', N_("FILE"), N_("Read MRI format linker script"), TWO_DASHES
},
111 { {"dc", no_argument
, NULL
, 'd'},
112 'd', NULL
, N_("Force common symbols to be defined"), ONE_DASH
},
113 { {"dp", no_argument
, NULL
, 'd'},
114 '\0', NULL
, NULL
, ONE_DASH
},
115 { {"entry", required_argument
, NULL
, 'e'},
116 'e', N_("ADDRESS"), N_("Set start address"), TWO_DASHES
},
117 { {"export-dynamic", no_argument
, NULL
, OPTION_EXPORT_DYNAMIC
},
118 'E', NULL
, N_("Export all dynamic symbols"), TWO_DASHES
},
119 { {"no-export-dynamic", no_argument
, NULL
, OPTION_NO_EXPORT_DYNAMIC
},
120 '\0', NULL
, N_("Undo the effect of --export-dynamic"), TWO_DASHES
},
121 { {"EB", no_argument
, NULL
, OPTION_EB
},
122 '\0', NULL
, N_("Link big-endian objects"), ONE_DASH
},
123 { {"EL", no_argument
, NULL
, OPTION_EL
},
124 '\0', NULL
, N_("Link little-endian objects"), ONE_DASH
},
125 { {"auxiliary", required_argument
, NULL
, 'f'},
126 'f', N_("SHLIB"), N_("Auxiliary filter for shared object symbol table"),
128 { {"filter", required_argument
, NULL
, 'F'},
129 'F', N_("SHLIB"), N_("Filter for shared object symbol table"),
131 { {NULL
, no_argument
, NULL
, '\0'},
132 'g', NULL
, N_("Ignored"), ONE_DASH
},
133 { {"gpsize", required_argument
, NULL
, 'G'},
134 'G', N_("SIZE"), N_("Small data size (if no size, same as --shared)"),
136 { {"soname", required_argument
, NULL
, OPTION_SONAME
},
137 'h', N_("FILENAME"), N_("Set internal name of shared library"), ONE_DASH
},
138 { {"dynamic-linker", required_argument
, NULL
, OPTION_DYNAMIC_LINKER
},
139 'I', N_("PROGRAM"), N_("Set PROGRAM as the dynamic linker to use"),
141 { {"library", required_argument
, NULL
, 'l'},
142 'l', N_("LIBNAME"), N_("Search for library LIBNAME"), TWO_DASHES
},
143 { {"library-path", required_argument
, NULL
, 'L'},
144 'L', N_("DIRECTORY"), N_("Add DIRECTORY to library search path"),
146 { {"sysroot=<DIRECTORY>", required_argument
, NULL
, OPTION_SYSROOT
},
147 '\0', NULL
, N_("Override the default sysroot location"), TWO_DASHES
},
148 { {NULL
, required_argument
, NULL
, '\0'},
149 'm', N_("EMULATION"), N_("Set emulation"), ONE_DASH
},
150 { {"print-map", no_argument
, NULL
, 'M'},
151 'M', NULL
, N_("Print map file on standard output"), TWO_DASHES
},
152 { {"nmagic", no_argument
, NULL
, 'n'},
153 'n', NULL
, N_("Do not page align data"), TWO_DASHES
},
154 { {"omagic", no_argument
, NULL
, 'N'},
155 'N', NULL
, N_("Do not page align data, do not make text readonly"),
156 EXACTLY_TWO_DASHES
},
157 { {"no-omagic", no_argument
, NULL
, OPTION_NO_OMAGIC
},
158 '\0', NULL
, N_("Page align data, make text readonly"),
159 EXACTLY_TWO_DASHES
},
160 { {"output", required_argument
, NULL
, 'o'},
161 'o', N_("FILE"), N_("Set output file name"), EXACTLY_TWO_DASHES
},
162 { {NULL
, required_argument
, NULL
, '\0'},
163 'O', NULL
, N_("Optimize output file"), ONE_DASH
},
164 #ifdef ENABLE_PLUGINS
165 { {"plugin", required_argument
, NULL
, OPTION_PLUGIN
},
166 '\0', N_("PLUGIN"), N_("Load named plugin"), ONE_DASH
},
167 { {"plugin-opt", required_argument
, NULL
, OPTION_PLUGIN_OPT
},
168 '\0', N_("ARG"), N_("Send arg to last-loaded plugin"), ONE_DASH
},
169 { {"flto", optional_argument
, NULL
, OPTION_IGNORE
},
170 '\0', NULL
, N_("Ignored for GCC LTO option compatibility"),
172 { {"flto-partition=", required_argument
, NULL
, OPTION_IGNORE
},
173 '\0', NULL
, N_("Ignored for GCC LTO option compatibility"),
175 #endif /* ENABLE_PLUGINS */
176 { {"fuse-ld=", required_argument
, NULL
, OPTION_IGNORE
},
177 '\0', NULL
, N_("Ignored for GCC linker option compatibility"),
179 { {"map-whole-files", optional_argument
, NULL
, OPTION_IGNORE
},
180 '\0', NULL
, N_("Ignored for gold option compatibility"),
182 { {"no-map-whole-files", optional_argument
, NULL
, OPTION_IGNORE
},
183 '\0', NULL
, N_("Ignored for gold option compatibility"),
185 { {"Qy", no_argument
, NULL
, OPTION_IGNORE
},
186 '\0', NULL
, N_("Ignored for SVR4 compatibility"), ONE_DASH
},
187 { {"emit-relocs", no_argument
, NULL
, 'q'},
188 'q', NULL
, "Generate relocations in final output", TWO_DASHES
},
189 { {"relocatable", no_argument
, NULL
, 'r'},
190 'r', NULL
, N_("Generate relocatable output"), TWO_DASHES
},
191 { {NULL
, no_argument
, NULL
, '\0'},
192 'i', NULL
, NULL
, ONE_DASH
},
193 { {"just-symbols", required_argument
, NULL
, 'R'},
194 'R', N_("FILE"), N_("Just link symbols (if directory, same as --rpath)"),
196 { {"strip-all", no_argument
, NULL
, 's'},
197 's', NULL
, N_("Strip all symbols"), TWO_DASHES
},
198 { {"strip-debug", no_argument
, NULL
, 'S'},
199 'S', NULL
, N_("Strip debugging symbols"), TWO_DASHES
},
200 { {"strip-discarded", no_argument
, NULL
, OPTION_STRIP_DISCARDED
},
201 '\0', NULL
, N_("Strip symbols in discarded sections"), TWO_DASHES
},
202 { {"no-strip-discarded", no_argument
, NULL
, OPTION_NO_STRIP_DISCARDED
},
203 '\0', NULL
, N_("Do not strip symbols in discarded sections"), TWO_DASHES
},
204 { {"trace", no_argument
, NULL
, 't'},
205 't', NULL
, N_("Trace file opens"), TWO_DASHES
},
206 { {"script", required_argument
, NULL
, 'T'},
207 'T', N_("FILE"), N_("Read linker script"), TWO_DASHES
},
208 { {"default-script", required_argument
, NULL
, OPTION_DEFAULT_SCRIPT
},
209 '\0', N_("FILE"), N_("Read default linker script"), TWO_DASHES
},
210 { {"dT", required_argument
, NULL
, OPTION_DEFAULT_SCRIPT
},
211 '\0', NULL
, NULL
, ONE_DASH
},
212 { {"undefined", required_argument
, NULL
, 'u'},
213 'u', N_("SYMBOL"), N_("Start with undefined reference to SYMBOL"),
215 { {"require-defined", required_argument
, NULL
, OPTION_REQUIRE_DEFINED_SYMBOL
},
216 '\0', N_("SYMBOL"), N_("Require SYMBOL be defined in the final output"),
218 { {"unique", optional_argument
, NULL
, OPTION_UNIQUE
},
219 '\0', N_("[=SECTION]"),
220 N_("Don't merge input [SECTION | orphan] sections"), TWO_DASHES
},
221 { {"Ur", no_argument
, NULL
, OPTION_UR
},
222 '\0', NULL
, N_("Build global constructor/destructor tables"), ONE_DASH
},
223 { {"version", no_argument
, NULL
, OPTION_VERSION
},
224 'v', NULL
, N_("Print version information"), TWO_DASHES
},
225 { {NULL
, no_argument
, NULL
, '\0'},
226 'V', NULL
, N_("Print version and emulation information"), ONE_DASH
},
227 { {"discard-all", no_argument
, NULL
, 'x'},
228 'x', NULL
, N_("Discard all local symbols"), TWO_DASHES
},
229 { {"discard-locals", no_argument
, NULL
, 'X'},
230 'X', NULL
, N_("Discard temporary local symbols (default)"), TWO_DASHES
},
231 { {"discard-none", no_argument
, NULL
, OPTION_DISCARD_NONE
},
232 '\0', NULL
, N_("Don't discard any local symbols"), TWO_DASHES
},
233 { {"trace-symbol", required_argument
, NULL
, 'y'},
234 'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES
},
235 { {NULL
, required_argument
, NULL
, '\0'},
236 'Y', N_("PATH"), N_("Default search path for Solaris compatibility"),
238 { {"start-group", no_argument
, NULL
, '('},
239 '(', NULL
, N_("Start a group"), TWO_DASHES
},
240 { {"end-group", no_argument
, NULL
, ')'},
241 ')', NULL
, N_("End a group"), TWO_DASHES
},
242 { {"accept-unknown-input-arch", no_argument
, NULL
,
243 OPTION_ACCEPT_UNKNOWN_INPUT_ARCH
},
245 N_("Accept input files whose architecture cannot be determined"),
247 { {"no-accept-unknown-input-arch", no_argument
, NULL
,
248 OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH
},
249 '\0', NULL
, N_("Reject input files whose architecture is unknown"),
252 /* The next two options are deprecated because of their similarity to
253 --as-needed and --no-as-needed. They have been replaced by
254 --copy-dt-needed-entries and --no-copy-dt-needed-entries. */
255 { {"add-needed", no_argument
, NULL
, OPTION_ADD_DT_NEEDED_FOR_DYNAMIC
},
256 '\0', NULL
, NULL
, NO_HELP
},
257 { {"no-add-needed", no_argument
, NULL
, OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC
},
258 '\0', NULL
, NULL
, NO_HELP
},
260 { {"as-needed", no_argument
, NULL
, OPTION_ADD_DT_NEEDED_FOR_REGULAR
},
261 '\0', NULL
, N_("Only set DT_NEEDED for following dynamic libs if used"),
263 { {"no-as-needed", no_argument
, NULL
, OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR
},
264 '\0', NULL
, N_("Always set DT_NEEDED for dynamic libraries mentioned on\n"
265 " the command line"),
267 { {"assert", required_argument
, NULL
, OPTION_ASSERT
},
268 '\0', N_("KEYWORD"), N_("Ignored for SunOS compatibility"), ONE_DASH
},
269 { {"Bdynamic", no_argument
, NULL
, OPTION_CALL_SHARED
},
270 '\0', NULL
, N_("Link against shared libraries"), ONE_DASH
},
271 { {"dy", no_argument
, NULL
, OPTION_CALL_SHARED
},
272 '\0', NULL
, NULL
, ONE_DASH
},
273 { {"call_shared", no_argument
, NULL
, OPTION_CALL_SHARED
},
274 '\0', NULL
, NULL
, ONE_DASH
},
275 { {"Bstatic", no_argument
, NULL
, OPTION_NON_SHARED
},
276 '\0', NULL
, N_("Do not link against shared libraries"), ONE_DASH
},
277 { {"dn", no_argument
, NULL
, OPTION_NON_SHARED
},
278 '\0', NULL
, NULL
, ONE_DASH
},
279 { {"non_shared", no_argument
, NULL
, OPTION_NON_SHARED
},
280 '\0', NULL
, NULL
, ONE_DASH
},
281 { {"static", no_argument
, NULL
, OPTION_NON_SHARED
},
282 '\0', NULL
, NULL
, ONE_DASH
},
283 { {"Bsymbolic", no_argument
, NULL
, OPTION_SYMBOLIC
},
284 '\0', NULL
, N_("Bind global references locally"), ONE_DASH
},
285 { {"Bsymbolic-functions", no_argument
, NULL
, OPTION_SYMBOLIC_FUNCTIONS
},
286 '\0', NULL
, N_("Bind global function references locally"), ONE_DASH
},
287 { {"check-sections", no_argument
, NULL
, OPTION_CHECK_SECTIONS
},
288 '\0', NULL
, N_("Check section addresses for overlaps (default)"),
290 { {"no-check-sections", no_argument
, NULL
, OPTION_NO_CHECK_SECTIONS
},
291 '\0', NULL
, N_("Do not check section addresses for overlaps"),
293 { {"copy-dt-needed-entries", no_argument
, NULL
,
294 OPTION_ADD_DT_NEEDED_FOR_DYNAMIC
},
295 '\0', NULL
, N_("Copy DT_NEEDED links mentioned inside DSOs that follow"),
297 { {"no-copy-dt-needed-entries", no_argument
, NULL
,
298 OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC
},
299 '\0', NULL
, N_("Do not copy DT_NEEDED links mentioned inside DSOs that follow"),
302 { {"cref", no_argument
, NULL
, OPTION_CREF
},
303 '\0', NULL
, N_("Output cross reference table"), TWO_DASHES
},
304 { {"defsym", required_argument
, NULL
, OPTION_DEFSYM
},
305 '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES
},
306 { {"demangle", optional_argument
, NULL
, OPTION_DEMANGLE
},
307 '\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"),
309 { {"embedded-relocs", no_argument
, NULL
, OPTION_EMBEDDED_RELOCS
},
310 '\0', NULL
, N_("Generate embedded relocs"), TWO_DASHES
},
311 { {"fatal-warnings", no_argument
, NULL
, OPTION_WARN_FATAL
},
312 '\0', NULL
, N_("Treat warnings as errors"),
314 { {"no-fatal-warnings", no_argument
, NULL
, OPTION_NO_WARN_FATAL
},
315 '\0', NULL
, N_("Do not treat warnings as errors (default)"),
317 { {"fini", required_argument
, NULL
, OPTION_FINI
},
318 '\0', N_("SYMBOL"), N_("Call SYMBOL at unload-time"), ONE_DASH
},
319 { {"force-exe-suffix", no_argument
, NULL
, OPTION_FORCE_EXE_SUFFIX
},
320 '\0', NULL
, N_("Force generation of file with .exe suffix"), TWO_DASHES
},
321 { {"gc-sections", no_argument
, NULL
, OPTION_GC_SECTIONS
},
322 '\0', NULL
, N_("Remove unused sections (on some targets)"),
324 { {"no-gc-sections", no_argument
, NULL
, OPTION_NO_GC_SECTIONS
},
325 '\0', NULL
, N_("Don't remove unused sections (default)"),
327 { {"print-gc-sections", no_argument
, NULL
, OPTION_PRINT_GC_SECTIONS
},
328 '\0', NULL
, N_("List removed unused sections on stderr"),
330 { {"no-print-gc-sections", no_argument
, NULL
, OPTION_NO_PRINT_GC_SECTIONS
},
331 '\0', NULL
, N_("Do not list removed unused sections"),
333 { {"hash-size=<NUMBER>", required_argument
, NULL
, OPTION_HASH_SIZE
},
334 '\0', NULL
, N_("Set default hash table size close to <NUMBER>"),
336 { {"help", no_argument
, NULL
, OPTION_HELP
},
337 '\0', NULL
, N_("Print option help"), TWO_DASHES
},
338 { {"init", required_argument
, NULL
, OPTION_INIT
},
339 '\0', N_("SYMBOL"), N_("Call SYMBOL at load-time"), ONE_DASH
},
340 { {"Map", required_argument
, NULL
, OPTION_MAP
},
341 '\0', N_("FILE"), N_("Write a map file"), ONE_DASH
},
342 { {"no-define-common", no_argument
, NULL
, OPTION_NO_DEFINE_COMMON
},
343 '\0', NULL
, N_("Do not define Common storage"), TWO_DASHES
},
344 { {"no-demangle", no_argument
, NULL
, OPTION_NO_DEMANGLE
},
345 '\0', NULL
, N_("Do not demangle symbol names"), TWO_DASHES
},
346 { {"no-keep-memory", no_argument
, NULL
, OPTION_NO_KEEP_MEMORY
},
347 '\0', NULL
, N_("Use less memory and more disk I/O"), TWO_DASHES
},
348 { {"no-undefined", no_argument
, NULL
, OPTION_NO_UNDEFINED
},
349 '\0', NULL
, N_("Do not allow unresolved references in object files"),
351 { {"allow-shlib-undefined", no_argument
, NULL
, OPTION_ALLOW_SHLIB_UNDEFINED
},
352 '\0', NULL
, N_("Allow unresolved references in shared libraries"),
354 { {"no-allow-shlib-undefined", no_argument
, NULL
,
355 OPTION_NO_ALLOW_SHLIB_UNDEFINED
},
356 '\0', NULL
, N_("Do not allow unresolved references in shared libs"),
358 { {"allow-multiple-definition", no_argument
, NULL
,
359 OPTION_ALLOW_MULTIPLE_DEFINITION
},
360 '\0', NULL
, N_("Allow multiple definitions"), TWO_DASHES
},
361 { {"no-undefined-version", no_argument
, NULL
, OPTION_NO_UNDEFINED_VERSION
},
362 '\0', NULL
, N_("Disallow undefined version"), TWO_DASHES
},
363 { {"default-symver", no_argument
, NULL
, OPTION_DEFAULT_SYMVER
},
364 '\0', NULL
, N_("Create default symbol version"), TWO_DASHES
},
365 { {"default-imported-symver", no_argument
, NULL
,
366 OPTION_DEFAULT_IMPORTED_SYMVER
},
367 '\0', NULL
, N_("Create default symbol version for imported symbols"),
369 { {"no-warn-mismatch", no_argument
, NULL
, OPTION_NO_WARN_MISMATCH
},
370 '\0', NULL
, N_("Don't warn about mismatched input files"), TWO_DASHES
},
371 { {"no-warn-search-mismatch", no_argument
, NULL
,
372 OPTION_NO_WARN_SEARCH_MISMATCH
},
373 '\0', NULL
, N_("Don't warn on finding an incompatible library"),
375 { {"no-whole-archive", no_argument
, NULL
, OPTION_NO_WHOLE_ARCHIVE
},
376 '\0', NULL
, N_("Turn off --whole-archive"), TWO_DASHES
},
377 { {"noinhibit-exec", no_argument
, NULL
, OPTION_NOINHIBIT_EXEC
},
378 '\0', NULL
, N_("Create an output file even if errors occur"),
380 { {"noinhibit_exec", no_argument
, NULL
, OPTION_NOINHIBIT_EXEC
},
381 '\0', NULL
, NULL
, NO_HELP
},
382 { {"nostdlib", no_argument
, NULL
, OPTION_NOSTDLIB
},
383 '\0', NULL
, N_("Only use library directories specified on\n"
384 " the command line"),
386 { {"oformat", required_argument
, NULL
, OPTION_OFORMAT
},
387 '\0', N_("TARGET"), N_("Specify target of output file"),
388 EXACTLY_TWO_DASHES
},
389 { {"print-output-format", no_argument
, NULL
, OPTION_PRINT_OUTPUT_FORMAT
},
390 '\0', NULL
, N_("Print default output format"), TWO_DASHES
},
391 { {"print-sysroot", no_argument
, NULL
, OPTION_PRINT_SYSROOT
},
392 '\0', NULL
, N_("Print current sysroot"), TWO_DASHES
},
393 { {"qmagic", no_argument
, NULL
, OPTION_IGNORE
},
394 '\0', NULL
, N_("Ignored for Linux compatibility"), ONE_DASH
},
395 { {"reduce-memory-overheads", no_argument
, NULL
,
396 OPTION_REDUCE_MEMORY_OVERHEADS
},
397 '\0', NULL
, N_("Reduce memory overheads, possibly taking much longer"),
399 { {"relax", no_argument
, NULL
, OPTION_RELAX
},
400 '\0', NULL
, N_("Reduce code size by using target specific optimizations"), TWO_DASHES
},
401 { {"no-relax", no_argument
, NULL
, OPTION_NO_RELAX
},
402 '\0', NULL
, N_("Do not use relaxation techniques to reduce code size"), TWO_DASHES
},
403 { {"retain-symbols-file", required_argument
, NULL
,
404 OPTION_RETAIN_SYMBOLS_FILE
},
405 '\0', N_("FILE"), N_("Keep only symbols listed in FILE"), TWO_DASHES
},
406 { {"rpath", required_argument
, NULL
, OPTION_RPATH
},
407 '\0', N_("PATH"), N_("Set runtime shared library search path"), ONE_DASH
},
408 { {"rpath-link", required_argument
, NULL
, OPTION_RPATH_LINK
},
409 '\0', N_("PATH"), N_("Set link time shared library search path"),
411 { {"shared", no_argument
, NULL
, OPTION_SHARED
},
412 '\0', NULL
, N_("Create a shared library"), ONE_DASH
},
413 { {"Bshareable", no_argument
, NULL
, OPTION_SHARED
}, /* FreeBSD. */
414 '\0', NULL
, NULL
, ONE_DASH
},
415 { {"pie", no_argument
, NULL
, OPTION_PIE
},
416 '\0', NULL
, N_("Create a position independent executable"), ONE_DASH
},
417 { {"pic-executable", no_argument
, NULL
, OPTION_PIE
},
418 '\0', NULL
, NULL
, TWO_DASHES
},
419 { {"sort-common", optional_argument
, NULL
, OPTION_SORT_COMMON
},
420 '\0', N_("[=ascending|descending]"),
421 N_("Sort common symbols by alignment [in specified order]"),
423 { {"sort_common", no_argument
, NULL
, OPTION_SORT_COMMON
},
424 '\0', NULL
, NULL
, NO_HELP
},
425 { {"sort-section", required_argument
, NULL
, OPTION_SORT_SECTION
},
426 '\0', N_("name|alignment"),
427 N_("Sort sections by name or maximum alignment"), TWO_DASHES
},
428 { {"spare-dynamic-tags", required_argument
, NULL
, OPTION_SPARE_DYNAMIC_TAGS
},
429 '\0', N_("COUNT"), N_("How many tags to reserve in .dynamic section"),
431 { {"split-by-file", optional_argument
, NULL
, OPTION_SPLIT_BY_FILE
},
432 '\0', N_("[=SIZE]"), N_("Split output sections every SIZE octets"),
434 { {"split-by-reloc", optional_argument
, NULL
, OPTION_SPLIT_BY_RELOC
},
435 '\0', N_("[=COUNT]"), N_("Split output sections every COUNT relocs"),
437 { {"stats", no_argument
, NULL
, OPTION_STATS
},
438 '\0', NULL
, N_("Print memory usage statistics"), TWO_DASHES
},
439 { {"target-help", no_argument
, NULL
, OPTION_TARGET_HELP
},
440 '\0', NULL
, N_("Display target specific options"), TWO_DASHES
},
441 { {"task-link", required_argument
, NULL
, OPTION_TASK_LINK
},
442 '\0', N_("SYMBOL"), N_("Do task level linking"), TWO_DASHES
},
443 { {"traditional-format", no_argument
, NULL
, OPTION_TRADITIONAL_FORMAT
},
444 '\0', NULL
, N_("Use same format as native linker"), TWO_DASHES
},
445 { {"section-start", required_argument
, NULL
, OPTION_SECTION_START
},
446 '\0', N_("SECTION=ADDRESS"), N_("Set address of named section"),
448 { {"Tbss", required_argument
, NULL
, OPTION_TBSS
},
449 '\0', N_("ADDRESS"), N_("Set address of .bss section"), ONE_DASH
},
450 { {"Tdata", required_argument
, NULL
, OPTION_TDATA
},
451 '\0', N_("ADDRESS"), N_("Set address of .data section"), ONE_DASH
},
452 { {"Ttext", required_argument
, NULL
, OPTION_TTEXT
},
453 '\0', N_("ADDRESS"), N_("Set address of .text section"), ONE_DASH
},
454 { {"Ttext-segment", required_argument
, NULL
, OPTION_TTEXT_SEGMENT
},
455 '\0', N_("ADDRESS"), N_("Set address of text segment"), ONE_DASH
},
456 { {"Trodata-segment", required_argument
, NULL
, OPTION_TRODATA_SEGMENT
},
457 '\0', N_("ADDRESS"), N_("Set address of rodata segment"), ONE_DASH
},
458 { {"Tldata-segment", required_argument
, NULL
, OPTION_TLDATA_SEGMENT
},
459 '\0', N_("ADDRESS"), N_("Set address of ldata segment"), ONE_DASH
},
460 { {"unresolved-symbols=<method>", required_argument
, NULL
,
461 OPTION_UNRESOLVED_SYMBOLS
},
462 '\0', NULL
, N_("How to handle unresolved symbols. <method> is:\n"
463 " ignore-all, report-all, ignore-in-object-files,\n"
464 " ignore-in-shared-libs"),
466 { {"verbose", optional_argument
, NULL
, OPTION_VERBOSE
},
467 '\0', N_("[=NUMBER]"),
468 N_("Output lots of information during link"), TWO_DASHES
},
469 { {"dll-verbose", no_argument
, NULL
, OPTION_VERBOSE
}, /* Linux. */
470 '\0', NULL
, NULL
, NO_HELP
},
471 { {"version-script", required_argument
, NULL
, OPTION_VERSION_SCRIPT
},
472 '\0', N_("FILE"), N_("Read version information script"), TWO_DASHES
},
473 { {"version-exports-section", required_argument
, NULL
,
474 OPTION_VERSION_EXPORTS_SECTION
},
475 '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n"
476 " SYMBOL as the version."),
478 { {"dynamic-list-data", no_argument
, NULL
, OPTION_DYNAMIC_LIST_DATA
},
479 '\0', NULL
, N_("Add data symbols to dynamic list"), TWO_DASHES
},
480 { {"dynamic-list-cpp-new", no_argument
, NULL
, OPTION_DYNAMIC_LIST_CPP_NEW
},
481 '\0', NULL
, N_("Use C++ operator new/delete dynamic list"), TWO_DASHES
},
482 { {"dynamic-list-cpp-typeinfo", no_argument
, NULL
, OPTION_DYNAMIC_LIST_CPP_TYPEINFO
},
483 '\0', NULL
, N_("Use C++ typeinfo dynamic list"), TWO_DASHES
},
484 { {"dynamic-list", required_argument
, NULL
, OPTION_DYNAMIC_LIST
},
485 '\0', N_("FILE"), N_("Read dynamic list"), TWO_DASHES
},
486 { {"warn-common", no_argument
, NULL
, OPTION_WARN_COMMON
},
487 '\0', NULL
, N_("Warn about duplicate common symbols"), TWO_DASHES
},
488 { {"warn-constructors", no_argument
, NULL
, OPTION_WARN_CONSTRUCTORS
},
489 '\0', NULL
, N_("Warn if global constructors/destructors are seen"),
491 { {"warn-multiple-gp", no_argument
, NULL
, OPTION_WARN_MULTIPLE_GP
},
492 '\0', NULL
, N_("Warn if the multiple GP values are used"), TWO_DASHES
},
493 { {"warn-once", no_argument
, NULL
, OPTION_WARN_ONCE
},
494 '\0', NULL
, N_("Warn only once per undefined symbol"), TWO_DASHES
},
495 { {"warn-orphan", no_argument
, NULL
, OPTION_WARN_ORPHAN
},
496 '\0', NULL
, N_("Warn if any orphan sections are encountered"), TWO_DASHES
},
497 { {"no-warn-orphan", no_argument
, NULL
, OPTION_NO_WARN_ORPHAN
},
498 '\0', NULL
, N_("Do not warn if orphan sections are encountered (default)"), TWO_DASHES
},
499 { {"warn-section-align", no_argument
, NULL
, OPTION_WARN_SECTION_ALIGN
},
500 '\0', NULL
, N_("Warn if start of section changes due to alignment"),
502 { {"warn-shared-textrel", no_argument
, NULL
, OPTION_WARN_SHARED_TEXTREL
},
503 '\0', NULL
, N_("Warn if shared object has DT_TEXTREL"),
505 { {"warn-alternate-em", no_argument
, NULL
, OPTION_WARN_ALTERNATE_EM
},
506 '\0', NULL
, N_("Warn if an object has alternate ELF machine code"),
508 { {"warn-unresolved-symbols", no_argument
, NULL
,
509 OPTION_WARN_UNRESOLVED_SYMBOLS
},
510 '\0', NULL
, N_("Report unresolved symbols as warnings"), TWO_DASHES
},
511 { {"error-unresolved-symbols", no_argument
, NULL
,
512 OPTION_ERROR_UNRESOLVED_SYMBOLS
},
513 '\0', NULL
, N_("Report unresolved symbols as errors"), TWO_DASHES
},
514 { {"whole-archive", no_argument
, NULL
, OPTION_WHOLE_ARCHIVE
},
515 '\0', NULL
, N_("Include all objects from following archives"),
517 { {"wrap", required_argument
, NULL
, OPTION_WRAP
},
518 '\0', N_("SYMBOL"), N_("Use wrapper functions for SYMBOL"), TWO_DASHES
},
519 { {"ignore-unresolved-symbol", required_argument
, NULL
,
520 OPTION_IGNORE_UNRESOLVED_SYMBOL
},
522 N_("Unresolved SYMBOL will not cause an error or warning"), TWO_DASHES
},
523 { {"push-state", no_argument
, NULL
, OPTION_PUSH_STATE
},
524 '\0', NULL
, N_("Push state of flags governing input file handling"),
526 { {"pop-state", no_argument
, NULL
, OPTION_POP_STATE
},
527 '\0', NULL
, N_("Pop state of flags governing input file handling"),
529 { {"print-memory-usage", no_argument
, NULL
, OPTION_PRINT_MEMORY_USAGE
},
530 '\0', NULL
, N_("Report target memory usage"), TWO_DASHES
},
533 #define OPTION_COUNT ARRAY_SIZE (ld_options)
536 parse_args (unsigned argc
, char **argv
)
541 char *default_dirlist
= NULL
;
543 struct option
*longopts
;
544 struct option
*really_longopts
;
546 enum report_method how_to_report_unresolved_symbols
= RM_GENERATE_ERROR
;
548 shortopts
= (char *) xmalloc (OPTION_COUNT
* 3 + 2);
549 longopts
= (struct option
*)
550 xmalloc (sizeof (*longopts
) * (OPTION_COUNT
+ 1));
551 really_longopts
= (struct option
*)
552 malloc (sizeof (*really_longopts
) * (OPTION_COUNT
+ 1));
554 /* Starting the short option string with '-' is for programs that
555 expect options and other ARGV-elements in any order and that care about
556 the ordering of the two. We describe each non-option ARGV-element
557 as if it were the argument of an option with character code 1. */
562 for (i
= 0; i
< OPTION_COUNT
; i
++)
564 if (ld_options
[i
].shortopt
!= '\0')
566 shortopts
[is
] = ld_options
[i
].shortopt
;
568 if (ld_options
[i
].opt
.has_arg
== required_argument
569 || ld_options
[i
].opt
.has_arg
== optional_argument
)
573 if (ld_options
[i
].opt
.has_arg
== optional_argument
)
580 if (ld_options
[i
].opt
.name
!= NULL
)
582 if (ld_options
[i
].control
== EXACTLY_TWO_DASHES
)
584 really_longopts
[irl
] = ld_options
[i
].opt
;
589 longopts
[il
] = ld_options
[i
].opt
;
594 shortopts
[is
] = '\0';
595 longopts
[il
].name
= NULL
;
596 really_longopts
[irl
].name
= NULL
;
598 ldemul_add_options (is
, &shortopts
, il
, &longopts
, irl
, &really_longopts
);
600 /* The -G option is ambiguous on different platforms. Sometimes it
601 specifies the largest data size to put into the small data
602 section. Sometimes it is equivalent to --shared. Unfortunately,
603 the first form takes an argument, while the second does not.
605 We need to permit the --shared form because on some platforms,
606 such as Solaris, gcc -shared will pass -G to the linker.
608 To permit either usage, we look through the argument list. If we
609 find -G not followed by a number, we change it into --shared.
610 This will work for most normal cases. */
611 for (i
= 1; i
< argc
; i
++)
612 if (strcmp (argv
[i
], "-G") == 0
614 || ! ISDIGIT (argv
[i
+ 1][0])))
615 argv
[i
] = (char *) "--shared";
617 /* Because we permit long options to start with a single dash, and
618 we have a --library option, and the -l option is conventionally
619 used with an immediately following argument, we can have bad
620 results if somebody tries to use -l with a library whose name
621 happens to start with "ibrary", as in -li. We avoid problems by
622 simply turning -l into --library. This means that users will
623 have to use two dashes in order to use --library, which is OK
624 since that's how it is documented.
626 FIXME: It's possible that this problem can arise for other short
627 options as well, although the user does always have the recourse
628 of adding a space between the option and the argument. */
629 for (i
= 1; i
< argc
; i
++)
631 if (argv
[i
][0] == '-'
633 && argv
[i
][2] != '\0')
637 n
= (char *) xmalloc (strlen (argv
[i
]) + 20);
638 sprintf (n
, "--library=%s", argv
[i
] + 2);
648 static unsigned int defsym_count
;
650 /* Using last_optind lets us avoid calling ldemul_parse_args
651 multiple times on a single option, which would lead to
652 confusion in the internal static variables maintained by
653 getopt. This could otherwise happen for an argument like
654 -nx, in which the -n is parsed as a single option, and we
655 loop around to pick up the -x. */
656 if (optind
!= last_optind
)
657 if (ldemul_parse_args (argc
, argv
))
660 /* getopt_long_only is like getopt_long, but '-' as well as '--'
661 can indicate a long option. */
663 last_optind
= optind
;
664 optc
= getopt_long_only (argc
, argv
, shortopts
, longopts
, &longind
);
667 optind
= last_optind
;
668 optc
= getopt_long (argc
, argv
, "-", really_longopts
, &longind
);
671 if (ldemul_handle_option (optc
))
680 einfo (_("%P: unrecognized option '%s'\n"), argv
[last_optind
]);
684 einfo (_("%P%F: use the --help option for usage information\n"));
686 case 1: /* File name. */
687 lang_add_input_file (optarg
, lang_input_file_is_file_enum
, NULL
);
693 /* For HP/UX compatibility. Actually -a shared should mean
694 ``use only shared libraries'' but, then, we don't
695 currently support shared libraries on HP/UX anyhow. */
696 if (strcmp (optarg
, "archive") == 0)
697 input_flags
.dynamic
= FALSE
;
698 else if (strcmp (optarg
, "shared") == 0
699 || strcmp (optarg
, "default") == 0)
700 input_flags
.dynamic
= TRUE
;
702 einfo (_("%P%F: unrecognized -a option `%s'\n"), optarg
);
705 /* FIXME: We just ignore these, but we should handle them. */
706 if (strcmp (optarg
, "definitions") == 0)
708 else if (strcmp (optarg
, "nodefinitions") == 0)
710 else if (strcmp (optarg
, "nosymbolic") == 0)
712 else if (strcmp (optarg
, "pure-text") == 0)
715 einfo (_("%P%F: unrecognized -assert option `%s'\n"), optarg
);
718 ldfile_add_arch (optarg
);
721 lang_add_target (optarg
);
724 ldfile_open_command_file (optarg
);
725 parser_input
= input_mri_script
;
728 case OPTION_CALL_SHARED
:
729 input_flags
.dynamic
= TRUE
;
731 case OPTION_NON_SHARED
:
732 input_flags
.dynamic
= FALSE
;
735 command_line
.cref
= TRUE
;
736 link_info
.notice_all
= TRUE
;
739 command_line
.force_common_definition
= TRUE
;
743 lex_redirect (optarg
, "--defsym", ++defsym_count
);
744 parser_input
= input_defsym
;
748 case OPTION_DEMANGLE
:
752 enum demangling_styles style
;
754 style
= cplus_demangle_name_to_style (optarg
);
755 if (style
== unknown_demangling
)
756 einfo (_("%F%P: unknown demangling style `%s'\n"),
759 cplus_demangle_set_style (style
);
762 case 'I': /* Used on Solaris. */
763 case OPTION_DYNAMIC_LINKER
:
764 command_line
.interpreter
= optarg
;
767 /* Already handled in ldmain.c. */
770 command_line
.endian
= ENDIAN_BIG
;
773 command_line
.endian
= ENDIAN_LITTLE
;
775 case OPTION_EMBEDDED_RELOCS
:
776 command_line
.embedded_relocs
= TRUE
;
778 case OPTION_EXPORT_DYNAMIC
:
779 case 'E': /* HP/UX compatibility. */
780 link_info
.export_dynamic
= TRUE
;
782 case OPTION_NO_EXPORT_DYNAMIC
:
783 link_info
.export_dynamic
= FALSE
;
786 lang_add_entry (optarg
, TRUE
);
789 if (command_line
.auxiliary_filters
== NULL
)
791 command_line
.auxiliary_filters
= (char **)
792 xmalloc (2 * sizeof (char *));
793 command_line
.auxiliary_filters
[0] = optarg
;
794 command_line
.auxiliary_filters
[1] = NULL
;
802 for (p
= command_line
.auxiliary_filters
; *p
!= NULL
; p
++)
804 command_line
.auxiliary_filters
= (char **)
805 xrealloc (command_line
.auxiliary_filters
,
806 (c
+ 2) * sizeof (char *));
807 command_line
.auxiliary_filters
[c
] = optarg
;
808 command_line
.auxiliary_filters
[c
+ 1] = NULL
;
812 command_line
.filter_shlib
= optarg
;
814 case OPTION_FORCE_EXE_SUFFIX
:
815 command_line
.force_exe_suffix
= TRUE
;
820 g_switch_value
= strtoul (optarg
, &end
, 0);
822 einfo (_("%P%F: invalid number `%s'\n"), optarg
);
828 case OPTION_GC_SECTIONS
:
829 link_info
.gc_sections
= TRUE
;
831 case OPTION_PRINT_GC_SECTIONS
:
832 link_info
.print_gc_sections
= TRUE
;
839 ldfile_add_library_path (optarg
, TRUE
);
842 lang_add_input_file (optarg
, lang_input_file_is_l_enum
, NULL
);
845 config
.map_filename
= "-";
848 /* Ignore. Was handled in a pre-parse. */
851 config
.map_filename
= optarg
;
854 config
.text_read_only
= FALSE
;
855 config
.magic_demand_paged
= FALSE
;
856 input_flags
.dynamic
= FALSE
;
858 case OPTION_NO_OMAGIC
:
859 config
.text_read_only
= TRUE
;
860 config
.magic_demand_paged
= TRUE
;
861 /* NB/ Does not set input_flags.dynamic to TRUE.
862 Use --call-shared or -Bdynamic for this. */
865 config
.magic_demand_paged
= FALSE
;
866 input_flags
.dynamic
= FALSE
;
868 case OPTION_NO_DEFINE_COMMON
:
869 command_line
.inhibit_common_definition
= TRUE
;
871 case OPTION_NO_DEMANGLE
:
874 case OPTION_NO_GC_SECTIONS
:
875 link_info
.gc_sections
= FALSE
;
877 case OPTION_NO_PRINT_GC_SECTIONS
:
878 link_info
.print_gc_sections
= FALSE
;
880 case OPTION_NO_KEEP_MEMORY
:
881 link_info
.keep_memory
= FALSE
;
883 case OPTION_NO_UNDEFINED
:
884 link_info
.unresolved_syms_in_objects
885 = how_to_report_unresolved_symbols
;
887 case OPTION_ALLOW_SHLIB_UNDEFINED
:
888 link_info
.unresolved_syms_in_shared_libs
= RM_IGNORE
;
890 case OPTION_NO_ALLOW_SHLIB_UNDEFINED
:
891 link_info
.unresolved_syms_in_shared_libs
892 = how_to_report_unresolved_symbols
;
894 case OPTION_UNRESOLVED_SYMBOLS
:
895 if (strcmp (optarg
, "ignore-all") == 0)
897 link_info
.unresolved_syms_in_objects
= RM_IGNORE
;
898 link_info
.unresolved_syms_in_shared_libs
= RM_IGNORE
;
900 else if (strcmp (optarg
, "report-all") == 0)
902 link_info
.unresolved_syms_in_objects
903 = how_to_report_unresolved_symbols
;
904 link_info
.unresolved_syms_in_shared_libs
905 = how_to_report_unresolved_symbols
;
907 else if (strcmp (optarg
, "ignore-in-object-files") == 0)
909 link_info
.unresolved_syms_in_objects
= RM_IGNORE
;
910 link_info
.unresolved_syms_in_shared_libs
911 = how_to_report_unresolved_symbols
;
913 else if (strcmp (optarg
, "ignore-in-shared-libs") == 0)
915 link_info
.unresolved_syms_in_objects
916 = how_to_report_unresolved_symbols
;
917 link_info
.unresolved_syms_in_shared_libs
= RM_IGNORE
;
920 einfo (_("%P%F: bad --unresolved-symbols option: %s\n"), optarg
);
922 case OPTION_WARN_UNRESOLVED_SYMBOLS
:
923 how_to_report_unresolved_symbols
= RM_GENERATE_WARNING
;
924 if (link_info
.unresolved_syms_in_objects
== RM_GENERATE_ERROR
)
925 link_info
.unresolved_syms_in_objects
= RM_GENERATE_WARNING
;
926 if (link_info
.unresolved_syms_in_shared_libs
== RM_GENERATE_ERROR
)
927 link_info
.unresolved_syms_in_shared_libs
= RM_GENERATE_WARNING
;
930 case OPTION_ERROR_UNRESOLVED_SYMBOLS
:
931 how_to_report_unresolved_symbols
= RM_GENERATE_ERROR
;
932 if (link_info
.unresolved_syms_in_objects
== RM_GENERATE_WARNING
)
933 link_info
.unresolved_syms_in_objects
= RM_GENERATE_ERROR
;
934 if (link_info
.unresolved_syms_in_shared_libs
== RM_GENERATE_WARNING
)
935 link_info
.unresolved_syms_in_shared_libs
= RM_GENERATE_ERROR
;
937 case OPTION_ALLOW_MULTIPLE_DEFINITION
:
938 link_info
.allow_multiple_definition
= TRUE
;
940 case OPTION_NO_UNDEFINED_VERSION
:
941 link_info
.allow_undefined_version
= FALSE
;
943 case OPTION_DEFAULT_SYMVER
:
944 link_info
.create_default_symver
= TRUE
;
946 case OPTION_DEFAULT_IMPORTED_SYMVER
:
947 link_info
.default_imported_symver
= TRUE
;
949 case OPTION_NO_WARN_MISMATCH
:
950 command_line
.warn_mismatch
= FALSE
;
952 case OPTION_NO_WARN_SEARCH_MISMATCH
:
953 command_line
.warn_search_mismatch
= FALSE
;
955 case OPTION_NOINHIBIT_EXEC
:
956 force_make_executable
= TRUE
;
958 case OPTION_NOSTDLIB
:
959 config
.only_cmd_line_lib_dirs
= TRUE
;
961 case OPTION_NO_WHOLE_ARCHIVE
:
962 input_flags
.whole_archive
= FALSE
;
965 /* FIXME "-O<non-digits> <value>" used to set the address of
966 section <non-digits>. Was this for compatibility with
967 something, or can we create a new option to do that
968 (with a syntax similar to -defsym)?
969 getopt can't handle two args to an option without kludges. */
971 /* Enable optimizations of output files. */
972 link_info
.optimize
= strtoul (optarg
, NULL
, 0) ? TRUE
: FALSE
;
975 lang_add_output (optarg
, 0);
978 lang_add_output_format (optarg
, NULL
, NULL
, 0);
980 case OPTION_PRINT_SYSROOT
:
985 case OPTION_PRINT_OUTPUT_FORMAT
:
986 command_line
.print_output_format
= TRUE
;
988 #ifdef ENABLE_PLUGINS
990 plugin_opt_plugin (optarg
);
992 case OPTION_PLUGIN_OPT
:
993 if (plugin_opt_plugin_arg (optarg
))
994 einfo(_("%P%F: bad -plugin-opt option\n"));
996 #endif /* ENABLE_PLUGINS */
998 link_info
.emitrelocations
= TRUE
;
1002 if (optind
== last_optind
)
1003 /* This can happen if the user put "-rpath,a" on the command
1004 line. (Or something similar. The comma is important).
1005 Getopt becomes confused and thinks that this is a -r option
1006 but it cannot parse the text after the -r so it refuses to
1007 increment the optind counter. Detect this case and issue
1008 an error message here. We cannot just make this a warning,
1009 increment optind, and continue because getopt is too confused
1010 and will seg-fault the next time around. */
1011 einfo(_("%P%F: unrecognised option: %s\n"), argv
[optind
]);
1013 if (bfd_link_pic (&link_info
))
1014 einfo (_("%P%F: -r and %s may not be used together\n"),
1015 bfd_link_dll (&link_info
) ? "-shared" : "-pie");
1017 link_info
.type
= type_relocatable
;
1018 config
.build_constructors
= FALSE
;
1019 config
.magic_demand_paged
= FALSE
;
1020 config
.text_read_only
= FALSE
;
1021 input_flags
.dynamic
= FALSE
;
1024 /* The GNU linker traditionally uses -R to mean to include
1025 only the symbols from a file. The Solaris linker uses -R
1026 to set the path used by the runtime linker to find
1027 libraries. This is the GNU linker -rpath argument. We
1028 try to support both simultaneously by checking the file
1029 named. If it is a directory, rather than a regular file,
1030 we assume -rpath was meant. */
1034 if (stat (optarg
, &s
) >= 0
1035 && ! S_ISDIR (s
.st_mode
))
1037 lang_add_input_file (optarg
,
1038 lang_input_file_is_symbols_only_enum
,
1045 if (command_line
.rpath
== NULL
)
1046 command_line
.rpath
= xstrdup (optarg
);
1049 size_t rpath_len
= strlen (command_line
.rpath
);
1050 size_t optarg_len
= strlen (optarg
);
1052 char *cp
= command_line
.rpath
;
1054 /* First see whether OPTARG is already in the path. */
1057 if (strncmp (optarg
, cp
, optarg_len
) == 0
1058 && (cp
[optarg_len
] == 0
1059 || cp
[optarg_len
] == config
.rpath_separator
))
1063 /* Not yet found. */
1064 cp
= strchr (cp
, config
.rpath_separator
);
1072 buf
= (char *) xmalloc (rpath_len
+ optarg_len
+ 2);
1073 sprintf (buf
, "%s%c%s", command_line
.rpath
,
1074 config
.rpath_separator
, optarg
);
1075 free (command_line
.rpath
);
1076 command_line
.rpath
= buf
;
1080 case OPTION_RPATH_LINK
:
1081 if (command_line
.rpath_link
== NULL
)
1082 command_line
.rpath_link
= xstrdup (optarg
);
1087 buf
= (char *) xmalloc (strlen (command_line
.rpath_link
)
1090 sprintf (buf
, "%s%c%s", command_line
.rpath_link
,
1091 config
.rpath_separator
, optarg
);
1092 free (command_line
.rpath_link
);
1093 command_line
.rpath_link
= buf
;
1096 case OPTION_NO_RELAX
:
1102 case OPTION_RETAIN_SYMBOLS_FILE
:
1103 add_keepsyms_file (optarg
);
1106 link_info
.strip
= strip_debugger
;
1109 link_info
.strip
= strip_all
;
1111 case OPTION_STRIP_DISCARDED
:
1112 link_info
.strip_discarded
= TRUE
;
1114 case OPTION_NO_STRIP_DISCARDED
:
1115 link_info
.strip_discarded
= FALSE
;
1118 if (config
.has_shared
)
1120 if (bfd_link_relocatable (&link_info
))
1121 einfo (_("%P%F: -r and -shared may not be used together\n"));
1123 link_info
.type
= type_dll
;
1124 /* When creating a shared library, the default
1125 behaviour is to ignore any unresolved references. */
1126 if (link_info
.unresolved_syms_in_objects
== RM_NOT_YET_SET
)
1127 link_info
.unresolved_syms_in_objects
= RM_IGNORE
;
1128 if (link_info
.unresolved_syms_in_shared_libs
== RM_NOT_YET_SET
)
1129 link_info
.unresolved_syms_in_shared_libs
= RM_IGNORE
;
1132 einfo (_("%P%F: -shared not supported\n"));
1135 if (config
.has_shared
)
1137 if (bfd_link_relocatable (&link_info
))
1138 einfo (_("%P%F: -r and -pie may not be used together\n"));
1140 link_info
.type
= type_pie
;
1143 einfo (_("%P%F: -pie not supported\n"));
1145 case 'h': /* Used on Solaris. */
1147 if (optarg
[0] == '\0' && command_line
.soname
1148 && command_line
.soname
[0])
1149 einfo (_("%P: SONAME must not be empty string; keeping previous one\n"));
1151 command_line
.soname
= optarg
;
1153 case OPTION_SORT_COMMON
:
1155 || strcmp (optarg
, N_("descending")) == 0)
1156 config
.sort_common
= sort_descending
;
1157 else if (strcmp (optarg
, N_("ascending")) == 0)
1158 config
.sort_common
= sort_ascending
;
1160 einfo (_("%P%F: invalid common section sorting option: %s\n"),
1163 case OPTION_SORT_SECTION
:
1164 if (strcmp (optarg
, N_("name")) == 0)
1165 sort_section
= by_name
;
1166 else if (strcmp (optarg
, N_("alignment")) == 0)
1167 sort_section
= by_alignment
;
1169 einfo (_("%P%F: invalid section sorting option: %s\n"),
1173 config
.stats
= TRUE
;
1175 case OPTION_SYMBOLIC
:
1176 command_line
.symbolic
= symbolic
;
1178 case OPTION_SYMBOLIC_FUNCTIONS
:
1179 command_line
.symbolic
= symbolic_functions
;
1185 previous_script_handle
= saved_script_handle
;
1186 ldfile_open_command_file (optarg
);
1187 parser_input
= input_script
;
1189 previous_script_handle
= NULL
;
1191 case OPTION_DEFAULT_SCRIPT
:
1192 command_line
.default_script
= optarg
;
1194 case OPTION_SECTION_START
:
1200 /* Check for <something>=<somthing>... */
1201 optarg2
= strchr (optarg
, '=');
1202 if (optarg2
== NULL
)
1203 einfo (_("%P%F: invalid argument to option"
1204 " \"--section-start\"\n"));
1208 /* So far so good. Are all the args present? */
1209 if ((*optarg
== '\0') || (*optarg2
== '\0'))
1210 einfo (_("%P%F: missing argument(s) to option"
1211 " \"--section-start\"\n"));
1213 /* We must copy the section name as set_section_start
1214 doesn't do it for us. */
1215 len
= optarg2
- optarg
;
1216 sec_name
= (char *) xmalloc (len
);
1217 memcpy (sec_name
, optarg
, len
- 1);
1218 sec_name
[len
- 1] = 0;
1220 /* Then set it... */
1221 set_section_start (sec_name
, optarg2
);
1224 case OPTION_TARGET_HELP
:
1225 /* Mention any target specific options. */
1226 ldemul_list_emulation_options (stdout
);
1229 set_segment_start (".bss", optarg
);
1232 set_segment_start (".data", optarg
);
1235 set_segment_start (".text", optarg
);
1237 case OPTION_TTEXT_SEGMENT
:
1238 set_segment_start (".text-segment", optarg
);
1240 case OPTION_TRODATA_SEGMENT
:
1241 set_segment_start (".rodata-segment", optarg
);
1243 case OPTION_TLDATA_SEGMENT
:
1244 set_segment_start (".ldata-segment", optarg
);
1246 case OPTION_TRADITIONAL_FORMAT
:
1247 link_info
.traditional_format
= TRUE
;
1249 case OPTION_TASK_LINK
:
1250 link_info
.task_link
= TRUE
;
1251 /* Fall through - do an implied -r option. */
1253 if (bfd_link_pic (&link_info
))
1254 einfo (_("%P%F: -r and %s may not be used together\n"),
1255 bfd_link_dll (&link_info
) ? "-shared" : "-pie");
1257 link_info
.type
= type_relocatable
;
1258 config
.build_constructors
= TRUE
;
1259 config
.magic_demand_paged
= FALSE
;
1260 config
.text_read_only
= FALSE
;
1261 input_flags
.dynamic
= FALSE
;
1264 ldlang_add_undef (optarg
, TRUE
);
1266 case OPTION_REQUIRE_DEFINED_SYMBOL
:
1267 ldlang_add_require_defined (optarg
);
1271 lang_add_unique (optarg
);
1273 config
.unique_orphan_sections
= TRUE
;
1275 case OPTION_VERBOSE
:
1277 version_printed
= TRUE
;
1279 overflow_cutoff_limit
= -2;
1283 int level ATTRIBUTE_UNUSED
= strtoul (optarg
, &end
, 0);
1285 einfo (_("%P%F: invalid number `%s'\n"), optarg
);
1286 #ifdef ENABLE_PLUGINS
1287 report_plugin_symbols
= level
> 1;
1288 #endif /* ENABLE_PLUGINS */
1293 version_printed
= TRUE
;
1297 version_printed
= TRUE
;
1299 case OPTION_VERSION
:
1303 case OPTION_VERSION_SCRIPT
:
1304 /* This option indicates a small script that only specifies
1305 version information. Read it, but don't assume that
1306 we've seen a linker script. */
1308 FILE *hold_script_handle
;
1310 hold_script_handle
= saved_script_handle
;
1311 ldfile_open_command_file (optarg
);
1312 saved_script_handle
= hold_script_handle
;
1313 parser_input
= input_version_script
;
1317 case OPTION_VERSION_EXPORTS_SECTION
:
1318 /* This option records a version symbol to be applied to the
1319 symbols listed for export to be found in the object files
1320 .exports sections. */
1321 command_line
.version_exports_section
= optarg
;
1323 case OPTION_DYNAMIC_LIST_DATA
:
1324 command_line
.dynamic_list
= dynamic_list_data
;
1325 if (command_line
.symbolic
== symbolic
)
1326 command_line
.symbolic
= symbolic_unset
;
1328 case OPTION_DYNAMIC_LIST_CPP_TYPEINFO
:
1329 lang_append_dynamic_list_cpp_typeinfo ();
1330 if (command_line
.dynamic_list
!= dynamic_list_data
)
1331 command_line
.dynamic_list
= dynamic_list
;
1332 if (command_line
.symbolic
== symbolic
)
1333 command_line
.symbolic
= symbolic_unset
;
1335 case OPTION_DYNAMIC_LIST_CPP_NEW
:
1336 lang_append_dynamic_list_cpp_new ();
1337 if (command_line
.dynamic_list
!= dynamic_list_data
)
1338 command_line
.dynamic_list
= dynamic_list
;
1339 if (command_line
.symbolic
== symbolic
)
1340 command_line
.symbolic
= symbolic_unset
;
1342 case OPTION_DYNAMIC_LIST
:
1343 /* This option indicates a small script that only specifies
1344 a dynamic list. Read it, but don't assume that we've
1345 seen a linker script. */
1347 FILE *hold_script_handle
;
1349 hold_script_handle
= saved_script_handle
;
1350 ldfile_open_command_file (optarg
);
1351 saved_script_handle
= hold_script_handle
;
1352 parser_input
= input_dynamic_list
;
1355 if (command_line
.dynamic_list
!= dynamic_list_data
)
1356 command_line
.dynamic_list
= dynamic_list
;
1357 if (command_line
.symbolic
== symbolic
)
1358 command_line
.symbolic
= symbolic_unset
;
1360 case OPTION_WARN_COMMON
:
1361 config
.warn_common
= TRUE
;
1363 case OPTION_WARN_CONSTRUCTORS
:
1364 config
.warn_constructors
= TRUE
;
1366 case OPTION_WARN_FATAL
:
1367 config
.fatal_warnings
= TRUE
;
1369 case OPTION_NO_WARN_FATAL
:
1370 config
.fatal_warnings
= FALSE
;
1372 case OPTION_WARN_MULTIPLE_GP
:
1373 config
.warn_multiple_gp
= TRUE
;
1375 case OPTION_WARN_ONCE
:
1376 config
.warn_once
= TRUE
;
1378 case OPTION_WARN_ORPHAN
:
1379 config
.warn_orphan
= TRUE
;
1381 case OPTION_NO_WARN_ORPHAN
:
1382 config
.warn_orphan
= FALSE
;
1384 case OPTION_WARN_SECTION_ALIGN
:
1385 config
.warn_section_align
= TRUE
;
1387 case OPTION_WARN_SHARED_TEXTREL
:
1388 link_info
.warn_shared_textrel
= TRUE
;
1390 case OPTION_WARN_ALTERNATE_EM
:
1391 link_info
.warn_alternate_em
= TRUE
;
1393 case OPTION_WHOLE_ARCHIVE
:
1394 input_flags
.whole_archive
= TRUE
;
1396 case OPTION_ADD_DT_NEEDED_FOR_DYNAMIC
:
1397 input_flags
.add_DT_NEEDED_for_dynamic
= TRUE
;
1399 case OPTION_NO_ADD_DT_NEEDED_FOR_DYNAMIC
:
1400 input_flags
.add_DT_NEEDED_for_dynamic
= FALSE
;
1402 case OPTION_ADD_DT_NEEDED_FOR_REGULAR
:
1403 input_flags
.add_DT_NEEDED_for_regular
= TRUE
;
1405 case OPTION_NO_ADD_DT_NEEDED_FOR_REGULAR
:
1406 input_flags
.add_DT_NEEDED_for_regular
= FALSE
;
1411 case OPTION_IGNORE_UNRESOLVED_SYMBOL
:
1412 add_ignoresym (&link_info
, optarg
);
1414 case OPTION_DISCARD_NONE
:
1415 link_info
.discard
= discard_none
;
1418 link_info
.discard
= discard_l
;
1421 link_info
.discard
= discard_all
;
1424 if (CONST_STRNEQ (optarg
, "P,"))
1426 if (default_dirlist
!= NULL
)
1427 free (default_dirlist
);
1428 default_dirlist
= xstrdup (optarg
);
1433 case OPTION_SPARE_DYNAMIC_TAGS
:
1434 link_info
.spare_dynamic_tags
= strtoul (optarg
, NULL
, 0);
1436 case OPTION_SPLIT_BY_RELOC
:
1438 config
.split_by_reloc
= strtoul (optarg
, NULL
, 0);
1440 config
.split_by_reloc
= 32768;
1442 case OPTION_SPLIT_BY_FILE
:
1444 config
.split_by_file
= bfd_scan_vma (optarg
, NULL
, 0);
1446 config
.split_by_file
= 1;
1448 case OPTION_CHECK_SECTIONS
:
1449 command_line
.check_section_addresses
= 1;
1451 case OPTION_NO_CHECK_SECTIONS
:
1452 command_line
.check_section_addresses
= 0;
1454 case OPTION_ACCEPT_UNKNOWN_INPUT_ARCH
:
1455 command_line
.accept_unknown_input_arch
= TRUE
;
1457 case OPTION_NO_ACCEPT_UNKNOWN_INPUT_ARCH
:
1458 command_line
.accept_unknown_input_arch
= FALSE
;
1461 lang_enter_group ();
1466 einfo (_("%P%F: group ended before it began (--help for usage)\n"));
1468 lang_leave_group ();
1473 link_info
.init_function
= optarg
;
1477 link_info
.fini_function
= optarg
;
1480 case OPTION_REDUCE_MEMORY_OVERHEADS
:
1481 link_info
.reduce_memory_overheads
= TRUE
;
1482 if (config
.hash_table_size
== 0)
1483 config
.hash_table_size
= 1021;
1486 case OPTION_HASH_SIZE
:
1488 bfd_size_type new_size
;
1490 new_size
= strtoul (optarg
, NULL
, 0);
1492 config
.hash_table_size
= new_size
;
1494 einfo (_("%P%X: --hash-size needs a numeric argument\n"));
1498 case OPTION_PUSH_STATE
:
1499 input_flags
.pushed
= xmemdup (&input_flags
,
1500 sizeof (input_flags
),
1501 sizeof (input_flags
));
1504 case OPTION_POP_STATE
:
1505 if (input_flags
.pushed
== NULL
)
1506 einfo (_("%P%F: no state pushed before popping\n"));
1509 struct lang_input_statement_flags
*oldp
= input_flags
.pushed
;
1510 memcpy (&input_flags
, oldp
, sizeof (input_flags
));
1515 case OPTION_PRINT_MEMORY_USAGE
:
1516 command_line
.print_memory_usage
= TRUE
;
1521 if (command_line
.soname
&& command_line
.soname
[0] == '\0')
1523 einfo (_("%P: SONAME must not be empty string; ignored\n"));
1524 command_line
.soname
= NULL
;
1529 lang_leave_group ();
1533 if (default_dirlist
!= NULL
)
1535 set_default_dirlist (default_dirlist
);
1536 free (default_dirlist
);
1539 if (link_info
.unresolved_syms_in_objects
== RM_NOT_YET_SET
)
1540 /* FIXME: Should we allow emulations a chance to set this ? */
1541 link_info
.unresolved_syms_in_objects
= how_to_report_unresolved_symbols
;
1543 if (link_info
.unresolved_syms_in_shared_libs
== RM_NOT_YET_SET
)
1544 /* FIXME: Should we allow emulations a chance to set this ? */
1545 link_info
.unresolved_syms_in_shared_libs
= how_to_report_unresolved_symbols
;
1547 if (bfd_link_relocatable (&link_info
)
1548 && command_line
.check_section_addresses
< 0)
1549 command_line
.check_section_addresses
= 0;
1551 /* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
1552 --dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
1553 --dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
1554 for shared libraries. -Bsymbolic overrides all others and vice
1556 switch (command_line
.symbolic
)
1558 case symbolic_unset
:
1561 /* -Bsymbolic is for shared library only. */
1562 if (bfd_link_dll (&link_info
))
1564 link_info
.symbolic
= TRUE
;
1565 /* Should we free the unused memory? */
1566 link_info
.dynamic_list
= NULL
;
1567 command_line
.dynamic_list
= dynamic_list_unset
;
1570 case symbolic_functions
:
1571 /* -Bsymbolic-functions is for shared library only. */
1572 if (bfd_link_dll (&link_info
))
1573 command_line
.dynamic_list
= dynamic_list_data
;
1577 switch (command_line
.dynamic_list
)
1579 case dynamic_list_unset
:
1581 case dynamic_list_data
:
1582 link_info
.dynamic_data
= TRUE
;
1584 link_info
.dynamic
= TRUE
;
1588 if (!bfd_link_dll (&link_info
))
1590 if (command_line
.filter_shlib
)
1591 einfo (_("%P%F: -F may not be used without -shared\n"));
1592 if (command_line
.auxiliary_filters
)
1593 einfo (_("%P%F: -f may not be used without -shared\n"));
1596 /* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
1597 don't see how else this can be handled, since in this case we
1598 must preserve all externally visible symbols. */
1599 if (bfd_link_relocatable (&link_info
) && link_info
.strip
== strip_all
)
1601 link_info
.strip
= strip_debugger
;
1602 if (link_info
.discard
== discard_sec_merge
)
1603 link_info
.discard
= discard_all
;
1607 /* Add the (colon-separated) elements of DIRLIST_PTR to the
1608 library search path. */
1611 set_default_dirlist (char *dirlist_ptr
)
1617 p
= strchr (dirlist_ptr
, PATH_SEPARATOR
);
1620 if (*dirlist_ptr
!= '\0')
1621 ldfile_add_library_path (dirlist_ptr
, TRUE
);
1624 dirlist_ptr
= p
+ 1;
1629 set_section_start (char *sect
, char *valstr
)
1632 bfd_vma val
= bfd_scan_vma (valstr
, &end
, 16);
1634 einfo (_("%P%F: invalid hex number `%s'\n"), valstr
);
1635 lang_section_start (sect
, exp_intop (val
), NULL
);
1639 set_segment_start (const char *section
, char *valstr
)
1645 bfd_vma val
= bfd_scan_vma (valstr
, &end
, 16);
1647 einfo (_("%P%F: invalid hex number `%s'\n"), valstr
);
1648 /* If we already have an entry for this segment, update the existing
1651 for (seg
= segments
; seg
; seg
= seg
->next
)
1652 if (strcmp (seg
->name
, name
) == 0)
1657 /* There was no existing value so we must create a new segment
1659 seg
= (segment_type
*) stat_alloc (sizeof (*seg
));
1663 /* Add it to the linked list of segments. */
1664 seg
->next
= segments
;
1666 /* Historically, -Ttext and friends set the base address of a
1667 particular section. For backwards compatibility, we still do
1668 that. If a SEGMENT_START directive is seen, the section address
1669 assignment will be disabled. */
1670 lang_section_start (section
, exp_intop (val
), seg
);
1674 elf_shlib_list_options (FILE *file
)
1677 --audit=AUDITLIB Specify a library to use for auditing\n"));
1679 -Bgroup Selects group name lookup rules for DSO\n"));
1681 --disable-new-dtags Disable new dynamic tags\n"));
1683 --enable-new-dtags Enable new dynamic tags\n"));
1685 --eh-frame-hdr Create .eh_frame_hdr section\n"));
1687 --exclude-libs=LIBS Make all symbols in LIBS hidden\n"));
1689 --hash-style=STYLE Set hash style to sysv, gnu or both\n"));
1691 -P AUDITLIB, --depaudit=AUDITLIB\n" "\
1692 Specify a library to use for auditing dependencies\n"));
1694 -z combreloc Merge dynamic relocs into one section and sort\n"));
1696 -z nocombreloc Don't merge dynamic relocs into one section\n"));
1698 -z global Make symbols in DSO available for subsequently\n\
1699 loaded objects\n"));
1701 -z initfirst Mark DSO to be initialized first at runtime\n"));
1703 -z interpose Mark object to interpose all DSOs but executable\n"));
1705 -z lazy Mark object lazy runtime binding (default)\n"));
1707 -z loadfltr Mark object requiring immediate process\n"));
1709 -z nocopyreloc Don't create copy relocs\n"));
1711 -z nodefaultlib Mark object not to use default search paths\n"));
1713 -z nodelete Mark DSO non-deletable at runtime\n"));
1715 -z nodlopen Mark DSO not available to dlopen\n"));
1717 -z nodump Mark DSO not available to dldump\n"));
1719 -z now Mark object non-lazy runtime binding\n"));
1721 -z origin Mark object requiring immediate $ORIGIN\n\
1722 processing at runtime\n"));
1724 -z relro Create RELRO program header\n"));
1726 -z norelro Don't create RELRO program header\n"));
1728 -z stacksize=SIZE Set size of stack segment\n"));
1730 -z text Treat DT_TEXTREL in shared object as error\n"));
1732 -z notext Don't treat DT_TEXTREL in shared object as error\n"));
1734 -z textoff Don't treat DT_TEXTREL in shared object as error\n"));
1738 elf_static_list_options (FILE *file
)
1741 --build-id[=STYLE] Generate build ID note\n"));
1743 --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]\n\
1744 Compress DWARF debug sections using zlib\n"));
1746 -z common-page-size=SIZE Set common page size to SIZE\n"));
1748 -z max-page-size=SIZE Set maximum page size to SIZE\n"));
1750 -z defs Report unresolved symbols in object files.\n"));
1752 -z muldefs Allow multiple definitions\n"));
1754 -z execstack Mark executable as requiring executable stack\n"));
1756 -z noexecstack Mark executable as not requiring executable stack\n"));
1760 elf_plt_unwind_list_options (FILE *file
)
1763 --ld-generated-unwind-info Generate exception handling info for PLT\n\
1764 --no-ld-generated-unwind-info\n\
1765 Don't generate exception handling info for PLT\n"));
1769 ld_list_options (FILE *file
, bfd_boolean elf
, bfd_boolean shlib
,
1770 bfd_boolean plt_unwind
)
1774 printf (_("ELF emulations:\n"));
1776 elf_plt_unwind_list_options (file
);
1777 elf_static_list_options (file
);
1779 elf_shlib_list_options (file
);
1783 /* Print help messages for the options. */
1789 const char **targets
, **pp
;
1792 printf (_("Usage: %s [options] file...\n"), program_name
);
1794 printf (_("Options:\n"));
1795 for (i
= 0; i
< OPTION_COUNT
; i
++)
1797 if (ld_options
[i
].doc
!= NULL
)
1810 if (ld_options
[j
].shortopt
!= '\0'
1811 && ld_options
[j
].control
!= NO_HELP
)
1813 printf ("%s-%c", comma
? ", " : "", ld_options
[j
].shortopt
);
1814 len
+= (comma
? 2 : 0) + 2;
1815 if (ld_options
[j
].arg
!= NULL
)
1817 if (ld_options
[j
].opt
.has_arg
!= optional_argument
)
1822 printf ("%s", _(ld_options
[j
].arg
));
1823 len
+= strlen (_(ld_options
[j
].arg
));
1829 while (j
< OPTION_COUNT
&& ld_options
[j
].doc
== NULL
);
1834 if (ld_options
[j
].opt
.name
!= NULL
1835 && ld_options
[j
].control
!= NO_HELP
)
1838 (ld_options
[j
].control
== TWO_DASHES
1839 || ld_options
[j
].control
== EXACTLY_TWO_DASHES
);
1843 two_dashes
? "-" : "",
1844 ld_options
[j
].opt
.name
);
1845 len
+= ((comma
? 2 : 0)
1847 + (two_dashes
? 1 : 0)
1848 + strlen (ld_options
[j
].opt
.name
));
1849 if (ld_options
[j
].arg
!= NULL
)
1851 printf (" %s", _(ld_options
[j
].arg
));
1852 len
+= 1 + strlen (_(ld_options
[j
].arg
));
1858 while (j
< OPTION_COUNT
&& ld_options
[j
].doc
== NULL
);
1866 for (; len
< 30; len
++)
1869 printf ("%s\n", _(ld_options
[i
].doc
));
1872 printf (_(" @FILE"));
1873 for (len
= strlen (" @FILE"); len
< 30; len
++)
1875 printf (_("Read options from FILE\n"));
1877 /* Note: Various tools (such as libtool) depend upon the
1878 format of the listings below - do not change them. */
1879 /* xgettext:c-format */
1880 printf (_("%s: supported targets:"), program_name
);
1881 targets
= bfd_target_list ();
1882 for (pp
= targets
; *pp
!= NULL
; pp
++)
1883 printf (" %s", *pp
);
1887 /* xgettext:c-format */
1888 printf (_("%s: supported emulations: "), program_name
);
1889 ldemul_list_emulations (stdout
);
1892 /* xgettext:c-format */
1893 printf (_("%s: emulation specific options:\n"), program_name
);
1894 ld_list_options (stdout
, ELF_LIST_OPTIONS
, ELF_SHLIB_LIST_OPTIONS
,
1895 ELF_PLT_UNWIND_LIST_OPTIONS
);
1896 ldemul_list_emulation_options (stdout
);
1899 if (REPORT_BUGS_TO
[0])
1900 printf (_("Report bugs to %s\n"), REPORT_BUGS_TO
);