* emultempl/sunos.em (gld${EMULATION_NAME}_find_so): Move
[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
712option.
713
714The
715.B \-rpath
716option may also be used on SunOS. By default, on SunOS, the linker
717will form a runtime search patch out of all the
718.B \-L
719options it is given. If a
720.B \-rpath option is used, the runtime search path
721will be formed exclusively using the
722.B \-rpath
723options, ignoring
724the
725.B \-L
726options. This can be useful when using gcc, which adds many
727.B \-L
728options which may be on NFS mounted filesystems.
729
730.TP
731.B \-rpath\-link\ \fIdirectory
235c6a67
ILT
732When using ELF or SunOS, one shared library may require another. This
733happens when an
5caef232
ILT
734.B ld\ \-shared
735link includes a shared library as one of the input files.
736
737When the linker encounters such a dependency when doing a non-shared,
738non-relocateable link, it will automatically try to locate the required
739shared library and include it in the link, if it is not included
740explicitly. In such a case, the
741.B \-rpath\-link
742option specifies the first set of directories to search. The
743.B \-rpath\-link
744option may specify a sequence of directory names either by specifying
745a list of names separated by colons, or by appearing multiple times.
746
747If the required shared library is not found, the linker will issue a
748warning and continue with the link.
749
0e166a63
RP
750.TP
751.B \-S
752Omits debugger symbol information (but not all symbols) from the output file.
753
754.TP
755.B \-s
756Omits all symbol information from the output file.
757
4551e108
ILT
758.TP
759.B \-shared
235c6a67
ILT
760Create a shared library. This is currently only supported on ELF and
761SunOS platforms (on SunOS it is not required, as the linker will
762automatically create a shared library when there are undefined symbols
763and the
764.B \-e
765option is not used).
4551e108 766
0e166a63 767.TP
2a28d8b0
DM
768.B \-sort\-common
769Normally, when
770.B ld
771places the global common symbols in the appropriate output sections,
772it sorts them by size. First come all the one byte symbols, then all
773the two bytes, then all the four bytes, and then everything else.
da08e9b9
DM
774This is to prevent gaps between symbols due to
775alignment constraints. This option disables that sorting.
2a28d8b0 776
ec586565
ILT
777.TP
778.B \-split\-by\-reloc\ \fIcount
779Trys to creates extra sections in the output file so that no single
780output section in the file contains more than
781.I count
782relocations.
783This is useful when generating huge relocatable for downloading into
784certain real time kernels with the COFF object file format; since COFF
785cannot represent more than 65535 relocations in a single section.
786Note that this will fail to work with object file formats which do not
787support arbitrary sections. The linker will not split up individual
788input sections for redistribution, so if a single input section
789contains more than
790.I count
791relocations one output section will contain that many relocations.
792
793.TP
794.B \-split\-by\-file
795Similar to
796.B \-split\-by\-reloc
797but creates a new output section for each input file.
798
2a28d8b0
DM
799.TP
800.BI "\-Tbss " "org"\c
0e166a63 801.TP
2a28d8b0 802.BI "\-Tdata " "org"\c
0e166a63 803.TP
2a28d8b0 804.BI "\-Ttext " "org"\c
0e166a63
RP
805Use \c
806.I org\c
807\& as the starting address for\(em\&respectively\(em\&the
808\c
809.B bss\c
810\&, \c
811.B data\c
812\&, or the \c
813.B text\c
814\& segment of the output file.
815\c
816.I textorg\c
817\& must be a hexadecimal integer.
818
819.TP
80165535 820.BI "\-T " "commandfile"
0e166a63
RP
821Equivalent to \c
822.B \-c \c
823.I commandfile\c
824\&\c
825\&; supported for compatibility with
826other tools.
827
828.TP
829.B \-t
830Prints names of input files as \c
831.B ld\c
832\& processes them.
833
834.TP
2a28d8b0 835.BI "\-u " "sym"
0e166a63
RP
836Forces \c
837.I sym\c
838\& to be entered in the output file as an undefined symbol.
839This may, for example, trigger linking of additional modules from
840standard libraries. \c
841.B \-u\c
842\& may be repeated with different option
843arguments to enter additional undefined symbols.
844
845.TP
846.B \-Ur
847For anything other than C++ programs, this option is equivalent to
848\c
849.B \-r\c
850\&: it generates relocatable output\(em\&i.e., an output file that can in
851turn serve as input to \c
852.B ld\c
853\&. When linking C++ programs, \c
80165535 854.B \-Ur
0e166a63
RP
855.I will\c
856\& resolve references to constructors, unlike \c
857.B \-r\c
858\&.
859
8ddef552 860.TP
a82ae15d 861.B \-\-verbose
8ddef552
DM
862Display the version number for \c
863.B ld
864and list the supported emulations.
de87cdb4 865Display which input files can and can not be opened.
8ddef552 866
0e166a63 867.TP
a82ae15d 868.B \-v, \-V
0e166a63
RP
869Display the version number for \c
870.B ld\c
871\&.
1f59c7a7
ILT
872The
873.B \-V
874option also lists the supported emulations.
0e166a63 875
bf065bfd
DM
876.TP
877.B \-\-version
878Display the version number for \c
879.B ld
880and exit.
881
2a28d8b0
DM
882.TP
883.B \-warn\-common
884Warn when a common symbol is combined with another common symbol or with
885a symbol definition. Unix linkers allow this somewhat sloppy practice,
886but linkers on some other operating systems do not. This option allows
887you to find potential problems from combining global symbols.
888
a89d9f5b
ILT
889.TP
890.B \-warn\-constructors
891Warn if any global constructors are used. This is only useful for a
892few object file formats. For formats like COFF or ELF, the linker can
893not detect the use of global constructors.
894
809ee7e0
ILT
895.TP
896.B \-warn\-once
897Only warn once for each undefined symbol, rather than once per module
898which refers to it.
899
ee499d81
ILT
900.TP
901.B \-\-whole\-archive
902For each archive mentioned on the command line, include every object
903file in the archive in the link, rather than searching the archive for
904the required object files. This is normally used to turn an archive
905file into a shared library, forcing every object to be included in the
906resulting shared library.
907
0e166a63
RP
908.TP
909.B \-X
21a2f026
ILT
910Delete all temporary local symbols. For most targets, this is all local
911symbols whose names begin with `\|\c
0e166a63
RP
912.B L\c
913\|'.
914
915.TP
916.B \-x
21a2f026 917Delete all local symbols.
0e166a63
RP
918
919.PP
920
921.SH ENVIRONMENT
922\c
8ddef552 923You can change the behavior of
0e166a63 924.B ld\c
8ddef552 925\& with the environment variable \c
0e166a63 926.B GNUTARGET\c
8ddef552 927\&.
0e166a63
RP
928
929\c
930.B GNUTARGET\c
931\& determines the input-file object format if you don't
932use \c
933.B \-b\c
934\& (or its synonym \c
935.B \-format\c
936\&). Its value should be one
937of the BFD names for an input format. If there is no
938\c
939.B GNUTARGET\c
940\& in the environment, \c
941.B ld\c
942\& uses the natural format
943of the host. If \c
944.B GNUTARGET\c
945\& is set to \c
946.B default\c
947\& then BFD attempts to discover the
948input format by examining binary input files; this method often
949succeeds, but there are potential ambiguities, since there is no method
950of ensuring that the magic number used to flag object-file formats is
951unique. However, the configuration procedure for BFD on each system
952places the conventional format for that system first in the search-list,
953so ambiguities are resolved in favor of convention.
954
0e166a63
RP
955.PP
956
957.SH "SEE ALSO"
958
959.BR objdump ( 1 )
960.br
961.br
962.RB "`\|" ld "\|' and `\|" binutils "\|'"
963entries in
964.B info\c
965.br
966.I
967ld: the GNU linker\c
968, Steve Chamberlain and Roland Pesch;
969.I
970The GNU Binary Utilities\c
971, Roland H. Pesch.
972
973.SH COPYING
974Copyright (c) 1991, 1992 Free Software Foundation, Inc.
975.PP
976Permission is granted to make and distribute verbatim copies of
977this manual provided the copyright notice and this permission notice
978are preserved on all copies.
979.PP
980Permission is granted to copy and distribute modified versions of this
981manual under the conditions for verbatim copying, provided that the
982entire resulting derived work is distributed under the terms of a
983permission notice identical to this one.
984.PP
985Permission is granted to copy and distribute translations of this
986manual into another language, under the above conditions for modified
987versions, except that this permission notice may be included in
988translations approved by the Free Software Foundation instead of in
989the original English.
This page took 0.159555 seconds and 4 git commands to generate.