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