* Makefile.am (CPU_OBJ_VALID): Add case to filter out invalid coff
[deliverable/binutils-gdb.git] / ld / ld.1
CommitLineData
cf055d54 1.\" Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software Foundation
252b5132 2.\" See section COPYING for conditions for redistribution
fd89e65f 3.TH ld 1 "" "Free Software Foundation" "GNU Development Tools"
252b5132
RH
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
176355da 42\&=\c
252b5132
RH
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\&\|]
176355da
NC
125.RB "[\|" "\-\-section\-start\ "\c
126.I sectionname\c
127\&=\c
128.I sectionorg\c
129\&\|]
252b5132
RH
130.RB "[\|" "\-Ttext\ "\c
131.I textorg\c
132\&\|]
133.RB "[\|" "\-Tdata\ "\c
134.I dataorg\c
135\&\|]
136.RB "[\|" "\-Tbss\ "\c
137.I bssorg\c
138\&\|]
139.RB "[\|" \-t "\|]"
140.RB "[\|" "\-u\ "\c
141.I sym\c
142\&]
143.RB "[\|" \-V "\|]"
144.RB "[\|" \-v "\|]"
145.RB "[\|" \-\-verbose "\|]"
146.RB "[\|" \-\-version "\|]"
147.RB "[\|" \-warn\-common "\|]"
148.RB "[\|" \-warn\-constructors "\|]"
149.RB "[\|" \-warn\-multiple\-gp "\|]"
150.RB "[\|" \-warn\-once "\|]"
151.RB "[\|" \-warn\-section\-align "\|]"
152.RB "[\|" \-\-whole\-archive "\|]"
153.RB "[\|" \-\-no\-whole\-archive "\|]"
154.RB "[\|" "\-\-wrap\ "\c
155.I symbol\c
156\&\|]
157.RB "[\|" \-X "\|]"
158.RB "[\|" \-x "\|]"
159.ad b
160.hy 1
161.SH DESCRIPTION
162\c
163.B ld\c
164\& combines a number of object and archive files, relocates
165their data and ties up symbol references. Often the last step in
166building a new compiled program to run is a call to \c
167.B ld\c
168\&.
169
170\c
171.B ld\c
172\& accepts Linker Command Language files
173to provide explicit and total control over the linking process.
174This man page does not describe the command language; see the `\|\c
175.B ld\c
176\|' entry in `\|\c
177.B info\c
178\|', or the manual
179.I
180ld: the GNU linker
181\&, for full details on the command language and on other aspects of
182the GNU linker.
183
184This version of \c
185.B ld\c
186\& uses the general purpose BFD libraries
187to operate on object files. This allows \c
188.B ld\c
189\& to read, combine, and
190write object files in many different formats\(em\&for example, COFF or
191\c
192.B a.out\c
193\&. Different formats may be linked together to produce any
194available kind of object file. You can use `\|\c
195.B objdump \-i\c
196\|' to get a list of formats supported on various architectures; see
197.BR objdump ( 1 ).
198
199Aside from its flexibility, the GNU linker is more helpful than other
200linkers in providing diagnostic information. Many linkers abandon
201execution immediately upon encountering an error; whenever possible,
202\c
203.B ld\c
204\& continues executing, allowing you to identify other errors
205(or, in some cases, to get an output file in spite of the error).
206
207The GNU linker \c
208.B ld\c
209\& is meant to cover a broad range of situations,
210and to be as compatible as possible with other linkers. As a result,
211you have many choices to control its behavior through the command line,
212and through environment variables.
213
214.SH OPTIONS
215The plethora of command-line options may seem intimidating, but in
216actual practice few of them are used in any particular context.
217For instance, a frequent use of \c
218.B ld\c
219\& is to link standard Unix
220object files on a standard, supported Unix system. On such a system, to
221link a file \c
222.B hello.o\c
223\&:
224.sp
225.br
226$\ ld\ \-o\ output\ /lib/crt0.o\ hello.o\ \-lc
227.br
228.sp
229This tells \c
230.B ld\c
231\& to produce a file called \c
232.B output\c
233\& as the
234result of linking the file \c
235.B /lib/crt0.o\c
236\& with \c
237.B hello.o\c
238\& and
239the library \c
240.B libc.a\c
241\& which will come from the standard search
242directories.
243
244The command-line options to \c
245.B ld\c
246\& may be specified in any order, and
247may be repeated at will. For the most part, repeating an option with a
248different argument will either have no further effect, or override prior
249occurrences (those further to the left on the command line) of an
250option.
251
252The exceptions\(em\&which may meaningfully be used more than once\(em\&are
253\c
254.B \-A\c
255\&, \c
256.B \-b\c
257\& (or its synonym \c
258.B \-format\c
259\&), \c
260.B \-defsym\c
176355da
NC
261\&, \c
262.B \-\-section\-start\c
263\&, \c
252b5132
RH
264.B \-L\c
265\&, \c
266.B \-l\c
267\&, \c
268.B \-R\c
269\&, and \c
270.B \-u\c
271\&.
272
273The list of object files to be linked together, shown as \c
274.I objfile\c
275\&,
276may follow, precede, or be mixed in with command-line options; save that
277an \c
278.I objfile\c
279\& argument may not be placed between an option flag and
280its argument.
281
282Usually the linker is invoked with at least one object file, but other
283forms of binary input files can also be specified with \c
284.B \-l\c
285\&,
286\c
287.B \-R\c
288\&, and the script command language. If \c
289.I no\c
290\& binary input
291files at all are specified, the linker does not produce any output, and
292issues the message `\|\c
293.B No input files\c
294\|'.
295
296Option arguments must either follow the option letter without intervening
297whitespace, or be given as separate arguments immediately following the
298option that requires them.
299
300.TP
301.BI "-A" "architecture"
302In the current release of \c
303.B ld\c
304\&, this option is useful only for the
305Intel 960 family of architectures. In that \c
306.B ld\c
307\& configuration, the
308\c
309.I architecture\c
310\& argument is one of the two-letter names identifying
311members of the 960 family; the option specifies the desired output
312target, and warns of any incompatible instructions in the input files.
313It also modifies the linker's search strategy for archive libraries, to
314support the use of libraries specific to each particular
315architecture, by including in the search loop names suffixed with the
316string identifying the architecture.
317
318For example, if your \c
319.B ld\c
320\& command line included `\|\c
321.B \-ACA\c
322\|' as
323well as `\|\c
324.B \-ltry\c
325\|', the linker would look (in its built-in search
326paths, and in any paths you specify with \c
327.B \-L\c
328\&) for a library with
329the names
330.sp
331.br
332try
333.br
334libtry.a
335.br
336tryca
337.br
338libtryca.a
339.br
340.sp
341
342The first two possibilities would be considered in any event; the last
343two are due to the use of `\|\c
344.B \-ACA\c
345\|'.
346
347Future releases of \c
348.B ld\c
349\& may support similar functionality for
350other architecture families.
351
352You can meaningfully use \c
353.B \-A\c
354\& more than once on a command line, if
355an architecture family allows combination of target architectures; each
356use will add another pair of name variants to search for when \c
357.B \-l
358specifies a library.
359
360.TP
361.BI "\-b " "input-format"
362Specify the binary format for input object files that follow this option
363on the command line. You don't usually need to specify this, as
364\c
365.B ld\c
366\& is configured to expect as a default input format the most
367usual format on each machine. \c
368.I input-format\c
369\& is a text string, the
370name of a particular format supported by the BFD libraries.
371\c
372.B \-format \c
373.I input-format\c
374\&\c
375\& has the same effect, as does the script command
376.BR TARGET .
377
378You may want to use this option if you are linking files with an unusual
379binary format. You can also use \c
380.B \-b\c
381\& to switch formats explicitly (when
382linking object files of different formats), by including
383\c
384.B \-b \c
385.I input-format\c
386\&\c
387\& before each group of object files in a
388particular format.
389
390The default format is taken from the environment variable
391.B GNUTARGET\c
392\&. You can also define the input
393format from a script, using the command \c
394.B TARGET\c
395\&.
396
397.TP
398.B \-Bstatic
399Do not link against shared libraries. This is only meaningful on
400platforms for which shared libraries are supported.
401
402.TP
403.B \-Bdynamic
404Link against dynamic libraries. This is only meaningful on platforms
405for which shared libraries are supported. This option is normally the
406default on such platforms.
407
408.TP
409.B \-Bsymbolic
410When creating a shared library, bind references to global symbols to
411the definition within the shared library, if any. Normally, it is
412possible for a program linked against a shared library to override the
413definition within the shared library. This option is only meaningful
414on ELF platforms which support shared libraries.
415
416.TP
417.BI "\-c " "commandfile"
418Directs \c
419.B ld\c
420\& to read link commands from the file
421\c
422.I commandfile\c
423\&. These commands will completely override \c
424.B ld\c
425\&'s
426default link format (rather than adding to it); \c
427.I commandfile\c
428\& must
429specify everything necessary to describe the target format.
430
431
432You may also include a script of link commands directly in the command
433line by bracketing it between `\|\c
434.B {\c
435\|' and `\|\c
436.B }\c
437\|' characters.
438
439.TP
440.B \-\-cref
441Output a cross reference table. If a linker map file is being
442generated, the cross reference table is printed to the map file.
443Otherwise, it is printed on the standard output.
444
445.TP
446.B \-d
447.TP
448.B \-dc
449.TP
450.B \-dp
451These three options are equivalent; multiple forms are supported for
452compatibility with other linkers. Use any of them to make \c
453.B ld
454assign space to common symbols even if a relocatable output file is
455specified (\c
456.B \-r\c
457\&). The script command
458\c
459.B FORCE_COMMON_ALLOCATION\c
460\& has the same effect.
461
462.TP
176355da 463.BI "-defsym " "symbol" "\fR=\fP" expression
252b5132
RH
464Create a global symbol in the output file, containing the absolute
465address given by \c
466.I expression\c
467\&. You may use this option as many
468times as necessary to define multiple symbols in the command line. A
469limited form of arithmetic is supported for the \c
470.I expression\c
471\& in this
472context: you may give a hexadecimal constant or the name of an existing
473symbol, or use \c
474.B +\c
475\& and \c
476.B \-\c
477\& to add or subtract hexadecimal
478constants or symbols. If you need more elaborate expressions, consider
479using the linker command language from a script.
480
481.TP
482.B \-\-demangle
483.TP
484.B \-\-no\-demangle
485These options control whether to demangle symbol names in error
486messages and other output. When the linker is told to demangle, it
487tries to present symbol names in a readable fashion: it strips leading
488underscores if they are used by the object file format, and converts
489C++ mangled symbol names into user readable names. The linker will
490demangle by default unless the environment variable
491.B COLLECT_NO_DEMANGLE
492is set. These options may be used to override the default.
493
494.TP
495.BI "-e " "entry"\c
496\&
497Use \c
498.I entry\c
499\& as the explicit symbol for beginning execution of your
500program, rather than the default entry point. See the `\|\c
501.B ld\c
502\|' entry in `\|\c
503.B info\c
504\|' for a
505discussion of defaults and other ways of specifying the
506entry point.
507
508.TP
509.B \-embedded\-relocs
510This option is only meaningful when linking MIPS embedded PIC code,
511generated by the
512.B \-membedded\-pic
513option to the GNU compiler and assembler. It causes the linker to
514create a table which may be used at runtime to relocate any data which
515was statically initialized to pointer values. See the code in
516testsuite/ld-empic for details.
517
518.TP
519.B \-E
520.TP
521.B \-export\-dynamic
522When creating an ELF file, add all symbols to the dynamic symbol table.
523Normally, the dynamic symbol table contains only symbols which are used
524by a dynamic object. This option is needed for some uses of
525.I dlopen.
526
527.TP
528.BI "-f " "name"
529.TP
530.BI "--auxiliary " "name"
531When creating an ELF shared object, set the internal DT_AUXILIARY field
532to the specified name. This tells the dynamic linker that the symbol
533table of the shared object should be used as an auxiliary filter on the
534symbol table of the shared object
535.I name.
536
537.TP
538.BI "-F " "name"
539.TP
540.BI "--filter " "name"
541When creating an ELF shared object, set the internal DT_FILTER field to
542the specified name. This tells the dynamic linker that the symbol table
543of the shared object should be used as a filter on the symbol table of
544the shared object
545.I name.
546
547.TP
548.BI "\-format " "input\-format"
549Synonym for \c
550.B \-b\c
551\& \c
552.I input\-format\c
553\&.
554
555.TP
556.B \-g
557Accepted, but ignored; provided for compatibility with other tools.
558
559.TP
560.BI "\-G " "size"\c
561Set the maximum size of objects to be optimized using the GP register
562to
563.I size
564under MIPS ECOFF. Ignored for other object file formats.
565
566.TP
567.BI "-h " "name"
568.TP
569.BI "-soname " "name"
570When creating an ELF shared object, set the internal DT_SONAME field to
571the specified name. When an executable is linked with a shared object
572which has a DT_SONAME field, then when the executable is run the dynamic
573linker will attempt to load the shared object specified by the DT_SONAME
574field rather than the using the file name given to the linker.
575
576.TP
577.B \-\-help
578Print a summary of the command-line options on the standard output and exit.
579This option and
580.B \-\-version
581begin with two dashes instead of one
582for compatibility with other GNU programs. The other options start with
583only one dash for compatibility with other linkers.
584
585.TP
586.B \-i
587Perform an incremental link (same as option \c
588.B \-r\c
589\&).
590
591.TP
592.BI "\-l" "ar"\c
593\&
594Add an archive file \c
595.I ar\c
596\& to the list of files to link. This
597option may be used any number of times. \c
598.B ld\c
599\& will search its
600path-list for occurrences of \c
601.B lib\c
602.I ar\c
603\&.a\c
604\& for every \c
605.I ar
606specified.
607
608.TP
609.BI "\-L" "searchdir"
610This command adds path \c
611.I searchdir\c
612\& to the list of paths that
613\c
614.B ld\c
615\& will search for archive libraries. You may use this option
616any number of times.
617
618The default set of paths searched (without being specified with
619\c
620.B \-L\c
621\&) depends on what emulation mode \c
622.B ld\c
623\& is using, and in
624some cases also on how it was configured. The
625paths can also be specified in a link script with the \c
626.B SEARCH_DIR
627command.
628
629.TP
630.B \-M
631Print (to the standard output file) a link map\(em\&diagnostic information
632about where symbols are mapped by \c
633.B ld\c
634\&, and information on global
635common storage allocation.
636
637.TP
638.BI "\-Map " "mapfile"\c
639Print to the file
640.I mapfile
641a link map\(em\&diagnostic information
642about where symbols are mapped by \c
643.B ld\c
644\&, and information on global
645common storage allocation.
646
647.TP
648.BI "\-m " "emulation"\c
649Emulate the
650.I emulation
651linker. You can list the available emulations with the
652.I \-\-verbose
653or
654.I \-V
655options. This option overrides the compiled-in default, which is the
656system for which you configured
657.BR ld .
658
659.TP
660.B \-N
661specifies readable and writable \c
662.B text\c
663\& and \c
664.B data\c
665\& sections. If
666the output format supports Unix style magic numbers, the output is
667marked as \c
668.B OMAGIC\c
669\&.
670
671When you use the `\|\c
672.B \-N\c
673\&\|' option, the linker does not page-align the
674data segment.
675
676.TP
677.B \-n
678sets the text segment to be read only, and \c
679.B NMAGIC\c
680\& is written
681if possible.
682
683.TP
684.B \-noinhibit\-exec
685Normally, the linker will not produce an output file if it encounters
686errors during the link process. With this flag, you can specify that
687you wish the output file retained even after non-fatal errors.
688
689.TP
690.B \-no\-keep\-memory
691The linker normally optimizes for speed over memory usage by caching
692the symbol tables of input files in memory. This option tells the
693linker to instead optimize for memory usage, by rereading the symbol
694tables as necessary. This may be required if the linker runs out of
695memory space while linking a large executable.
696
697.TP
698.B \-no\-warn\-mismatch
699Normally the linker will give an error if you try to link together
700input files that are mismatched for some reason, perhaps because they
701have been compiled for different processors or for different
702endiannesses. This option tells the linker that it should silently
703permit such possible errors. This option should only be used with
704care, in cases when you have taken some special action that ensures
705that the linker errors are inappropriate.
706
707.TP
708.BI "\-o " "output"
709.I output\c
710\& is a name for the program produced by \c
711.B ld\c
712\&; if this
713option is not specified, the name `\|\c
714.B a.out\c
715\|' is used by default. The
716script command \c
717.B OUTPUT\c
718\& can also specify the output file name.
719
720.TP
721.BI "\-O" "level"
722Generate optimized output files. This might use significantly more
723time and therefore probably should be enabled only for generating the
724final binary.
725\c
726.I level\c
727\& is supposed to be a numeric value. Any value greater than zero enables
728the optimizations.
729
730.TP
731.BI "\-oformat " "output\-format"
732Specify the binary format for the output object file.
733You don't usually need to specify this, as
734\c
735.B ld\c
736\& is configured to produce as a default output format the most
737usual format on each machine. \c
738.I output-format\c
739\& is a text string, the
740name of a particular format supported by the BFD libraries.
741The script command
742.B OUTPUT_FORMAT
743can also specify the output format, but this option overrides it.
744
745.TP
746.BI "\-R " "filename"
747Read symbol names and their addresses from \c
748.I filename\c
749\&, but do not
750relocate it or include it in the output. This allows your output file
751to refer symbolically to absolute locations of memory defined in other
752programs.
753
754.TP
755.B \-relax
756An option with machine dependent effects. Currently this option is only
757supported on the H8/300.
758
759On some platforms, use this option to perform global optimizations that
760become possible when the linker resolves addressing in your program, such
761as relaxing address modes and synthesizing new instructions in the
762output object file.
763
764On platforms where this is not supported, `\|\c
765.B \-relax\c
766\&\|' is accepted, but has no effect.
767
768.TP
769.B \-r
770Generates relocatable output\(em\&i.e., generate an output file that can in
771turn serve as input to \c
772.B ld\c
773\&. This is often called \c
774.I partial
775linking\c
776\&. As a side effect, in environments that support standard Unix
777magic numbers, this option also sets the output file's magic number to
778\c
779.B OMAGIC\c
780\&.
781If this option is not specified, an absolute file is produced. When
782linking C++ programs, this option \c
783.I will not\c
784\& resolve references to
785constructors; \c
786.B \-Ur\c
787\& is an alternative.
788
789This option does the same as \c
790.B \-i\c
791\&.
792
793.TP
794.B \-rpath\ \fIdirectory
795Add a directory to the runtime library search path. This is used when
796linking an ELF executable with shared objects. All
797.B \-rpath
798arguments are concatenated and passed to the runtime linker, which uses
799them to locate shared objects at runtime. The
800.B \-rpath
801option is also used when locating shared objects which are needed by
802shared objects explicitly included in the link; see the description of
803the
804.B \-rpath\-link
805option. If
806.B \-rpath
807is not used when linking an ELF executable, the contents of the
808environment variable
809.B LD_RUN_PATH
810will be used if it is defined.
811
812The
813.B \-rpath
814option may also be used on SunOS. By default, on SunOS, the linker
815will form a runtime search path out of all the
816.B \-L
817options it is given. If a
818.B \-rpath
819option is used, the runtime search path will be formed exclusively
820using the
821.B \-rpath
822options, ignoring
823the
824.B \-L
825options. This can be useful when using gcc, which adds many
826.B \-L
827options which may be on NFS mounted filesystems.
828
829.TP
830.B \-rpath\-link\ \fIdirectory
831When using ELF or SunOS, one shared library may require another. This
832happens when an
833.B ld\ \-shared
834link includes a shared library as one of the input files.
835
836When the linker encounters such a dependency when doing a non-shared,
837non-relocateable link, it will automatically try to locate the required
838shared library and include it in the link, if it is not included
839explicitly. In such a case, the
840.B \-rpath\-link
841option specifies the first set of directories to search. The
842.B \-rpath\-link
843option may specify a sequence of directory names either by specifying
844a list of names separated by colons, or by appearing multiple times.
845
846If the required shared library is not found, the linker will issue a
847warning and continue with the link.
848
849.TP
850.B \-S
851Omits debugger symbol information (but not all symbols) from the output file.
852
853.TP
854.B \-s
855Omits all symbol information from the output file.
856
857.TP
858.B \-shared
859Create a shared library. This is currently only supported on ELF and
860SunOS platforms (on SunOS it is not required, as the linker will
861automatically create a shared library when there are undefined symbols
862and the
863.B \-e
864option is not used).
865
866.TP
867.B \-sort\-common
868Normally, when
869.B ld
870places the global common symbols in the appropriate output sections,
871it sorts them by size. First come all the one byte symbols, then all
872the two bytes, then all the four bytes, and then everything else.
873This is to prevent gaps between symbols due to
874alignment constraints. This option disables that sorting.
875
876.TP
877.B \-split\-by\-reloc\ \fIcount
878Trys to creates extra sections in the output file so that no single
879output section in the file contains more than
880.I count
881relocations.
882This is useful when generating huge relocatable for downloading into
883certain real time kernels with the COFF object file format; since COFF
884cannot represent more than 65535 relocations in a single section.
885Note that this will fail to work with object file formats which do not
886support arbitrary sections. The linker will not split up individual
887input sections for redistribution, so if a single input section
888contains more than
889.I count
890relocations one output section will contain that many relocations.
891
892.TP
893.B \-split\-by\-file
894Similar to
895.B \-split\-by\-reloc
896but creates a new output section for each input file.
897
176355da
NC
898.TP
899.BI "--section-start " "sectionname" "\fR=\fP"org
900Locate a section in the output file at the absolute
901address given by \c
902.I org\c
903\&. \c
904\c
905.I org\c
906\& must be a hexadecimal integer.
907You may use this option as many
908times as necessary to locate multiple sections in the command
909line. If you need more elaborate expressions, consider
910using the linker command language from a script.
911
252b5132
RH
912.TP
913.BI "\-Tbss " "org"\c
914.TP
915.BI "\-Tdata " "org"\c
916.TP
917.BI "\-Ttext " "org"\c
918Use \c
919.I org\c
920\& as the starting address for\(em\&respectively\(em\&the
921\c
922.B bss\c
923\&, \c
924.B data\c
925\&, or the \c
926.B text\c
927\& segment of the output file.
928\c
929.I org\c
930\& must be a hexadecimal integer.
931
932.TP
933.BI "\-T " "commandfile"
934Equivalent to \c
935.B \-c \c
936.I commandfile\c
937\&\c
938\&; supported for compatibility with
939other tools.
940
941.TP
942.B \-t
943Prints names of input files as \c
944.B ld\c
945\& processes them.
946
947.TP
948.BI "\-u " "sym"
949Forces \c
950.I sym\c
951\& to be entered in the output file as an undefined symbol.
952This may, for example, trigger linking of additional modules from
953standard libraries. \c
954.B \-u\c
955\& may be repeated with different option
956arguments to enter additional undefined symbols.
957
958.TP
959.B \-Ur
960For anything other than C++ programs, this option is equivalent to
961\c
962.B \-r\c
963\&: it generates relocatable output\(em\&i.e., an output file that can in
964turn serve as input to \c
965.B ld\c
966\&. When linking C++ programs, \c
967.B \-Ur
968.I will\c
969\& resolve references to constructors, unlike \c
970.B \-r\c
971\&.
972
973.TP
974.B \-\-verbose
975Display the version number for \c
976.B ld
977and list the supported emulations.
978Display which input files can and can not be opened.
979
980.TP
981.B \-v, \-V
982Display the version number for \c
983.B ld\c
984\&.
985The
986.B \-V
987option also lists the supported emulations.
988
989.TP
990.B \-\-version
991Display the version number for \c
992.B ld
993and exit.
994
995.TP
996.B \-warn\-common
997Warn when a common symbol is combined with another common symbol or with
998a symbol definition. Unix linkers allow this somewhat sloppy practice,
999but linkers on some other operating systems do not. This option allows
1000you to find potential problems from combining global symbols.
1001
1002.TP
1003.B \-warn\-constructors
1004Warn if any global constructors are used. This is only useful for a
1005few object file formats. For formats like COFF or ELF, the linker can
1006not detect the use of global constructors.
1007
1008.TP
1009.B \-warn\-multiple\-gp
1010Warn if the output file requires multiple global-pointer values. This
1011option is only meaningful for certain processors, such as the Alpha.
1012
1013.TP
1014.B \-warn\-once
1015Only warn once for each undefined symbol, rather than once per module
1016which refers to it.
1017
1018.TP
1019.B \-warn\-section\-align
1020Warn if the address of an output section is changed because of
1021alignment. Typically, the alignment will be set by an input section.
1022The address will only be changed if it not explicitly specified; that
1023is, if the SECTIONS command does not specify a start address for the
1024section.
1025
1026.TP
1027.B \-\-whole\-archive
1028For each archive mentioned on the command line after the
1029.B \-\-whole\-archive
1030option, include every object file in the archive in the link, rather
1031than searching the archive for the required object files. This is
1032normally used to turn an archive file into a shared library, forcing
1033every object to be included in the resulting shared library.
1034
1035.TP
1036.B \-\-no\-whole\-archive
1037Turn off the effect of the
1038.B \-\-whole\-archive
1039option for archives which appear later on the command line.
1040
1041.TP
1042.BI "--wrap " "symbol"
1043Use a wrapper function for
1044.I symbol.
1045Any undefined reference to
1046.I symbol
1047will be resolved to
1048.BI "__wrap_" "symbol".
1049Any undefined reference to
1050.BI "__real_" "symbol"
1051will be resolved to
1052.I symbol.
1053
1054.TP
1055.B \-X
1056Delete all temporary local symbols. For most targets, this is all local
1057symbols whose names begin with `\|\c
1058.B L\c
1059\|'.
1060
1061.TP
1062.B \-x
1063Delete all local symbols.
1064
1065.PP
1066
1067.SH ENVIRONMENT
1068\c
1069You can change the behavior of
1070.B ld\c
1071\& with the environment variable \c
1072.B GNUTARGET\c
1073\&.
1074
1075\c
1076.B GNUTARGET\c
1077\& determines the input-file object format if you don't
1078use \c
1079.B \-b\c
1080\& (or its synonym \c
1081.B \-format\c
1082\&). Its value should be one
1083of the BFD names for an input format. If there is no
1084\c
1085.B GNUTARGET\c
1086\& in the environment, \c
1087.B ld\c
1088\& uses the natural format
1089of the host. If \c
1090.B GNUTARGET\c
1091\& is set to \c
1092.B default\c
1093\& then BFD attempts to discover the
1094input format by examining binary input files; this method often
1095succeeds, but there are potential ambiguities, since there is no method
1096of ensuring that the magic number used to flag object-file formats is
1097unique. However, the configuration procedure for BFD on each system
1098places the conventional format for that system first in the search-list,
1099so ambiguities are resolved in favor of convention.
1100
1101.PP
1102
1103.SH "SEE ALSO"
1104
1105.BR objdump ( 1 )
1106.br
1107.br
1108.RB "`\|" ld "\|' and `\|" binutils "\|'"
1109entries in
1110.B info\c
1111.br
1112.I
1113ld: the GNU linker\c
1114, Steve Chamberlain and Roland Pesch;
1115.I
1116The GNU Binary Utilities\c
1117, Roland H. Pesch.
1118
1119.SH COPYING
cf055d54
NC
1120Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
1121.PP
1122This document is distributed under the terms of the GNU Free
1123Documenation License. That license is described in the GNU Free
1124Documentation License section.
1125
1126.SH GNU Free Documentation License
1127 Version 1.1, March 2000
1128
1129 Copyright (C) 2000 Free Software Foundation, Inc.
1130 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1131
1132 Everyone is permitted to copy and distribute verbatim
1133 copies of this license document, but changing it is
1134 not allowed.
1135.PP
11360. PREAMBLE
1137.PP
1138The purpose of this License is to make a manual, textbook, or other
1139written document "free" in the sense of freedom: to assure everyone
1140the effective freedom to copy and redistribute it, with or without
1141modifying it, either commercially or noncommercially. Secondarily,
1142this License preserves for the author and publisher a way to get
1143credit for their work, while not being considered responsible for
1144modifications made by others.
1145.PP
1146This License is a kind of "copyleft", which means that derivative
1147works of the document must themselves be free in the same sense. It
1148complements the GNU General Public License, which is a copyleft
1149license designed for free software.
1150.PP
1151We have designed this License in order to use it for manuals for free
1152software, because free software needs free documentation: a free
1153program should come with manuals providing the same freedoms that the
1154software does. But this License is not limited to software manuals;
1155it can be used for any textual work, regardless of subject matter or
1156whether it is published as a printed book. We recommend this License
1157principally for works whose purpose is instruction or reference.
1158.PP
11591. APPLICABILITY AND DEFINITIONS
1160.PP
1161This License applies to any manual or other work that contains a
1162notice placed by the copyright holder saying it can be distributed
1163under the terms of this License. The "Document", below, refers to any
1164such manual or work. Any member of the public is a licensee, and is
1165addressed as "you".
1166.PP
1167A "Modified Version" of the Document means any work containing the
1168Document or a portion of it, either copied verbatim, or with
1169modifications and/or translated into another language.
1170.PP
1171A "Secondary Section" is a named appendix or a front-matter section of
1172the Document that deals exclusively with the relationship of the
1173publishers or authors of the Document to the Document's overall subject
1174(or to related matters) and contains nothing that could fall directly
1175within that overall subject. (For example, if the Document is in part a
1176textbook of mathematics, a Secondary Section may not explain any
1177mathematics.) The relationship could be a matter of historical
1178connection with the subject or with related matters, or of legal,
1179commercial, philosophical, ethical or political position regarding
1180them.
1181.PP
1182The "Invariant Sections" are certain Secondary Sections whose titles
1183are designated, as being those of Invariant Sections, in the notice
1184that says that the Document is released under this License.
1185.PP
1186The "Cover Texts" are certain short passages of text that are listed,
1187as Front-Cover Texts or Back-Cover Texts, in the notice that says that
1188the Document is released under this License.
1189.PP
1190A "Transparent" copy of the Document means a machine-readable copy,
1191represented in a format whose specification is available to the
1192general public, whose contents can be viewed and edited directly and
1193straightforwardly with generic text editors or (for images composed of
1194pixels) generic paint programs or (for drawings) some widely available
1195drawing editor, and that is suitable for input to text formatters or
1196for automatic translation to a variety of formats suitable for input
1197to text formatters. A copy made in an otherwise Transparent file
1198format whose markup has been designed to thwart or discourage
1199subsequent modification by readers is not Transparent. A copy that is
1200not "Transparent" is called "Opaque".
1201.PP
1202Examples of suitable formats for Transparent copies include plain
1203ASCII without markup, Texinfo input format, LaTeX input format, SGML
1204or XML using a publicly available DTD, and standard-conforming simple
1205HTML designed for human modification. Opaque formats include
1206PostScript, PDF, proprietary formats that can be read and edited only
1207by proprietary word processors, SGML or XML for which the DTD and/or
1208processing tools are not generally available, and the
1209machine-generated HTML produced by some word processors for output
1210purposes only.
1211.PP
1212The "Title Page" means, for a printed book, the title page itself,
1213plus such following pages as are needed to hold, legibly, the material
1214this License requires to appear in the title page. For works in
1215formats which do not have any title page as such, "Title Page" means
1216the text near the most prominent appearance of the work's title,
1217preceding the beginning of the body of the text.
1218.PP
12192. VERBATIM COPYING
1220.PP
1221You may copy and distribute the Document in any medium, either
1222commercially or noncommercially, provided that this License, the
1223copyright notices, and the license notice saying this License applies
1224to the Document are reproduced in all copies, and that you add no other
1225conditions whatsoever to those of this License. You may not use
1226technical measures to obstruct or control the reading or further
1227copying of the copies you make or distribute. However, you may accept
1228compensation in exchange for copies. If you distribute a large enough
1229number of copies you must also follow the conditions in section 3.
1230.PP
1231You may also lend copies, under the same conditions stated above, and
1232you may publicly display copies.
1233.PP
12343. COPYING IN QUANTITY
1235.PP
1236If you publish printed copies of the Document numbering more than 100,
1237and the Document's license notice requires Cover Texts, you must enclose
1238the copies in covers that carry, clearly and legibly, all these Cover
1239Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
1240the back cover. Both covers must also clearly and legibly identify
1241you as the publisher of these copies. The front cover must present
1242the full title with all words of the title equally prominent and
1243visible. You may add other material on the covers in addition.
1244Copying with changes limited to the covers, as long as they preserve
1245the title of the Document and satisfy these conditions, can be treated
1246as verbatim copying in other respects.
1247.PP
1248If the required texts for either cover are too voluminous to fit
1249legibly, you should put the first ones listed (as many as fit
1250reasonably) on the actual cover, and continue the rest onto adjacent
1251pages.
1252.PP
1253If you publish or distribute Opaque copies of the Document numbering
1254more than 100, you must either include a machine-readable Transparent
1255copy along with each Opaque copy, or state in or with each Opaque copy
1256a publicly-accessible computer-network location containing a complete
1257Transparent copy of the Document, free of added material, which the
1258general network-using public has access to download anonymously at no
1259charge using public-standard network protocols. If you use the latter
1260option, you must take reasonably prudent steps, when you begin
1261distribution of Opaque copies in quantity, to ensure that this
1262Transparent copy will remain thus accessible at the stated location
1263until at least one year after the last time you distribute an Opaque
1264copy (directly or through your agents or retailers) of that edition to
1265the public.
1266.PP
1267It is requested, but not required, that you contact the authors of the
1268Document well before redistributing any large number of copies, to give
1269them a chance to provide you with an updated version of the Document.
1270.PP
12714. MODIFICATIONS
1272.PP
1273You may copy and distribute a Modified Version of the Document under
1274the conditions of sections 2 and 3 above, provided that you release
1275the Modified Version under precisely this License, with the Modified
1276Version filling the role of the Document, thus licensing distribution
1277and modification of the Modified Version to whoever possesses a copy
1278of it. In addition, you must do these things in the Modified Version:
1279.PP
1280A. Use in the Title Page (and on the covers, if any) a title distinct
1281from that of the Document, and from those of previous versions
1282(which should, if there were any, be listed in the History section
1283of the Document). You may use the same title as a previous version
1284if the original publisher of that version gives permission.
1285.PP
1286B. List on the Title Page, as authors, one or more persons or entities
1287responsible for authorship of the modifications in the Modified
1288Version, together with at least five of the principal authors of the
1289Document (all of its principal authors, if it has less than five).
1290.PP
1291C. State on the Title page the name of the publisher of the
1292Modified Version, as the publisher.
1293.PP
1294D. Preserve all the copyright notices of the Document.
1295.PP
1296E. Add an appropriate copyright notice for your modifications
1297adjacent to the other copyright notices.
1298.PP
1299F. Include, immediately after the copyright notices, a license notice
1300giving the public permission to use the Modified Version under the
1301terms of this License, in the form shown in the Addendum below.
1302Preserve in that license notice the full lists of Invariant Sections
1303and required Cover Texts given in the Document's license notice.
1304.PP
1305H. Include an unaltered copy of this License.
1306.PP
1307I. Preserve the section entitled "History", and its title, and add to
1308it an item stating at least the title, year, new authors, and
1309publisher of the Modified Version as given on the Title Page. If
1310there is no section entitled "History" in the Document, create one
1311stating the title, year, authors, and publisher of the Document as
1312given on its Title Page, then add an item describing the Modified
1313Version as stated in the previous sentence.
1314.PP
1315J. Preserve the network location, if any, given in the Document for
1316public access to a Transparent copy of the Document, and likewise
1317the network locations given in the Document for previous versions
1318it was based on. These may be placed in the "History" section.
1319You may omit a network location for a work that was published at
1320least four years before the Document itself, or if the original
1321publisher of the version it refers to gives permission.
1322.PP
1323K. In any section entitled "Acknowledgements" or "Dedications",
1324preserve the section's title, and preserve in the section all the
1325substance and tone of each of the contributor acknowledgements
1326and/or dedications given therein.
1327.PP
1328L. Preserve all the Invariant Sections of the Document,
1329unaltered in their text and in their titles. Section numbers
1330or the equivalent are not considered part of the section titles.
1331.PP
1332M. Delete any section entitled "Endorsements". Such a section
1333may not be included in the Modified Version.
1334.PP
1335N. Do not retitle any existing section as "Endorsements"
1336or to conflict in title with any Invariant Section.
1337.PP
1338If the Modified Version includes new front-matter sections or
1339appendices that qualify as Secondary Sections and contain no material
1340copied from the Document, you may at your option designate some or all
1341of these sections as invariant. To do this, add their titles to the
1342list of Invariant Sections in the Modified Version's license notice.
1343These titles must be distinct from any other section titles.
1344.PP
1345You may add a section entitled "Endorsements", provided it contains
1346nothing but endorsements of your Modified Version by various
1347parties--for example, statements of peer review or that the text has
1348been approved by an organization as the authoritative definition of a
1349standard.
1350.PP
1351You may add a passage of up to five words as a Front-Cover Text, and a
1352passage of up to 25 words as a Back-Cover Text, to the end of the list
1353of Cover Texts in the Modified Version. Only one passage of
1354Front-Cover Text and one of Back-Cover Text may be added by (or
1355through arrangements made by) any one entity. If the Document already
1356includes a cover text for the same cover, previously added by you or
1357by arrangement made by the same entity you are acting on behalf of,
1358you may not add another; but you may replace the old one, on explicit
1359permission from the previous publisher that added the old one.
1360.PP
1361The author(s) and publisher(s) of the Document do not by this License
1362give permission to use their names for publicity for or to assert or
1363imply endorsement of any Modified Version.
1364.PP
1365
13665. COMBINING DOCUMENTS
1367.PP
1368You may combine the Document with other documents released under this
1369License, under the terms defined in section 4 above for modified
1370versions, provided that you include in the combination all of the
1371Invariant Sections of all of the original documents, unmodified, and
1372list them all as Invariant Sections of your combined work in its
1373license notice.
1374.PP
1375The combined work need only contain one copy of this License, and
1376multiple identical Invariant Sections may be replaced with a single
1377copy. If there are multiple Invariant Sections with the same name but
1378different contents, make the title of each such section unique by
1379adding at the end of it, in parentheses, the name of the original
1380author or publisher of that section if known, or else a unique number.
1381Make the same adjustment to the section titles in the list of
1382Invariant Sections in the license notice of the combined work.
1383.PP
1384In the combination, you must combine any sections entitled "History"
1385in the various original documents, forming one section entitled
1386"History"; likewise combine any sections entitled "Acknowledgements",
1387and any sections entitled "Dedications". You must delete all sections
1388entitled "Endorsements."
1389.PP
1390
13916. COLLECTIONS OF DOCUMENTS
1392.PP
1393You may make a collection consisting of the Document and other documents
1394released under this License, and replace the individual copies of this
1395License in the various documents with a single copy that is included in
1396the collection, provided that you follow the rules of this License for
1397verbatim copying of each of the documents in all other respects.
1398.PP
1399You may extract a single document from such a collection, and distribute
1400it individually under this License, provided you insert a copy of this
1401License into the extracted document, and follow this License in all
1402other respects regarding verbatim copying of that document.
1403.PP
1404
14057. AGGREGATION WITH INDEPENDENT WORKS
1406.PP
1407A compilation of the Document or its derivatives with other separate
1408and independent documents or works, in or on a volume of a storage or
1409distribution medium, does not as a whole count as a Modified Version
1410of the Document, provided no compilation copyright is claimed for the
1411compilation. Such a compilation is called an "aggregate", and this
1412License does not apply to the other self-contained works thus compiled
1413with the Document, on account of their being thus compiled, if they
1414are not themselves derivative works of the Document.
1415.PP
1416If the Cover Text requirement of section 3 is applicable to these
1417copies of the Document, then if the Document is less than one quarter
1418of the entire aggregate, the Document's Cover Texts may be placed on
1419covers that surround only the Document within the aggregate.
1420Otherwise they must appear on covers around the whole aggregate.
1421.PP
1422
14238. TRANSLATION
1424.PP
1425Translation is considered a kind of modification, so you may
1426distribute translations of the Document under the terms of section 4.
1427Replacing Invariant Sections with translations requires special
1428permission from their copyright holders, but you may include
1429translations of some or all Invariant Sections in addition to the
1430original versions of these Invariant Sections. You may include a
1431translation of this License provided that you also include the
1432original English version of this License. In case of a disagreement
1433between the translation and the original English version of this
1434License, the original English version will prevail.
1435.PP
1436
14379. TERMINATION
1438.PP
1439You may not copy, modify, sublicense, or distribute the Document except
1440as expressly provided for under this License. Any other attempt to
1441copy, modify, sublicense or distribute the Document is void, and will
1442automatically terminate your rights under this License. However,
1443parties who have received copies, or rights, from you under this
1444License will not have their licenses terminated so long as such
1445parties remain in full compliance.
1446.PP
1447
144810. FUTURE REVISIONS OF THIS LICENSE
1449.PP
1450The Free Software Foundation may publish new, revised versions
1451of the GNU Free Documentation License from time to time. Such new
1452versions will be similar in spirit to the present version, but may
1453differ in detail to address new problems or concerns. See
1454http://www.gnu.org/copyleft/.
1455.PP
1456Each version of the License is given a distinguishing version number.
1457If the Document specifies that a particular numbered version of this
1458License "or any later version" applies to it, you have the option of
1459following the terms and conditions either of that specified version or
1460of any later version that has been published (not as a draft) by the
1461Free Software Foundation. If the Document does not specify a version
1462number of this License, you may choose any version ever published (not
1463as a draft) by the Free Software Foundation.
1464.PP
1465
1466ADDENDUM: How to use this License for your documents
1467.PP
1468To use this License in a document you have written, include a copy of
1469the License in the document and put the following copyright and
1470license notices just after the title page:
1471.PP
1472 Copyright (c) YEAR YOUR NAME.
1473 Permission is granted to copy, distribute and/or
1474 modify this document under the terms of the GNU
1475 Free Documentation License, Version 1.1 or any later
1476 version published by the Free Software Foundation;
1477 with the Invariant Sections being LIST THEIR TITLES,
1478 with the Front-Cover Texts being LIST, and with the
1479 Back-Cover Texts being LIST. A copy of the license
1480 is included in the section entitled "GNU Free
1481 Documentation License".
1482.PP
1483If you have no Invariant Sections, write "with no Invariant Sections"
1484instead of saying which ones are invariant. If you have no
1485Front-Cover Texts, write "no Front-Cover Texts" instead of
1486"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
1487.PP
1488If your document contains nontrivial examples of program code, we
1489recommend releasing these examples in parallel under your choice of
1490free software license, such as the GNU General Public License,
1491to permit their use in free software.
This page took 0.141132 seconds and 4 git commands to generate.