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