fix crinfo swapping
[deliverable/binutils-gdb.git] / ld / ld.1
CommitLineData
a89d9f5b 1.\" Copyright (c) 1991, 92, 93, 94, 1995 Free Software Foundation
0e166a63
RP
2.\" See section COPYING for conditions for redistribution
3.TH ld 1 "17 August 1992" "cygnus support" "GNU Development Tools"
4.de BP
5.sp
6.ti \-.2i
7\(**
8..
9
10.SH NAME
11ld \- the GNU linker
12
13.SH SYNOPSIS
14.hy 0
15.na
16.TP
17.B ld
18.RB "[\|" \-o "
19.I output\c
20\&\|] \c
8ddef552 21.I objfile\c
0e166a63
RP
22\&.\|.\|.
23.br
24.RB "[\|" \-A\c
25.I architecture\c
26\&\|]
27.RB "[\|" "\-b\ "\c
28.I input-format\c
29\&\|]
30.RB "[\|" \-Bstatic "\|]"
4551e108
ILT
31.RB "[\|" \-Bdynamic "\|]"
32.RB "[\|" \-Bsymbolic "\|]"
0e166a63
RP
33.RB "[\|" "\-c\ "\c
34.I commandfile\c
35\&\|]
36.RB "[\|" \-d | \-dc | \-dp\c
37\|]
38.br
39.RB "[\|" "\-defsym\ "\c
40.I symbol\c
41\& = \c
42.I expression\c
43\&\|]
44.RB "[\|" "\-e\ "\c
45.I entry\c
46\&\|]
39a6e282 47.RB "[\|" \-embedded\-relocs "\|]"
0e166a63
RP
48.RB "[\|" \-F "\|]"
49.RB "[\|" "\-F\ "\c
50.I format\c
51\&\|]
52.RB "[\|" "\-format\ "\c
53.I input-format\c
54\&\|]
55.RB "[\|" \-g "\|]"
80165535 56.RB "[\|" \-G
8ddef552
DM
57.I size\c
58\&\|]
bf065bfd 59.RB "[\|" \-\-help "\|]"
0e166a63
RP
60.RB "[\|" \-i "\|]"
61.RB "[\|" \-l\c
62.I ar\c
63\&\|]
64.RB "[\|" \-L\c
65.I searchdir\c
66\&\|]
8ddef552 67.RB "[\|" \-M "\|]"
80165535 68.RB "[\|" \-Map
d18a4527
DM
69.I mapfile\c
70\&\|]
80165535 71.RB "[\|" \-m
8ddef552
DM
72.I emulation\c
73\&\|]
0e166a63
RP
74.RB "[\|" \-n | \-N "\|]"
75.RB "[\|" \-noinhibit-exec "\|]"
e920526d 76.RB "[\|" \-no\-keep\-memory "\|]"
346535cc
DM
77.RB "[\|" "\-oformat\ "\c
78.I output-format\c
79\&\|]
0e166a63
RP
80.RB "[\|" "\-R\ "\c
81.I filename\c
82\&\|]
83.RB "[\|" \-relax "\|]"
84.RB "[\|" \-r | \-Ur "\|]"
5caef232
ILT
85.RB "[\|" "\-rpath\ "\c
86.I directory\c
87\&\|]
88.RB "[\|" "\-rpath\-link\ "\c
89.I directory\c
90\&\|]
0e166a63
RP
91.RB "[\|" \-S "\|]"
92.RB "[\|" \-s "\|]"
4551e108 93.RB "[\|" \-shared "\|]"
2a28d8b0 94.RB "[\|" \-sort\-common "\|]"
80165535 95.RB "[\|" "\-split\-by\-reloc\ "\c
ec586565
ILT
96.I count\c
97\&\|]
98.RB "[\|" \-split\-by\-file "\|]"
0e166a63
RP
99.RB "[\|" "\-T\ "\c
100.I commandfile\c
101\&\|]
102.RB "[\|" "\-Ttext\ "\c
103.I textorg\c
104\&\|]
105.RB "[\|" "\-Tdata\ "\c
106.I dataorg\c
107\&\|]
108.RB "[\|" "\-Tbss\ "\c
109.I bssorg\c
110\&\|]
111.RB "[\|" \-t "\|]"
112.RB "[\|" "\-u\ "\c
113.I sym\c
114\&]
8ddef552 115.RB "[\|" \-V "\|]"
0e166a63 116.RB "[\|" \-v "\|]"
a82ae15d 117.RB "[\|" \-\-verbose "\|]"
bf065bfd 118.RB "[\|" \-\-version "\|]"
2a28d8b0 119.RB "[\|" \-warn\-common "\|]"
a89d9f5b 120.RB "[\|" \-warn\-constructors "\|]"
809ee7e0 121.RB "[\|" \-warn\-once "\|]"
ee499d81 122.RB "[\|" \-\-whole\-archive "\|]"
0e166a63
RP
123.RB "[\|" \-X "\|]"
124.RB "[\|" \-x "\|]"
0e166a63
RP
125.ad b
126.hy 1
127.SH DESCRIPTION
128\c
129.B ld\c
130\& combines a number of object and archive files, relocates
131their data and ties up symbol references. Often the last step in
132building a new compiled program to run is a call to \c
133.B ld\c
134\&.
135
136\c
137.B ld\c
138\& accepts Linker Command Language files
139to provide explicit and total control over the linking process.
140This man page does not describe the command language; see the `\|\c
141.B ld\c
142\|' entry in `\|\c
143.B info\c
144\|', or the manual
145.I
146ld: the GNU linker
147\&, for full details on the command language and on other aspects of
148the GNU linker.
149
150This version of \c
151.B ld\c
152\& uses the general purpose BFD libraries
153to operate on object files. This allows \c
154.B ld\c
155\& to read, combine, and
156write object files in many different formats\(em\&for example, COFF or
157\c
158.B a.out\c
159\&. Different formats may be linked together to produce any
160available kind of object file. You can use `\|\c
161.B objdump \-i\c
162\|' to get a list of formats supported on various architectures; see
163.BR objdump ( 1 ).
164
165Aside from its flexibility, the GNU linker is more helpful than other
166linkers in providing diagnostic information. Many linkers abandon
167execution immediately upon encountering an error; whenever possible,
168\c
169.B ld\c
170\& continues executing, allowing you to identify other errors
171(or, in some cases, to get an output file in spite of the error).
172
173The GNU linker \c
174.B ld\c
175\& is meant to cover a broad range of situations,
176and to be as compatible as possible with other linkers. As a result,
177you have many choices to control its behavior through the command line,
178and through environment variables.
179
180.SH OPTIONS
181The plethora of command-line options may seem intimidating, but in
182actual practice few of them are used in any particular context.
183For instance, a frequent use of \c
184.B ld\c
185\& is to link standard Unix
186object files on a standard, supported Unix system. On such a system, to
187link a file \c
188.B hello.o\c
189\&:
190.sp
191.br
192$\ ld\ \-o\ output\ /lib/crt0.o\ hello.o\ \-lc
193.br
194.sp
195This tells \c
196.B ld\c
197\& to produce a file called \c
198.B output\c
199\& as the
200result of linking the file \c
201.B /lib/crt0.o\c
202\& with \c
203.B hello.o\c
204\& and
205the library \c
206.B libc.a\c
207\& which will come from the standard search
208directories.
209
210The command-line options to \c
211.B ld\c
212\& may be specified in any order, and
213may be repeated at will. For the most part, repeating an option with a
214different argument will either have no further effect, or override prior
215occurrences (those further to the left on the command line) of an
216option.
217
218The exceptions\(em\&which may meaningfully be used more than once\(em\&are
219\c
220.B \-A\c
221\&, \c
222.B \-b\c
223\& (or its synonym \c
224.B \-format\c
225\&), \c
226.B \-defsym\c
227\&,
228\c
229.B \-L\c
230\&, \c
231.B \-l\c
232\&, \c
233.B \-R\c
234\&, and \c
235.B \-u\c
236\&.
237
238The list of object files to be linked together, shown as \c
8ddef552 239.I objfile\c
0e166a63
RP
240\&,
241may follow, precede, or be mixed in with command-line options; save that
242an \c
8ddef552 243.I objfile\c
0e166a63
RP
244\& argument may not be placed between an option flag and
245its argument.
246
247Usually the linker is invoked with at least one object file, but other
248forms of binary input files can also be specified with \c
249.B \-l\c
250\&,
251\c
252.B \-R\c
253\&, and the script command language. If \c
254.I no\c
255\& binary input
256files at all are specified, the linker does not produce any output, and
257issues the message `\|\c
258.B No input files\c
259\|'.
260
261Option arguments must either follow the option letter without intervening
262whitespace, or be given as separate arguments immediately following the
263option that requires them.
264
0e166a63 265.TP
80165535 266.BI "-A" "architecture"
0e166a63
RP
267In the current release of \c
268.B ld\c
269\&, this option is useful only for the
270Intel 960 family of architectures. In that \c
271.B ld\c
272\& configuration, the
273\c
274.I architecture\c
275\& argument is one of the two-letter names identifying
276members of the 960 family; the option specifies the desired output
277target, and warns of any incompatible instructions in the input files.
278It also modifies the linker's search strategy for archive libraries, to
279support the use of libraries specific to each particular
280architecture, by including in the search loop names suffixed with the
281string identifying the architecture.
282
283For example, if your \c
284.B ld\c
285\& command line included `\|\c
286.B \-ACA\c
287\|' as
288well as `\|\c
289.B \-ltry\c
290\|', the linker would look (in its built-in search
291paths, and in any paths you specify with \c
292.B \-L\c
293\&) for a library with
294the names
295.sp
296.br
297try
298.br
299libtry.a
300.br
301tryca
302.br
303libtryca.a
304.br
305.sp
306
307The first two possibilities would be considered in any event; the last
308two are due to the use of `\|\c
309.B \-ACA\c
310\|'.
311
312Future releases of \c
313.B ld\c
314\& may support similar functionality for
315other architecture families.
316
317You can meaningfully use \c
318.B \-A\c
319\& more than once on a command line, if
320an architecture family allows combination of target architectures; each
321use will add another pair of name variants to search for when \c
80165535 322.B \-l
0e166a63
RP
323specifies a library.
324
325.TP
80165535 326.BI "\-b " "input-format"
0e166a63
RP
327Specify the binary format for input object files that follow this option
328on the command line. You don't usually need to specify this, as
329\c
330.B ld\c
331\& is configured to expect as a default input format the most
332usual format on each machine. \c
333.I input-format\c
334\& is a text string, the
335name of a particular format supported by the BFD libraries.
336\c
337.B \-format \c
338.I input-format\c
339\&\c
346535cc
DM
340\& has the same effect, as does the script command
341.BR TARGET .
0e166a63
RP
342
343You may want to use this option if you are linking files with an unusual
344binary format. You can also use \c
345.B \-b\c
346\& to switch formats explicitly (when
347linking object files of different formats), by including
348\c
349.B \-b \c
350.I input-format\c
351\&\c
352\& before each group of object files in a
353particular format.
354
355The default format is taken from the environment variable
356.B GNUTARGET\c
357\&. You can also define the input
358format from a script, using the command \c
359.B TARGET\c
360\&.
361
362.TP
363.B \-Bstatic
4551e108
ILT
364Do not link against shared libraries. This is only meaningful on
365platforms for which shared libraries are supported.
366
367.TP
368.B \-Bdynamic
369Link against dynamic libraries. This is only meaningful on platforms
370for which shared libraries are supported. This option is normally the
371default on such platforms.
372
373.TP
374.B \-Bsymbolic
375When creating a shared library, bind references to global symbols to
376the definition within the shared library, if any. Normally, it is
377possible for a program linked against a shared library to override the
378definition within the shared library. This option is only meaningful
379on ELF platforms which support shared libraries.
0e166a63
RP
380
381.TP
80165535 382.BI "\-c " "commandfile"
0e166a63
RP
383Directs \c
384.B ld\c
385\& to read link commands from the file
386\c
387.I commandfile\c
388\&. These commands will completely override \c
389.B ld\c
390\&'s
391default link format (rather than adding to it); \c
392.I commandfile\c
393\& must
394specify everything necessary to describe the target format.
395
396
397You may also include a script of link commands directly in the command
398line by bracketing it between `\|\c
399.B {\c
400\|' and `\|\c
401.B }\c
402\|' characters.
403
404.TP
405.B \-d
406.TP
407.B \-dc
408.TP
409.B \-dp
410These three options are equivalent; multiple forms are supported for
411compatibility with other linkers. Use any of them to make \c
80165535 412.B ld
0e166a63
RP
413assign space to common symbols even if a relocatable output file is
414specified (\c
415.B \-r\c
416\&). The script command
417\c
418.B FORCE_COMMON_ALLOCATION\c
419\& has the same effect.
420
421.TP
80165535 422.BI "-defsym " "symbol" "\fR = \fP" expression
0e166a63
RP
423Create a global symbol in the output file, containing the absolute
424address given by \c
425.I expression\c
426\&. You may use this option as many
427times as necessary to define multiple symbols in the command line. A
428limited form of arithmetic is supported for the \c
429.I expression\c
430\& in this
431context: you may give a hexadecimal constant or the name of an existing
432symbol, or use \c
433.B +\c
434\& and \c
435.B \-\c
436\& to add or subtract hexadecimal
437constants or symbols. If you need more elaborate expressions, consider
438using the linker command language from a script.
439
440.TP
441.BI "-e " "entry"\c
442\&
443Use \c
444.I entry\c
445\& as the explicit symbol for beginning execution of your
446program, rather than the default entry point. for a
447discussion of defaults and other ways of specifying the
448entry point.
449
39a6e282
ILT
450.TP
451.B \-embedded\-relocs
452This option is only meaningful when linking MIPS embedded PIC code,
453generated by the
454.B \-membedded\-pic
455option to the GNU compiler and assembler. It causes the linker to
456create a table which may be used at runtime to relocate any data which
457was statically initialized to pointer values. See the code in
458testsuite/ld-empic for details.
459
0e166a63
RP
460.TP
461.B \-F
462.TP
80165535 463.BI "-F" "format"
0e166a63
RP
464Some older linkers used this option throughout a compilation toolchain
465for specifying object-file format for both input and output object
466files. \c
467.B ld\c
468\&'s mechanisms (the \c
469.B \-b\c
470\& or \c
471.B \-format\c
472\& options
473for input files, the \c
474.B TARGET\c
475\& command in linker scripts for output
476files, the \c
477.B GNUTARGET\c
478\& environment variable) are more flexible, but
479but it accepts (and ignores) the \c
480.B \-F\c
481\& option flag for compatibility
482with scripts written to call the old linker.
483
484.TP
80165535 485.BI "\-format " "input\-format"
0e166a63
RP
486Synonym for \c
487.B \-b\c
488\& \c
2a28d8b0 489.I input\-format\c
0e166a63
RP
490\&.
491
492.TP
493.B \-g
494Accepted, but ignored; provided for compatibility with other tools.
495
8ddef552
DM
496.TP
497.BI "\-G " "size"\c
498Set the maximum size of objects to be optimized using the GP register
499to
500.I size
501under MIPS ECOFF. Ignored for other object file formats.
502
bf065bfd
DM
503.TP
504.B \-\-help
505Print a summary of the command-line options on the standard output and exit.
506This option and
507.B \-\-version
508begin with two dashes instead of one
509for compatibility with other GNU programs. The other options start with
510only one dash for compatibility with other linkers.
511
0e166a63
RP
512.TP
513.B \-i
514Perform an incremental link (same as option \c
515.B \-r\c
516\&).
517
518.TP
2a28d8b0 519.BI "\-l" "ar"\c
0e166a63
RP
520\&
521Add an archive file \c
522.I ar\c
523\& to the list of files to link. This
524option may be used any number of times. \c
525.B ld\c
526\& will search its
527path-list for occurrences of \c
528.B lib\c
529.I ar\c
530\&.a\c
531\& for every \c
80165535 532.I ar
0e166a63
RP
533specified.
534
535.TP
80165535 536.BI "\-L" "searchdir"
0e166a63
RP
537This command adds path \c
538.I searchdir\c
539\& to the list of paths that
540\c
541.B ld\c
542\& will search for archive libraries. You may use this option
543any number of times.
544
545The default set of paths searched (without being specified with
546\c
547.B \-L\c
548\&) depends on what emulation mode \c
549.B ld\c
550\& is using, and in
551some cases also on how it was configured. The
552paths can also be specified in a link script with the \c
80165535 553.B SEARCH_DIR
0e166a63
RP
554command.
555
556.TP
557.B \-M
0e166a63
RP
558Print (to the standard output file) a link map\(em\&diagnostic information
559about where symbols are mapped by \c
560.B ld\c
561\&, and information on global
562common storage allocation.
563
d18a4527
DM
564.TP
565.BI "\-Map " "mapfile"\c
566Print to the file
567.I mapfile
568a link map\(em\&diagnostic information
569about where symbols are mapped by \c
570.B ld\c
571\&, and information on global
572common storage allocation.
573
8ddef552
DM
574.TP
575.BI "\-m " "emulation"\c
576Emulate the
577.I emulation
578linker. You can list the available emulations with the
a82ae15d 579.I \-\-verbose
1f59c7a7
ILT
580or
581.I \-V
582options. This option overrides the compiled-in default, which is the
8ddef552
DM
583system for which you configured
584.BR ld .
585
0e166a63
RP
586.TP
587.B \-N
588specifies readable and writable \c
589.B text\c
590\& and \c
591.B data\c
592\& sections. If
593the output format supports Unix style magic numbers, the output is
594marked as \c
595.B OMAGIC\c
596\&.
597
598When you use the `\|\c
599.B \-N\c
600\&\|' option, the linker does not page-align the
601data segment.
602
603.TP
604.B \-n
605sets the text segment to be read only, and \c
606.B NMAGIC\c
607\& is written
608if possible.
609
610.TP
2a28d8b0 611.B \-noinhibit\-exec
0e166a63
RP
612Normally, the linker will not produce an output file if it encounters
613errors during the link process. With this flag, you can specify that
614you wish the output file retained even after non-fatal errors.
615
e920526d
ILT
616.TP
617.B \-no\-keep\-memory
618The linker normally optimizes for speed over memory usage by caching
619the symbol tables of input files in memory. This option tells the
620linker to instead optimize for memory usage, by rereading the symbol
621tables as necessary. This may be required if the linker runs out of
622memory space while linking a large executable.
623
0e166a63 624.TP
80165535 625.BI "\-o " "output"
0e166a63
RP
626.I output\c
627\& is a name for the program produced by \c
628.B ld\c
629\&; if this
630option is not specified, the name `\|\c
631.B a.out\c
632\|' is used by default. The
633script command \c
634.B OUTPUT\c
635\& can also specify the output file name.
636
346535cc 637.TP
80165535 638.BI "\-oformat " "output\-format"
346535cc
DM
639Specify the binary format for the output object file.
640You don't usually need to specify this, as
641\c
642.B ld\c
643\& is configured to produce as a default output format the most
644usual format on each machine. \c
645.I output-format\c
646\& is a text string, the
647name of a particular format supported by the BFD libraries.
648The script command
649.B OUTPUT_FORMAT
650can also specify the output format, but this option overrides it.
651
0e166a63 652.TP
80165535 653.BI "\-R " "filename"
0e166a63
RP
654Read symbol names and their addresses from \c
655.I filename\c
656\&, but do not
657relocate it or include it in the output. This allows your output file
658to refer symbolically to absolute locations of memory defined in other
659programs.
660
661.TP
662.B \-relax
663An option with machine dependent effects. Currently this option is only
664supported on the H8/300.
665
666On some platforms, use this option to perform global optimizations that
667become possible when the linker resolves addressing in your program, such
668as relaxing address modes and synthesizing new instructions in the
669output object file.
670
671On platforms where this is not supported, `\|\c
672.B \-relax\c
673\&\|' is accepted, but has no effect.
674
675.TP
676.B \-r
677Generates relocatable output\(em\&i.e., generate an output file that can in
678turn serve as input to \c
679.B ld\c
680\&. This is often called \c
681.I partial
682linking\c
683\&. As a side effect, in environments that support standard Unix
684magic numbers, this option also sets the output file's magic number to
685\c
686.B OMAGIC\c
687\&.
688If this option is not specified, an absolute file is produced. When
689linking C++ programs, this option \c
690.I will not\c
691\& resolve references to
692constructors; \c
693.B \-Ur\c
694\& is an alternative.
695
696This option does the same as \c
697.B \-i\c
698\&.
699
5caef232
ILT
700.TP
701.B \-rpath\ \fIdirectory
702Add a directory to the runtime library search path. This is used when
703linking an ELF executable with shared objects. All
704.B \-rpath
705arguments are concatenated and passed to the runtime linker, which uses
706them to locate shared objects at runtime. The
707.B \-rpath
708option is also used when locating shared objects which are needed by
709shared objects explicitly included in the link; see the description of
710the
711.B \-rpath\-link
20406675
ILT
712option. If
713.B \-rpath
714is not used when linking an ELF executable, the contents of the
715environment variable
716.B LD_RUN_PATH
717will be used if it is defined.
5caef232
ILT
718
719The
720.B \-rpath
721option may also be used on SunOS. By default, on SunOS, the linker
722will form a runtime search patch out of all the
723.B \-L
724options it is given. If a
725.B \-rpath option is used, the runtime search path
726will be formed exclusively using the
727.B \-rpath
728options, ignoring
729the
730.B \-L
731options. This can be useful when using gcc, which adds many
732.B \-L
733options which may be on NFS mounted filesystems.
734
735.TP
736.B \-rpath\-link\ \fIdirectory
235c6a67
ILT
737When using ELF or SunOS, one shared library may require another. This
738happens when an
5caef232
ILT
739.B ld\ \-shared
740link includes a shared library as one of the input files.
741
742When the linker encounters such a dependency when doing a non-shared,
743non-relocateable link, it will automatically try to locate the required
744shared library and include it in the link, if it is not included
745explicitly. In such a case, the
746.B \-rpath\-link
747option specifies the first set of directories to search. The
748.B \-rpath\-link
749option may specify a sequence of directory names either by specifying
750a list of names separated by colons, or by appearing multiple times.
751
752If the required shared library is not found, the linker will issue a
753warning and continue with the link.
754
0e166a63
RP
755.TP
756.B \-S
757Omits debugger symbol information (but not all symbols) from the output file.
758
759.TP
760.B \-s
761Omits all symbol information from the output file.
762
4551e108
ILT
763.TP
764.B \-shared
235c6a67
ILT
765Create a shared library. This is currently only supported on ELF and
766SunOS platforms (on SunOS it is not required, as the linker will
767automatically create a shared library when there are undefined symbols
768and the
769.B \-e
770option is not used).
4551e108 771
0e166a63 772.TP
2a28d8b0
DM
773.B \-sort\-common
774Normally, when
775.B ld
776places the global common symbols in the appropriate output sections,
777it sorts them by size. First come all the one byte symbols, then all
778the two bytes, then all the four bytes, and then everything else.
da08e9b9
DM
779This is to prevent gaps between symbols due to
780alignment constraints. This option disables that sorting.
2a28d8b0 781
ec586565
ILT
782.TP
783.B \-split\-by\-reloc\ \fIcount
784Trys to creates extra sections in the output file so that no single
785output section in the file contains more than
786.I count
787relocations.
788This is useful when generating huge relocatable for downloading into
789certain real time kernels with the COFF object file format; since COFF
790cannot represent more than 65535 relocations in a single section.
791Note that this will fail to work with object file formats which do not
792support arbitrary sections. The linker will not split up individual
793input sections for redistribution, so if a single input section
794contains more than
795.I count
796relocations one output section will contain that many relocations.
797
798.TP
799.B \-split\-by\-file
800Similar to
801.B \-split\-by\-reloc
802but creates a new output section for each input file.
803
2a28d8b0
DM
804.TP
805.BI "\-Tbss " "org"\c
0e166a63 806.TP
2a28d8b0 807.BI "\-Tdata " "org"\c
0e166a63 808.TP
2a28d8b0 809.BI "\-Ttext " "org"\c
0e166a63
RP
810Use \c
811.I org\c
812\& as the starting address for\(em\&respectively\(em\&the
813\c
814.B bss\c
815\&, \c
816.B data\c
817\&, or the \c
818.B text\c
819\& segment of the output file.
820\c
821.I textorg\c
822\& must be a hexadecimal integer.
823
824.TP
80165535 825.BI "\-T " "commandfile"
0e166a63
RP
826Equivalent to \c
827.B \-c \c
828.I commandfile\c
829\&\c
830\&; supported for compatibility with
831other tools.
832
833.TP
834.B \-t
835Prints names of input files as \c
836.B ld\c
837\& processes them.
838
839.TP
2a28d8b0 840.BI "\-u " "sym"
0e166a63
RP
841Forces \c
842.I sym\c
843\& to be entered in the output file as an undefined symbol.
844This may, for example, trigger linking of additional modules from
845standard libraries. \c
846.B \-u\c
847\& may be repeated with different option
848arguments to enter additional undefined symbols.
849
850.TP
851.B \-Ur
852For anything other than C++ programs, this option is equivalent to
853\c
854.B \-r\c
855\&: it generates relocatable output\(em\&i.e., an output file that can in
856turn serve as input to \c
857.B ld\c
858\&. When linking C++ programs, \c
80165535 859.B \-Ur
0e166a63
RP
860.I will\c
861\& resolve references to constructors, unlike \c
862.B \-r\c
863\&.
864
8ddef552 865.TP
a82ae15d 866.B \-\-verbose
8ddef552
DM
867Display the version number for \c
868.B ld
869and list the supported emulations.
de87cdb4 870Display which input files can and can not be opened.
8ddef552 871
0e166a63 872.TP
a82ae15d 873.B \-v, \-V
0e166a63
RP
874Display the version number for \c
875.B ld\c
876\&.
1f59c7a7
ILT
877The
878.B \-V
879option also lists the supported emulations.
0e166a63 880
bf065bfd
DM
881.TP
882.B \-\-version
883Display the version number for \c
884.B ld
885and exit.
886
2a28d8b0
DM
887.TP
888.B \-warn\-common
889Warn when a common symbol is combined with another common symbol or with
890a symbol definition. Unix linkers allow this somewhat sloppy practice,
891but linkers on some other operating systems do not. This option allows
892you to find potential problems from combining global symbols.
893
a89d9f5b
ILT
894.TP
895.B \-warn\-constructors
896Warn if any global constructors are used. This is only useful for a
897few object file formats. For formats like COFF or ELF, the linker can
898not detect the use of global constructors.
899
809ee7e0
ILT
900.TP
901.B \-warn\-once
902Only warn once for each undefined symbol, rather than once per module
903which refers to it.
904
ee499d81
ILT
905.TP
906.B \-\-whole\-archive
907For each archive mentioned on the command line, include every object
908file in the archive in the link, rather than searching the archive for
909the required object files. This is normally used to turn an archive
910file into a shared library, forcing every object to be included in the
911resulting shared library.
912
0e166a63
RP
913.TP
914.B \-X
21a2f026
ILT
915Delete all temporary local symbols. For most targets, this is all local
916symbols whose names begin with `\|\c
0e166a63
RP
917.B L\c
918\|'.
919
920.TP
921.B \-x
21a2f026 922Delete all local symbols.
0e166a63
RP
923
924.PP
925
926.SH ENVIRONMENT
927\c
8ddef552 928You can change the behavior of
0e166a63 929.B ld\c
8ddef552 930\& with the environment variable \c
0e166a63 931.B GNUTARGET\c
8ddef552 932\&.
0e166a63
RP
933
934\c
935.B GNUTARGET\c
936\& determines the input-file object format if you don't
937use \c
938.B \-b\c
939\& (or its synonym \c
940.B \-format\c
941\&). Its value should be one
942of the BFD names for an input format. If there is no
943\c
944.B GNUTARGET\c
945\& in the environment, \c
946.B ld\c
947\& uses the natural format
948of the host. If \c
949.B GNUTARGET\c
950\& is set to \c
951.B default\c
952\& then BFD attempts to discover the
953input format by examining binary input files; this method often
954succeeds, but there are potential ambiguities, since there is no method
955of ensuring that the magic number used to flag object-file formats is
956unique. However, the configuration procedure for BFD on each system
957places the conventional format for that system first in the search-list,
958so ambiguities are resolved in favor of convention.
959
0e166a63
RP
960.PP
961
962.SH "SEE ALSO"
963
964.BR objdump ( 1 )
965.br
966.br
967.RB "`\|" ld "\|' and `\|" binutils "\|'"
968entries in
969.B info\c
970.br
971.I
972ld: the GNU linker\c
973, Steve Chamberlain and Roland Pesch;
974.I
975The GNU Binary Utilities\c
976, Roland H. Pesch.
977
978.SH COPYING
979Copyright (c) 1991, 1992 Free Software Foundation, Inc.
980.PP
981Permission is granted to make and distribute verbatim copies of
982this manual provided the copyright notice and this permission notice
983are preserved on all copies.
984.PP
985Permission is granted to copy and distribute modified versions of this
986manual under the conditions for verbatim copying, provided that the
987entire resulting derived work is distributed under the terms of a
988permission notice identical to this one.
989.PP
990Permission is granted to copy and distribute translations of this
991manual into another language, under the above conditions for modified
992versions, except that this permission notice may be included in
993translations approved by the Free Software Foundation instead of in
994the original English.
This page took 0.166385 seconds and 4 git commands to generate.