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