1LD(1) GNU Development Tools LD(1)
2
3
4
6 ld - The GNU linker
7
9 ld [options] objfile ...
10
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
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 -A architecture
146 --architecture=architecture
147 In the current release of ld, this option is useful only for the
148 Intel 960 family of architectures. In that ld configuration, the
149 architecture argument identifies the particular architecture in the
150 960 family, enabling some safeguards and modifying the archive-
151 library search path.
152
153 Future releases of ld may support similar functionality for other
154 architecture families.
155
156 -b input-format
157 --format=input-format
158 ld may be configured to support more than one kind of object file.
159 If your ld is configured this way, you can use the -b option to
160 specify the binary format for input object files that follow this
161 option on the command line. Even when ld is configured to support
162 alternative object formats, you don't usually need to specify this,
163 as ld should be configured to expect as a default input format the
164 most usual format on each machine. input-format is a text string,
165 the name of a particular format supported by the BFD libraries.
166 (You can list the available binary formats with objdump -i.)
167
168 You may want to use this option if you are linking files with an
169 unusual binary format. You can also use -b to switch formats
170 explicitly (when linking object files of different formats), by
171 including -b input-format before each group of object files in a
172 particular format.
173
174 The default format is taken from the environment variable
175 "GNUTARGET".
176
177 You can also define the input format from a script, using the
178 command "TARGET";
179
180 -c MRI-commandfile
181 --mri-script=MRI-commandfile
182 For compatibility with linkers produced by MRI, ld accepts script
183 files written in an alternate, restricted command language,
184 described in the MRI Compatible Script Files section of GNU ld
185 documentation. Introduce MRI script files with the option -c; use
186 the -T option to run linker scripts written in the general-purpose
187 ld scripting language. If MRI-cmdfile does not exist, ld looks for
188 it in the directories specified by any -L options.
189
190 -d
191 -dc
192 -dp These three options are equivalent; multiple forms are supported
193 for compatibility with other linkers. They assign space to common
194 symbols even if a relocatable output file is specified (with -r).
195 The script command "FORCE_COMMON_ALLOCATION" has the same effect.
196
197 -e entry
198 --entry=entry
199 Use entry as the explicit symbol for beginning execution of your
200 program, rather than the default entry point. If there is no
201 symbol named entry, the linker will try to parse entry as a number,
202 and use that as the entry address (the number will be interpreted
203 in base 10; you may use a leading 0x for base 16, or a leading 0
204 for base 8).
205
206 --exclude-libs lib,lib,...
207 Specifies a list of archive libraries from which symbols should not
208 be automatically exported. The library names may be delimited by
209 commas or colons. Specifying "--exclude-libs ALL" excludes symbols
210 in all archive libraries from automatic export. This option is
211 available only for the i386 PE targeted port of the linker and for
212 ELF targeted ports. For i386 PE, symbols explicitly listed in a
213 .def file are still exported, regardless of this option. For ELF
214 targeted ports, symbols affected by this option will be treated as
215 hidden.
216
217 --exclude-modules-for-implib module,module,...
218 Specifies a list of object files or archive members, from which
219 symbols should not be automatically exported, but which should be
220 copied wholesale into the import library being generated during the
221 link. The module names may be delimited by commas or colons, and
222 must match exactly the filenames used by ld to open the files; for
223 archive members, this is simply the member name, but for object
224 files the name listed must include and match precisely any path
225 used to specify the input file on the linker's command-line. This
226 option is available only for the i386 PE targeted port of the
227 linker. Symbols explicitly listed in a .def file are still
228 exported, regardless of this option.
229
230 -E
231 --export-dynamic
232 --no-export-dynamic
233 When creating a dynamically linked executable, using the -E option
234 or the --export-dynamic option causes the linker to add all symbols
235 to the dynamic symbol table. The dynamic symbol table is the set
236 of symbols which are visible from dynamic objects at run time.
237
238 If you do not use either of these options (or use the
239 --no-export-dynamic option to restore the default behavior), the
240 dynamic symbol table will normally contain only those symbols which
241 are referenced by some dynamic object mentioned in the link.
242
243 If you use "dlopen" to load a dynamic object which needs to refer
244 back to the symbols defined by the program, rather than some other
245 dynamic object, then you will probably need to use this option when
246 linking the program itself.
247
248 You can also use the dynamic list to control what symbols should be
249 added to the dynamic symbol table if the output format supports it.
250 See the description of --dynamic-list.
251
252 Note that this option is specific to ELF targeted ports. PE
253 targets support a similar function to export all symbols from a DLL
254 or EXE; see the description of --export-all-symbols below.
255
256 -EB Link big-endian objects. This affects the default output format.
257
258 -EL Link little-endian objects. This affects the default output
259 format.
260
261 -f name
262 --auxiliary=name
263 When creating an ELF shared object, set the internal DT_AUXILIARY
264 field to the specified name. This tells the dynamic linker that
265 the symbol table of the shared object should be used as an
266 auxiliary filter on the symbol table of the shared object name.
267
268 If you later link a program against this filter object, then, when
269 you run the program, the dynamic linker will see the DT_AUXILIARY
270 field. If the dynamic linker resolves any symbols from the filter
271 object, it will first check whether there is a definition in the
272 shared object name. If there is one, it will be used instead of
273 the definition in the filter object. The shared object name need
274 not exist. Thus the shared object name may be used to provide an
275 alternative implementation of certain functions, perhaps for
276 debugging or for machine specific performance.
277
278 This option may be specified more than once. The DT_AUXILIARY
279 entries will be created in the order in which they appear on the
280 command line.
281
282 -F name
283 --filter=name
284 When creating an ELF shared object, set the internal DT_FILTER
285 field to the specified name. This tells the dynamic linker that
286 the symbol table of the shared object which is being created should
287 be used as a filter on the symbol table of the shared object name.
288
289 If you later link a program against this filter object, then, when
290 you run the program, the dynamic linker will see the DT_FILTER
291 field. The dynamic linker will resolve symbols according to the
292 symbol table of the filter object as usual, but it will actually
293 link to the definitions found in the shared object name. Thus the
294 filter object can be used to select a subset of the symbols
295 provided by the object name.
296
297 Some older linkers used the -F option throughout a compilation
298 toolchain for specifying object-file format for both input and
299 output object files. The GNU linker uses other mechanisms for this
300 purpose: the -b, --format, --oformat options, the "TARGET" command
301 in linker scripts, and the "GNUTARGET" environment variable. The
302 GNU linker will ignore the -F option when not creating an ELF
303 shared object.
304
305 -fini=name
306 When creating an ELF executable or shared object, call NAME when
307 the executable or shared object is unloaded, by setting DT_FINI to
308 the address of the function. By default, the linker uses "_fini"
309 as the function to call.
310
311 -g Ignored. Provided for compatibility with other tools.
312
313 -G value
314 --gpsize=value
315 Set the maximum size of objects to be optimized using the GP
316 register to size. This is only meaningful for object file formats
317 such as MIPS ECOFF which supports putting large and small objects
318 into different sections. This is ignored for other object file
319 formats.
320
321 -h name
322 -soname=name
323 When creating an ELF shared object, set the internal DT_SONAME
324 field to the specified name. When an executable is linked with a
325 shared object which has a DT_SONAME field, then when the executable
326 is run the dynamic linker will attempt to load the shared object
327 specified by the DT_SONAME field rather than the using the file
328 name given to the linker.
329
330 -i Perform an incremental link (same as option -r).
331
332 -init=name
333 When creating an ELF executable or shared object, call NAME when
334 the executable or shared object is loaded, by setting DT_INIT to
335 the address of the function. By default, the linker uses "_init"
336 as the function to call.
337
338 -l namespec
339 --library=namespec
340 Add the archive or object file specified by namespec to the list of
341 files to link. This option may be used any number of times. If
342 namespec is of the form :filename, ld will search the library path
343 for a file called filename, otherwise it will search the library
344 path for a file called libnamespec.a.
345
346 On systems which support shared libraries, ld may also search for
347 files other than libnamespec.a. Specifically, on ELF and SunOS
348 systems, ld will search a directory for a library called
349 libnamespec.so before searching for one called libnamespec.a. (By
350 convention, a ".so" extension indicates a shared library.) Note
351 that this behavior does not apply to :filename, which always
352 specifies a file called filename.
353
354 The linker will search an archive only once, at the location where
355 it is specified on the command line. If the archive defines a
356 symbol which was undefined in some object which appeared before the
357 archive on the command line, the linker will include the
358 appropriate file(s) from the archive. However, an undefined symbol
359 in an object appearing later on the command line will not cause the
360 linker to search the archive again.
361
362 See the -( option for a way to force the linker to search archives
363 multiple times.
364
365 You may list the same archive multiple times on the command line.
366
367 This type of archive searching is standard for Unix linkers.
368 However, if you are using ld on AIX, note that it is different from
369 the behaviour of the AIX linker.
370
371 -L searchdir
372 --library-path=searchdir
373 Add path searchdir to the list of paths that ld will search for
374 archive libraries and ld control scripts. You may use this option
375 any number of times. The directories are searched in the order in
376 which they are specified on the command line. Directories
377 specified on the command line are searched before the default
378 directories. All -L options apply to all -l options, regardless of
379 the order in which the options appear. -L options do not affect
380 how ld searches for a linker script unless -T option is specified.
381
382 If searchdir begins with "=", then the "=" will be replaced by the
383 sysroot prefix, a path specified when the linker is configured.
384
385 The default set of paths searched (without being specified with -L)
386 depends on which emulation mode ld is using, and in some cases also
387 on how it was configured.
388
389 The paths can also be specified in a link script with the
390 "SEARCH_DIR" command. Directories specified this way are searched
391 at the point in which the linker script appears in the command
392 line.
393
394 -m emulation
395 Emulate the emulation linker. You can list the available
396 emulations with the --verbose or -V options.
397
398 If the -m option is not used, the emulation is taken from the
399 "LDEMULATION" environment variable, if that is defined.
400
401 Otherwise, the default emulation depends upon how the linker was
402 configured.
403
404 -M
405 --print-map
406 Print a link map to the standard output. A link map provides
407 information about the link, including the following:
408
409 · Where object files are mapped into memory.
410
411 · How common symbols are allocated.
412
413 · All archive members included in the link, with a mention of the
414 symbol which caused the archive member to be brought in.
415
416 · The values assigned to symbols.
417
418 Note - symbols whose values are computed by an expression which
419 involves a reference to a previous value of the same symbol may
420 not have correct result displayed in the link map. This is
421 because the linker discards intermediate results and only
422 retains the final value of an expression. Under such
423 circumstances the linker will display the final value enclosed
424 by square brackets. Thus for example a linker script
425 containing:
426
427 foo = 1
428 foo = foo * 4
429 foo = foo + 8
430
431 will produce the following output in the link map if the -M
432 option is used:
433
434 0x00000001 foo = 0x1
435 [0x0000000c] foo = (foo * 0x4)
436 [0x0000000c] foo = (foo + 0x8)
437
438 See Expressions for more information about expressions in
439 linker scripts.
440
441 -n
442 --nmagic
443 Turn off page alignment of sections, and mark the output as
444 "NMAGIC" if possible.
445
446 -N
447 --omagic
448 Set the text and data sections to be readable and writable. Also,
449 do not page-align the data segment, and disable linking against
450 shared libraries. If the output format supports Unix style magic
451 numbers, mark the output as "OMAGIC". Note: Although a writable
452 text section is allowed for PE-COFF targets, it does not conform to
453 the format specification published by Microsoft.
454
455 --no-omagic
456 This option negates most of the effects of the -N option. It sets
457 the text section to be read-only, and forces the data segment to be
458 page-aligned. Note - this option does not enable linking against
459 shared libraries. Use -Bdynamic for this.
460
461 -o output
462 --output=output
463 Use output as the name for the program produced by ld; if this
464 option is not specified, the name a.out is used by default. The
465 script command "OUTPUT" can also specify the output file name.
466
467 -O level
468 If level is a numeric values greater than zero ld optimizes the
469 output. This might take significantly longer and therefore
470 probably should only be enabled for the final binary. At the
471 moment this option only affects ELF shared library generation.
472 Future releases of the linker may make more use of this option.
473 Also currently there is no difference in the linker's behaviour for
474 different non-zero values of this option. Again this may change
475 with future releases.
476
477 -q
478 --emit-relocs
479 Leave relocation sections and contents in fully linked executables.
480 Post link analysis and optimization tools may need this information
481 in order to perform correct modifications of executables. This
482 results in larger executables.
483
484 This option is currently only supported on ELF platforms.
485
486 --force-dynamic
487 Force the output file to have dynamic sections. This option is
488 specific to VxWorks targets.
489
490 -r
491 --relocatable
492 Generate relocatable output---i.e., generate an output file that
493 can in turn serve as input to ld. This is often called partial
494 linking. As a side effect, in environments that support standard
495 Unix magic numbers, this option also sets the output file's magic
496 number to "OMAGIC". If this option is not specified, an absolute
497 file is produced. When linking C++ programs, this option will not
498 resolve references to constructors; to do that, use -Ur.
499
500 When an input file does not have the same format as the output
501 file, partial linking is only supported if that input file does not
502 contain any relocations. Different output formats can have further
503 restrictions; for example some "a.out"-based formats do not support
504 partial linking with input files in other formats at all.
505
506 This option does the same thing as -i.
507
508 -R filename
509 --just-symbols=filename
510 Read symbol names and their addresses from filename, but do not
511 relocate it or include it in the output. This allows your output
512 file to refer symbolically to absolute locations of memory defined
513 in other programs. You may use this option more than once.
514
515 For compatibility with other ELF linkers, if the -R option is
516 followed by a directory name, rather than a file name, it is
517 treated as the -rpath option.
518
519 -s
520 --strip-all
521 Omit all symbol information from the output file.
522
523 -S
524 --strip-debug
525 Omit debugger symbol information (but not all symbols) from the
526 output file.
527
528 -t
529 --trace
530 Print the names of the input files as ld processes them.
531
532 -T scriptfile
533 --script=scriptfile
534 Use scriptfile as the linker script. This script replaces ld's
535 default linker script (rather than adding to it), so commandfile
536 must specify everything necessary to describe the output file.
537 If scriptfile does not exist in the current directory, "ld" looks
538 for it in the directories specified by any preceding -L options.
539 Multiple -T options accumulate.
540
541 -dT scriptfile
542 --default-script=scriptfile
543 Use scriptfile as the default linker script.
544
545 This option is similar to the --script option except that
546 processing of the script is delayed until after the rest of the
547 command line has been processed. This allows options placed after
548 the --default-script option on the command line to affect the
549 behaviour of the linker script, which can be important when the
550 linker command line cannot be directly controlled by the user. (eg
551 because the command line is being constructed by another tool, such
552 as gcc).
553
554 -u symbol
555 --undefined=symbol
556 Force symbol to be entered in the output file as an undefined
557 symbol. Doing this may, for example, trigger linking of additional
558 modules from standard libraries. -u may be repeated with different
559 option arguments to enter additional undefined symbols. This
560 option is equivalent to the "EXTERN" linker script command.
561
562 -Ur For anything other than C++ programs, this option is equivalent to
563 -r: it generates relocatable output---i.e., an output file that can
564 in turn serve as input to ld. When linking C++ programs, -Ur does
565 resolve references to constructors, unlike -r. It does not work to
566 use -Ur on files that were themselves linked with -Ur; once the
567 constructor table has been built, it cannot be added to. Use -Ur
568 only for the last partial link, and -r for the others.
569
570 --unique[=SECTION]
571 Creates a separate output section for every input section matching
572 SECTION, or if the optional wildcard SECTION argument is missing,
573 for every orphan input section. An orphan section is one not
574 specifically mentioned in a linker script. You may use this option
575 multiple times on the command line; It prevents the normal merging
576 of input sections with the same name, overriding output section
577 assignments in a linker script.
578
579 -v
580 --version
581 -V Display the version number for ld. The -V option also lists the
582 supported emulations.
583
584 -x
585 --discard-all
586 Delete all local symbols.
587
588 -X
589 --discard-locals
590 Delete all temporary local symbols. (These symbols start with
591 system-specific local label prefixes, typically .L for ELF systems
592 or L for traditional a.out systems.)
593
594 -y symbol
595 --trace-symbol=symbol
596 Print the name of each linked file in which symbol appears. This
597 option may be given any number of times. On many systems it is
598 necessary to prepend an underscore.
599
600 This option is useful when you have an undefined symbol in your
601 link but don't know where the reference is coming from.
602
603 -Y path
604 Add path to the default library search path. This option exists
605 for Solaris compatibility.
606
607 -z keyword
608 The recognized keywords are:
609
610 combreloc
611 Combines multiple reloc sections and sorts them to make dynamic
612 symbol lookup caching possible.
613
614 defs
615 Disallows undefined symbols in object files. Undefined symbols
616 in shared libraries are still allowed.
617
618 execstack
619 Marks the object as requiring executable stack.
620
621 initfirst
622 This option is only meaningful when building a shared object.
623 It marks the object so that its runtime initialization will
624 occur before the runtime initialization of any other objects
625 brought into the process at the same time. Similarly the
626 runtime finalization of the object will occur after the runtime
627 finalization of any other objects.
628
629 interpose
630 Marks the object that its symbol table interposes before all
631 symbols but the primary executable.
632
633 lazy
634 When generating an executable or shared library, mark it to
635 tell the dynamic linker to defer function call resolution to
636 the point when the function is called (lazy binding), rather
637 than at load time. Lazy binding is the default.
638
639 loadfltr
640 Marks the object that its filters be processed immediately at
641 runtime.
642
643 muldefs
644 Allows multiple definitions.
645
646 nocombreloc
647 Disables multiple reloc sections combining.
648
649 nocopyreloc
650 Disables production of copy relocs.
651
652 nodefaultlib
653 Marks the object that the search for dependencies of this
654 object will ignore any default library search paths.
655
656 nodelete
657 Marks the object shouldn't be unloaded at runtime.
658
659 nodlopen
660 Marks the object not available to "dlopen".
661
662 nodump
663 Marks the object can not be dumped by "dldump".
664
665 noexecstack
666 Marks the object as not requiring executable stack.
667
668 norelro
669 Don't create an ELF "PT_GNU_RELRO" segment header in the
670 object.
671
672 now When generating an executable or shared library, mark it to
673 tell the dynamic linker to resolve all symbols when the program
674 is started, or when the shared library is linked to using
675 dlopen, instead of deferring function call resolution to the
676 point when the function is first called.
677
678 origin
679 Marks the object may contain $ORIGIN.
680
681 relro
682 Create an ELF "PT_GNU_RELRO" segment header in the object.
683
684 max-page-size=value
685 Set the emulation maximum page size to value.
686
687 common-page-size=value
688 Set the emulation common page size to value.
689
690 Other keywords are ignored for Solaris compatibility.
691
692 -( archives -)
693 --start-group archives --end-group
694 The archives should be a list of archive files. They may be either
695 explicit file names, or -l options.
696
697 The specified archives are searched repeatedly until no new
698 undefined references are created. Normally, an archive is searched
699 only once in the order that it is specified on the command line.
700 If a symbol in that archive is needed to resolve an undefined
701 symbol referred to by an object in an archive that appears later on
702 the command line, the linker would not be able to resolve that
703 reference. By grouping the archives, they all be searched
704 repeatedly until all possible references are resolved.
705
706 Using this option has a significant performance cost. It is best
707 to use it only when there are unavoidable circular references
708 between two or more archives.
709
710 --accept-unknown-input-arch
711 --no-accept-unknown-input-arch
712 Tells the linker to accept input files whose architecture cannot be
713 recognised. The assumption is that the user knows what they are
714 doing and deliberately wants to link in these unknown input files.
715 This was the default behaviour of the linker, before release 2.14.
716 The default behaviour from release 2.14 onwards is to reject such
717 input files, and so the --accept-unknown-input-arch option has been
718 added to restore the old behaviour.
719
720 --as-needed
721 --no-as-needed
722 This option affects ELF DT_NEEDED tags for dynamic libraries
723 mentioned on the command line after the --as-needed option.
724 Normally, the linker will add a DT_NEEDED tag for each dynamic
725 library mentioned on the command line, regardless of whether the
726 library is actually needed. --as-needed causes a DT_NEEDED tag to
727 only be emitted for a library that satisfies a symbol reference
728 from regular objects which is undefined at the point that the
729 library was linked, or, if the library is not found in the
730 DT_NEEDED lists of other libraries linked up to that point, a
731 reference from another dynamic library. --no-as-needed restores
732 the default behaviour.
733
734 --add-needed
735 --no-add-needed
736 This option affects the treatment of dynamic libraries from ELF
737 DT_NEEDED tags in dynamic libraries mentioned on the command line
738 after the --no-add-needed option. Normally, the linker will add a
739 DT_NEEDED tag for each dynamic library from DT_NEEDED tags.
740 --no-add-needed causes DT_NEEDED tags will never be emitted for
741 those libraries from DT_NEEDED tags. --add-needed restores the
742 default behaviour.
743
744 -assert keyword
745 This option is ignored for SunOS compatibility.
746
747 -Bdynamic
748 -dy
749 -call_shared
750 Link against dynamic libraries. This is only meaningful on
751 platforms for which shared libraries are supported. This option is
752 normally the default on such platforms. The different variants of
753 this option are for compatibility with various systems. You may
754 use this option multiple times on the command line: it affects
755 library searching for -l options which follow it.
756
757 -Bgroup
758 Set the "DF_1_GROUP" flag in the "DT_FLAGS_1" entry in the dynamic
759 section. This causes the runtime linker to handle lookups in this
760 object and its dependencies to be performed only inside the group.
761 --unresolved-symbols=report-all is implied. This option is only
762 meaningful on ELF platforms which support shared libraries.
763
764 -Bstatic
765 -dn
766 -non_shared
767 -static
768 Do not link against shared libraries. This is only meaningful on
769 platforms for which shared libraries are supported. The different
770 variants of this option are for compatibility with various systems.
771 You may use this option multiple times on the command line: it
772 affects library searching for -l options which follow it. This
773 option also implies --unresolved-symbols=report-all. This option
774 can be used with -shared. Doing so means that a shared library is
775 being created but that all of the library's external references
776 must be resolved by pulling in entries from static libraries.
777
778 -Bsymbolic
779 When creating a shared library, bind references to global symbols
780 to the definition within the shared library, if any. Normally, it
781 is possible for a program linked against a shared library to
782 override the definition within the shared library. This option is
783 only meaningful on ELF platforms which support shared libraries.
784
785 -Bsymbolic-functions
786 When creating a shared library, bind references to global function
787 symbols to the definition within the shared library, if any. This
788 option is only meaningful on ELF platforms which support shared
789 libraries.
790
791 --dynamic-list=dynamic-list-file
792 Specify the name of a dynamic list file to the linker. This is
793 typically used when creating shared libraries to specify a list of
794 global symbols whose references shouldn't be bound to the
795 definition within the shared library, or creating dynamically
796 linked executables to specify a list of symbols which should be
797 added to the symbol table in the executable. This option is only
798 meaningful on ELF platforms which support shared libraries.
799
800 The format of the dynamic list is the same as the version node
801 without scope and node name. See VERSION for more information.
802
803 --dynamic-list-data
804 Include all global data symbols to the dynamic list.
805
806 --dynamic-list-cpp-new
807 Provide the builtin dynamic list for C++ operator new and delete.
808 It is mainly useful for building shared libstdc++.
809
810 --dynamic-list-cpp-typeinfo
811 Provide the builtin dynamic list for C++ runtime type
812 identification.
813
814 --check-sections
815 --no-check-sections
816 Asks the linker not to check section addresses after they have been
817 assigned to see if there are any overlaps. Normally the linker
818 will perform this check, and if it finds any overlaps it will
819 produce suitable error messages. The linker does know about, and
820 does make allowances for sections in overlays. The default
821 behaviour can be restored by using the command line switch
822 --check-sections. Section overlap is not usually checked for
823 relocatable links. You can force checking in that case by using
824 the --check-sections option.
825
826 --cref
827 Output a cross reference table. If a linker map file is being
828 generated, the cross reference table is printed to the map file.
829 Otherwise, it is printed on the standard output.
830
831 The format of the table is intentionally simple, so that it may be
832 easily processed by a script if necessary. The symbols are printed
833 out, sorted by name. For each symbol, a list of file names is
834 given. If the symbol is defined, the first file listed is the
835 location of the definition. The remaining files contain references
836 to the symbol.
837
838 --no-define-common
839 This option inhibits the assignment of addresses to common symbols.
840 The script command "INHIBIT_COMMON_ALLOCATION" has the same effect.
841
842 The --no-define-common option allows decoupling the decision to
843 assign addresses to Common symbols from the choice of the output
844 file type; otherwise a non-Relocatable output type forces assigning
845 addresses to Common symbols. Using --no-define-common allows
846 Common symbols that are referenced from a shared library to be
847 assigned addresses only in the main program. This eliminates the
848 unused duplicate space in the shared library, and also prevents any
849 possible confusion over resolving to the wrong duplicate when there
850 are many dynamic modules with specialized search paths for runtime
851 symbol resolution.
852
853 --defsym=symbol=expression
854 Create a global symbol in the output file, containing the absolute
855 address given by expression. You may use this option as many times
856 as necessary to define multiple symbols in the command line. A
857 limited form of arithmetic is supported for the expression in this
858 context: you may give a hexadecimal constant or the name of an
859 existing symbol, or use "+" and "-" to add or subtract hexadecimal
860 constants or symbols. If you need more elaborate expressions,
861 consider using the linker command language from a script. Note:
862 there should be no white space between symbol, the equals sign
863 ("="), and expression.
864
865 --demangle[=style]
866 --no-demangle
867 These options control whether to demangle symbol names in error
868 messages and other output. When the linker is told to demangle, it
869 tries to present symbol names in a readable fashion: it strips
870 leading underscores if they are used by the object file format, and
871 converts C++ mangled symbol names into user readable names.
872 Different compilers have different mangling styles. The optional
873 demangling style argument can be used to choose an appropriate
874 demangling style for your compiler. The linker will demangle by
875 default unless the environment variable COLLECT_NO_DEMANGLE is set.
876 These options may be used to override the default.
877
878 -Ifile
879 --dynamic-linker=file
880 Set the name of the dynamic linker. This is only meaningful when
881 generating dynamically linked ELF executables. The default dynamic
882 linker is normally correct; don't use this unless you know what you
883 are doing.
884
885 --fatal-warnings
886 --no-fatal-warnings
887 Treat all warnings as errors. The default behaviour can be
888 restored with the option --no-fatal-warnings.
889
890 --force-exe-suffix
891 Make sure that an output file has a .exe suffix.
892
893 If a successfully built fully linked output file does not have a
894 ".exe" or ".dll" suffix, this option forces the linker to copy the
895 output file to one of the same name with a ".exe" suffix. This
896 option is useful when using unmodified Unix makefiles on a
897 Microsoft Windows host, since some versions of Windows won't run an
898 image unless it ends in a ".exe" suffix.
899
900 --gc-sections
901 --no-gc-sections
902 Enable garbage collection of unused input sections. It is ignored
903 on targets that do not support this option. The default behaviour
904 (of not performing this garbage collection) can be restored by
905 specifying --no-gc-sections on the command line.
906
907 --gc-sections decides which input sections are used by examining
908 symbols and relocations. The section containing the entry symbol
909 and all sections containing symbols undefined on the command-line
910 will be kept, as will sections containing symbols referenced by
911 dynamic objects. Note that when building shared libraries, the
912 linker must assume that any visible symbol is referenced. Once
913 this initial set of sections has been determined, the linker
914 recursively marks as used any section referenced by their
915 relocations. See --entry and --undefined.
916
917 This option can be set when doing a partial link (enabled with
918 option -r). In this case the root of symbols kept must be
919 explicitely specified either by an --entry or --undefined option or
920 by a "ENTRY" command in the linker script.
921
922 --print-gc-sections
923 --no-print-gc-sections
924 List all sections removed by garbage collection. The listing is
925 printed on stderr. This option is only effective if garbage
926 collection has been enabled via the --gc-sections) option. The
927 default behaviour (of not listing the sections that are removed)
928 can be restored by specifying --no-print-gc-sections on the command
929 line.
930
931 --help
932 Print a summary of the command-line options on the standard output
933 and exit.
934
935 --target-help
936 Print a summary of all target specific options on the standard
937 output and exit.
938
939 -Map=mapfile
940 Print a link map to the file mapfile. See the description of the
941 -M option, above.
942
943 --no-keep-memory
944 ld normally optimizes for speed over memory usage by caching the
945 symbol tables of input files in memory. This option tells ld to
946 instead optimize for memory usage, by rereading the symbol tables
947 as necessary. This may be required if ld runs out of memory space
948 while linking a large executable.
949
950 --no-undefined
951 -z defs
952 Report unresolved symbol references from regular object files.
953 This is done even if the linker is creating a non-symbolic shared
954 library. The switch --[no-]allow-shlib-undefined controls the
955 behaviour for reporting unresolved references found in shared
956 libraries being linked in.
957
958 --allow-multiple-definition
959 -z muldefs
960 Normally when a symbol is defined multiple times, the linker will
961 report a fatal error. These options allow multiple definitions and
962 the first definition will be used.
963
964 --allow-shlib-undefined
965 --no-allow-shlib-undefined
966 Allows or disallows undefined symbols in shared libraries. This
967 switch is similar to --no-undefined except that it determines the
968 behaviour when the undefined symbols are in a shared library rather
969 than a regular object file. It does not affect how undefined
970 symbols in regular object files are handled.
971
972 The default behaviour is to report errors for any undefined symbols
973 referenced in shared libraries if the linker is being used to
974 create an executable, but to allow them if the linker is being used
975 to create a shared library.
976
977 The reasons for allowing undefined symbol references in shared
978 libraries specified at link time are that:
979
980 · A shared library specified at link time may not be the same as
981 the one that is available at load time, so the symbol might
982 actually be resolvable at load time.
983
984 · There are some operating systems, eg BeOS and HPPA, where
985 undefined symbols in shared libraries are normal.
986
987 The BeOS kernel for example patches shared libraries at load
988 time to select whichever function is most appropriate for the
989 current architecture. This is used, for example, to
990 dynamically select an appropriate memset function.
991
992 --no-undefined-version
993 Normally when a symbol has an undefined version, the linker will
994 ignore it. This option disallows symbols with undefined version and
995 a fatal error will be issued instead.
996
997 --default-symver
998 Create and use a default symbol version (the soname) for
999 unversioned exported symbols.
1000
1001 --default-imported-symver
1002 Create and use a default symbol version (the soname) for
1003 unversioned imported symbols.
1004
1005 --no-warn-mismatch
1006 Normally ld will give an error if you try to link together input
1007 files that are mismatched for some reason, perhaps because they
1008 have been compiled for different processors or for different
1009 endiannesses. This option tells ld that it should silently permit
1010 such possible errors. This option should only be used with care,
1011 in cases when you have taken some special action that ensures that
1012 the linker errors are inappropriate.
1013
1014 --no-warn-search-mismatch
1015 Normally ld will give a warning if it finds an incompatible library
1016 during a library search. This option silences the warning.
1017
1018 --no-whole-archive
1019 Turn off the effect of the --whole-archive option for subsequent
1020 archive files.
1021
1022 --noinhibit-exec
1023 Retain the executable output file whenever it is still usable.
1024 Normally, the linker will not produce an output file if it
1025 encounters errors during the link process; it exits without writing
1026 an output file when it issues any error whatsoever.
1027
1028 -nostdlib
1029 Only search library directories explicitly specified on the command
1030 line. Library directories specified in linker scripts (including
1031 linker scripts specified on the command line) are ignored.
1032
1033 --oformat=output-format
1034 ld may be configured to support more than one kind of object file.
1035 If your ld is configured this way, you can use the --oformat option
1036 to specify the binary format for the output object file. Even when
1037 ld is configured to support alternative object formats, you don't
1038 usually need to specify this, as ld should be configured to produce
1039 as a default output format the most usual format on each machine.
1040 output-format is a text string, the name of a particular format
1041 supported by the BFD libraries. (You can list the available binary
1042 formats with objdump -i.) The script command "OUTPUT_FORMAT" can
1043 also specify the output format, but this option overrides it.
1044
1045 -pie
1046 --pic-executable
1047 Create a position independent executable. This is currently only
1048 supported on ELF platforms. Position independent executables are
1049 similar to shared libraries in that they are relocated by the
1050 dynamic linker to the virtual address the OS chooses for them
1051 (which can vary between invocations). Like normal dynamically
1052 linked executables they can be executed and symbols defined in the
1053 executable cannot be overridden by shared libraries.
1054
1055 -qmagic
1056 This option is ignored for Linux compatibility.
1057
1058 -Qy This option is ignored for SVR4 compatibility.
1059
1060 --relax
1061 An option with machine dependent effects. This option is only
1062 supported on a few targets.
1063
1064 On some platforms, the --relax option performs global optimizations
1065 that become possible when the linker resolves addressing in the
1066 program, such as relaxing address modes and synthesizing new
1067 instructions in the output object file.
1068
1069 On some platforms these link time global optimizations may make
1070 symbolic debugging of the resulting executable impossible. This is
1071 known to be the case for the Matsushita MN10200 and MN10300 family
1072 of processors.
1073
1074 On platforms where this is not supported, --relax is accepted, but
1075 ignored.
1076
1077 --retain-symbols-file=filename
1078 Retain only the symbols listed in the file filename, discarding all
1079 others. filename is simply a flat file, with one symbol name per
1080 line. This option is especially useful in environments (such as
1081 VxWorks) where a large global symbol table is accumulated
1082 gradually, to conserve run-time memory.
1083
1084 --retain-symbols-file does not discard undefined symbols, or
1085 symbols needed for relocations.
1086
1087 You may only specify --retain-symbols-file once in the command
1088 line. It overrides -s and -S.
1089
1090 -rpath=dir
1091 Add a directory to the runtime library search path. This is used
1092 when linking an ELF executable with shared objects. All -rpath
1093 arguments are concatenated and passed to the runtime linker, which
1094 uses them to locate shared objects at runtime. The -rpath option
1095 is also used when locating shared objects which are needed by
1096 shared objects explicitly included in the link; see the description
1097 of the -rpath-link option. If -rpath is not used when linking an
1098 ELF executable, the contents of the environment variable
1099 "LD_RUN_PATH" will be used if it is defined.
1100
1101 The -rpath option may also be used on SunOS. By default, on SunOS,
1102 the linker will form a runtime search patch out of all the -L
1103 options it is given. If a -rpath option is used, the runtime
1104 search path will be formed exclusively using the -rpath options,
1105 ignoring the -L options. This can be useful when using gcc, which
1106 adds many -L options which may be on NFS mounted file systems.
1107
1108 For compatibility with other ELF linkers, if the -R option is
1109 followed by a directory name, rather than a file name, it is
1110 treated as the -rpath option.
1111
1112 -rpath-link=dir
1113 When using ELF or SunOS, one shared library may require another.
1114 This happens when an "ld -shared" link includes a shared library as
1115 one of the input files.
1116
1117 When the linker encounters such a dependency when doing a non-
1118 shared, non-relocatable link, it will automatically try to locate
1119 the required shared library and include it in the link, if it is
1120 not included explicitly. In such a case, the -rpath-link option
1121 specifies the first set of directories to search. The -rpath-link
1122 option may specify a sequence of directory names either by
1123 specifying a list of names separated by colons, or by appearing
1124 multiple times.
1125
1126 This option should be used with caution as it overrides the search
1127 path that may have been hard compiled into a shared library. In
1128 such a case it is possible to use unintentionally a different
1129 search path than the runtime linker would do.
1130
1131 The linker uses the following search paths to locate required
1132 shared libraries:
1133
1134 1. Any directories specified by -rpath-link options.
1135
1136 2. Any directories specified by -rpath options. The difference
1137 between -rpath and -rpath-link is that directories specified by
1138 -rpath options are included in the executable and used at
1139 runtime, whereas the -rpath-link option is only effective at
1140 link time. Searching -rpath in this way is only supported by
1141 native linkers and cross linkers which have been configured
1142 with the --with-sysroot option.
1143
1144 3. On an ELF system, for native linkers, if the -rpath and
1145 -rpath-link options were not used, search the contents of the
1146 environment variable "LD_RUN_PATH".
1147
1148 4. On SunOS, if the -rpath option was not used, search any
1149 directories specified using -L options.
1150
1151 5. For a native linker, the search the contents of the environment
1152 variable "LD_LIBRARY_PATH".
1153
1154 6. For a native ELF linker, the directories in "DT_RUNPATH" or
1155 "DT_RPATH" of a shared library are searched for shared
1156 libraries needed by it. The "DT_RPATH" entries are ignored if
1157 "DT_RUNPATH" entries exist.
1158
1159 7. The default directories, normally /lib and /usr/lib.
1160
1161 8. For a native linker on an ELF system, if the file
1162 /etc/ld.so.conf exists, the list of directories found in that
1163 file.
1164
1165 If the required shared library is not found, the linker will issue
1166 a warning and continue with the link.
1167
1168 -shared
1169 -Bshareable
1170 Create a shared library. This is currently only supported on ELF,
1171 XCOFF and SunOS platforms. On SunOS, the linker will automatically
1172 create a shared library if the -e option is not used and there are
1173 undefined symbols in the link.
1174
1175 --sort-common
1176 --sort-common=ascending
1177 --sort-common=descending
1178 This option tells ld to sort the common symbols by alignment in
1179 ascending or descending order when it places them in the
1180 appropriate output sections. The symbol alignments considered are
1181 sixteen-byte or larger, eight-byte, four-byte, two-byte, and one-
1182 byte. This is to prevent gaps between symbols due to alignment
1183 constraints. If no sorting order is specified, then descending
1184 order is assumed.
1185
1186 --sort-section=name
1187 This option will apply "SORT_BY_NAME" to all wildcard section
1188 patterns in the linker script.
1189
1190 --sort-section=alignment
1191 This option will apply "SORT_BY_ALIGNMENT" to all wildcard section
1192 patterns in the linker script.
1193
1194 --split-by-file[=size]
1195 Similar to --split-by-reloc but creates a new output section for
1196 each input file when size is reached. size defaults to a size of 1
1197 if not given.
1198
1199 --split-by-reloc[=count]
1200 Tries to creates extra sections in the output file so that no
1201 single output section in the file contains more than count
1202 relocations. This is useful when generating huge relocatable files
1203 for downloading into certain real time kernels with the COFF object
1204 file format; since COFF cannot represent more than 65535
1205 relocations in a single section. Note that this will fail to work
1206 with object file formats which do not support arbitrary sections.
1207 The linker will not split up individual input sections for
1208 redistribution, so if a single input section contains more than
1209 count relocations one output section will contain that many
1210 relocations. count defaults to a value of 32768.
1211
1212 --stats
1213 Compute and display statistics about the operation of the linker,
1214 such as execution time and memory usage.
1215
1216 --sysroot=directory
1217 Use directory as the location of the sysroot, overriding the
1218 configure-time default. This option is only supported by linkers
1219 that were configured using --with-sysroot.
1220
1221 --traditional-format
1222 For some targets, the output of ld is different in some ways from
1223 the output of some existing linker. This switch requests ld to use
1224 the traditional format instead.
1225
1226 For example, on SunOS, ld combines duplicate entries in the symbol
1227 string table. This can reduce the size of an output file with full
1228 debugging information by over 30 percent. Unfortunately, the SunOS
1229 "dbx" program can not read the resulting program ("gdb" has no
1230 trouble). The --traditional-format switch tells ld to not combine
1231 duplicate entries.
1232
1233 --section-start=sectionname=org
1234 Locate a section in the output file at the absolute address given
1235 by org. You may use this option as many times as necessary to
1236 locate multiple sections in the command line. org must be a single
1237 hexadecimal integer; for compatibility with other linkers, you may
1238 omit the leading 0x usually associated with hexadecimal values.
1239 Note: there should be no white space between sectionname, the
1240 equals sign ("="), and org.
1241
1242 -Tbss=org
1243 -Tdata=org
1244 -Ttext=org
1245 Same as --section-start, with ".bss", ".data" or ".text" as the
1246 sectionname.
1247
1248 -Ttext-segment=org
1249 When creating an ELF executable or shared object, it will set the
1250 address of the first byte of the text segment.
1251
1252 --unresolved-symbols=method
1253 Determine how to handle unresolved symbols. There are four
1254 possible values for method:
1255
1256 ignore-all
1257 Do not report any unresolved symbols.
1258
1259 report-all
1260 Report all unresolved symbols. This is the default.
1261
1262 ignore-in-object-files
1263 Report unresolved symbols that are contained in shared
1264 libraries, but ignore them if they come from regular object
1265 files.
1266
1267 ignore-in-shared-libs
1268 Report unresolved symbols that come from regular object files,
1269 but ignore them if they come from shared libraries. This can
1270 be useful when creating a dynamic binary and it is known that
1271 all the shared libraries that it should be referencing are
1272 included on the linker's command line.
1273
1274 The behaviour for shared libraries on their own can also be
1275 controlled by the --[no-]allow-shlib-undefined option.
1276
1277 Normally the linker will generate an error message for each
1278 reported unresolved symbol but the option --warn-unresolved-symbols
1279 can change this to a warning.
1280
1281 --dll-verbose
1282 --verbose
1283 Display the version number for ld and list the linker emulations
1284 supported. Display which input files can and cannot be opened.
1285 Display the linker script being used by the linker.
1286
1287 --version-script=version-scriptfile
1288 Specify the name of a version script to the linker. This is
1289 typically used when creating shared libraries to specify additional
1290 information about the version hierarchy for the library being
1291 created. This option is only fully supported on ELF platforms
1292 which support shared libraries; see VERSION. It is partially
1293 supported on PE platforms, which can use version scripts to filter
1294 symbol visibility in auto-export mode: any symbols marked local in
1295 the version script will not be exported.
1296
1297 --warn-common
1298 Warn when a common symbol is combined with another common symbol or
1299 with a symbol definition. Unix linkers allow this somewhat sloppy
1300 practise, but linkers on some other operating systems do not. This
1301 option allows you to find potential problems from combining global
1302 symbols. Unfortunately, some C libraries use this practise, so you
1303 may get some warnings about symbols in the libraries as well as in
1304 your programs.
1305
1306 There are three kinds of global symbols, illustrated here by C
1307 examples:
1308
1309 int i = 1;
1310 A definition, which goes in the initialized data section of the
1311 output file.
1312
1313 extern int i;
1314 An undefined reference, which does not allocate space. There
1315 must be either a definition or a common symbol for the variable
1316 somewhere.
1317
1318 int i;
1319 A common symbol. If there are only (one or more) common
1320 symbols for a variable, it goes in the uninitialized data area
1321 of the output file. The linker merges multiple common symbols
1322 for the same variable into a single symbol. If they are of
1323 different sizes, it picks the largest size. The linker turns a
1324 common symbol into a declaration, if there is a definition of
1325 the same variable.
1326
1327 The --warn-common option can produce five kinds of warnings. Each
1328 warning consists of a pair of lines: the first describes the symbol
1329 just encountered, and the second describes the previous symbol
1330 encountered with the same name. One or both of the two symbols
1331 will be a common symbol.
1332
1333 1. Turning a common symbol into a reference, because there is
1334 already a definition for the symbol.
1335
1336 <file>(<section>): warning: common of `<symbol>'
1337 overridden by definition
1338 <file>(<section>): warning: defined here
1339
1340 2. Turning a common symbol into a reference, because a later
1341 definition for the symbol is encountered. This is the same as
1342 the previous case, except that the symbols are encountered in a
1343 different order.
1344
1345 <file>(<section>): warning: definition of `<symbol>'
1346 overriding common
1347 <file>(<section>): warning: common is here
1348
1349 3. Merging a common symbol with a previous same-sized common
1350 symbol.
1351
1352 <file>(<section>): warning: multiple common
1353 of `<symbol>'
1354 <file>(<section>): warning: previous common is here
1355
1356 4. Merging a common symbol with a previous larger common symbol.
1357
1358 <file>(<section>): warning: common of `<symbol>'
1359 overridden by larger common
1360 <file>(<section>): warning: larger common is here
1361
1362 5. Merging a common symbol with a previous smaller common symbol.
1363 This is the same as the previous case, except that the symbols
1364 are encountered in a different order.
1365
1366 <file>(<section>): warning: common of `<symbol>'
1367 overriding smaller common
1368 <file>(<section>): warning: smaller common is here
1369
1370 --warn-constructors
1371 Warn if any global constructors are used. This is only useful for
1372 a few object file formats. For formats like COFF or ELF, the
1373 linker can not detect the use of global constructors.
1374
1375 --warn-multiple-gp
1376 Warn if multiple global pointer values are required in the output
1377 file. This is only meaningful for certain processors, such as the
1378 Alpha. Specifically, some processors put large-valued constants in
1379 a special section. A special register (the global pointer) points
1380 into the middle of this section, so that constants can be loaded
1381 efficiently via a base-register relative addressing mode. Since
1382 the offset in base-register relative mode is fixed and relatively
1383 small (e.g., 16 bits), this limits the maximum size of the constant
1384 pool. Thus, in large programs, it is often necessary to use
1385 multiple global pointer values in order to be able to address all
1386 possible constants. This option causes a warning to be issued
1387 whenever this case occurs.
1388
1389 --warn-once
1390 Only warn once for each undefined symbol, rather than once per
1391 module which refers to it.
1392
1393 --warn-section-align
1394 Warn if the address of an output section is changed because of
1395 alignment. Typically, the alignment will be set by an input
1396 section. The address will only be changed if it not explicitly
1397 specified; that is, if the "SECTIONS" command does not specify a
1398 start address for the section.
1399
1400 --warn-shared-textrel
1401 Warn if the linker adds a DT_TEXTREL to a shared object.
1402
1403 --warn-alternate-em
1404 Warn if an object has alternate ELF machine code.
1405
1406 --warn-unresolved-symbols
1407 If the linker is going to report an unresolved symbol (see the
1408 option --unresolved-symbols) it will normally generate an error.
1409 This option makes it generate a warning instead.
1410
1411 --error-unresolved-symbols
1412 This restores the linker's default behaviour of generating errors
1413 when it is reporting unresolved symbols.
1414
1415 --whole-archive
1416 For each archive mentioned on the command line after the
1417 --whole-archive option, include every object file in the archive in
1418 the link, rather than searching the archive for the required object
1419 files. This is normally used to turn an archive file into a shared
1420 library, forcing every object to be included in the resulting
1421 shared library. This option may be used more than once.
1422
1423 Two notes when using this option from gcc: First, gcc doesn't know
1424 about this option, so you have to use -Wl,-whole-archive. Second,
1425 don't forget to use -Wl,-no-whole-archive after your list of
1426 archives, because gcc will add its own list of archives to your
1427 link and you may not want this flag to affect those as well.
1428
1429 --wrap=symbol
1430 Use a wrapper function for symbol. Any undefined reference to
1431 symbol will be resolved to "__wrap_symbol". Any undefined
1432 reference to "__real_symbol" will be resolved to symbol.
1433
1434 This can be used to provide a wrapper for a system function. The
1435 wrapper function should be called "__wrap_symbol". If it wishes to
1436 call the system function, it should call "__real_symbol".
1437
1438 Here is a trivial example:
1439
1440 void *
1441 __wrap_malloc (size_t c)
1442 {
1443 printf ("malloc called with %zu\n", c);
1444 return __real_malloc (c);
1445 }
1446
1447 If you link other code with this file using --wrap malloc, then all
1448 calls to "malloc" will call the function "__wrap_malloc" instead.
1449 The call to "__real_malloc" in "__wrap_malloc" will call the real
1450 "malloc" function.
1451
1452 You may wish to provide a "__real_malloc" function as well, so that
1453 links without the --wrap option will succeed. If you do this, you
1454 should not put the definition of "__real_malloc" in the same file
1455 as "__wrap_malloc"; if you do, the assembler may resolve the call
1456 before the linker has a chance to wrap it to "malloc".
1457
1458 --eh-frame-hdr
1459 Request creation of ".eh_frame_hdr" section and ELF
1460 "PT_GNU_EH_FRAME" segment header.
1461
1462 --enable-new-dtags
1463 --disable-new-dtags
1464 This linker can create the new dynamic tags in ELF. But the older
1465 ELF systems may not understand them. If you specify
1466 --enable-new-dtags, the dynamic tags will be created as needed. If
1467 you specify --disable-new-dtags, no new dynamic tags will be
1468 created. By default, the new dynamic tags are not created. Note
1469 that those options are only available for ELF systems.
1470
1471 --hash-size=number
1472 Set the default size of the linker's hash tables to a prime number
1473 close to number. Increasing this value can reduce the length of
1474 time it takes the linker to perform its tasks, at the expense of
1475 increasing the linker's memory requirements. Similarly reducing
1476 this value can reduce the memory requirements at the expense of
1477 speed.
1478
1479 --hash-style=style
1480 Set the type of linker's hash table(s). style can be either "sysv"
1481 for classic ELF ".hash" section, "gnu" for new style GNU
1482 ".gnu.hash" section or "both" for both the classic ELF ".hash" and
1483 new style GNU ".gnu.hash" hash tables. The default is "sysv".
1484
1485 --reduce-memory-overheads
1486 This option reduces memory requirements at ld runtime, at the
1487 expense of linking speed. This was introduced to select the old
1488 O(n^2) algorithm for link map file generation, rather than the new
1489 O(n) algorithm which uses about 40% more memory for symbol storage.
1490
1491 Another effect of the switch is to set the default hash table size
1492 to 1021, which again saves memory at the cost of lengthening the
1493 linker's run time. This is not done however if the --hash-size
1494 switch has been used.
1495
1496 The --reduce-memory-overheads switch may be also be used to enable
1497 other tradeoffs in future versions of the linker.
1498
1499 --build-id
1500 --build-id=style
1501 Request creation of ".note.gnu.build-id" ELF note section. The
1502 contents of the note are unique bits identifying this linked file.
1503 style can be "uuid" to use 128 random bits, "sha1" to use a 160-bit
1504 SHA1 hash on the normative parts of the output contents, "md5" to
1505 use a 128-bit MD5 hash on the normative parts of the output
1506 contents, or "0xhexstring" to use a chosen bit string specified as
1507 an even number of hexadecimal digits ("-" and ":" characters
1508 between digit pairs are ignored). If style is omitted, "sha1" is
1509 used.
1510
1511 The "md5" and "sha1" styles produces an identifier that is always
1512 the same in an identical output file, but will be unique among all
1513 nonidentical output files. It is not intended to be compared as a
1514 checksum for the file's contents. A linked file may be changed
1515 later by other tools, but the build ID bit string identifying the
1516 original linked file does not change.
1517
1518 Passing "none" for style disables the setting from any "--build-id"
1519 options earlier on the command line.
1520
1521 The i386 PE linker supports the -shared option, which causes the output
1522 to be a dynamically linked library (DLL) instead of a normal
1523 executable. You should name the output "*.dll" when you use this
1524 option. In addition, the linker fully supports the standard "*.def"
1525 files, which may be specified on the linker command line like an object
1526 file (in fact, it should precede archives it exports symbols from, to
1527 ensure that they get linked in, just like a normal object file).
1528
1529 In addition to the options common to all targets, the i386 PE linker
1530 support additional command line options that are specific to the i386
1531 PE target. Options that take values may be separated from their values
1532 by either a space or an equals sign.
1533
1534 --add-stdcall-alias
1535 If given, symbols with a stdcall suffix (@nn) will be exported as-
1536 is and also with the suffix stripped. [This option is specific to
1537 the i386 PE targeted port of the linker]
1538
1539 --base-file file
1540 Use file as the name of a file in which to save the base addresses
1541 of all the relocations needed for generating DLLs with dlltool.
1542 [This is an i386 PE specific option]
1543
1544 --dll
1545 Create a DLL instead of a regular executable. You may also use
1546 -shared or specify a "LIBRARY" in a given ".def" file. [This
1547 option is specific to the i386 PE targeted port of the linker]
1548
1549 --enable-long-section-names
1550 --disable-long-section-names
1551 The PE variants of the Coff object format add an extension that
1552 permits the use of section names longer than eight characters, the
1553 normal limit for Coff. By default, these names are only allowed in
1554 object files, as fully-linked executable images do not carry the
1555 Coff string table required to support the longer names. As a GNU
1556 extension, it is possible to allow their use in executable images
1557 as well, or to (probably pointlessly!) disallow it in object
1558 files, by using these two options. Executable images generated
1559 with these long section names are slightly non-standard, carrying
1560 as they do a string table, and may generate confusing output when
1561 examined with non-GNU PE-aware tools, such as file viewers and
1562 dumpers. However, GDB relies on the use of PE long section names
1563 to find Dwarf-2 debug information sections in an executable image
1564 at runtime, and so if neither option is specified on the command-
1565 line, ld will enable long section names, overriding the default and
1566 technically correct behaviour, when it finds the presence of debug
1567 information while linking an executable image and not stripping
1568 symbols. [This option is valid for all PE targeted ports of the
1569 linker]
1570
1571 --enable-stdcall-fixup
1572 --disable-stdcall-fixup
1573 If the link finds a symbol that it cannot resolve, it will attempt
1574 to do "fuzzy linking" by looking for another defined symbol that
1575 differs only in the format of the symbol name (cdecl vs stdcall)
1576 and will resolve that symbol by linking to the match. For example,
1577 the undefined symbol "_foo" might be linked to the function
1578 "_foo@12", or the undefined symbol "_bar@16" might be linked to the
1579 function "_bar". When the linker does this, it prints a warning,
1580 since it normally should have failed to link, but sometimes import
1581 libraries generated from third-party dlls may need this feature to
1582 be usable. If you specify --enable-stdcall-fixup, this feature is
1583 fully enabled and warnings are not printed. If you specify
1584 --disable-stdcall-fixup, this feature is disabled and such
1585 mismatches are considered to be errors. [This option is specific
1586 to the i386 PE targeted port of the linker]
1587
1588 --export-all-symbols
1589 If given, all global symbols in the objects used to build a DLL
1590 will be exported by the DLL. Note that this is the default if
1591 there otherwise wouldn't be any exported symbols. When symbols are
1592 explicitly exported via DEF files or implicitly exported via
1593 function attributes, the default is to not export anything else
1594 unless this option is given. Note that the symbols "DllMain@12",
1595 "DllEntryPoint@0", "DllMainCRTStartup@12", and "impure_ptr" will
1596 not be automatically exported. Also, symbols imported from other
1597 DLLs will not be re-exported, nor will symbols specifying the DLL's
1598 internal layout such as those beginning with "_head_" or ending
1599 with "_iname". In addition, no symbols from "libgcc", "libstd++",
1600 "libmingw32", or "crtX.o" will be exported. Symbols whose names
1601 begin with "__rtti_" or "__builtin_" will not be exported, to help
1602 with C++ DLLs. Finally, there is an extensive list of cygwin-
1603 private symbols that are not exported (obviously, this applies on
1604 when building DLLs for cygwin targets). These cygwin-excludes are:
1605 "_cygwin_dll_entry@12", "_cygwin_crt0_common@8",
1606 "_cygwin_noncygwin_dll_entry@12", "_fmode", "_impure_ptr",
1607 "cygwin_attach_dll", "cygwin_premain0", "cygwin_premain1",
1608 "cygwin_premain2", "cygwin_premain3", and "environ". [This option
1609 is specific to the i386 PE targeted port of the linker]
1610
1611 --exclude-symbols symbol,symbol,...
1612 Specifies a list of symbols which should not be automatically
1613 exported. The symbol names may be delimited by commas or colons.
1614 [This option is specific to the i386 PE targeted port of the
1615 linker]
1616
1617 --file-alignment
1618 Specify the file alignment. Sections in the file will always begin
1619 at file offsets which are multiples of this number. This defaults
1620 to 512. [This option is specific to the i386 PE targeted port of
1621 the linker]
1622
1623 --heap reserve
1624 --heap reserve,commit
1625 Specify the number of bytes of memory to reserve (and optionally
1626 commit) to be used as heap for this program. The default is 1Mb
1627 reserved, 4K committed. [This option is specific to the i386 PE
1628 targeted port of the linker]
1629
1630 --image-base value
1631 Use value as the base address of your program or dll. This is the
1632 lowest memory location that will be used when your program or dll
1633 is loaded. To reduce the need to relocate and improve performance
1634 of your dlls, each should have a unique base address and not
1635 overlap any other dlls. The default is 0x400000 for executables,
1636 and 0x10000000 for dlls. [This option is specific to the i386 PE
1637 targeted port of the linker]
1638
1639 --kill-at
1640 If given, the stdcall suffixes (@nn) will be stripped from symbols
1641 before they are exported. [This option is specific to the i386 PE
1642 targeted port of the linker]
1643
1644 --large-address-aware
1645 If given, the appropriate bit in the "Characteristics" field of the
1646 COFF header is set to indicate that this executable supports
1647 virtual addresses greater than 2 gigabytes. This should be used in
1648 conjunction with the /3GB or /USERVA=value megabytes switch in the
1649 "[operating systems]" section of the BOOT.INI. Otherwise, this bit
1650 has no effect. [This option is specific to PE targeted ports of
1651 the linker]
1652
1653 --major-image-version value
1654 Sets the major number of the "image version". Defaults to 1.
1655 [This option is specific to the i386 PE targeted port of the
1656 linker]
1657
1658 --major-os-version value
1659 Sets the major number of the "os version". Defaults to 4. [This
1660 option is specific to the i386 PE targeted port of the linker]
1661
1662 --major-subsystem-version value
1663 Sets the major number of the "subsystem version". Defaults to 4.
1664 [This option is specific to the i386 PE targeted port of the
1665 linker]
1666
1667 --minor-image-version value
1668 Sets the minor number of the "image version". Defaults to 0.
1669 [This option is specific to the i386 PE targeted port of the
1670 linker]
1671
1672 --minor-os-version value
1673 Sets the minor number of the "os version". Defaults to 0. [This
1674 option is specific to the i386 PE targeted port of the linker]
1675
1676 --minor-subsystem-version value
1677 Sets the minor number of the "subsystem version". Defaults to 0.
1678 [This option is specific to the i386 PE targeted port of the
1679 linker]
1680
1681 --output-def file
1682 The linker will create the file file which will contain a DEF file
1683 corresponding to the DLL the linker is generating. This DEF file
1684 (which should be called "*.def") may be used to create an import
1685 library with "dlltool" or may be used as a reference to
1686 automatically or implicitly exported symbols. [This option is
1687 specific to the i386 PE targeted port of the linker]
1688
1689 --out-implib file
1690 The linker will create the file file which will contain an import
1691 lib corresponding to the DLL the linker is generating. This import
1692 lib (which should be called "*.dll.a" or "*.a" may be used to link
1693 clients against the generated DLL; this behaviour makes it possible
1694 to skip a separate "dlltool" import library creation step. [This
1695 option is specific to the i386 PE targeted port of the linker]
1696
1697 --enable-auto-image-base
1698 Automatically choose the image base for DLLs, unless one is
1699 specified using the "--image-base" argument. By using a hash
1700 generated from the dllname to create unique image bases for each
1701 DLL, in-memory collisions and relocations which can delay program
1702 execution are avoided. [This option is specific to the i386 PE
1703 targeted port of the linker]
1704
1705 --disable-auto-image-base
1706 Do not automatically generate a unique image base. If there is no
1707 user-specified image base ("--image-base") then use the platform
1708 default. [This option is specific to the i386 PE targeted port of
1709 the linker]
1710
1711 --dll-search-prefix string
1712 When linking dynamically to a dll without an import library, search
1713 for "<string><basename>.dll" in preference to "lib<basename>.dll".
1714 This behaviour allows easy distinction between DLLs built for the
1715 various "subplatforms": native, cygwin, uwin, pw, etc. For
1716 instance, cygwin DLLs typically use "--dll-search-prefix=cyg".
1717 [This option is specific to the i386 PE targeted port of the
1718 linker]
1719
1720 --enable-auto-import
1721 Do sophisticated linking of "_symbol" to "__imp__symbol" for DATA
1722 imports from DLLs, and create the necessary thunking symbols when
1723 building the import libraries with those DATA exports. Note: Use of
1724 the 'auto-import' extension will cause the text section of the
1725 image file to be made writable. This does not conform to the PE-
1726 COFF format specification published by Microsoft.
1727
1728 Note - use of the 'auto-import' extension will also cause read only
1729 data which would normally be placed into the .rdata section to be
1730 placed into the .data section instead. This is in order to work
1731 around a problem with consts that is described here:
1732 http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
1733
1734 Using 'auto-import' generally will 'just work' -- but sometimes you
1735 may see this message:
1736
1737 "variable '<var>' can't be auto-imported. Please read the
1738 documentation for ld's "--enable-auto-import" for details."
1739
1740 This message occurs when some (sub)expression accesses an address
1741 ultimately given by the sum of two constants (Win32 import tables
1742 only allow one). Instances where this may occur include accesses
1743 to member fields of struct variables imported from a DLL, as well
1744 as using a constant index into an array variable imported from a
1745 DLL. Any multiword variable (arrays, structs, long long, etc) may
1746 trigger this error condition. However, regardless of the exact
1747 data type of the offending exported variable, ld will always detect
1748 it, issue the warning, and exit.
1749
1750 There are several ways to address this difficulty, regardless of
1751 the data type of the exported variable:
1752
1753 One way is to use --enable-runtime-pseudo-reloc switch. This leaves
1754 the task of adjusting references in your client code for runtime
1755 environment, so this method works only when runtime environment
1756 supports this feature.
1757
1758 A second solution is to force one of the 'constants' to be a
1759 variable -- that is, unknown and un-optimizable at compile time.
1760 For arrays, there are two possibilities: a) make the indexee (the
1761 array's address) a variable, or b) make the 'constant' index a
1762 variable. Thus:
1763
1764 extern type extern_array[];
1765 extern_array[1] -->
1766 { volatile type *t=extern_array; t[1] }
1767
1768 or
1769
1770 extern type extern_array[];
1771 extern_array[1] -->
1772 { volatile int t=1; extern_array[t] }
1773
1774 For structs (and most other multiword data types) the only option
1775 is to make the struct itself (or the long long, or the ...)
1776 variable:
1777
1778 extern struct s extern_struct;
1779 extern_struct.field -->
1780 { volatile struct s *t=&extern_struct; t->field }
1781
1782 or
1783
1784 extern long long extern_ll;
1785 extern_ll -->
1786 { volatile long long * local_ll=&extern_ll; *local_ll }
1787
1788 A third method of dealing with this difficulty is to abandon
1789 'auto-import' for the offending symbol and mark it with
1790 "__declspec(dllimport)". However, in practise that requires using
1791 compile-time #defines to indicate whether you are building a DLL,
1792 building client code that will link to the DLL, or merely
1793 building/linking to a static library. In making the choice
1794 between the various methods of resolving the 'direct address with
1795 constant offset' problem, you should consider typical real-world
1796 usage:
1797
1798 Original:
1799
1800 --foo.h
1801 extern int arr[];
1802 --foo.c
1803 #include "foo.h"
1804 void main(int argc, char **argv){
1805 printf("%d\n",arr[1]);
1806 }
1807
1808 Solution 1:
1809
1810 --foo.h
1811 extern int arr[];
1812 --foo.c
1813 #include "foo.h"
1814 void main(int argc, char **argv){
1815 /* This workaround is for win32 and cygwin; do not "optimize" */
1816 volatile int *parr = arr;
1817 printf("%d\n",parr[1]);
1818 }
1819
1820 Solution 2:
1821
1822 --foo.h
1823 /* Note: auto-export is assumed (no __declspec(dllexport)) */
1824 #if (defined(_WIN32) || defined(__CYGWIN__)) && \
1825 !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
1826 #define FOO_IMPORT __declspec(dllimport)
1827 #else
1828 #define FOO_IMPORT
1829 #endif
1830 extern FOO_IMPORT int arr[];
1831 --foo.c
1832 #include "foo.h"
1833 void main(int argc, char **argv){
1834 printf("%d\n",arr[1]);
1835 }
1836
1837 A fourth way to avoid this problem is to re-code your library to
1838 use a functional interface rather than a data interface for the
1839 offending variables (e.g. set_foo() and get_foo() accessor
1840 functions). [This option is specific to the i386 PE targeted port
1841 of the linker]
1842
1843 --disable-auto-import
1844 Do not attempt to do sophisticated linking of "_symbol" to
1845 "__imp__symbol" for DATA imports from DLLs. [This option is
1846 specific to the i386 PE targeted port of the linker]
1847
1848 --enable-runtime-pseudo-reloc
1849 If your code contains expressions described in --enable-auto-import
1850 section, that is, DATA imports from DLL with non-zero offset, this
1851 switch will create a vector of 'runtime pseudo relocations' which
1852 can be used by runtime environment to adjust references to such
1853 data in your client code. [This option is specific to the i386 PE
1854 targeted port of the linker]
1855
1856 --disable-runtime-pseudo-reloc
1857 Do not create pseudo relocations for non-zero offset DATA imports
1858 from DLLs. This is the default. [This option is specific to the
1859 i386 PE targeted port of the linker]
1860
1861 --enable-extra-pe-debug
1862 Show additional debug info related to auto-import symbol thunking.
1863 [This option is specific to the i386 PE targeted port of the
1864 linker]
1865
1866 --section-alignment
1867 Sets the section alignment. Sections in memory will always begin
1868 at addresses which are a multiple of this number. Defaults to
1869 0x1000. [This option is specific to the i386 PE targeted port of
1870 the linker]
1871
1872 --stack reserve
1873 --stack reserve,commit
1874 Specify the number of bytes of memory to reserve (and optionally
1875 commit) to be used as stack for this program. The default is 2Mb
1876 reserved, 4K committed. [This option is specific to the i386 PE
1877 targeted port of the linker]
1878
1879 --subsystem which
1880 --subsystem which:major
1881 --subsystem which:major.minor
1882 Specifies the subsystem under which your program will execute. The
1883 legal values for which are "native", "windows", "console", "posix",
1884 and "xbox". You may optionally set the subsystem version also.
1885 Numeric values are also accepted for which. [This option is
1886 specific to the i386 PE targeted port of the linker]
1887
1888 The following options set flags in the "DllCharacteristics" field
1889 of the PE file header: [These options are specific to PE targeted
1890 ports of the linker]
1891
1892 --dynamicbase
1893 The image base address may be relocated using address space layout
1894 randomization (ASLR). This feature was introduced with MS Windows
1895 Vista for i386 PE targets.
1896
1897 --forceinteg
1898 Code integrity checks are enforced.
1899
1900 --nxcompat
1901 The image is compatible with the Data Execution Prevention. This
1902 feature was introduced with MS Windows XP SP2 for i386 PE targets.
1903
1904 --no-isolation
1905 Although the image understands isolation, do not isolate the image.
1906
1907 --no-seh
1908 The image does not use SEH. No SE handler may be called from this
1909 image.
1910
1911 --no-bind
1912 Do not bind this image.
1913
1914 --wdmdriver
1915 The driver uses the MS Windows Driver Model.
1916
1917 --tsaware
1918 The image is Terminal Server aware.
1919
1920 The 68HC11 and 68HC12 linkers support specific options to control the
1921 memory bank switching mapping and trampoline code generation.
1922
1923 --no-trampoline
1924 This option disables the generation of trampoline. By default a
1925 trampoline is generated for each far function which is called using
1926 a "jsr" instruction (this happens when a pointer to a far function
1927 is taken).
1928
1929 --bank-window name
1930 This option indicates to the linker the name of the memory region
1931 in the MEMORY specification that describes the memory bank window.
1932 The definition of such region is then used by the linker to compute
1933 paging and addresses within the memory window.
1934
1935 The following options are supported to control handling of GOT
1936 generation when linking for 68K targets.
1937
1938 --got=type
1939 This option tells the linker which GOT generation scheme to use.
1940 type should be one of single, negative, multigot or target. For
1941 more information refer to the Info entry for ld.
1942
1944 You can change the behaviour of ld with the environment variables
1945 "GNUTARGET", "LDEMULATION" and "COLLECT_NO_DEMANGLE".
1946
1947 "GNUTARGET" determines the input-file object format if you don't use -b
1948 (or its synonym --format). Its value should be one of the BFD names
1949 for an input format. If there is no "GNUTARGET" in the environment, ld
1950 uses the natural format of the target. If "GNUTARGET" is set to
1951 "default" then BFD attempts to discover the input format by examining
1952 binary input files; this method often succeeds, but there are potential
1953 ambiguities, since there is no method of ensuring that the magic number
1954 used to specify object-file formats is unique. However, the
1955 configuration procedure for BFD on each system places the conventional
1956 format for that system first in the search-list, so ambiguities are
1957 resolved in favor of convention.
1958
1959 "LDEMULATION" determines the default emulation if you don't use the -m
1960 option. The emulation can affect various aspects of linker behaviour,
1961 particularly the default linker script. You can list the available
1962 emulations with the --verbose or -V options. If the -m option is not
1963 used, and the "LDEMULATION" environment variable is not defined, the
1964 default emulation depends upon how the linker was configured.
1965
1966 Normally, the linker will default to demangling symbols. However, if
1967 "COLLECT_NO_DEMANGLE" is set in the environment, then it will default
1968 to not demangling symbols. This environment variable is used in a
1969 similar fashion by the "gcc" linker wrapper program. The default may
1970 be overridden by the --demangle and --no-demangle options.
1971
1973 ar(1), nm(1), objcopy(1), objdump(1), readelf(1) and the Info entries
1974 for binutils and ld.
1975
1977 Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
1978 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
1979
1980 Permission is granted to copy, distribute and/or modify this document
1981 under the terms of the GNU Free Documentation License, Version 1.3 or
1982 any later version published by the Free Software Foundation; with no
1983 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
1984 Texts. A copy of the license is included in the section entitled "GNU
1985 Free Documentation License".
1986
1987
1988
1989binutils-2.20 2009-10-16 LD(1)