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