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