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