1LD(1)                        GNU Development Tools                       LD(1)
2
3
4

NAME

6       ld - The GNU linker
7

SYNOPSIS

9       ld [options] objfile ...
10

DESCRIPTION

12       ld combines a number of object and archive files, relocates their data
13       and ties up symbol references. Usually the last step in compiling a
14       program is to run ld.
15
16       ld accepts Linker Command Language files written in a superset of
17       AT&T's Link Editor Command Language syntax, to provide explicit and
18       total control over the linking process.
19
20       This man page does not describe the command language; see the ld entry
21       in "info" for full details on the command language and on other aspects
22       of the GNU linker.
23
24       This version of ld uses the general purpose BFD libraries to operate on
25       object files. This allows ld to read, combine, and write object files
26       in many different formats---for example, COFF or "a.out".  Different
27       formats may be linked together to produce any available kind of object
28       file.
29
30       Aside from its flexibility, the GNU linker is more helpful than other
31       linkers in providing diagnostic information.  Many linkers abandon
32       execution immediately upon encountering an error; whenever possible, ld
33       continues executing, allowing you to identify other errors (or, in some
34       cases, to get an output file in spite of the error).
35
36       The GNU linker ld is meant to cover a broad range of situations, and to
37       be as compatible as possible with other linkers.  As a result, you have
38       many choices to control its behavior.
39

OPTIONS

