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