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