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

ENVIRONMENT

2984       You can change the behaviour of ld with the environment variables
2985       "GNUTARGET", "LDEMULATION" and "COLLECT_NO_DEMANGLE".
2986
2987       "GNUTARGET" determines the input-file object format if you don't use -b
2988       (or its synonym --format).  Its value should be one of the BFD names
2989       for an input format.  If there is no "GNUTARGET" in the environment, ld
2990       uses the natural format of the target. If "GNUTARGET" is set to
2991       "default" then BFD attempts to discover the input format by examining
2992       binary input files; this method often succeeds, but there are potential
2993       ambiguities, since there is no method of ensuring that the magic number
2994       used to specify object-file formats is unique.  However, the
2995       configuration procedure for BFD on each system places the conventional
2996       format for that system first in the search-list, so ambiguities are
2997       resolved in favor of convention.
2998
2999       "LDEMULATION" determines the default emulation if you don't use the -m
3000       option.  The emulation can affect various aspects of linker behaviour,
3001       particularly the default linker script.  You can list the available
3002       emulations with the --verbose or -V options.  If the -m option is not
3003       used, and the "LDEMULATION" environment variable is not defined, the
3004       default emulation depends upon how the linker was configured.
3005
3006       Normally, the linker will default to demangling symbols.  However, if
3007       "COLLECT_NO_DEMANGLE" is set in the environment, then it will default
3008       to not demangling symbols.  This environment variable is used in a
3009       similar fashion by the "gcc" linker wrapper program.  The default may
3010       be overridden by the --demangle and --no-demangle options.
3011

SEE ALSO

3013       ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and the Info entries
3014       for binutils and ld.
3015
3017       Copyright (c) 1991-2023 Free Software Foundation, Inc.
3018
3019       Permission is granted to copy, distribute and/or modify this document
3020       under the terms of the GNU Free Documentation License, Version 1.3 or
3021       any later version published by the Free Software Foundation; with no
3022       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
3023       Texts.  A copy of the license is included in the section entitled "GNU
3024       Free Documentation License".
3025
3026
3027
3028binutils-2.41                     2023-07-30                             LD(1)
Impressum