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