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