41       The linker supports a plethora of command-line options, but in actual
42       practice few of them are used in any particular context.  For instance,
43       a frequent use of ld is to link standard Unix object files on a
44       standard, supported Unix system.  On such a system, to link a file
45       "hello.o":
46
47               ld -o <output> /lib/crt0.o hello.o -lc
48
49       This tells ld to produce a file called output as the result of linking
50       the file "/lib/crt0.o" with "hello.o" and the library "libc.a", which
51       will come from the standard search directories.  (See the discussion of
52       the -l option below.)
53
54       Some of the command-line options to ld may be specified at any point in
55       the command line.  However, options which refer to files, such as -l or
56       -T, cause the file to be read at the point at which the option appears
57       in the command line, relative to the object files and other file
58       options.  Repeating non-file options with a different argument will
59       either have no further effect, or override prior occurrences (those
60       further to the left on the command line) of that option.  Options which
61       may be meaningfully specified more than once are noted in the
62       descriptions below.
63
64       Non-option arguments are object files or archives which are to be
65       linked together.  They may follow, precede, or be mixed in with
66       command-line options, except that an object file argument may not be
67       placed between an option and its argument.
68
69       Usually the linker is invoked with at least one object file, but you
70       can specify other forms of binary input files using -l, -R, and the
71       script command language.  If no binary input files at all are
72       specified, the linker does not produce any output, and issues the
73       message No input files.
74
75       If the linker cannot recognize the format of an object file, it will
76       assume that it is a linker script.  A script specified in this way
77       augments the main linker script used for the link (either the default
78       linker script or the one specified by using -T).  This feature permits
79       the linker to link against a file which appears to be an object or an
80       archive, but actually merely defines some symbol values, or uses
81       "INPUT" or "GROUP" to load other objects.  Specifying a script in this
82       way merely augments the main linker script, with the extra commands
83       placed after the main script; use the -T option to replace the default
84       linker script entirely, but note the effect of the "INSERT" command.
85
86       For options whose names are a single letter, option arguments must
87       either follow the option letter without intervening whitespace, or be
88       given as separate arguments immediately following the option that
89       requires them.
90
91       For options whose names are multiple letters, either one dash or two
92       can precede the option name; for example, -trace-symbol and
93       --trace-symbol are equivalent.  Note---there is one exception to this
94       rule.  Multiple letter options that start with a lower case 'o' can
95       only be preceded by two dashes.  This is to reduce confusion with the
96       -o option.  So for example -omagic sets the output file name to magic
97       whereas --omagic sets the NMAGIC flag on the output.
98
99       Arguments to multiple-letter options must either be separated from the
100       option name by an equals sign, or be given as separate arguments
101       immediately following the option that requires them.  For example,
102       --trace-symbol foo and --trace-symbol=foo are equivalent.  Unique
103       abbreviations of the names of multiple-letter options are accepted.
104
105       Note---if the linker is being invoked indirectly, via a compiler driver
106       (e.g. gcc) then all the linker command-line options should be prefixed
107       by -Wl, (or whatever is appropriate for the particular compiler driver)
108       like this:
109
110                 gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
111
112       This is important, because otherwise the compiler driver program may
113       silently drop the linker options, resulting in a bad link.  Confusion
114       may also arise when passing options that require values through a
115       driver, as the use of a space between option and argument acts as a
116       separator, and causes the driver to pass only the option to the linker
117       and the argument to the compiler.  In this case, it is simplest to use
118       the joined forms of both single- and multiple-letter options, such as:
119
120                 gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map
121
122       Here is a table of the generic command-line switches accepted by the
123       GNU linker:
124
125       @file
126           Read command-line options from file.  The options read are inserted
127           in place of the original @file option.  If file does not exist, or
128           cannot be read, then the option will be treated literally, and not
129           removed.
130
131           Options in file are separated by whitespace.  A whitespace
132           character may be included in an option by surrounding the entire
133           option in either single or double quotes.  Any character (including
134           a backslash) may be included by prefixing the character to be
135           included with a backslash.  The file may itself contain additional
136           @file options; any such options will be processed recursively.
137
138       -a keyword
139           This option is supported for HP/UX compatibility.  The keyword
140           argument must be one of the strings archive, shared, or default.
141           -aarchive is functionally equivalent to -Bstatic, and the other two
142           keywords are functionally equivalent to -Bdynamic.  This option may
143           be used any number of times.
144
145       --audit AUDITLIB
146           Adds AUDITLIB to the "DT_AUDIT" entry of the dynamic section.
147           AUDITLIB is not checked for existence, nor will it use the
148           DT_SONAME specified in the library.  If specified multiple times
149           "DT_AUDIT" will contain a colon separated list of audit interfaces
150           to use. If the linker finds an object with an audit entry while
151           searching for shared libraries, it will add a corresponding
152           "DT_DEPAUDIT" entry in the output file.  This option is only
153           meaningful on ELF platforms supporting the rtld-audit interface.
154
155       -b input-format
156       --format=input-format
157           ld may be configured to support more than one kind of object file.
158           If your ld is configured this way, you can use the -b option to
159           specify the binary format for input object files that follow this
160           option on the command line.  Even when ld is configured to support
161           alternative object formats, you don't usually need to specify this,
162           as ld should be configured to expect as a default input format the
163           most usual format on each machine.  input-format is a text string,
164           the name of a particular format supported by the BFD libraries.
165           (You can list the available binary formats with objdump -i.)
166
167           You may want to use this option if you are linking files with an
168           unusual binary format.  You can also use -b to switch formats
169           explicitly (when linking object files of different formats), by
170           including -b input-format before each group of object files in a
171           particular format.
172
173           The default format is taken from the environment variable
174           "GNUTARGET".
175
176           You can also define the input format from a script, using the
177           command "TARGET";
178
179       -c MRI-commandfile
180       --mri-script=MRI-commandfile
181           For compatibility with linkers produced by MRI, ld accepts script
182           files written in an alternate, restricted command language,
183           described in the MRI Compatible Script Files section of GNU ld
184           documentation.  Introduce MRI script files with the option -c; use
185           the -T option to run linker scripts written in the general-purpose
186           ld scripting language.  If MRI-cmdfile does not exist, ld looks for
187           it in the directories specified by any -L options.
188
189       -d
190       -dc
191       -dp These three options are equivalent; multiple forms are supported
192           for compatibility with other linkers.  They assign space to common
193           symbols even if a relocatable output file is specified (with -r).
194           The script command "FORCE_COMMON_ALLOCATION" has the same effect.
195
196       --depaudit AUDITLIB
197       -P AUDITLIB
198           Adds AUDITLIB to the "DT_DEPAUDIT" entry of the dynamic section.
199           AUDITLIB is not checked for existence, nor will it use the
200           DT_SONAME specified in the library.  If specified multiple times
201           "DT_DEPAUDIT" will contain a colon separated list of audit
202           interfaces to use.  This option is only meaningful on ELF platforms
203           supporting the rtld-audit interface.  The -P option is provided for
204           Solaris compatibility.
205
206       -e entry
207       --entry=entry
208           Use entry as the explicit symbol for beginning execution of your
209           program, rather than the default entry point.  If there is no
210           symbol named entry, the linker will try to parse entry as a number,
211           and use that as the entry address (the number will be interpreted
212           in base 10; you may use a leading 0x for base 16, or a leading 0
213           for base 8).
214
215       --exclude-libs lib,lib,...
216           Specifies a list of archive libraries from which symbols should not
217           be automatically exported.  The library names may be delimited by
218           commas or colons.  Specifying "--exclude-libs ALL" excludes symbols
219           in all archive libraries from automatic export.  This option is
220           available only for the i386 PE targeted port of the linker and for
221           ELF targeted ports.  For i386 PE, symbols explicitly listed in a
222           .def file are still exported, regardless of this option.  For ELF
223           targeted ports, symbols affected by this option will be treated as
224           hidden.
225
226       --exclude-modules-for-implib module,module,...
227           Specifies a list of object files or archive members, from which
228           symbols should not be automatically exported, but which should be
229           copied wholesale into the import library being generated during the
230           link.  The module names may be delimited by commas or colons, and
231           must match exactly the filenames used by ld to open the files; for
232           archive members, this is simply the member name, but for object
233           files the name listed must include and match precisely any path
234           used to specify the input file on the linker's command-line.  This
235           option is available only for the i386 PE targeted port of the
236           linker.  Symbols explicitly listed in a .def file are still
237           exported, regardless of this option.
238
239       -E
240       --export-dynamic
241       --no-export-dynamic
242           When creating a dynamically linked executable, using the -E option
243           or the --export-dynamic option causes the linker to add all symbols
244           to the dynamic symbol table.  The dynamic symbol table is the set
245           of symbols which are visible from dynamic objects at run time.
246
247           If you do not use either of these options (or use the
248           --no-export-dynamic option to restore the default behavior), the
249           dynamic symbol table will normally contain only those symbols which
250           are referenced by some dynamic object mentioned in the link.
251
252           If you use "dlopen" to load a dynamic object which needs to refer
253           back to the symbols defined by the program, rather than some other
254           dynamic object, then you will probably need to use this option when
255           linking the program itself.
256
257           You can also use the dynamic list to control what symbols should be
258           added to the dynamic symbol table if the output format supports it.
259           See the description of --dynamic-list.
260
261           Note that this option is specific to ELF targeted ports.  PE
262           targets support a similar function to export all symbols from a DLL
263           or EXE; see the description of --export-all-symbols below.
264
265       -EB Link big-endian objects.  This affects the default output format.
266
267       -EL Link little-endian objects.  This affects the default output
268           format.
269
270       -f name
271       --auxiliary=name
272           When creating an ELF shared object, set the internal DT_AUXILIARY
273           field to the specified name.  This tells the dynamic linker that
274           the symbol table of the shared object should be used as an
275           auxiliary filter on the symbol table of the shared object name.
276
277           If you later link a program against this filter object, then, when
278           you run the program, the dynamic linker will see the DT_AUXILIARY
279           field.  If the dynamic linker resolves any symbols from the filter
280           object, it will first check whether there is a definition in the
281           shared object name.  If there is one, it will be used instead of
282           the definition in the filter object.  The shared object name need
283           not exist.  Thus the shared object name may be used to provide an
284           alternative implementation of certain functions, perhaps for
285           debugging or for machine specific performance.
286
287           This option may be specified more than once.  The DT_AUXILIARY
288           entries will be created in the order in which they appear on the
289           command line.
290
291       -F name
292       --filter=name
293           When creating an ELF shared object, set the internal DT_FILTER
294           field to the specified name.  This tells the dynamic linker that
295           the symbol table of the shared object which is being created should
296           be used as a filter on the symbol table of the shared object name.
297
298           If you later link a program against this filter object, then, when
299           you run the program, the dynamic linker will see the DT_FILTER
300           field.  The dynamic linker will resolve symbols according to the
301           symbol table of the filter object as usual, but it will actually
302           link to the definitions found in the shared object name.  Thus the
303           filter object can be used to select a subset of the symbols
304           provided by the object name.
305
306           Some older linkers used the -F option throughout a compilation
307           toolchain for specifying object-file format for both input and
308           output object files.  The GNU linker uses other mechanisms for this
309           purpose: the -b, --format, --oformat options, the "TARGET" command
310           in linker scripts, and the "GNUTARGET" environment variable.  The
311           GNU linker will ignore the -F option when not creating an ELF
312           shared object.
313
314       -fini=name
315           When creating an ELF executable or shared object, call NAME when
316           the executable or shared object is unloaded, by setting DT_FINI to
317           the address of the function.  By default, the linker uses "_fini"
318           as the function to call.
319
320       -g  Ignored.  Provided for compatibility with other tools.
321
322       -G value
323       --gpsize=value
324           Set the maximum size of objects to be optimized using the GP
325           register to size.  This is only meaningful for object file formats
326           such as MIPS ELF that support putting large and small objects into
327           different sections.  This is ignored for other object file formats.
328
329       -h name
330       -soname=name
331           When creating an ELF shared object, set the internal DT_SONAME
332           field to the specified name.  When an executable is linked with a
333           shared object which has a DT_SONAME field, then when the executable
334           is run the dynamic linker will attempt to load the shared object
335           specified by the DT_SONAME field rather than the using the file
336           name given to the linker.
337
338       -i  Perform an incremental link (same as option -r).
339
340       -init=name
341           When creating an ELF executable or shared object, call NAME when
342           the executable or shared object is loaded, by setting DT_INIT to
343           the address of the function.  By default, the linker uses "_init"
344           as the function to call.
345
346       -l namespec
347       --library=namespec
348           Add the archive or object file specified by namespec to the list of
349           files to link.  This option may be used any number of times.  If
350           namespec is of the form :filename, ld will search the library path
351           for a file called filename, otherwise it will search the library
352           path for a file called libnamespec.a.
353
354           On systems which support shared libraries, ld may also search for
355           files other than libnamespec.a.  Specifically, on ELF and SunOS
356           systems, ld will search a directory for a library called
357           libnamespec.so before searching for one called libnamespec.a.  (By
358           convention, a ".so" extension indicates a shared library.)  Note
359           that this behavior does not apply to :filename, which always
360           specifies a file called filename.
361
362           The linker will search an archive only once, at the location where
363           it is specified on the command line.  If the archive defines a
364           symbol which was undefined in some object which appeared before the
365           archive on the command line, the linker will include the
366           appropriate file(s) from the archive.  However, an undefined symbol
367           in an object appearing later on the command line will not cause the
368           linker to search the archive again.
369
370           See the -( option for a way to force the linker to search archives
371           multiple times.
372
373           You may list the same archive multiple times on the command line.
374
375           This type of archive searching is standard for Unix linkers.
376           However, if you are using ld on AIX, note that it is different from
377           the behaviour of the AIX linker.
378
379       -L searchdir
380       --library-path=searchdir
381           Add path searchdir to the list of paths that ld will search for
382           archive libraries and ld control scripts.  You may use this option
383           any number of times.  The directories are searched in the order in
384           which they are specified on the command line.  Directories
385           specified on the command line are searched before the default
386           directories.  All -L options apply to all -l options, regardless of
387           the order in which the options appear.  -L options do not affect
388           how ld searches for a linker script unless -T option is specified.
389
390           If searchdir begins with "=" or $SYSROOT, then this prefix will be
391           replaced by the sysroot prefix, controlled by the --sysroot option,
392           or specified when the linker is configured.
393
394           The default set of paths searched (without being specified with -L)
395           depends on which emulation mode ld is using, and in some cases also
396           on how it was configured.
397
398           The paths can also be specified in a link script with the
399           "SEARCH_DIR" command.  Directories specified this way are searched
400           at the point in which the linker script appears in the command
401           line.
402
403       -m emulation
404           Emulate the emulation linker.  You can list the available
405           emulations with the --verbose or -V options.
406
407           If the -m option is not used, the emulation is taken from the
408           "LDEMULATION" environment variable, if that is defined.
409
410           Otherwise, the default emulation depends upon how the linker was
411           configured.
412
413       -M
414       --print-map
415           Print a link map to the standard output.  A link map provides
416           information about the link, including the following:
417
418           ·   Where object files are mapped into memory.
419
420           ·   How common symbols are allocated.
421
422           ·   All archive members included in the link, with a mention of the
423               symbol which caused the archive member to be brought in.
424
425           ·   The values assigned to symbols.
426
427               Note - symbols whose values are computed by an expression which
428               involves a reference to a previous value of the same symbol may
429               not have correct result displayed in the link map.  This is
430               because the linker discards intermediate results and only
431               retains the final value of an expression.  Under such
432               circumstances the linker will display the final value enclosed
433               by square brackets.  Thus for example a linker script
434               containing:
435
436                          foo = 1
437                          foo = foo * 4
438                          foo = foo + 8
439
440               will produce the following output in the link map if the -M
441               option is used:
442
443                          0x00000001                foo = 0x1
444                          [0x0000000c]                foo = (foo * 0x4)
445                          [0x0000000c]                foo = (foo + 0x8)
446
447               See Expressions for more information about expressions in
448               linker scripts.
449
450           ·   *<How GNU properties are merged.>
451
452               When linker merges input .note.gnu.property sections into one
453               output .note.gnu.property section, some properties are removed
454               or updated, which are reported in the link map as
455
456                       Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
457
458               It indicates that property 0xc0000002 is removed from output
459               when merging properties in  foo.o, whose property 0xc0000002
460               value is 0x1, and bar.o, which doesn't have property
461               0xc0000002.
462
463                       Updated property 0xc0000002 (0x1) to merge foo.o (0x1) and bar.o (0x1)
464
465               It indicates that property 0xc0010001 value is updated to 0x1
466               in output when merging properties in  foo.o, whose 0xc0010001
467               property value is 0x1, and bar.o, whose 0xc0010001 property
468               value is 0x1.
469
470       -n
471       --nmagic
472           Turn off page alignment of sections, and disable linking against
473           shared libraries.  If the output format supports Unix style magic
474           numbers, mark the output as "NMAGIC".
475
476       -N
477       --omagic
478           Set the text and data sections to be readable and writable.  Also,
479           do not page-align the data segment, and disable linking against
480           shared libraries.  If the output format supports Unix style magic
481           numbers, mark the output as "OMAGIC". Note: Although a writable
482           text section is allowed for PE-COFF targets, it does not conform to
483           the format specification published by Microsoft.
484
485       --no-omagic
486           This option negates most of the effects of the -N option.  It sets
487           the text section to be read-only, and forces the data segment to be
488           page-aligned.  Note - this option does not enable linking against
489           shared libraries.  Use -Bdynamic for this.
490
491       -o output
492       --output=output
493           Use output as the name for the program produced by ld; if this
494           option is not specified, the name a.out is used by default.  The
495           script command "OUTPUT" can also specify the output file name.
496
497       -O level
498           If level is a numeric values greater than zero ld optimizes the
499           output.  This might take significantly longer and therefore
500           probably should only be enabled for the final binary.  At the
501           moment this option only affects ELF shared library generation.
502           Future releases of the linker may make more use of this option.
503           Also currently there is no difference in the linker's behaviour for
504           different non-zero values of this option.  Again this may change
505           with future releases.
506
507       -plugin name
508           Involve a plugin in the linking process.  The name parameter is the
509           absolute filename of the plugin.  Usually this parameter is
510           automatically added by the complier, when using link time
511           optimization, but users can also add their own plugins if they so
512           wish.
513
514           Note that the location of the compiler originated plugins is
515           different from the place where the ar, nm and ranlib programs
516           search for their plugins.  In order for those commands to make use
517           of a compiler based plugin it must first be copied into the
518           ${libdir}/bfd-plugins directory.  All gcc based linker plugins are
519           backward compatible, so it is sufficient to just copy in the newest
520           one.
521
522       --push-state
523           The --push-state allows to preserve the current state of the flags
524           which govern the input file handling so that they can all be
525           restored with one corresponding --pop-state option.
526
527           The option which are covered are: -Bdynamic, -Bstatic, -dn, -dy,
528           -call_shared, -non_shared, -static, -N, -n, --whole-archive,
529           --no-whole-archive, -r, -Ur, --copy-dt-needed-entries,
530           --no-copy-dt-needed-entries, --as-needed, --no-as-needed, and -a.
531
532           One target for this option are specifications for pkg-config.  When
533           used with the --libs option all possibly needed libraries are
534           listed and then possibly linked with all the time.  It is better to
535           return something as follows:
536
537                   -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state
538
539       --pop-state
540           Undoes the effect of --push-state, restores the previous values of
541           the flags governing input file handling.
542
543       -q
544       --emit-relocs
545           Leave relocation sections and contents in fully linked executables.
546           Post link analysis and optimization tools may need this information
547           in order to perform correct modifications of executables.  This
548           results in larger executables.
549
550           This option is currently only supported on ELF platforms.
551
552       --force-dynamic
553           Force the output file to have dynamic sections.  This option is
554           specific to VxWorks targets.
555
556       -r
557       --relocatable
558           Generate relocatable output---i.e., generate an output file that
559           can in turn serve as input to ld.  This is often called partial
560           linking.  As a side effect, in environments that support standard
561           Unix magic numbers, this option also sets the output file's magic
562           number to "OMAGIC".  If this option is not specified, an absolute
563           file is produced.  When linking C++ programs, this option will not
564           resolve references to constructors; to do that, use -Ur.
565
566           When an input file does not have the same format as the output
567           file, partial linking is only supported if that input file does not
568           contain any relocations.  Different output formats can have further
569           restrictions; for example some "a.out"-based formats do not support
570           partial linking with input files in other formats at all.
571
572           This option does the same thing as -i.
573
574       -R filename
575       --just-symbols=filename
576           Read symbol names and their addresses from filename, but do not
577           relocate it or include it in the output.  This allows your output
578           file to refer symbolically to absolute locations of memory defined
579           in other programs.  You may use this option more than once.
580
581           For compatibility with other ELF linkers, if the -R option is
582           followed by a directory name, rather than a file name, it is
583           treated as the -rpath option.
584
585       -s
586       --strip-all
587           Omit all symbol information from the output file.
588
589       -S
590       --strip-debug
591           Omit debugger symbol information (but not all symbols) from the
592           output file.
593
594       --strip-discarded
595       --no-strip-discarded
596           Omit (or do not omit) global symbols defined in discarded sections.
597           Enabled by default.
598
599       -t
600       --trace
601           Print the names of the input files as ld processes them.  If -t is
602           given twice then members within archives are also printed.  -t
603           output is useful to generate a list of all the object files and
604           scripts involved in linking, for example, when packaging files for
605           a linker bug report.
606
607       -T scriptfile
608       --script=scriptfile
609           Use scriptfile as the linker script.  This script replaces ld's
610           default linker script (rather than adding to it), so commandfile
611           must specify everything necessary to describe the output file.
612           If scriptfile does not exist in the current directory, "ld" looks
613           for it in the directories specified by any preceding -L options.
614           Multiple -T options accumulate.
615
616       -dT scriptfile
617       --default-script=scriptfile
618           Use scriptfile as the default linker script.
619
620           This option is similar to the --script option except that
621           processing of the script is delayed until after the rest of the
622           command line has been processed.  This allows options placed after
623           the --default-script option on the command line to affect the
624           behaviour of the linker script, which can be important when the
625           linker command line cannot be directly controlled by the user.  (eg
626           because the command line is being constructed by another tool, such
627           as gcc).
628
629       -u symbol
630       --undefined=symbol
631           Force symbol to be entered in the output file as an undefined
632           symbol.  Doing this may, for example, trigger linking of additional
633           modules from standard libraries.  -u may be repeated with different
634           option arguments to enter additional undefined symbols.  This
635           option is equivalent to the "EXTERN" linker script command.
636
637           If this option is being used to force additional modules to be
638           pulled into the link, and if it is an error for the symbol to
639           remain undefined, then the option --require-defined should be used
640           instead.
641
642       --require-defined=symbol
643           Require that symbol is defined in the output file.  This option is
644           the same as option --undefined except that if symbol is not defined
645           in the output file then the linker will issue an error and exit.
646           The same effect can be achieved in a linker script by using
647           "EXTERN", "ASSERT" and "DEFINED" together.  This option can be used
648           multiple times to require additional symbols.
649
650       -Ur For anything other than C++ programs, this option is equivalent to
651           -r: it generates relocatable output---i.e., an output file that can
652           in turn serve as input to ld.  When linking C++ programs, -Ur does
653           resolve references to constructors, unlike -r.  It does not work to
654           use -Ur on files that were themselves linked with -Ur; once the
655           constructor table has been built, it cannot be added to.  Use -Ur
656           only for the last partial link, and -r for the others.
657
658       --orphan-handling=MODE
659           Control how orphan sections are handled.  An orphan section is one
660           not specifically mentioned in a linker script.
661
662           MODE can have any of the following values:
663
664           "place"
665               Orphan sections are placed into a suitable output section
666               following the strategy described in Orphan Sections.  The
667               option --unique also affects how sections are placed.
668
669           "discard"
670               All orphan sections are discarded, by placing them in the
671               /DISCARD/ section.
672
673           "warn"
674               The linker will place the orphan section as for "place" and
675               also issue a warning.
676
677           "error"
678               The linker will exit with an error if any orphan section is
679               found.
680
681           The default if --orphan-handling is not given is "place".
682
683       --unique[=SECTION]
684           Creates a separate output section for every input section matching
685           SECTION, or if the optional wildcard SECTION argument is missing,
686           for every orphan input section.  An orphan section is one not
687           specifically mentioned in a linker script.  You may use this option
688           multiple times on the command line;  It prevents the normal merging
689           of input sections with the same name, overriding output section
690           assignments in a linker script.
691
692       -v
693       --version
694       -V  Display the version number for ld.  The -V option also lists the
695           supported emulations.
696
697       -x
698       --discard-all
699           Delete all local symbols.
700
701       -X
702       --discard-locals
703           Delete all temporary local symbols.  (These symbols start with
704           system-specific local label prefixes, typically .L for ELF systems
705           or L for traditional a.out systems.)
706
707       -y symbol
708       --trace-symbol=symbol
709           Print the name of each linked file in which symbol appears.  This
710           option may be given any number of times.  On many systems it is
711           necessary to prepend an underscore.
712
713           This option is useful when you have an undefined symbol in your
714           link but don't know where the reference is coming from.
715
716       -Y path
717           Add path to the default library search path.  This option exists
718           for Solaris compatibility.
719
720       -z keyword
721           The recognized keywords are:
722
723           bndplt
724               Always generate BND prefix in PLT entries. Supported for
725               Linux/x86_64.
726
727           call-nop=prefix-addr
728           call-nop=suffix-nop
729           call-nop=prefix-byte
730           call-nop=suffix-byte
731               Specify the 1-byte "NOP" padding when transforming indirect
732               call to a locally defined function, foo, via its GOT slot.
733               call-nop=prefix-addr generates "0x67 call foo".
734               call-nop=suffix-nop generates "call foo 0x90".
735               call-nop=prefix-byte generates "byte call foo".
736               call-nop=suffix-byte generates "call foo byte".  Supported for
737               i386 and x86_64.
738
739           combreloc
740           nocombreloc
741               Combine multiple dynamic relocation sections and sort to
742               improve dynamic symbol lookup caching.  Do not do this if
743               nocombreloc.
744
745           common
746           nocommon
747               Generate common symbols with STT_COMMON type during a
748               relocatable link.  Use STT_OBJECT type if nocommon.
749
750           common-page-size=value
751               Set the page size most commonly used to value.  Memory image
752               layout will be optimized to minimize memory pages if the system
753               is using pages of this size.
754
755           defs
756               Report unresolved symbol references from regular object files.
757               This is done even if the linker is creating a non-symbolic
758               shared library.  This option is the inverse of -z undefs.
759
760           dynamic-undefined-weak
761           nodynamic-undefined-weak
762               Make undefined weak symbols dynamic when building a dynamic
763               object, if they are referenced from a regular object file and
764               not forced local by symbol visibility or versioning.  Do not
765               make them dynamic if nodynamic-undefined-weak.  If neither
766               option is given, a target may default to either option being in
767               force, or make some other selection of undefined weak symbols
768               dynamic.  Not all targets support these options.
769
770           execstack
771               Marks the object as requiring executable stack.
772
773           global
774               This option is only meaningful when building a shared object.
775               It makes the symbols defined by this shared object available
776               for symbol resolution of subsequently loaded libraries.
777
778           globalaudit
779               This option is only meaningful when building a dynamic
780               executable.  This option marks the executable as requiring
781               global auditing by setting the "DF_1_GLOBAUDIT" bit in the
782               "DT_FLAGS_1" dynamic tag.  Global auditing requires that any
783               auditing library defined via the --depaudit or -P command-line
784               options be run for all dynamic objects loaded by the
785               application.
786
787           ibtplt
788               Generate Intel Indirect Branch Tracking (IBT) enabled PLT
789               entries.  Supported for Linux/i386 and Linux/x86_64.
790
791           ibt Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property
792               section to indicate compatibility with IBT.  This also implies
793               ibtplt.  Supported for Linux/i386 and Linux/x86_64.
794
795           initfirst
796               This option is only meaningful when building a shared object.
797               It marks the object so that its runtime initialization will
798               occur before the runtime initialization of any other objects
799               brought into the process at the same time.  Similarly the
800               runtime finalization of the object will occur after the runtime
801               finalization of any other objects.
802
803           interpose
804               Specify that the dynamic loader should modify its symbol search
805               order so that symbols in this shared library interpose all
806               other shared libraries not so marked.
807
808           lazy
809               When generating an executable or shared library, mark it to
810               tell the dynamic linker to defer function call resolution to
811               the point when the function is called (lazy binding), rather
812               than at load time.  Lazy binding is the default.
813
814           loadfltr
815               Specify that the object's filters be processed immediately at
816               runtime.
817
818           max-page-size=value
819               Set the maximum memory page size supported to value.
820
821           muldefs
822               Allow multiple definitions.
823
824           nocopyreloc
825               Disable linker generated .dynbss variables used in place of
826               variables defined in shared libraries.  May result in dynamic
827               text relocations.
828
829           nodefaultlib
830               Specify that the dynamic loader search for dependencies of this
831               object should ignore any default library search paths.
832
833           nodelete
834               Specify that the object shouldn't be unloaded at runtime.
835
836           nodlopen
837               Specify that the object is not available to "dlopen".
838
839           nodump
840               Specify that the object can not be dumped by "dldump".
841
842           noexecstack
843               Marks the object as not requiring executable stack.
844
845           noextern-protected-data
846               Don't treat protected data symbols as external when building a
847               shared library.  This option overrides the linker backend
848               default.  It can be used to work around incorrect relocations
849               against protected data symbols generated by compiler.  Updates
850               on protected data symbols by another module aren't visible to
851               the resulting shared library.  Supported for i386 and x86-64.
852
853           noreloc-overflow
854               Disable relocation overflow check.  This can be used to disable
855               relocation overflow check if there will be no dynamic
856               relocation overflow at run-time.  Supported for x86_64.
857
858           now When generating an executable or shared library, mark it to
859               tell the dynamic linker to resolve all symbols when the program
860               is started, or when the shared library is loaded by dlopen,
861               instead of deferring function call resolution to the point when
862               the function is first called.
863
864           origin
865               Specify that the object requires $ORIGIN handling in paths.
866
867           relro
868           norelro
869               Create an ELF "PT_GNU_RELRO" segment header in the object.
870               This specifies a memory segment that should be made read-only
871               after relocation, if supported.  Specifying common-page-size
872               smaller than the system page size will render this protection
873               ineffective.  Don't create an ELF "PT_GNU_RELRO" segment if
874               norelro.
875
876           separate-code
877           noseparate-code
878               Create separate code "PT_LOAD" segment header in the object.
879               This specifies a memory segment that should contain only
880               instructions and must be in wholly disjoint pages from any
881               other data.  Don't create separate code "PT_LOAD" segment if
882               noseparate-code is used.
883
884           shstk
885               Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in .note.gnu.property
886               section to indicate compatibility with Intel Shadow Stack.
887               Supported for Linux/i386 and Linux/x86_64.
888
889           stack-size=value
890               Specify a stack size for an ELF "PT_GNU_STACK" segment.
891               Specifying zero will override any default non-zero sized
892               "PT_GNU_STACK" segment creation.
893
894           text
895           notext
896           textoff
897               Report an error if DT_TEXTREL is set, i.e., if the binary has
898               dynamic relocations in read-only sections.  Don't report an
899               error if notext or textoff.
900
901           undefs
902               Do not report unresolved symbol references from regular object
903               files, either when creating an executable, or when creating a
904               shared library.  This option is the inverse of -z defs.
905
906           Other keywords are ignored for Solaris compatibility.
907
908       -( archives -)
909       --start-group archives --end-group
910           The archives should be a list of archive files.  They may be either
911           explicit file names, or -l options.
912
913           The specified archives are searched repeatedly until no new
914           undefined references are created.  Normally, an archive is searched
915           only once in the order that it is specified on the command line.
916           If a symbol in that archive is needed to resolve an undefined
917           symbol referred to by an object in an archive that appears later on
918           the command line, the linker would not be able to resolve that
919           reference.  By grouping the archives, they all be searched
920           repeatedly until all possible references are resolved.
921
922           Using this option has a significant performance cost.  It is best
923           to use it only when there are unavoidable circular references
924           between two or more archives.
925
926       --accept-unknown-input-arch
927       --no-accept-unknown-input-arch
928           Tells the linker to accept input files whose architecture cannot be
929           recognised.  The assumption is that the user knows what they are
930           doing and deliberately wants to link in these unknown input files.
931           This was the default behaviour of the linker, before release 2.14.
932           The default behaviour from release 2.14 onwards is to reject such
933           input files, and so the --accept-unknown-input-arch option has been
934           added to restore the old behaviour.
935
936       --as-needed
937       --no-as-needed
938           This option affects ELF DT_NEEDED tags for dynamic libraries
939           mentioned on the command line after the --as-needed option.
940           Normally the linker will add a DT_NEEDED tag for each dynamic
941           library mentioned on the command line, regardless of whether the
942           library is actually needed or not.  --as-needed causes a DT_NEEDED
943           tag to only be emitted for a library that at that point in the link
944           satisfies a non-weak undefined symbol reference from a regular
945           object file or, if the library is not found in the DT_NEEDED lists
946           of other needed libraries, a non-weak undefined symbol reference
947           from another needed dynamic library.  Object files or libraries
948           appearing on the command line after the library in question do not
949           affect whether the library is seen as needed.  This is similar to
950           the rules for extraction of object files from archives.
951           --no-as-needed restores the default behaviour.
952
953       --add-needed
954       --no-add-needed
955           These two options have been deprecated because of the similarity of
956           their names to the --as-needed and --no-as-needed options.  They
957           have been replaced by --copy-dt-needed-entries and
958           --no-copy-dt-needed-entries.
959
960       -assert keyword
961           This option is ignored for SunOS compatibility.
962
963       -Bdynamic
964       -dy
965       -call_shared
966           Link against dynamic libraries.  This is only meaningful on
967           platforms for which shared libraries are supported.  This option is
968           normally the default on such platforms.  The different variants of
969           this option are for compatibility with various systems.  You may
970           use this option multiple times on the command line: it affects
971           library searching for -l options which follow it.
972
973       -Bgroup
974           Set the "DF_1_GROUP" flag in the "DT_FLAGS_1" entry in the dynamic
975           section.  This causes the runtime linker to handle lookups in this
976           object and its dependencies to be performed only inside the group.
977           --unresolved-symbols=report-all is implied.  This option is only
978           meaningful on ELF platforms which support shared libraries.
979
980       -Bstatic
981       -dn
982       -non_shared
983       -static
984           Do not link against shared libraries.  This is only meaningful on
985           platforms for which shared libraries are supported.  The different
986           variants of this option are for compatibility with various systems.
987           You may use this option multiple times on the command line: it
988           affects library searching for -l options which follow it.  This
989           option also implies --unresolved-symbols=report-all.  This option
990           can be used with -shared.  Doing so means that a shared library is
991           being created but that all of the library's external references
992           must be resolved by pulling in entries from static libraries.
993
994       -Bsymbolic
995           When creating a shared library, bind references to global symbols
996           to the definition within the shared library, if any.  Normally, it
997           is possible for a program linked against a shared library to
998           override the definition within the shared library.  This option can
999           also be used with the --export-dynamic option, when creating a
1000           position independent executable, to bind references to global
1001           symbols to the definition within the executable.  This option is
1002           only meaningful on ELF platforms which support shared libraries and
1003           position independent executables.
1004
1005       -Bsymbolic-functions
1006           When creating a shared library, bind references to global function
1007           symbols to the definition within the shared library, if any.  This
1008           option can also be used with the --export-dynamic option, when
1009           creating a position independent executable, to bind references to
1010           global function symbols to the definition within the executable.
1011           This option is only meaningful on ELF platforms which support
1012           shared libraries and position independent executables.
1013
1014       --dynamic-list=dynamic-list-file
1015           Specify the name of a dynamic list file to the linker.  This is
1016           typically used when creating shared libraries to specify a list of
1017           global symbols whose references shouldn't be bound to the
1018           definition within the shared library, or creating dynamically
1019           linked executables to specify a list of symbols which should be
1020           added to the symbol table in the executable.  This option is only
1021           meaningful on ELF platforms which support shared libraries.
1022
1023           The format of the dynamic list is the same as the version node
1024           without scope and node name.  See VERSION for more information.
1025
1026       --dynamic-list-data
1027           Include all global data symbols to the dynamic list.
1028
1029       --dynamic-list-cpp-new
1030           Provide the builtin dynamic list for C++ operator new and delete.
1031           It is mainly useful for building shared libstdc++.
1032
1033       --dynamic-list-cpp-typeinfo
1034           Provide the builtin dynamic list for C++ runtime type
1035           identification.
1036
1037       --check-sections
1038       --no-check-sections
1039           Asks the linker not to check section addresses after they have been
1040           assigned to see if there are any overlaps.  Normally the linker
1041           will perform this check, and if it finds any overlaps it will
1042           produce suitable error messages.  The linker does know about, and
1043           does make allowances for sections in overlays.  The default
1044           behaviour can be restored by using the command-line switch
1045           --check-sections.  Section overlap is not usually checked for
1046           relocatable links.  You can force checking in that case by using
1047           the --check-sections option.
1048
1049       --copy-dt-needed-entries
1050       --no-copy-dt-needed-entries
1051           This option affects the treatment of dynamic libraries referred to
1052           by DT_NEEDED tags inside ELF dynamic libraries mentioned on the
1053           command line.  Normally the linker won't add a DT_NEEDED tag to the
1054           output binary for each library mentioned in a DT_NEEDED tag in an
1055           input dynamic library.  With --copy-dt-needed-entries specified on
1056           the command line however any dynamic libraries that follow it will
1057           have their DT_NEEDED entries added.  The default behaviour can be
1058           restored with --no-copy-dt-needed-entries.
1059
1060           This option also has an effect on the resolution of symbols in
1061           dynamic libraries.  With --copy-dt-needed-entries dynamic libraries
1062           mentioned on the command line will be recursively searched,
1063           following their DT_NEEDED tags to other libraries, in order to
1064           resolve symbols required by the output binary.  With the default
1065           setting however the searching of dynamic libraries that follow it
1066           will stop with the dynamic library itself.  No DT_NEEDED links will
1067           be traversed to resolve symbols.
1068
1069       --cref
1070           Output a cross reference table.  If a linker map file is being
1071           generated, the cross reference table is printed to the map file.
1072           Otherwise, it is printed on the standard output.
1073
1074           The format of the table is intentionally simple, so that it may be
1075           easily processed by a script if necessary.  The symbols are printed
1076           out, sorted by name.  For each symbol, a list of file names is
1077           given.  If the symbol is defined, the first file listed is the
1078           location of the definition.  If the symbol is defined as a common
1079           value then any files where this happens appear next.  Finally any
1080           files that reference the symbol are listed.
1081
1082       --no-define-common
1083           This option inhibits the assignment of addresses to common symbols.
1084           The script command "INHIBIT_COMMON_ALLOCATION" has the same effect.
1085
1086           The --no-define-common option allows decoupling the decision to
1087           assign addresses to Common symbols from the choice of the output
1088           file type; otherwise a non-Relocatable output type forces assigning
1089           addresses to Common symbols.  Using --no-define-common allows
1090           Common symbols that are referenced from a shared library to be
1091           assigned addresses only in the main program.  This eliminates the
1092           unused duplicate space in the shared library, and also prevents any
1093           possible confusion over resolving to the wrong duplicate when there
1094           are many dynamic modules with specialized search paths for runtime
1095           symbol resolution.
1096
1097       --force-group-allocation
1098           This option causes the linker to place section group members like
1099           normal input sections, and to delete the section groups.  This is
1100           the default behaviour for a final link but this option can be used
1101           to change the behaviour of a relocatable link (-r).  The script
1102           command "FORCE_GROUP_ALLOCATION" has the same effect.
1103
1104       --defsym=symbol=expression
1105           Create a global symbol in the output file, containing the absolute
1106           address given by expression.  You may use this option as many times
1107           as necessary to define multiple symbols in the command line.  A
1108           limited form of arithmetic is supported for the expression in this
1109           context: you may give a hexadecimal constant or the name of an
1110           existing symbol, or use "+" and "-" to add or subtract hexadecimal
1111           constants or symbols.  If you need more elaborate expressions,
1112           consider using the linker command language from a script.  Note:
1113           there should be no white space between symbol, the equals sign
1114           ("="), and expression.
1115
1116       --demangle[=style]
1117       --no-demangle
1118           These options control whether to demangle symbol names in error
1119           messages and other output.  When the linker is told to demangle, it
1120           tries to present symbol names in a readable fashion: it strips
1121           leading underscores if they are used by the object file format, and
1122           converts C++ mangled symbol names into user readable names.
1123           Different compilers have different mangling styles.  The optional
1124           demangling style argument can be used to choose an appropriate
1125           demangling style for your compiler.  The linker will demangle by
1126           default unless the environment variable COLLECT_NO_DEMANGLE is set.
1127           These options may be used to override the default.
1128
1129       -Ifile
1130       --dynamic-linker=file
1131           Set the name of the dynamic linker.  This is only meaningful when
1132           generating dynamically linked ELF executables.  The default dynamic
1133           linker is normally correct; don't use this unless you know what you
1134           are doing.
1135
1136       --no-dynamic-linker
1137           When producing an executable file, omit the request for a dynamic
1138           linker to be used at load-time.  This is only meaningful for ELF
1139           executables that contain dynamic relocations, and usually requires
1140           entry point code that is capable of processing these relocations.
1141
1142       --embedded-relocs
1143           This option is similar to the --emit-relocs option except that the
1144           relocs are stored in a target specific section.  This option is
1145           only supported by the BFIN, CR16 and M68K targets.
1146
1147       --disable-multiple-abs-defs
1148           Do not allow multiple definitions with symbols included in filename
1149           invoked by -R or --just-symbols
1150
1151       --fatal-warnings
1152       --no-fatal-warnings
1153           Treat all warnings as errors.  The default behaviour can be
1154           restored with the option --no-fatal-warnings.
1155
1156       --force-exe-suffix
1157           Make sure that an output file has a .exe suffix.
1158
1159           If a successfully built fully linked output file does not have a
1160           ".exe" or ".dll" suffix, this option forces the linker to copy the
1161           output file to one of the same name with a ".exe" suffix. This
1162           option is useful when using unmodified Unix makefiles on a
1163           Microsoft Windows host, since some versions of Windows won't run an
1164           image unless it ends in a ".exe" suffix.
1165
1166       --gc-sections
1167       --no-gc-sections
1168           Enable garbage collection of unused input sections.  It is ignored
1169           on targets that do not support this option.  The default behaviour
1170           (of not performing this garbage collection) can be restored by
1171           specifying --no-gc-sections on the command line.  Note that garbage
1172           collection for COFF and PE format targets is supported, but the
1173           implementation is currently considered to be experimental.
1174
1175           --gc-sections decides which input sections are used by examining
1176           symbols and relocations.  The section containing the entry symbol
1177           and all sections containing symbols undefined on the command-line
1178           will be kept, as will sections containing symbols referenced by
1179           dynamic objects.  Note that when building shared libraries, the
1180           linker must assume that any visible symbol is referenced.  Once
1181           this initial set of sections has been determined, the linker
1182           recursively marks as used any section referenced by their
1183           relocations.  See --entry, --undefined, and --gc-keep-exported.
1184
1185           This option can be set when doing a partial link (enabled with
1186           option -r).  In this case the root of symbols kept must be
1187           explicitly specified either by one of the options --entry,
1188           --undefined, or --gc-keep-exported or by a "ENTRY" command in the
1189           linker script.
1190
1191       --print-gc-sections
1192       --no-print-gc-sections
1193           List all sections removed by garbage collection.  The listing is
1194           printed on stderr.  This option is only effective if garbage
1195           collection has been enabled via the --gc-sections) option.  The
1196           default behaviour (of not listing the sections that are removed)
1197           can be restored by specifying --no-print-gc-sections on the command
1198           line.
1199
1200       --gc-keep-exported
1201           When --gc-sections is enabled, this option prevents garbage
1202           collection of unused input sections that contain global symbols
1203           having default or protected visibility.  This option is intended to
1204           be used for executables where unreferenced sections would otherwise
1205           be garbage collected regardless of the external visibility of
1206           contained symbols.  Note that this option has no effect when
1207           linking shared objects since it is already the default behaviour.
1208           This option is only supported for ELF format targets.
1209
1210       --print-output-format
1211           Print the name of the default output format (perhaps influenced by
1212           other command-line options).  This is the string that would appear
1213           in an "OUTPUT_FORMAT" linker script command.
1214
1215       --print-memory-usage
1216           Print used size, total size and used size of memory regions created
1217           with the MEMORY command.  This is useful on embedded targets to
1218           have a quick view of amount of free memory.  The format of the
1219           output has one headline and one line per region.  It is both human
1220           readable and easily parsable by tools.  Here is an example of an
1221           output:
1222
1223                   Memory region         Used Size  Region Size  %age Used
1224                                ROM:        256 KB         1 MB     25.00%
1225                                RAM:          32 B         2 GB      0.00%
1226
1227       --help
1228           Print a summary of the command-line options on the standard output
1229           and exit.
1230
1231       --target-help
1232           Print a summary of all target specific options on the standard
1233           output and exit.
1234
1235       -Map=mapfile
1236           Print a link map to the file mapfile.  See the description of the
1237           -M option, above.
1238
1239       --no-keep-memory
1240           ld normally optimizes for speed over memory usage by caching the
1241           symbol tables of input files in memory.  This option tells ld to
1242           instead optimize for memory usage, by rereading the symbol tables
1243           as necessary.  This may be required if ld runs out of memory space
1244           while linking a large executable.
1245
1246       --no-undefined
1247       -z defs
1248           Report unresolved symbol references from regular object files.
1249           This is done even if the linker is creating a non-symbolic shared
1250           library.  The switch --[no-]allow-shlib-undefined controls the
1251           behaviour for reporting unresolved references found in shared
1252           libraries being linked in.
1253
1254           The effects of this option can be reverted by using "-z undefs".
1255
1256       --allow-multiple-definition
1257       -z muldefs
1258           Normally when a symbol is defined multiple times, the linker will
1259           report a fatal error. These options allow multiple definitions and
1260           the first definition will be used.
1261
1262       --allow-shlib-undefined
1263       --no-allow-shlib-undefined
1264           Allows or disallows undefined symbols in shared libraries.  This
1265           switch is similar to --no-undefined except that it determines the
1266           behaviour when the undefined symbols are in a shared library rather
1267           than a regular object file.  It does not affect how undefined
1268           symbols in regular object files are handled.
1269
1270           The default behaviour is to report errors for any undefined symbols
1271           referenced in shared libraries if the linker is being used to
1272           create an executable, but to allow them if the linker is being used
1273           to create a shared library.
1274
1275           The reasons for allowing undefined symbol references in shared
1276           libraries specified at link time are that:
1277
1278           ·   A shared library specified at link time may not be the same as
1279               the one that is available at load time, so the symbol might
1280               actually be resolvable at load time.
1281
1282           ·   There are some operating systems, eg BeOS and HPPA, where
1283               undefined symbols in shared libraries are normal.
1284
1285               The BeOS kernel for example patches shared libraries at load
1286               time to select whichever function is most appropriate for the
1287               current architecture.  This is used, for example, to
1288               dynamically select an appropriate memset function.
1289
1290       --no-undefined-version
1291           Normally when a symbol has an undefined version, the linker will
1292           ignore it. This option disallows symbols with undefined version and
1293           a fatal error will be issued instead.
1294
1295       --default-symver
1296           Create and use a default symbol version (the soname) for
1297           unversioned exported symbols.
1298
1299       --default-imported-symver
1300           Create and use a default symbol version (the soname) for
1301           unversioned imported symbols.
1302
1303       --no-warn-mismatch
1304           Normally ld will give an error if you try to link together input
1305           files that are mismatched for some reason, perhaps because they
1306           have been compiled for different processors or for different
1307           endiannesses.  This option tells ld that it should silently permit
1308           such possible errors.  This option should only be used with care,
1309           in cases when you have taken some special action that ensures that
1310           the linker errors are inappropriate.
1311
1312       --no-warn-search-mismatch
1313           Normally ld will give a warning if it finds an incompatible library
1314           during a library search.  This option silences the warning.
1315
1316       --no-whole-archive
1317           Turn off the effect of the --whole-archive option for subsequent
1318           archive files.
1319
1320       --noinhibit-exec
1321           Retain the executable output file whenever it is still usable.
1322           Normally, the linker will not produce an output file if it
1323           encounters errors during the link process; it exits without writing
1324           an output file when it issues any error whatsoever.
1325
1326       -nostdlib
1327           Only search library directories explicitly specified on the command
1328           line.  Library directories specified in linker scripts (including
1329           linker scripts specified on the command line) are ignored.
1330
1331       --oformat=output-format
1332           ld may be configured to support more than one kind of object file.
1333           If your ld is configured this way, you can use the --oformat option
1334           to specify the binary format for the output object file.  Even when
1335           ld is configured to support alternative object formats, you don't
1336           usually need to specify this, as ld should be configured to produce
1337           as a default output format the most usual format on each machine.
1338           output-format is a text string, the name of a particular format
1339           supported by the BFD libraries.  (You can list the available binary
1340           formats with objdump -i.)  The script command "OUTPUT_FORMAT" can
1341           also specify the output format, but this option overrides it.
1342
1343       --out-implib file
1344           Create an import library in file corresponding to the executable
1345           the linker is generating (eg. a DLL or ELF program).  This import
1346           library (which should be called "*.dll.a" or "*.a" for DLLs) may be
1347           used to link clients against the generated executable; this
1348           behaviour makes it possible to skip a separate import library
1349           creation step (eg. "dlltool" for DLLs).  This option is only
1350           available for the i386 PE and ELF targetted ports of the linker.
1351
1352       -pie
1353       --pic-executable
1354           Create a position independent executable.  This is currently only
1355           supported on ELF platforms.  Position independent executables are
1356           similar to shared libraries in that they are relocated by the
1357           dynamic linker to the virtual address the OS chooses for them
1358           (which can vary between invocations).  Like normal dynamically
1359           linked executables they can be executed and symbols defined in the
1360           executable cannot be overridden by shared libraries.
1361
1362       -qmagic
1363           This option is ignored for Linux compatibility.
1364
1365       -Qy This option is ignored for SVR4 compatibility.
1366
1367       --relax
1368       --no-relax
1369           An option with machine dependent effects.  This option is only
1370           supported on a few targets.
1371
1372           On some platforms the --relax option performs target specific,
1373           global optimizations that become possible when the linker resolves
1374           addressing in the program, such as relaxing address modes,
1375           synthesizing new instructions, selecting shorter version of current
1376           instructions, and combining constant values.
1377
1378           On some platforms these link time global optimizations may make
1379           symbolic debugging of the resulting executable impossible.  This is
1380           known to be the case for the Matsushita MN10200 and MN10300 family
1381           of processors.
1382
1383           On platforms where this is not supported, --relax is accepted, but
1384           ignored.
1385
1386           On platforms where --relax is accepted the option --no-relax can be
1387           used to disable the feature.
1388
1389       --retain-symbols-file=filename
1390           Retain only the symbols listed in the file filename, discarding all
1391           others.  filename is simply a flat file, with one symbol name per
1392           line.  This option is especially useful in environments (such as
1393           VxWorks) where a large global symbol table is accumulated
1394           gradually, to conserve run-time memory.
1395
1396           --retain-symbols-file does not discard undefined symbols, or
1397           symbols needed for relocations.
1398
1399           You may only specify --retain-symbols-file once in the command
1400           line.  It overrides -s and -S.
1401
1402       -rpath=dir
1403           Add a directory to the runtime library search path.  This is used
1404           when linking an ELF executable with shared objects.  All -rpath
1405           arguments are concatenated and passed to the runtime linker, which
1406           uses them to locate shared objects at runtime.  The -rpath option
1407           is also used when locating shared objects which are needed by
1408           shared objects explicitly included in the link; see the description
1409           of the -rpath-link option.  If -rpath is not used when linking an
1410           ELF executable, the contents of the environment variable
1411           "LD_RUN_PATH" will be used if it is defined.
1412
1413           The -rpath option may also be used on SunOS.  By default, on SunOS,
1414           the linker will form a runtime search path out of all the -L
1415           options it is given.  If a -rpath option is used, the runtime
1416           search path will be formed exclusively using the -rpath options,
1417           ignoring the -L options.  This can be useful when using gcc, which
1418           adds many -L options which may be on NFS mounted file systems.
1419
1420           For compatibility with other ELF linkers, if the -R option is
1421           followed by a directory name, rather than a file name, it is
1422           treated as the -rpath option.
1423
1424       -rpath-link=dir
1425           When using ELF or SunOS, one shared library may require another.
1426           This happens when an "ld -shared" link includes a shared library as
1427           one of the input files.
1428
1429           When the linker encounters such a dependency when doing a non-
1430           shared, non-relocatable link, it will automatically try to locate
1431           the required shared library and include it in the link, if it is
1432           not included explicitly.  In such a case, the -rpath-link option
1433           specifies the first set of directories to search.  The -rpath-link
1434           option may specify a sequence of directory names either by
1435           specifying a list of names separated by colons, or by appearing
1436           multiple times.
1437
1438           The tokens $ORIGIN and $LIB can appear in these search directories.
1439           They will be replaced by the full path to the directory containing
1440           the program or shared object in the case of $ORIGIN and either lib
1441           - for 32-bit binaries - or lib64 - for 64-bit binaries - in the
1442           case of $LIB.
1443
1444           The alternative form of these tokens - ${ORIGIN} and ${LIB} can
1445           also be used.  The token $PLATFORM is not supported.
1446
1447           This option should be used with caution as it overrides the search
1448           path that may have been hard compiled into a shared library. In
1449           such a case it is possible to use unintentionally a different
1450           search path than the runtime linker would do.
1451
1452           The linker uses the following search paths to locate required
1453           shared libraries:
1454
1455           1.  Any directories specified by -rpath-link options.
1456
1457           2.  Any directories specified by -rpath options.  The difference
1458               between -rpath and -rpath-link is that directories specified by
1459               -rpath options are included in the executable and used at
1460               runtime, whereas the -rpath-link option is only effective at
1461               link time. Searching -rpath in this way is only supported by
1462               native linkers and cross linkers which have been configured
1463               with the --with-sysroot option.
1464
1465           3.  On an ELF system, for native linkers, if the -rpath and
1466               -rpath-link options were not used, search the contents of the
1467               environment variable "LD_RUN_PATH".
1468
1469           4.  On SunOS, if the -rpath option was not used, search any
1470               directories specified using -L options.
1471
1472           5.  For a native linker, search the contents of the environment
1473               variable "LD_LIBRARY_PATH".
1474
1475           6.  For a native ELF linker, the directories in "DT_RUNPATH" or
1476               "DT_RPATH" of a shared library are searched for shared
1477               libraries needed by it. The "DT_RPATH" entries are ignored if
1478               "DT_RUNPATH" entries exist.
1479
1480           7.  The default directories, normally /lib and /usr/lib.
1481
1482           8.  For a native linker on an ELF system, if the file
1483               /etc/ld.so.conf exists, the list of directories found in that
1484               file.
1485
1486           If the required shared library is not found, the linker will issue
1487           a warning and continue with the link.
1488
1489       -shared
1490       -Bshareable
1491           Create a shared library.  This is currently only supported on ELF,
1492           XCOFF and SunOS platforms.  On SunOS, the linker will automatically
1493           create a shared library if the -e option is not used and there are
1494           undefined symbols in the link.
1495
1496       --sort-common
1497       --sort-common=ascending
1498       --sort-common=descending
1499           This option tells ld to sort the common symbols by alignment in
1500           ascending or descending order when it places them in the
1501           appropriate output sections.  The symbol alignments considered are
1502           sixteen-byte or larger, eight-byte, four-byte, two-byte, and one-
1503           byte. This is to prevent gaps between symbols due to alignment
1504           constraints.  If no sorting order is specified, then descending
1505           order is assumed.
1506
1507       --sort-section=name
1508           This option will apply "SORT_BY_NAME" to all wildcard section
1509           patterns in the linker script.
1510
1511       --sort-section=alignment
1512           This option will apply "SORT_BY_ALIGNMENT" to all wildcard section
1513           patterns in the linker script.
1514
1515       --spare-dynamic-tags=count
1516           This option specifies the number of empty slots to leave in the
1517           .dynamic section of ELF shared objects.  Empty slots may be needed
1518           by post processing tools, such as the prelinker.  The default is 5.
1519
1520       --split-by-file[=size]
1521           Similar to --split-by-reloc but creates a new output section for
1522           each input file when size is reached.  size defaults to a size of 1
1523           if not given.
1524
1525       --split-by-reloc[=count]
1526           Tries to creates extra sections in the output file so that no
1527           single output section in the file contains more than count
1528           relocations.  This is useful when generating huge relocatable files
1529           for downloading into certain real time kernels with the COFF object
1530           file format; since COFF cannot represent more than 65535
1531           relocations in a single section.  Note that this will fail to work
1532           with object file formats which do not support arbitrary sections.
1533           The linker will not split up individual input sections for
1534           redistribution, so if a single input section contains more than
1535           count relocations one output section will contain that many
1536           relocations.  count defaults to a value of 32768.
1537
1538       --stats
1539           Compute and display statistics about the operation of the linker,
1540           such as execution time and memory usage.
1541
1542       --sysroot=directory
1543           Use directory as the location of the sysroot, overriding the
1544           configure-time default.  This option is only supported by linkers
1545           that were configured using --with-sysroot.
1546
1547       --task-link
1548           This is used by COFF/PE based targets to create a task-linked
1549           object file where all of the global symbols have been converted to
1550           statics.
1551
1552       --traditional-format
1553           For some targets, the output of ld is different in some ways from
1554           the output of some existing linker.  This switch requests ld to use
1555           the traditional format instead.
1556
1557           For example, on SunOS, ld combines duplicate entries in the symbol
1558           string table.  This can reduce the size of an output file with full
1559           debugging information by over 30 percent.  Unfortunately, the SunOS
1560           "dbx" program can not read the resulting program ("gdb" has no
1561           trouble).  The --traditional-format switch tells ld to not combine
1562           duplicate entries.
1563
1564       --section-start=sectionname=org
1565           Locate a section in the output file at the absolute address given
1566           by org.  You may use this option as many times as necessary to
1567           locate multiple sections in the command line.  org must be a single
1568           hexadecimal integer; for compatibility with other linkers, you may
1569           omit the leading 0x usually associated with hexadecimal values.
1570           Note: there should be no white space between sectionname, the
1571           equals sign ("="), and org.
1572
1573       -Tbss=org
1574       -Tdata=org
1575       -Ttext=org
1576           Same as --section-start, with ".bss", ".data" or ".text" as the
1577           sectionname.
1578
1579       -Ttext-segment=org
1580           When creating an ELF executable, it will set the address of the
1581           first byte of the text segment.
1582
1583       -Trodata-segment=org
1584           When creating an ELF executable or shared object for a target where
1585           the read-only data is in its own segment separate from the
1586           executable text, it will set the address of the first byte of the
1587           read-only data segment.
1588
1589       -Tldata-segment=org
1590           When creating an ELF executable or shared object for x86-64 medium
1591           memory model, it will set the address of the first byte of the
1592           ldata segment.
1593
1594       --unresolved-symbols=method
1595           Determine how to handle unresolved symbols.  There are four
1596           possible values for method:
1597
1598           ignore-all
1599               Do not report any unresolved symbols.
1600
1601           report-all
1602               Report all unresolved symbols.  This is the default.
1603
1604           ignore-in-object-files
1605               Report unresolved symbols that are contained in shared
1606               libraries, but ignore them if they come from regular object
1607               files.
1608
1609           ignore-in-shared-libs
1610               Report unresolved symbols that come from regular object files,
1611               but ignore them if they come from shared libraries.  This can
1612               be useful when creating a dynamic binary and it is known that
1613               all the shared libraries that it should be referencing are
1614               included on the linker's command line.
1615
1616           The behaviour for shared libraries on their own can also be
1617           controlled by the --[no-]allow-shlib-undefined option.
1618
1619           Normally the linker will generate an error message for each
1620           reported unresolved symbol but the option --warn-unresolved-symbols
1621           can change this to a warning.
1622
1623       --dll-verbose
1624       --verbose[=NUMBER]
1625           Display the version number for ld and list the linker emulations
1626           supported.  Display which input files can and cannot be opened.
1627           Display the linker script being used by the linker. If the optional
1628           NUMBER argument > 1, plugin symbol status will also be displayed.
1629
1630       --version-script=version-scriptfile
1631           Specify the name of a version script to the linker.  This is
1632           typically used when creating shared libraries to specify additional
1633           information about the version hierarchy for the library being
1634           created.  This option is only fully supported on ELF platforms
1635           which support shared libraries; see VERSION.  It is partially
1636           supported on PE platforms, which can use version scripts to filter
1637           symbol visibility in auto-export mode: any symbols marked local in
1638           the version script will not be exported.
1639
1640       --warn-common
1641           Warn when a common symbol is combined with another common symbol or
1642           with a symbol definition.  Unix linkers allow this somewhat sloppy
1643           practice, but linkers on some other operating systems do not.  This
1644           option allows you to find potential problems from combining global
1645           symbols.  Unfortunately, some C libraries use this practice, so you
1646           may get some warnings about symbols in the libraries as well as in
1647           your programs.
1648
1649           There are three kinds of global symbols, illustrated here by C
1650           examples:
1651
1652           int i = 1;
1653               A definition, which goes in the initialized data section of the
1654               output file.
1655
1656           extern int i;
1657               An undefined reference, which does not allocate space.  There
1658               must be either a definition or a common symbol for the variable
1659               somewhere.
1660
1661           int i;
1662               A common symbol.  If there are only (one or more) common
1663               symbols for a variable, it goes in the uninitialized data area
1664               of the output file.  The linker merges multiple common symbols
1665               for the same variable into a single symbol.  If they are of
1666               different sizes, it picks the largest size.  The linker turns a
1667               common symbol into a declaration, if there is a definition of
1668               the same variable.
1669
1670           The --warn-common option can produce five kinds of warnings.  Each
1671           warning consists of a pair of lines: the first describes the symbol
1672           just encountered, and the second describes the previous symbol
1673           encountered with the same name.  One or both of the two symbols
1674           will be a common symbol.
1675
1676           1.  Turning a common symbol into a reference, because there is
1677               already a definition for the symbol.
1678
1679                       <file>(<section>): warning: common of `<symbol>'
1680                          overridden by definition
1681                       <file>(<section>): warning: defined here
1682
1683           2.  Turning a common symbol into a reference, because a later
1684               definition for the symbol is encountered.  This is the same as
1685               the previous case, except that the symbols are encountered in a
1686               different order.
1687
1688                       <file>(<section>): warning: definition of `<symbol>'
1689                          overriding common
1690                       <file>(<section>): warning: common is here
1691
1692           3.  Merging a common symbol with a previous same-sized common
1693               symbol.
1694
1695                       <file>(<section>): warning: multiple common
1696                          of `<symbol>'
1697                       <file>(<section>): warning: previous common is here
1698
1699           4.  Merging a common symbol with a previous larger common symbol.
1700
1701                       <file>(<section>): warning: common of `<symbol>'
1702                          overridden by larger common
1703                       <file>(<section>): warning: larger common is here
1704
1705           5.  Merging a common symbol with a previous smaller common symbol.
1706               This is the same as the previous case, except that the symbols
1707               are encountered in a different order.
1708
1709                       <file>(<section>): warning: common of `<symbol>'
1710                          overriding smaller common
1711                       <file>(<section>): warning: smaller common is here
1712
1713       --warn-constructors
1714           Warn if any global constructors are used.  This is only useful for
1715           a few object file formats.  For formats like COFF or ELF, the
1716           linker can not detect the use of global constructors.
1717
1718       --warn-multiple-gp
1719           Warn if multiple global pointer values are required in the output
1720           file.  This is only meaningful for certain processors, such as the
1721           Alpha.  Specifically, some processors put large-valued constants in
1722           a special section.  A special register (the global pointer) points
1723           into the middle of this section, so that constants can be loaded
1724           efficiently via a base-register relative addressing mode.  Since
1725           the offset in base-register relative mode is fixed and relatively
1726           small (e.g., 16 bits), this limits the maximum size of the constant
1727           pool.  Thus, in large programs, it is often necessary to use
1728           multiple global pointer values in order to be able to address all
1729           possible constants.  This option causes a warning to be issued
1730           whenever this case occurs.
1731
1732       --warn-once
1733           Only warn once for each undefined symbol, rather than once per
1734           module which refers to it.
1735
1736       --warn-section-align
1737           Warn if the address of an output section is changed because of
1738           alignment.  Typically, the alignment will be set by an input
1739           section.  The address will only be changed if it not explicitly
1740           specified; that is, if the "SECTIONS" command does not specify a
1741           start address for the section.
1742
1743       --warn-shared-textrel
1744           Warn if the linker adds a DT_TEXTREL to a shared object.
1745
1746       --warn-alternate-em
1747           Warn if an object has alternate ELF machine code.
1748
1749       --warn-unresolved-symbols
1750           If the linker is going to report an unresolved symbol (see the
1751           option --unresolved-symbols) it will normally generate an error.
1752           This option makes it generate a warning instead.
1753
1754       --error-unresolved-symbols
1755           This restores the linker's default behaviour of generating errors
1756           when it is reporting unresolved symbols.
1757
1758       --whole-archive
1759           For each archive mentioned on the command line after the
1760           --whole-archive option, include every object file in the archive in
1761           the link, rather than searching the archive for the required object
1762           files.  This is normally used to turn an archive file into a shared
1763           library, forcing every object to be included in the resulting
1764           shared library.  This option may be used more than once.
1765
1766           Two notes when using this option from gcc: First, gcc doesn't know
1767           about this option, so you have to use -Wl,-whole-archive.  Second,
1768           don't forget to use -Wl,-no-whole-archive after your list of
1769           archives, because gcc will add its own list of archives to your
1770           link and you may not want this flag to affect those as well.
1771
1772       --wrap=symbol
1773           Use a wrapper function for symbol.  Any undefined reference to
1774           symbol will be resolved to "__wrap_symbol".  Any undefined
1775           reference to "__real_symbol" will be resolved to symbol.
1776
1777           This can be used to provide a wrapper for a system function.  The
1778           wrapper function should be called "__wrap_symbol".  If it wishes to
1779           call the system function, it should call "__real_symbol".
1780
1781           Here is a trivial example:
1782
1783                   void *
1784                   __wrap_malloc (size_t c)
1785                   {
1786                     printf ("malloc called with %zu\n", c);
1787                     return __real_malloc (c);
1788                   }
1789
1790           If you link other code with this file using --wrap malloc, then all
1791           calls to "malloc" will call the function "__wrap_malloc" instead.
1792           The call to "__real_malloc" in "__wrap_malloc" will call the real
1793           "malloc" function.
1794
1795           You may wish to provide a "__real_malloc" function as well, so that
1796           links without the --wrap option will succeed.  If you do this, you
1797           should not put the definition of "__real_malloc" in the same file
1798           as "__wrap_malloc"; if you do, the assembler may resolve the call
1799           before the linker has a chance to wrap it to "malloc".
1800
1801           Only undefined references are replaced by the linker.  So,
1802           translation unit internal references to symbol are not resolved to
1803           "__wrap_symbol".  In the next example, the call to "f" in "g" is
1804           not resolved to "__wrap_f".
1805
1806                   int
1807                   f (void)
1808                   {
1809                     return 123;
1810                   }
1811
1812                   int
1813                   g (void)
1814                   {
1815                     return f();
1816                   }
1817
1818       --eh-frame-hdr
1819       --no-eh-frame-hdr
1820           Request (--eh-frame-hdr) or suppress (--no-eh-frame-hdr) the
1821           creation of ".eh_frame_hdr" section and ELF "PT_GNU_EH_FRAME"
1822           segment header.
1823
1824       --no-ld-generated-unwind-info
1825           Request creation of ".eh_frame" unwind info for linker generated
1826           code sections like PLT.  This option is on by default if linker
1827           generated unwind info is supported.
1828
1829       --enable-new-dtags
1830       --disable-new-dtags
1831           This linker can create the new dynamic tags in ELF. But the older
1832           ELF systems may not understand them. If you specify
1833           --enable-new-dtags, the new dynamic tags will be created as needed
1834           and older dynamic tags will be omitted.  If you specify
1835           --disable-new-dtags, no new dynamic tags will be created. By
1836           default, the new dynamic tags are not created. Note that those
1837           options are only available for ELF systems.
1838
1839       --hash-size=number
1840           Set the default size of the linker's hash tables to a prime number
1841           close to number.  Increasing this value can reduce the length of
1842           time it takes the linker to perform its tasks, at the expense of
1843           increasing the linker's memory requirements.  Similarly reducing
1844           this value can reduce the memory requirements at the expense of
1845           speed.
1846
1847       --hash-style=style
1848           Set the type of linker's hash table(s).  style can be either "sysv"
1849           for classic ELF ".hash" section, "gnu" for new style GNU
1850           ".gnu.hash" section or "both" for both the classic ELF ".hash" and
1851           new style GNU ".gnu.hash" hash tables.  The default depends upon
1852           how the linker was configured, but for most Linux based systems it
1853           will be "both".
1854
1855       --compress-debug-sections=none
1856       --compress-debug-sections=zlib
1857       --compress-debug-sections=zlib-gnu
1858       --compress-debug-sections=zlib-gabi
1859           On ELF platforms, these options control how DWARF debug sections
1860           are compressed using zlib.
1861
1862           --compress-debug-sections=none doesn't compress DWARF debug
1863           sections.  --compress-debug-sections=zlib-gnu compresses DWARF
1864           debug sections and renames them to begin with .zdebug instead of
1865           .debug.  --compress-debug-sections=zlib-gabi also compresses DWARF
1866           debug sections, but rather than renaming them it sets the
1867           SHF_COMPRESSED flag in the sections' headers.
1868
1869           The --compress-debug-sections=zlib option is an alias for
1870           --compress-debug-sections=zlib-gabi.
1871
1872           Note that this option overrides any compression in input debug
1873           sections, so if a binary is linked with
1874           --compress-debug-sections=none for example, then any compressed
1875           debug sections in input files will be uncompressed before they are
1876           copied into the output binary.
1877
1878           The default compression behaviour varies depending upon the target
1879           involved and the configure options used to build the toolchain.
1880           The default can be determined by examining the output from the
1881           linker's --help option.
1882
1883       --reduce-memory-overheads
1884           This option reduces memory requirements at ld runtime, at the
1885           expense of linking speed.  This was introduced to select the old
1886           O(n^2) algorithm for link map file generation, rather than the new
1887           O(n) algorithm which uses about 40% more memory for symbol storage.
1888
1889           Another effect of the switch is to set the default hash table size
1890           to 1021, which again saves memory at the cost of lengthening the
1891           linker's run time.  This is not done however if the --hash-size
1892           switch has been used.
1893
1894           The --reduce-memory-overheads switch may be also be used to enable
1895           other tradeoffs in future versions of the linker.
1896
1897       --build-id
1898       --build-id=style
1899           Request the creation of a ".note.gnu.build-id" ELF note section or
1900           a ".buildid" COFF section.  The contents of the note are unique
1901           bits identifying this linked file.  style can be "uuid" to use 128
1902           random bits, "sha1" to use a 160-bit SHA1 hash on the normative
1903           parts of the output contents, "md5" to use a 128-bit MD5 hash on
1904           the normative parts of the output contents, or "0xhexstring" to use
1905           a chosen bit string specified as an even number of hexadecimal
1906           digits ("-" and ":" characters between digit pairs are ignored).
1907           If style is omitted, "sha1" is used.
1908
1909           The "md5" and "sha1" styles produces an identifier that is always
1910           the same in an identical output file, but will be unique among all
1911           nonidentical output files.  It is not intended to be compared as a
1912           checksum for the file's contents.  A linked file may be changed
1913           later by other tools, but the build ID bit string identifying the
1914           original linked file does not change.
1915
1916           Passing "none" for style disables the setting from any "--build-id"
1917           options earlier on the command line.
1918
1919       The i386 PE linker supports the -shared option, which causes the output
1920       to be a dynamically linked library (DLL) instead of a normal
1921       executable.  You should name the output "*.dll" when you use this
1922       option.  In addition, the linker fully supports the standard "*.def"
1923       files, which may be specified on the linker command line like an object
1924       file (in fact, it should precede archives it exports symbols from, to
1925       ensure that they get linked in, just like a normal object file).
1926
1927       In addition to the options common to all targets, the i386 PE linker
1928       support additional command-line options that are specific to the i386
1929       PE target.  Options that take values may be separated from their values
1930       by either a space or an equals sign.
1931
1932       --add-stdcall-alias
1933           If given, symbols with a stdcall suffix (@nn) will be exported as-
1934           is and also with the suffix stripped.  [This option is specific to
1935           the i386 PE targeted port of the linker]
1936
1937       --base-file file
1938           Use file as the name of a file in which to save the base addresses
1939           of all the relocations needed for generating DLLs with dlltool.
1940           [This is an i386 PE specific option]
1941
1942       --dll
1943           Create a DLL instead of a regular executable.  You may also use
1944           -shared or specify a "LIBRARY" in a given ".def" file.  [This
1945           option is specific to the i386 PE targeted port of the linker]
1946
1947       --enable-long-section-names
1948       --disable-long-section-names
1949           The PE variants of the COFF object format add an extension that
1950           permits the use of section names longer than eight characters, the
1951           normal limit for COFF.  By default, these names are only allowed in
1952           object files, as fully-linked executable images do not carry the
1953           COFF string table required to support the longer names.  As a GNU
1954           extension, it is possible to allow their use in executable images
1955           as well, or to (probably pointlessly!)  disallow it in object
1956           files, by using these two options.  Executable images generated
1957           with these long section names are slightly non-standard, carrying
1958           as they do a string table, and may generate confusing output when
1959           examined with non-GNU PE-aware tools, such as file viewers and
1960           dumpers.  However, GDB relies on the use of PE long section names
1961           to find Dwarf-2 debug information sections in an executable image
1962           at runtime, and so if neither option is specified on the command-
1963           line, ld will enable long section names, overriding the default and
1964           technically correct behaviour, when it finds the presence of debug
1965           information while linking an executable image and not stripping
1966           symbols.  [This option is valid for all PE targeted ports of the
1967           linker]
1968
1969       --enable-stdcall-fixup
1970       --disable-stdcall-fixup
1971           If the link finds a symbol that it cannot resolve, it will attempt
1972           to do "fuzzy linking" by looking for another defined symbol that
1973           differs only in the format of the symbol name (cdecl vs stdcall)
1974           and will resolve that symbol by linking to the match.  For example,
1975           the undefined symbol "_foo" might be linked to the function
1976           "_foo@12", or the undefined symbol "_bar@16" might be linked to the
1977           function "_bar".  When the linker does this, it prints a warning,
1978           since it normally should have failed to link, but sometimes import
1979           libraries generated from third-party dlls may need this feature to
1980           be usable.  If you specify --enable-stdcall-fixup, this feature is
1981           fully enabled and warnings are not printed.  If you specify
1982           --disable-stdcall-fixup, this feature is disabled and such
1983           mismatches are considered to be errors.  [This option is specific
1984           to the i386 PE targeted port of the linker]
1985
1986       --leading-underscore
1987       --no-leading-underscore
1988           For most targets default symbol-prefix is an underscore and is
1989           defined in target's description. By this option it is possible to
1990           disable/enable the default underscore symbol-prefix.
1991
1992       --export-all-symbols
1993           If given, all global symbols in the objects used to build a DLL
1994           will be exported by the DLL.  Note that this is the default if
1995           there otherwise wouldn't be any exported symbols.  When symbols are
1996           explicitly exported via DEF files or implicitly exported via
1997           function attributes, the default is to not export anything else
1998           unless this option is given.  Note that the symbols "DllMain@12",
1999           "DllEntryPoint@0", "DllMainCRTStartup@12", and "impure_ptr" will
2000           not be automatically exported.  Also, symbols imported from other
2001           DLLs will not be re-exported, nor will symbols specifying the DLL's
2002           internal layout such as those beginning with "_head_" or ending
2003           with "_iname".  In addition, no symbols from "libgcc", "libstd++",
2004           "libmingw32", or "crtX.o" will be exported.  Symbols whose names
2005           begin with "__rtti_" or "__builtin_" will not be exported, to help
2006           with C++ DLLs.  Finally, there is an extensive list of cygwin-
2007           private symbols that are not exported (obviously, this applies on
2008           when building DLLs for cygwin targets).  These cygwin-excludes are:
2009           "_cygwin_dll_entry@12", "_cygwin_crt0_common@8",
2010           "_cygwin_noncygwin_dll_entry@12", "_fmode", "_impure_ptr",
2011           "cygwin_attach_dll", "cygwin_premain0", "cygwin_premain1",
2012           "cygwin_premain2", "cygwin_premain3", and "environ".  [This option
2013           is specific to the i386 PE targeted port of the linker]
2014
2015       --exclude-symbols symbol,symbol,...
2016           Specifies a list of symbols which should not be automatically
2017           exported.  The symbol names may be delimited by commas or colons.
2018           [This option is specific to the i386 PE targeted port of the
2019           linker]
2020
2021       --exclude-all-symbols
2022           Specifies no symbols should be automatically exported.  [This
2023           option is specific to the i386 PE targeted port of the linker]
2024
2025       --file-alignment
2026           Specify the file alignment.  Sections in the file will always begin
2027           at file offsets which are multiples of this number.  This defaults
2028           to 512.  [This option is specific to the i386 PE targeted port of
2029           the linker]
2030
2031       --heap reserve
2032       --heap reserve,commit
2033           Specify the number of bytes of memory to reserve (and optionally
2034           commit) to be used as heap for this program.  The default is 1MB
2035           reserved, 4K committed.  [This option is specific to the i386 PE
2036           targeted port of the linker]
2037
2038       --image-base value
2039           Use value as the base address of your program or dll.  This is the
2040           lowest memory location that will be used when your program or dll
2041           is loaded.  To reduce the need to relocate and improve performance
2042           of your dlls, each should have a unique base address and not
2043           overlap any other dlls.  The default is 0x400000 for executables,
2044           and 0x10000000 for dlls.  [This option is specific to the i386 PE
2045           targeted port of the linker]
2046
2047       --kill-at
2048           If given, the stdcall suffixes (@nn) will be stripped from symbols
2049           before they are exported.  [This option is specific to the i386 PE
2050           targeted port of the linker]
2051
2052       --large-address-aware
2053           If given, the appropriate bit in the "Characteristics" field of the
2054           COFF header is set to indicate that this executable supports
2055           virtual addresses greater than 2 gigabytes.  This should be used in
2056           conjunction with the /3GB or /USERVA=value megabytes switch in the
2057           "[operating systems]" section of the BOOT.INI.  Otherwise, this bit
2058           has no effect.  [This option is specific to PE targeted ports of
2059           the linker]
2060
2061       --disable-large-address-aware
2062           Reverts the effect of a previous --large-address-aware option.
2063           This is useful if --large-address-aware is always set by the
2064           compiler driver (e.g. Cygwin gcc) and the executable does not
2065           support virtual addresses greater than 2 gigabytes.  [This option
2066           is specific to PE targeted ports of the linker]
2067
2068       --major-image-version value
2069           Sets the major number of the "image version".  Defaults to 1.
2070           [This option is specific to the i386 PE targeted port of the
2071           linker]
2072
2073       --major-os-version value
2074           Sets the major number of the "os version".  Defaults to 4.  [This
2075           option is specific to the i386 PE targeted port of the linker]
2076
2077       --major-subsystem-version value
2078           Sets the major number of the "subsystem version".  Defaults to 4.
2079           [This option is specific to the i386 PE targeted port of the
2080           linker]
2081
2082       --minor-image-version value
2083           Sets the minor number of the "image version".  Defaults to 0.
2084           [This option is specific to the i386 PE targeted port of the
2085           linker]
2086
2087       --minor-os-version value
2088           Sets the minor number of the "os version".  Defaults to 0.  [This
2089           option is specific to the i386 PE targeted port of the linker]
2090
2091       --minor-subsystem-version value
2092           Sets the minor number of the "subsystem version".  Defaults to 0.
2093           [This option is specific to the i386 PE targeted port of the
2094           linker]
2095
2096       --output-def file
2097           The linker will create the file file which will contain a DEF file
2098           corresponding to the DLL the linker is generating.  This DEF file
2099           (which should be called "*.def") may be used to create an import
2100           library with "dlltool" or may be used as a reference to
2101           automatically or implicitly exported symbols.  [This option is
2102           specific to the i386 PE targeted port of the linker]
2103
2104       --enable-auto-image-base
2105       --enable-auto-image-base=value
2106           Automatically choose the image base for DLLs, optionally starting
2107           with base value, unless one is specified using the "--image-base"
2108           argument.  By using a hash generated from the dllname to create
2109           unique image bases for each DLL, in-memory collisions and
2110           relocations which can delay program execution are avoided.  [This
2111           option is specific to the i386 PE targeted port of the linker]
2112
2113       --disable-auto-image-base
2114           Do not automatically generate a unique image base.  If there is no
2115           user-specified image base ("--image-base") then use the platform
2116           default.  [This option is specific to the i386 PE targeted port of
2117           the linker]
2118
2119       --dll-search-prefix string
2120           When linking dynamically to a dll without an import library, search
2121           for "<string><basename>.dll" in preference to "lib<basename>.dll".
2122           This behaviour allows easy distinction between DLLs built for the
2123           various "subplatforms": native, cygwin, uwin, pw, etc.  For
2124           instance, cygwin DLLs typically use "--dll-search-prefix=cyg".
2125           [This option is specific to the i386 PE targeted port of the
2126           linker]
2127
2128       --enable-auto-import
2129           Do sophisticated linking of "_symbol" to "__imp__symbol" for DATA
2130           imports from DLLs, thus making it possible to bypass the dllimport
2131           mechanism on the user side and to reference unmangled symbol names.
2132           [This option is specific to the i386 PE targeted port of the
2133           linker]
2134
2135           The following remarks pertain to the original implementation of the
2136           feature and are obsolete nowadays for Cygwin and MinGW targets.
2137
2138           Note: Use of the 'auto-import' extension will cause the text
2139           section of the image file to be made writable. This does not
2140           conform to the PE-COFF format specification published by Microsoft.
2141
2142           Note - use of the 'auto-import' extension will also cause read only
2143           data which would normally be placed into the .rdata section to be
2144           placed into the .data section instead.  This is in order to work
2145           around a problem with consts that is described here:
2146           http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
2147
2148           Using 'auto-import' generally will 'just work' -- but sometimes you
2149           may see this message:
2150
2151           "variable '<var>' can't be auto-imported. Please read the
2152           documentation for ld's "--enable-auto-import" for details."
2153
2154           This message occurs when some (sub)expression accesses an address
2155           ultimately given by the sum of two constants (Win32 import tables
2156           only allow one).  Instances where this may occur include accesses
2157           to member fields of struct variables imported from a DLL, as well
2158           as using a constant index into an array variable imported from a
2159           DLL.  Any multiword variable (arrays, structs, long long, etc) may
2160           trigger this error condition.  However, regardless of the exact
2161           data type of the offending exported variable, ld will always detect
2162           it, issue the warning, and exit.
2163
2164           There are several ways to address this difficulty, regardless of
2165           the data type of the exported variable:
2166
2167           One way is to use --enable-runtime-pseudo-reloc switch. This leaves
2168           the task of adjusting references in your client code for runtime
2169           environment, so this method works only when runtime environment
2170           supports this feature.
2171
2172           A second solution is to force one of the 'constants' to be a
2173           variable -- that is, unknown and un-optimizable at compile time.
2174           For arrays, there are two possibilities: a) make the indexee (the
2175           array's address) a variable, or b) make the 'constant' index a
2176           variable.  Thus:
2177
2178                   extern type extern_array[];
2179                   extern_array[1] -->
2180                      { volatile type *t=extern_array; t[1] }
2181
2182           or
2183
2184                   extern type extern_array[];
2185                   extern_array[1] -->
2186                      { volatile int t=1; extern_array[t] }
2187
2188           For structs (and most other multiword data types) the only option
2189           is to make the struct itself (or the long long, or the ...)
2190           variable:
2191
2192                   extern struct s extern_struct;
2193                   extern_struct.field -->
2194                      { volatile struct s *t=&extern_struct; t->field }
2195
2196           or
2197
2198                   extern long long extern_ll;
2199                   extern_ll -->
2200                     { volatile long long * local_ll=&extern_ll; *local_ll }
2201
2202           A third method of dealing with this difficulty is to abandon
2203           'auto-import' for the offending symbol and mark it with
2204           "__declspec(dllimport)".  However, in practice that requires using
2205           compile-time #defines to indicate whether you are building a DLL,
2206           building client code that will link to the DLL, or merely
2207           building/linking to a static library.   In making the choice
2208           between the various methods of resolving the 'direct address with
2209           constant offset' problem, you should consider typical real-world
2210           usage:
2211
2212           Original:
2213
2214                   --foo.h
2215                   extern int arr[];
2216                   --foo.c
2217                   #include "foo.h"
2218                   void main(int argc, char **argv){
2219                     printf("%d\n",arr[1]);
2220                   }
2221
2222           Solution 1:
2223
2224                   --foo.h
2225                   extern int arr[];
2226                   --foo.c
2227                   #include "foo.h"
2228                   void main(int argc, char **argv){
2229                     /* This workaround is for win32 and cygwin; do not "optimize" */
2230                     volatile int *parr = arr;
2231                     printf("%d\n",parr[1]);
2232                   }
2233
2234           Solution 2:
2235
2236                   --foo.h
2237                   /* Note: auto-export is assumed (no __declspec(dllexport)) */
2238                   #if (defined(_WIN32) || defined(__CYGWIN__)) && \
2239                     !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
2240                   #define FOO_IMPORT __declspec(dllimport)
2241                   #else
2242                   #define FOO_IMPORT
2243                   #endif
2244                   extern FOO_IMPORT int arr[];
2245                   --foo.c
2246                   #include "foo.h"
2247                   void main(int argc, char **argv){
2248                     printf("%d\n",arr[1]);
2249                   }
2250
2251           A fourth way to avoid this problem is to re-code your library to
2252           use a functional interface rather than a data interface for the
2253           offending variables (e.g. set_foo() and get_foo() accessor
2254           functions).
2255
2256       --disable-auto-import
2257           Do not attempt to do sophisticated linking of "_symbol" to
2258           "__imp__symbol" for DATA imports from DLLs.  [This option is
2259           specific to the i386 PE targeted port of the linker]
2260
2261       --enable-runtime-pseudo-reloc
2262           If your code contains expressions described in --enable-auto-import
2263           section, that is, DATA imports from DLL with non-zero offset, this
2264           switch will create a vector of 'runtime pseudo relocations' which
2265           can be used by runtime environment to adjust references to such
2266           data in your client code.  [This option is specific to the i386 PE
2267           targeted port of the linker]
2268
2269       --disable-runtime-pseudo-reloc
2270           Do not create pseudo relocations for non-zero offset DATA imports
2271           from DLLs.  [This option is specific to the i386 PE targeted port
2272           of the linker]
2273
2274       --enable-extra-pe-debug
2275           Show additional debug info related to auto-import symbol thunking.
2276           [This option is specific to the i386 PE targeted port of the
2277           linker]
2278
2279       --section-alignment
2280           Sets the section alignment.  Sections in memory will always begin
2281           at addresses which are a multiple of this number.  Defaults to
2282           0x1000.  [This option is specific to the i386 PE targeted port of
2283           the linker]
2284
2285       --stack reserve
2286       --stack reserve,commit
2287           Specify the number of bytes of memory to reserve (and optionally
2288           commit) to be used as stack for this program.  The default is 2MB
2289           reserved, 4K committed.  [This option is specific to the i386 PE
2290           targeted port of the linker]
2291
2292       --subsystem which
2293       --subsystem which:major
2294       --subsystem which:major.minor
2295           Specifies the subsystem under which your program will execute.  The
2296           legal values for which are "native", "windows", "console", "posix",
2297           and "xbox".  You may optionally set the subsystem version also.
2298           Numeric values are also accepted for which.  [This option is
2299           specific to the i386 PE targeted port of the linker]
2300
2301           The following options set flags in the "DllCharacteristics" field
2302           of the PE file header: [These options are specific to PE targeted
2303           ports of the linker]
2304
2305       --high-entropy-va
2306           Image is compatible with 64-bit address space layout randomization
2307           (ASLR).
2308
2309       --dynamicbase
2310           The image base address may be relocated using address space layout
2311           randomization (ASLR).  This feature was introduced with MS Windows
2312           Vista for i386 PE targets.
2313
2314       --forceinteg
2315           Code integrity checks are enforced.
2316
2317       --nxcompat
2318           The image is compatible with the Data Execution Prevention.  This
2319           feature was introduced with MS Windows XP SP2 for i386 PE targets.
2320
2321       --no-isolation
2322           Although the image understands isolation, do not isolate the image.
2323
2324       --no-seh
2325           The image does not use SEH. No SE handler may be called from this
2326           image.
2327
2328       --no-bind
2329           Do not bind this image.
2330
2331       --wdmdriver
2332           The driver uses the MS Windows Driver Model.
2333
2334       --tsaware
2335           The image is Terminal Server aware.
2336
2337       --insert-timestamp
2338       --no-insert-timestamp
2339           Insert a real timestamp into the image.  This is the default
2340           behaviour as it matches legacy code and it means that the image
2341           will work with other, proprietary tools.  The problem with this
2342           default is that it will result in slightly different images being
2343           produced each time the same sources are linked.  The option
2344           --no-insert-timestamp can be used to insert a zero value for the
2345           timestamp, this ensuring that binaries produced from identical
2346           sources will compare identically.
2347
2348       The C6X uClinux target uses a binary format called DSBT to support
2349       shared libraries.  Each shared library in the system needs to have a
2350       unique index; all executables use an index of 0.
2351
2352       --dsbt-size size
2353           This option sets the number of entries in the DSBT of the current
2354           executable or shared library to size.  The default is to create a
2355           table with 64 entries.
2356
2357       --dsbt-index index
2358           This option sets the DSBT index of the current executable or shared
2359           library to index.  The default is 0, which is appropriate for
2360           generating executables.  If a shared library is generated with a
2361           DSBT index of 0, the "R_C6000_DSBT_INDEX" relocs are copied into
2362           the output file.
2363
2364           The --no-merge-exidx-entries switch disables the merging of
2365           adjacent exidx entries in frame unwind info.
2366
2367       --branch-stub
2368           This option enables linker branch relaxation by inserting branch
2369           stub sections when needed to extend the range of branches.  This
2370           option is usually not required since C-SKY supports branch and call
2371           instructions that can access the full memory range and branch
2372           relaxation is normally handled by the compiler or assembler.
2373
2374       --stub-group-size=N
2375           This option allows finer control of linker branch stub creation.
2376           It sets the maximum size of a group of input sections that can be
2377           handled by one stub section.  A negative value of N locates stub
2378           sections after their branches, while a positive value allows stub
2379           sections to appear either before or after the branches.  Values of
2380           1 or -1 indicate that the linker should choose suitable defaults.
2381
2382       The 68HC11 and 68HC12 linkers support specific options to control the
2383       memory bank switching mapping and trampoline code generation.
2384
2385       --no-trampoline
2386           This option disables the generation of trampoline. By default a
2387           trampoline is generated for each far function which is called using
2388           a "jsr" instruction (this happens when a pointer to a far function
2389           is taken).
2390
2391       --bank-window name
2392           This option indicates to the linker the name of the memory region
2393           in the MEMORY specification that describes the memory bank window.
2394           The definition of such region is then used by the linker to compute
2395           paging and addresses within the memory window.
2396
2397       The following options are supported to control handling of GOT
2398       generation when linking for 68K targets.
2399
2400       --got=type
2401           This option tells the linker which GOT generation scheme to use.
2402           type should be one of single, negative, multigot or target.  For
2403           more information refer to the Info entry for ld.
2404
2405       The following options are supported to control microMIPS instruction
2406       generation and branch relocation checks for ISA mode transitions when
2407       linking for MIPS targets.
2408
2409       --insn32
2410       --no-insn32
2411           These options control the choice of microMIPS instructions used in
2412           code generated by the linker, such as that in the PLT or lazy
2413           binding stubs, or in relaxation.  If --insn32 is used, then the
2414           linker only uses 32-bit instruction encodings.  By default or if
2415           --no-insn32 is used, all instruction encodings are used, including
2416           16-bit ones where possible.
2417
2418       --ignore-branch-isa
2419       --no-ignore-branch-isa
2420           These options control branch relocation checks for invalid ISA mode
2421           transitions.  If --ignore-branch-isa is used, then the linker
2422           accepts any branch relocations and any ISA mode transition required
2423           is lost in relocation calculation, except for some cases of "BAL"
2424           instructions which meet relaxation conditions and are converted to
2425           equivalent "JALX" instructions as the associated relocation is
2426           calculated.  By default or if --no-ignore-branch-isa is used a
2427           check is made causing the loss of an ISA mode transition to produce
2428           an error.
2429

ENVIRONMENT

2431       You can change the behaviour of ld with the environment variables
2432       "GNUTARGET", "LDEMULATION" and "COLLECT_NO_DEMANGLE".
2433
2434       "GNUTARGET" determines the input-file object format if you don't use -b
2435       (or its synonym --format).  Its value should be one of the BFD names
2436       for an input format.  If there is no "GNUTARGET" in the environment, ld
2437       uses the natural format of the target. If "GNUTARGET" is set to
2438       "default" then BFD attempts to discover the input format by examining
2439       binary input files; this method often succeeds, but there are potential
2440       ambiguities, since there is no method of ensuring that the magic number
2441       used to specify object-file formats is unique.  However, the
2442       configuration procedure for BFD on each system places the conventional
2443       format for that system first in the search-list, so ambiguities are
2444       resolved in favor of convention.
2445
2446       "LDEMULATION" determines the default emulation if you don't use the -m
2447       option.  The emulation can affect various aspects of linker behaviour,
2448       particularly the default linker script.  You can list the available
2449       emulations with the --verbose or -V options.  If the -m option is not
2450       used, and the "LDEMULATION" environment variable is not defined, the
2451       default emulation depends upon how the linker was configured.
2452
2453       Normally, the linker will default to demangling symbols.  However, if
2454       "COLLECT_NO_DEMANGLE" is set in the environment, then it will default
2455       to not demangling symbols.  This environment variable is used in a
2456       similar fashion by the "gcc" linker wrapper program.  The default may
2457       be overridden by the --demangle and --no-demangle options.
2458

SEE ALSO

2460       ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and the Info entries
2461       for binutils and ld.
2462
2464       Copyright (c) 1991-2019 Free Software Foundation, Inc.
2465
2466       Permission is granted to copy, distribute and/or modify this document
2467       under the terms of the GNU Free Documentation License, Version 1.3 or
2468       any later version published by the Free Software Foundation; with no
2469       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
2470       Texts.  A copy of the license is included in the section entitled "GNU
2471       Free Documentation License".
2472
2473
2474
2475binutils-2.32                     2019-02-02                             LD(1)
Impressum