binutils.texi: fixed dir-entry, copyright date, last chapter a bit
[binutils-gdb.git] / binutils / binutils.texi
1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
3
4 @ifinfo
5 @format
6 START-INFO-DIR-ENTRY
7 * Binutils: (binutils). The GNU binary utilities "ar", "ld", "objcopy",
8 "objdump", "nm", "size", "strings", "strip", and "ranlib".
9 END-INFO-DIR-ENTRY
10 @end format
11 @end ifinfo
12
13 @ifinfo
14 Copyright @copyright{} 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
15
16 Permission is granted to make and distribute verbatim copies of
17 this manual provided the copyright notice and this permission notice
18 are preserved on all copies.
19
20 @ignore
21 Permission is granted to process this file through TeX and print the
22 results, provided the printed document carries a copying permission
23 notice identical to this one except for the removal of this paragraph
24 (this paragraph not being relevant to the printed manual).
25
26 @end ignore
27
28 Permission is granted to copy and distribute modified versions of this
29 manual under the conditions for verbatim copying, provided also that
30 the entire resulting derived work is distributed under the terms of a
31 permission notice identical to this one.
32
33 Permission is granted to copy and distribute translations of this manual
34 into another language, under the above conditions for modified versions.
35 @end ifinfo
36
37 @synindex ky cp
38 @c
39 @c This file documents the GNU binary utilities "ar", "ld", "objcopy",
40 @c "objdump", "nm", "size", "strings", "strip", and "ranlib".
41 @c
42 @c Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
43 @c
44 @c This text may be freely distributed under the terms of the GNU
45 @c General Public License.
46 @c
47
48 @setchapternewpage odd
49 @settitle GNU Binary Utilities
50 @titlepage
51 @finalout
52 @title The GNU Binary Utilities
53 @subtitle Version 2.2
54 @sp 1
55 @subtitle May 1993
56 @author Roland H. Pesch
57 @author Jeffrey M. Osier
58 @author Cygnus Support
59 @page
60
61 @tex
62 {\parskip=0pt \hfill Cygnus Support\par \hfill
63 \TeX{}info \texinfoversion\par }
64 @end tex
65
66 @vskip 0pt plus 1filll
67 Copyright @copyright{} 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
68
69 Permission is granted to make and distribute verbatim copies of
70 this manual provided the copyright notice and this permission notice
71 are preserved on all copies.
72
73 Permission is granted to copy and distribute modified versions of this
74 manual under the conditions for verbatim copying, provided also that
75 the entire resulting derived work is distributed under the terms of a
76 permission notice identical to this one.
77
78 Permission is granted to copy and distribute translations of this manual
79 into another language, under the above conditions for modified versions.
80 @end titlepage
81
82 @node Top
83 @top Introduction
84
85 @cindex version
86 This brief manual contains preliminary documentation for the GNU binary
87 utilities (collectively version 2.2):
88
89 @iftex
90 @table @code
91 @item ar
92 Create, modify, and extract from archives
93
94 @item nm
95 List symbols from object files
96
97 @item objcopy
98 Copy and translate object files
99
100 @item objdump
101 Display information from object files
102
103 @item ranlib
104 Generate index to archive contents
105
106 @item size
107 List file section sizes and total size
108
109 @item strings
110 List printable strings from files
111
112 @item strip
113 Discard symbols
114
115 @item c++filt
116 Demangle encoded C++ symbols
117
118 @item nlmconv
119 Convert object code into a Netware Loadable Module
120 @end table
121 @end iftex
122
123 @menu
124 * ar:: Create, modify, and extract from archives
125 * nm:: List symbols from object files
126 * objcopy:: Copy and translate object files
127 * objdump:: Display information from object files
128 * ranlib:: Generate index to archive contents
129 * size:: List section sizes and total size
130 * strings:: List printable strings from files
131 * strip:: Discard symbols
132 * c++filt:: Filter to demangle encoded C++ symbols
133 * nlmconv:: Converts object code into an NLM
134 * Selecting The Target System:: How these utilities determine the target.
135 * Index::
136 @end menu
137
138 @node ar
139 @chapter ar
140
141 @kindex ar
142 @cindex archives
143 @cindex collections of files
144 @smallexample
145 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
146 ar -M [ <mri-script ]
147 @end smallexample
148
149 The GNU @code{ar} program creates, modifies, and extracts from
150 archives. An @dfn{archive} is a single file holding a collection of
151 other files in a structure that makes it possible to retrieve
152 the original individual files (called @dfn{members} of the archive).
153
154 The original files' contents, mode (permissions), timestamp, owner, and
155 group are preserved in the archive, and can be restored on
156 extraction.
157
158 @cindex name length
159 GNU @code{ar} can maintain archives whose members have names of any
160 length; however, depending on how @code{ar} is configured on your
161 system, a limit on member-name length may be imposed for compatibility
162 with archive formats maintained with other tools. If it exists, the
163 limit is often 15 characters (typical of formats related to a.out) or 16
164 characters (typical of formats related to coff).
165
166 @cindex libraries
167 @code{ar} is considered a binary utility because archives of this sort
168 are most often used as @dfn{libraries} holding commonly needed
169 subroutines.
170
171 @cindex symbol index
172 @code{ar} creates an index to the symbols defined in relocatable
173 object modules in the archive when you specify the modifier @samp{s}.
174 Once created, this index is updated in the archive whenever @code{ar}
175 makes a change to its contents (save for the @samp{q} update operation).
176 An archive with such an index speeds up linking to the library, and
177 allows routines in the library to call each other without regard to
178 their placement in the archive.
179
180 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
181 table. If an archive lacks the table, another form of @code{ar} called
182 @code{ranlib} can be used to add just the table.
183
184 @cindex compatibility, @code{ar}
185 @cindex @code{ar} compatibility
186 GNU @code{ar} is designed to be compatible with two different
187 facilities. You can control its activity using command-line options,
188 like the different varieties of @code{ar} on Unix systems; or, if you
189 specify the single command-line option @samp{-M}, you can control it
190 with a script supplied via standard input, like the MRI ``librarian''
191 program.
192
193 @menu
194 * ar cmdline:: Controlling @code{ar} on the command line
195 * ar scripts:: Controlling @code{ar} with a script
196 @end menu
197
198 @page
199 @node ar cmdline
200 @section Controlling @code{ar} on the command line
201
202 @smallexample
203 ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}]
204 @end smallexample
205
206 @cindex Unix compatibility, @code{ar}
207 When you use @code{ar} in the Unix style, @code{ar} insists on at least two
208 arguments to execute: one keyletter specifying the @emph{operation}
209 (optionally accompanied by other keyletters specifying
210 @emph{modifiers}), and the archive name to act on.
211
212 Most operations can also accept further @var{member} arguments,
213 specifying particular files to operate on.
214
215 GNU @code{ar} allows you to mix the operation code @var{p} and modifier
216 flags @var{mod} in any order, within the first command-line argument.
217
218 If you wish, you may begin the first command-line argument with a
219 dash.
220
221 @cindex operations on archive
222 The @var{p} keyletter specifies what operation to execute; it may be
223 any of the following, but you must specify only one of them:
224
225 @table @code
226 @item d
227 @cindex deleting from archive
228 @emph{Delete} modules from the archive. Specify the names of modules to
229 be deleted as @var{member}@dots{}; the archive is untouched if you
230 specify no files to delete.
231
232 If you specify the @samp{v} modifier, @code{ar} lists each module
233 as it is deleted.
234
235 @item m
236 @cindex moving in archive
237 Use this operation to @emph{move} members in an archive.
238
239 The ordering of members in an archive can make a difference in how
240 programs are linked using the library, if a symbol is defined in more
241 than one member.
242
243 If no modifiers are used with @code{m}, any members you name in the
244 @var{member} arguments are moved to the @emph{end} of the archive;
245 you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
246 specified place instead.
247
248 @item p
249 @cindex printing from archive
250 @emph{Print} the specified members of the archive, to the standard
251 output file. If the @samp{v} modifier is specified, show the member
252 name before copying its contents to standard output.
253
254 If you specify no @var{member} arguments, all the files in the archive are
255 printed.
256
257 @item q
258 @cindex quick append to archive
259 @emph{Quick append}; add the files @var{member}@dots{} to the end of
260 @var{archive}, without checking for replacement.
261
262 The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
263 operation; new members are always placed at the end of the archive.
264
265 The modifier @samp{v} makes @code{ar} list each file as it is appended.
266
267 Since the point of this operation is speed, the archive's symbol table
268 index is not updated, even if it already existed; you can use @samp{ar s} or
269 @code{ranlib} explicitly to update the symbol table index.
270
271 @item r
272 @cindex replacement in archive
273 Insert the files @var{member}@dots{} into @var{archive} (with
274 @emph{replacement}). This operation differs from @samp{q} in that any
275 previously existing members are deleted if their names match those being
276 added.
277
278 If one of the files named in @var{member}@dots{} does not exist, @code{ar}
279 displays an error message, and leaves undisturbed any existing members
280 of the archive matching that name.
281
282 By default, new members are added at the end of the file; but you may
283 use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
284 placement relative to some existing member.
285
286 The modifier @samp{v} used with this operation elicits a line of
287 output for each file inserted, along with one of the letters @samp{a} or
288 @samp{r} to indicate whether the file was appended (no old member
289 deleted) or replaced.
290
291 @item t
292 @cindex contents of archive
293 Display a @emph{table} listing the contents of @var{archive}, or those
294 of the files listed in @var{member}@dots{} that are present in the
295 archive. Normally only the member name is shown; if you also want to
296 see the modes (permissions), timestamp, owner, group, and size, you can
297 request that by also specifying the @samp{v} modifier.
298
299 If you do not specify a @var{member}, all files in the archive
300 are listed.
301
302 @cindex repeated names in archive
303 @cindex name duplication in archive
304 If there is more than one file with the same name (say, @samp{fie}) in
305 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
306 first instance; to see them all, you must ask for a complete
307 listing---in our example, @samp{ar t b.a}.
308 @c WRS only; per Gumby, this is implementation-dependent, and in a more
309 @c recent case in fact works the other way.
310
311 @item x
312 @cindex extract from archive
313 @emph{Extract} members (named @var{member}) from the archive. You can
314 use the @samp{v} modifier with this operation, to request that
315 @code{ar} list each name as it extracts it.
316
317 If you do not specify a @var{member}, all files in the archive
318 are extracted.
319
320 @end table
321
322 A number of modifiers (@var{mod}) may immediately follow the @var{p}
323 keyletter, to specify variations on an operation's behavior:
324
325 @table @code
326 @item a
327 @cindex relative placement in archive
328 Add new files @emph{after} an existing member of the
329 archive. If you use the modifier @samp{a}, the name of an existing archive
330 member must be present as the @var{relpos} argument, before the
331 @var{archive} specification.
332
333 @item b
334 Add new files @emph{before} an existing member of the
335 archive. If you use the modifier @samp{b}, the name of an existing archive
336 member must be present as the @var{relpos} argument, before the
337 @var{archive} specification. (same as @samp{i}).
338
339 @item c
340 @cindex creating archives
341 @emph{Create} the archive. The specified @var{archive} is always
342 created if it did not exist, when you request an update. But a warning is
343 issued unless you specify in advance that you expect to create it, by
344 using this modifier.
345
346 @item i
347 Insert new files @emph{before} an existing member of the
348 archive. If you use the modifier @samp{i}, the name of an existing archive
349 member must be present as the @var{relpos} argument, before the
350 @var{archive} specification. (same as @samp{b}).
351
352 @item l
353 This modifier is accepted but not used.
354 @c whaffor ar l modifier??? presumably compat; with
355 @c what???---pesch@@cygnus.com, 25jan91
356
357 @item o
358 @cindex dates in archive
359 Preserve the @emph{original} dates of members when extracting them. If
360 you do not specify this modifier, files extracted from the archive
361 are stamped with the time of extraction.
362
363 @item s
364 @cindex writing archive index
365 Write an object-file index into the archive, or update an existing one,
366 even if no other change is made to the archive. You may use this modifier
367 flag either with any operation, or alone. Running @samp{ar s} on an
368 archive is equivalent to running @samp{ranlib} on it.
369
370 @item u
371 @cindex updating an archive
372 Normally, @samp{ar r}@dots{} inserts all files
373 listed into the archive. If you would like to insert @emph{only} those
374 of the files you list that are newer than existing members of the same
375 names, use this modifier. The @samp{u} modifier is allowed only for the
376 operation @samp{r} (replace). In particular, the combination @samp{qu} is
377 not allowed, since checking the timestamps would lose any speed
378 advantage from the operation @samp{q}.
379
380 @item v
381 This modifier requests the @emph{verbose} version of an operation. Many
382 operations display additional information, such as filenames processed,
383 when the modifier @samp{v} is appended.
384
385 @item V
386 This modifier shows the version number of @code{ar}.
387 @end table
388
389 @node ar scripts
390 @section Controlling @code{ar} with a script
391
392 @smallexample
393 ar -M [ <@var{script} ]
394 @end smallexample
395
396 @cindex MRI compatibility, @code{ar}
397 @cindex scripts, @code{ar}
398 If you use the single command-line option @samp{-M} with @code{ar}, you
399 can control its operation with a rudimentary command language. This
400 form of @code{ar} operates interactively if standard input is coming
401 directly from a terminal. During interactive use, @code{ar} prompts for
402 input (the prompt is @samp{AR >}), and continues executing even after
403 errors. If you redirect standard input to a script file, no prompts are
404 issued, and @code{ar} abandons execution (with a nonzero exit code)
405 on any error.
406
407 The @code{ar} command language is @emph{not} designed to be equivalent
408 to the command-line options; in fact, it provides somewhat less control
409 over archives. The only purpose of the command language is to ease the
410 transition to GNU @code{ar} for developers who already have scripts
411 written for the MRI ``librarian'' program.
412
413 The syntax for the @code{ar} command language is straightforward:
414 @itemize @bullet
415 @item
416 commands are recognized in upper or lower case; for example, @code{LIST}
417 is the same as @code{list}. In the following descriptions, commands are
418 shown in upper case for clarity.
419
420 @item
421 a single command may appear on each line; it is the first word on the
422 line.
423
424 @item
425 empty lines are allowed, and have no effect.
426
427 @item
428 comments are allowed; text after either of the characters @samp{*}
429 or @samp{;} is ignored.
430
431 @item
432 Whenever you use a list of names as part of the argument to an @code{ar}
433 command, you can separate the individual names with either commas or
434 blanks. Commas are shown in the explanations below, for clarity.
435
436 @item
437 @samp{+} is used as a line continuation character; if @samp{+} appears
438 at the end of a line, the text on the following line is considered part
439 of the current command.
440 @end itemize
441
442 Here are the commands you can use in @code{ar} scripts, or when using
443 @code{ar} interactively. Three of them have special significance:
444
445 @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
446 a temporary file required for most of the other commands.
447
448 @code{SAVE} commits the changes so far specified by the script. Prior
449 to @code{SAVE}, commands affect only the temporary copy of the current
450 archive.
451
452 @table @code
453 @item ADDLIB @var{archive}
454 @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
455 Add all the contents of @var{archive} (or, if specified, each named
456 @var{module} from @var{archive}) to the current archive.
457
458 Requires prior use of @code{OPEN} or @code{CREATE}.
459
460 @item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
461 @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
462 @c else like "ar q..."
463 Add each named @var{member} as a module in the current archive.
464
465 Requires prior use of @code{OPEN} or @code{CREATE}.
466
467 @item CLEAR
468 Discard the contents of the current archive, cancelling the effect of
469 any operations since the last @code{SAVE}. May be executed (with no
470 effect) even if no current archive is specified.
471
472 @item CREATE @var{archive}
473 Creates an archive, and makes it the current archive (required for many
474 other commands). The new archive is created with a temporary name; it
475 is not actually saved as @var{archive} until you use @code{SAVE}.
476 You can overwrite existing archives; similarly, the contents of any
477 existing file named @var{archive} will not be destroyed until @code{SAVE}.
478
479 @item DELETE @var{module}, @var{module}, @dots{} @var{module}
480 Delete each listed @var{module} from the current archive; equivalent to
481 @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
482
483 Requires prior use of @code{OPEN} or @code{CREATE}.
484
485 @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
486 @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
487 List each named @var{module} present in @var{archive}. The separate
488 command @code{VERBOSE} specifies the form of the output: when verbose
489 output is off, output is like that of @samp{ar -t @var{archive}
490 @var{module}@dots{}}. When verbose output is on, the listing is like
491 @samp{ar -tv @var{archive} @var{module}@dots{}}.
492
493 Output normally goes to the standard output stream; however, if you
494 specify @var{outputfile} as a final argument, @code{ar} directs the
495 output to that file.
496
497 @item END
498 Exit from @code{ar}, with a @code{0} exit code to indicate successful
499 completion. This command does not save the output file; if you have
500 changed the current archive since the last @code{SAVE} command, those
501 changes are lost.
502
503 @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
504 Extract each named @var{module} from the current archive, writing them
505 into the current directory as separate files. Equivalent to @samp{ar -x
506 @var{archive} @var{module}@dots{}}.
507
508 Requires prior use of @code{OPEN} or @code{CREATE}.
509
510 @ignore
511 @c FIXME Tokens but no commands???
512 @item FULLDIR
513
514 @item HELP
515 @end ignore
516
517 @item LIST
518 Display full contents of the current archive, in ``verbose'' style
519 regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
520 tv @var{archive}}). (This single command is a GNU @code{ld}
521 enhancement, rather than present for MRI compatibility.)
522
523 Requires prior use of @code{OPEN} or @code{CREATE}.
524
525 @item OPEN @var{archive}
526 Opens an existing archive for use as the current archive (required for
527 many other commands). Any changes as the result of subsequent commands
528 will not actually affect @var{archive} until you next use @code{SAVE}.
529
530 @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
531 In the current archive, replace each existing @var{module} (named in
532 the @code{REPLACE} arguments) from files in the current working directory.
533 To execute this command without errors, both the file, and the module in
534 the current archive, must exist.
535
536 Requires prior use of @code{OPEN} or @code{CREATE}.
537
538 @item VERBOSE
539 Toggle an internal flag governing the output from @code{DIRECTORY}.
540 When the flag is on, @code{DIRECTORY} output matches output from
541 @samp{ar -tv }@dots{}.
542
543 @item SAVE
544 Commit your changes to the current archive, and actually save it as a
545 file with the name specified in the last @code{CREATE} or @code{OPEN}
546 command.
547
548 Requires prior use of @code{OPEN} or @code{CREATE}.
549
550 @end table
551
552 @iftex
553 @node ld
554 @chapter ld
555 @cindex linker
556 @kindex ld
557 The GNU linker @code{ld} is now described in a separate manual.
558 @xref{Top,, Overview,, Using LD: the GNU linker}.
559 @end iftex
560
561 @node nm
562 @chapter nm
563 @cindex symbols
564 @kindex nm
565
566 @smallexample
567 nm [ -a | --debug-syms ] [ -g | --extern-only ]
568 [ -B ] [ -C | --demangle ]
569 [ -s | --print-armap ] [ -A | -o | --print-file-name ]
570 [ -n | -v | --numeric-sort ] [ -p | --no-sort ]
571 [ -r | --reverse-sort ] [ -u | --undefined-only ]
572 [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
573 [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
574 [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
575 @end smallexample
576
577 GNU @code{nm} lists the symbols from object files @var{objfile}@dots{}.
578 If no object files are listed as arguments, @code{nm} assumes
579 @file{a.out}.
580
581 For each symbol, @code{nm} shows:
582
583 @itemize @bullet
584 @item
585 The symbol value, in the radix selected by options (see below), or
586 hexadecimal by default.
587
588 @item
589 The symbol type. At least the following types are used; others are, as
590 well, depending on the object file format. If lowercase, the symbol is
591 local; if uppercase, the symbol is global (external).
592
593 @c Some more detail on exactly what these symbol types are used for
594 @c would be nice.
595 @table @code
596 @item A
597 Absolute.
598
599 @item B
600 BSS (uninitialized data).
601
602 @item C
603 Common.
604
605 @item D
606 Initialized data.
607
608 @item I
609 Indirect reference.
610
611 @item T
612 Text (program code).
613
614 @item U
615 Undefined.
616 @end table
617
618 @item
619 The symbol name.
620 @end itemize
621
622 The long and short forms of options, shown here as alternatives, are
623 equivalent.
624
625 @table @code
626 @item -A
627 @itemx -o
628 @itemx --print-file-name
629 @cindex input file name
630 @cindex file name
631 @cindex source file name
632 Precede each symbol by the name of the input file (or archive element)
633 in which it was found, rather than identifying the input file once only,
634 before all of its symbols.
635
636 @item -a
637 @itemx --debug-syms
638 @cindex debugging symbols
639 Display all symbols, even debugger-only symbols; normally these are not
640 listed.
641
642 @item -B
643 @cindex @code{nm} format
644 @cindex @code{nm} compatibility
645 The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}).
646
647 @item -C
648 @itemx --demangle
649 @cindex demangling C++ symbols
650 Decode (@dfn{demangle}) low-level symbol names into user-level names.
651 Besides removing any initial underscore prepended by the system, this
652 makes C++ function names readable. @xref{c++filt}, for more information
653 on demangling.
654
655 @item -f @var{format}
656 @itemx --format=@var{format}
657 @cindex @code{nm} format
658 @cindex @code{nm} compatibility
659 Use the output format @var{format}, which can be @code{bsd},
660 @code{sysv}, or @code{posix}. The default is @code{bsd}.
661 Only the first character of @var{format} is significant; it can be
662 either upper or lower case.
663
664 @item -g
665 @itemx --extern-only
666 @cindex external symbols
667 Display only external symbols.
668
669 @item -n
670 @itemx -v
671 @itemx --numeric-sort
672 Sort symbols numerically by their addresses, rather than alphabetically
673 by their names.
674
675 @item -p
676 @itemx --no-sort
677 @cindex sorting symbols
678 Do not bother to sort the symbols in any order; print them in the order
679 encountered.
680
681 @item -P
682 @itemx --portability
683 Use the POSIX.2 standard output format instead of the default format.
684 Equivalent to @samp{-f posix}.
685
686 @item -s
687 @itemx --print-armap
688 @cindex symbol index, listing
689 When listing symbols from archive members, include the index: a mapping
690 (stored in the archive by @code{ar} or @code{ranlib}) of which modules
691 contain definitions for which names.
692
693 @item -r
694 @itemx --reverse-sort
695 Reverse the order of the sort (whether numeric or alphabetic); let the
696 last come first.
697
698 @item -t @var{radix}
699 @itemx --radix=@var{radix}
700 Use @var{radix} as the radix for printing the symbol values. It must be
701 @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
702
703 @item --target=@var{bfdname}
704 @cindex object code format
705 Specify an object code format other than your system's default format.
706 @xref{Target Selection}, for more information.
707
708 @item -u
709 @itemx --undefined-only
710 @cindex external symbols
711 @cindex undefined symbols
712 Display only undefined symbols (those external to each object file).
713
714 @item -V
715 @itemx --version
716 Show the version number of @code{nm} and exit.
717
718 @item --help
719 Show a summary of the options to @code{nm} and exit.
720 @end table
721
722 @node objcopy
723 @chapter objcopy
724
725 @smallexample
726 objcopy [ -F @var{bfdname} | --target=@var{bfdname} ]
727 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
728 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
729 [ -S | --strip-all ] [ -g | --strip-debug ]
730 [ -x | --discard-all ] [ -X | --discard-locals ]
731 [ -b @var{byte} | --byte=@var{byte} ]
732 [ -i @var{interleave} | --interleave=@var{interleave} ]
733 [ -v | --verbose ] [ -V | --version ] [ --help ]
734 @var{infile} [@var{outfile}]
735 @end smallexample
736
737 The @sc{gnu} @code{objcopy} utility copies the contents of an object
738 file to another. @code{objcopy} uses the @sc{gnu} @sc{bfd} Library to
739 read and write the object files. It can write the destination object
740 file in a format different from that of the source object file. The
741 exact behavior of @code{objcopy} is controlled by command-line options.
742
743 @code{objcopy} creates temporary files to do its translations and
744 deletes them afterward. @code{objcopy} uses @sc{bfd} to do all its
745 translation work; it has access to all the formats described in @sc{bfd}
746 and thus is able to recognize most formats without being told
747 explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
748
749 @table @code
750 @item @var{infile}
751 @itemx @var{outfile}
752 The source and output files, respectively.
753 If you do not specify @var{outfile}, @code{objcopy} creates a
754 temporary file and destructively renames the result with
755 the name of @var{infile}.
756
757 @item -I @var{bfdname}
758 @itemx --input-target=@var{bfdname}
759 Consider the source file's object format to be @var{bfdname}, rather than
760 attempting to deduce it. @xref{Target Selection}, for more information.
761
762 @item -O @var{bfdname}
763 @itemx --output-target=@var{bfdname}
764 Write the output file using the object format @var{bfdname}.
765 @xref{Target Selection}, for more information.
766
767 @item -F @var{bfdname}
768 @itemx --target=@var{bfdname}
769 Use @var{bfdname} as the object format for both the input and the output
770 file; i.e., simply transfer data from source to destination with no
771 translation. @xref{Target Selection}, for more information.
772
773 @item -S
774 @itemx --strip-all
775 Do not copy relocation and symbol information from the source file.
776
777 @item -g
778 @itemx --strip-debug
779 Do not copy debugging symbols from the source file.
780
781 @item -x
782 @itemx --discard-all
783 Do not copy non-global symbols from the source file.
784 @c FIXME any reason to prefer "non-global" to "local" here?
785
786 @item -X
787 @itemx --discard-locals
788 Do not copy compiler-generated local symbols.
789 (These usually start with @samp{L} or @samp{.}.)
790
791 @item -b @var{byte}
792 @itemx --byte=@var{byte}
793 Keep only every @var{byte}th byte of the input file (header data is not
794 affected). @var{byte} can be in the range from 0 to @var{interleave}-1,
795 where @var{interleave} is given by the @samp{-i} or @samp{--interleave}
796 option, or the default of 4. This option is useful for creating files
797 to program @sc{rom}. It is typically used with an @code{srec} output
798 target.
799
800 @item -i @var{interleave}
801 @itemx --interleave=@var{interleave}
802 Only copy one out of every @var{interleave} bytes. Select which byte to
803 copy with the @var{-b} or @samp{--byte} option. The default is 4.
804 @code{objcopy} ignores this option if you do not specify either @samp{-b} or
805 @samp{--byte}.
806
807 @item -V
808 @itemx --version
809 Show the version number of @code{objcopy}.
810
811 @item -v
812 @itemx --verbose
813 Verbose output: list all object files modified. In the case of
814 archives, @samp{objcopy -V} lists all members of the archive.
815
816 @item --help
817 Show a summary of the options to @code{objcopy}.
818 @end table
819
820 @node objdump
821 @chapter objdump
822
823 @cindex object file information
824 @kindex objdump
825
826 @smallexample
827 objdump [ -a | --archive-headers ]
828 [ -b @var{bfdname} | --target=@var{bfdname} ]
829 [ -d | --disassemble ] [ -f | --file-headers ]
830 [ -h | --section-headers | --headers ] [ -i | --info ]
831 [ -j @var{section} | --section=@var{section} ]
832 [ -l | --line-numbers ]
833 [ -m @var{machine} | --architecture=@var{machine} ] [ -r | --reloc ]
834 [ -s | --full-contents ] [ --stabs ] [ -t | --syms ]
835 [ -x | --all-headers ] [ --version ] [ --help ]
836 @var{objfile}@dots{}
837 @end smallexample
838
839 @code{objdump} displays information about one or more object files.
840 The options control what particular information to display. This
841 information is mostly useful to programmers who are working on the
842 compilation tools, as opposed to programmers who just want their
843 program to compile and work.
844
845 @var{objfile}@dots{} are the object files to be examined. When you
846 specify archives, @code{objdump} shows information on each of the member
847 object files.
848
849 The long and short forms of options, shown here as alternatives, are
850 equivalent. At least one option besides @samp{-l} must be given.
851
852 @table @code
853 @item -a
854 @itemx --archive-header
855 @cindex archive headers
856 If any of the @var{objfile} files are archives, display the archive
857 header information (in a format similar to @samp{ls -l}). Besides the
858 information you could list with @samp{ar tv}, @samp{objdump -a} shows
859 the object file format of each archive member.
860
861 @item -b @var{bfdname}
862 @itemx --target=@var{bfdname}
863 @cindex object code format
864 Specify that the object-code format for the object files is
865 @var{bfdname}. This option may not be necessary; @var{objdump} can
866 automatically recognize many formats.
867
868 For example,
869 @example
870 objdump -b oasys -m vax -h fu.o
871 @end example
872 @noindent
873 displays summary information from the section headers (@samp{-h}) of
874 @file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object
875 file in the format produced by Oasys compilers. You can list the
876 formats available with the @samp{-i} option.
877 @xref{Target Selection}, for more information.
878
879 @item -d
880 @itemx --disassemble
881 @cindex disassembling object code
882 @cindex machine instructions
883 Display the assembler mnemonics for the machine
884 instructions from @var{objfile}.
885
886 @item -f
887 @itemx --file-header
888 @cindex object file header
889 Display summary information from the overall header of
890 each of the @var{objfile} files.
891
892 @item -h
893 @itemx --section-header
894 @itemx --header
895 @cindex section headers
896 Display summary information from the section headers of the
897 object file.
898
899 File segments may be relocated to nonstandard addresses, for example by
900 using the @samp{-Ttext}, @samp{-Tdata}, or @samp{-Tbss} options to
901 @code{ld}. However, some object file formats, such as a.out, do not
902 store the starting address of the file segments. In those situations,
903 although @code{ld} relocates the sections correctly, using @samp{objdump
904 -h} to list the file section headers cannot show the correct addresses.
905 Instead, it shows the usual addresses, which are implicit for the
906 target.
907
908 @item --help
909 Print a summary of the options to @code{objdump} and exit.
910
911 @item -i
912 @itemx --info
913 @cindex architectures available
914 @cindex object formats available
915 Display a list showing all architectures and object formats available
916 for specification with @samp{-b} or @samp{-m}.
917
918 @item -j @var{name}
919 @itemx --section=@var{name}
920 @cindex section information
921 Display information only for section @var{name}.
922
923 @item -l
924 @itemx --line-numbers
925 @cindex source filenames for object files
926 Label the display (using debugging information) with the filename
927 and source line numbers corresponding to the object code shown.
928 Only useful with @samp{-d}.
929
930 @item -m @var{machine}
931 @itemx --architecture=@var{machine}
932 @cindex architecture
933 Specify that the object files @var{objfile} are for architecture
934 @var{machine}. You can list available architectures using the @samp{-i}
935 option.
936
937 @item -r
938 @itemx --reloc
939 @cindex relocation entries, in object file
940 Print the relocation entries of the file.
941
942 @item -s
943 @itemx --full-contents
944 @cindex sections, full contents
945 @cindex object file sections
946 Display the full contents of any sections requested.
947
948 @item --stabs
949 @cindex stab
950 @cindex .stab
951 @cindex debug symbols
952 @cindex ELF object file format
953 Display the full contents of any sections requested. Display the
954 contents of the .stab and .stab.index and .stab.excl sections from an
955 ELF file. This is only useful on systems (such as Solaris 2.0) in which
956 @code{.stab} debugging symbol-table entries are carried in an ELF
957 section. In most other file formats, debugging symbol-table entries are
958 interleaved with linkage symbols, and are visible in the @samp{--syms}
959 output.
960
961 @item -t
962 @itemx --syms
963 @cindex symbol table entries, printing
964 Print the symbol table entries of the file.
965 This is similar to the information provided by the @samp{nm} program.
966
967 @item --version
968 Print the version number of @code{objdump} and exit.
969
970 @item -x
971 @itemx --all-header
972 @cindex all header information, object file
973 @cindex header information, all
974 Display all available header information, including the symbol table and
975 relocation entries. Using @samp{-x} is equivalent to specifying all of
976 @samp{-a -f -h -r -t}.
977 @end table
978
979 @node ranlib
980 @chapter ranlib
981
982 @kindex ranlib
983 @cindex archive contents
984 @cindex symbol index
985
986 @smallexample
987 ranlib [-vV] @var{archive}
988 @end smallexample
989
990 @code{ranlib} generates an index to the contents of an archive and
991 stores it in the archive. The index lists each symbol defined by a
992 member of an archive that is a relocatable object file.
993
994 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
995
996 An archive with such an index speeds up linking to the library and
997 allows routines in the library to call each other without regard to
998 their placement in the archive.
999
1000 The GNU @code{ranlib} program is another form of GNU @code{ar}; running
1001 @code{ranlib} is completely equivalent to executing @samp{ar -s}.
1002 @xref{ar}.
1003
1004 @table @code
1005 @item -v
1006 @itemx -V
1007 Show the version number of @code{ranlib}.
1008 @end table
1009
1010 @node size
1011 @chapter size
1012
1013 @kindex size
1014 @cindex section sizes
1015
1016 @smallexample
1017 size [ -A | -B | --format=@var{compatibility} ]
1018 [ --help ] [ -d | -o | -x | --radix=@var{number} ]
1019 [ --target=@var{bfdname} ] [ -V | --version ]
1020 @var{objfile}@dots{}
1021 @end smallexample
1022
1023 The GNU @code{size} utility lists the section sizes---and the total
1024 size---for each of the object or archive files @var{objfile} in its
1025 argument list. By default, one line of output is generated for each
1026 object file or each module in an archive.
1027
1028 @var{objfile}@dots{} are the object files to be examined.
1029
1030 The command line options have the following meanings:
1031
1032 @table @code
1033 @item -A
1034 @itemx -B
1035 @itemx --format=@var{compatibility}
1036 @cindex @code{size} display format
1037 Using one of these options, you can choose whether the output from GNU
1038 @code{size} resembles output from System V @code{size} (using @samp{-A},
1039 or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or
1040 @samp{--format=berkeley}). The default is the one-line format similar to
1041 Berkeley's.
1042 @c Bonus for doc-source readers: you can also say --format=strange (or
1043 @c anything else that starts with 's') for sysv, and --format=boring (or
1044 @c anything else that starts with 'b') for Berkeley.
1045
1046 Here is an example of the Berkeley (default) format of output from
1047 @code{size}:
1048 @smallexample
1049 size --format=Berkeley ranlib size
1050 text data bss dec hex filename
1051 294880 81920 11592 388392 5ed28 ranlib
1052 294880 81920 11888 388688 5ee50 size
1053 @end smallexample
1054
1055 @noindent
1056 This is the same data, but displayed closer to System V conventions:
1057
1058 @smallexample
1059 size --format=SysV ranlib size
1060 ranlib :
1061 section size addr
1062 .text 294880 8192
1063 .data 81920 303104
1064 .bss 11592 385024
1065 Total 388392
1066
1067
1068 size :
1069 section size addr
1070 .text 294880 8192
1071 .data 81920 303104
1072 .bss 11888 385024
1073 Total 388688
1074 @end smallexample
1075
1076 @item --help
1077 Show a summary of acceptable arguments and options.
1078
1079 @item -d
1080 @itemx -o
1081 @itemx -x
1082 @itemx --radix=@var{number}
1083 @cindex @code{size} number format
1084 @cindex radix for section sizes
1085 Using one of these options, you can control whether the size of each
1086 section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal
1087 (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or
1088 @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three
1089 values (8, 10, 16) are supported. The total size is always given in two
1090 radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or
1091 octal and hexadecimal if you're using @samp{-o}.
1092
1093 @item --target=@var{bfdname}
1094 @cindex object code format
1095 Specify that the object-code format for @var{objfile} is
1096 @var{bfdname}. This option may not be necessary; @code{size} can
1097 automatically recognize many formats.
1098 @xref{Target Selection}, for more information.
1099
1100 @item -V
1101 @itemx --version
1102 Display the version number of @code{size}.
1103 @end table
1104
1105 @node strings
1106 @chapter strings
1107 @kindex strings
1108 @cindex listings strings
1109 @cindex printing strings
1110 @cindex strings, printing
1111
1112 @smallexample
1113 strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-]
1114 [--all] [--print-file-name] [--bytes=@var{min-len}]
1115 [--radix=@var{radix}] [--target=@var{bfdname}]
1116 [--help] [--version] @var{file}@dots{}
1117 @end smallexample
1118
1119 For each @var{file} given, GNU @code{strings} prints the printable
1120 character sequences that are at least 4 characters long (or the number
1121 given with the options below) and are followed by a NUL or newline
1122 character. By default, it only prints the strings from the initialized
1123 data sections of object files; for other types of files, it prints the
1124 strings from the whole file.
1125
1126 @code{strings} is mainly useful for determining the contents of non-text
1127 files.
1128
1129 @table @code
1130 @item -a
1131 @itemx --all
1132 @itemx -
1133 Do not scan only the initialized data section of object files; scan
1134 the whole files.
1135
1136 @item -f
1137 @itemx --print-file-name
1138 Print the name of the file before each string.
1139
1140 @item --help
1141 Print a summary of the program usage on the standard output and exit.
1142
1143 @itemx -@var{min-len}
1144 @item -n @var{min-len}
1145 @itemx --bytes=@var{min-len}
1146 Print sequences of characters that are at least @var{min-len} characters
1147 long, instead of the default 4.
1148
1149 @item -o
1150 Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o}
1151 act like @samp{-t d} instead. Since we can not be compatible with both
1152 ways, we simply chose one.
1153
1154 @item -t @var{radix}
1155 @itemx --radix=@var{radix}
1156 Print the offset within the file before each string. The single
1157 character argument specifies the radix of the offset---@samp{o} for
1158 octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
1159
1160 @item --target=@var{bfdname}
1161 @cindex object code format
1162 Specify an object code format other than your system's default format.
1163 @xref{Target Selection}, for more information.
1164
1165 @item -v
1166 @itemx --version
1167 Print the program version number on the standard output and exit.
1168 @end table
1169
1170 @node strip
1171 @chapter strip
1172
1173 @kindex strip
1174 @cindex removing symbols
1175 @cindex discarding symbols
1176 @cindex symbols, discarding
1177
1178 @smallexample
1179 strip [ -F @var{bfdname} | --target=@var{bfdname} | --target=@var{bfdname} ]
1180 [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1181 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
1182 [ -s | --strip-all ] [ -S | -g | --strip-debug ]
1183 [ -x | --discard-all ] [ -X | --discard-locals ]
1184 [ -v | --verbose ] [ -V | --version ] [ --help ]
1185 @var{objfile}@dots{}
1186 @end smallexample
1187
1188 GNU @code{strip} discards all symbols from object files
1189 @var{objfile}. The list of object files may include archives.
1190 At least one object file must be given.
1191
1192 @code{strip} modifies the files named in its argument,
1193 rather than writing modified copies under different names.
1194
1195 @table @code
1196 @item -F @var{bfdname}
1197 @itemx --target=@var{bfdname}
1198 Treat the original @var{objfile} as a file with the object
1199 code format @var{bfdname}, and rewrite it in the same format.
1200 @xref{Target Selection}, for more information.
1201
1202 @item --help
1203 Show a summary of the options to @code{strip} and exit.
1204
1205 @item -I @var{bfdname}
1206 @itemx --input-target=@var{bfdname}
1207 Treat the original @var{objfile} as a file with the object
1208 code format @var{bfdname}.
1209 @xref{Target Selection}, for more information.
1210
1211 @item -O @var{bfdname}
1212 @itemx --output-target=@var{bfdname}
1213 Replace @var{objfile} with a file in the output format @var{bfdname}.
1214 @xref{Target Selection}, for more information.
1215
1216 @item -s
1217 @itemx --strip-all
1218 Remove all symbols.
1219
1220 @item -g
1221 @itemx -S
1222 @itemx --strip-debug
1223 Remove debugging symbols only.
1224
1225 @item -x
1226 @itemx --discard-all
1227 Remove non-global symbols.
1228
1229 @item -X
1230 @itemx --discard-locals
1231 Remove compiler-generated local symbols.
1232 (These usually start with @samp{L} or @samp{.}.)
1233
1234 @item -V
1235 @itemx --version
1236 Show the version number for @code{strip}.
1237
1238 @item -v
1239 @itemx --verbose
1240 Verbose output: list all object files modified. In the case of
1241 archives, @samp{strip -v} lists all members of the archive.
1242 @end table
1243
1244 @node c++filt
1245 @chapter c++filt
1246
1247 @kindex c++filt
1248 @cindex demangling C++ symbols
1249
1250 @smallexample
1251 c++filt [ -_ | --strip-underscores ]
1252 [ -s @var{format} | --format=@var{format} ]
1253 [ --help ] [ --version ] [ @var{symbol}@dots{} ]
1254 @end smallexample
1255
1256 The C++ language provides function overloading, which means that you can
1257 write many functions with the same name (providing each takes parameters
1258 of different types). All C++ function names are encoded into a
1259 low-level assembly label (this process is known as
1260 @dfn{mangling}). The @code{c++filt} program does the inverse mapping: it
1261 decodes (@dfn{demangles}) low-level names into user-level names so that
1262 the linker can keep these overloaded functions from clashing.
1263
1264 Every alphanumeric word (consisting of letters, digits, underscores,
1265 dollars, or periods) seen in the input is a potential label. If the
1266 label decodes into a C++ name, the C++ name replaces the low-level
1267 name in the output.
1268
1269 You can use @code{c++filt} to decipher individual symbols:
1270
1271 @example
1272 c++filt @var{symbol}
1273 @end example
1274
1275 If no @var{symbol} arguments are given, @code{c++filt} reads symbol
1276 names from the standard input and writes the demangled names to the
1277 standard output. All results are printed on the standard output.
1278
1279 @table @code
1280 @item -_
1281 @itemx --strip-underscores
1282 On some systems, both the C and C++ compilers put an underscore in front
1283 of every name. For example, the C name @code{foo} gets the low-level
1284 name @code{_foo}. This option removes the initial underscore.
1285
1286 @item -s @var{format}
1287 @itemx --format=@var{format}
1288 GNU @code{nm} can decode three different methods of mangling, used by
1289 different C++ compilers. The argument to this option selects which
1290 method it uses:
1291
1292 @table @code
1293 @item gnu
1294 the one used by the GNU compiler (the default method)
1295 @item lucid
1296 the one used by the Lucid compiler
1297 @item arm
1298 the one specified by the C++ Annotated Reference Manual
1299 @end table
1300
1301 @item --help
1302 Print a summary of the options to @code{c++filt} and exit.
1303
1304 @item --version
1305 Print the version number of @code{c++filt} and exit.
1306 @end table
1307
1308 @quotation
1309 @emph{Warning:} @code{c++filt} is a new utility, and the details of its
1310 user interface are subject to change in future releases. In particular,
1311 a command-line option may be required in the the future to decode a name
1312 passed as an argument on the command line; in other words,
1313
1314 @example
1315 c++filt @var{symbol}
1316 @end example
1317
1318 @noindent
1319 may in a future release become
1320
1321 @example
1322 c++filt @var{option} @var{symbol}
1323 @end example
1324 @end quotation
1325
1326 @node nlmconv
1327 @chapter nlmconv
1328
1329 @code{nlmconv} converts a relocatable object file into a NetWare
1330 Loadable Module.
1331
1332 @ignore
1333 @code{nlmconv} currently works with @samp{i386} object
1334 files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
1335 object files in @sc{elf}, or @code{a.out} format@footnote{
1336 @code{nlmconv} should work with any @samp{i386} or @sc{sparc} object
1337 format in the Binary File Descriptor library. It has only been tested
1338 with the above formats.}.
1339 @end ignore
1340
1341 @quotation
1342 @emph{Warning:} @code{nlmconv} is not always built as part of the binary
1343 utilities, since it is only useful for NLM targets.
1344 @end quotation
1345
1346 @smallexample
1347 nlmconv [ -I @var{bfdname} | --input-target=@var{bfdname} ]
1348 [ -O @var{bfdname} | --output-target=@var{bfdname} ]
1349 [ -T @var{headerfile} | --header-file=@var{headerfile} ]
1350 [ -h | --help ] [ -V | --version ]
1351 @var{infile} @var{outfile}
1352 @end smallexample
1353
1354 @code{nlmconv} converts the relocatable @samp{i386} object file
1355 @var{infile} into the NetWare Loadable Module @var{outfile}, optionally
1356 reading @var{headerfile} for NLM header information. For instructions
1357 on writing the NLM command file language used in header files, see the
1358 @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
1359 Development and Tools Overview}, which is part of the NLM Software
1360 Developer's Kit (``NLM SDK''), available from Novell, Inc.
1361 @code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
1362 @var{infile}; see @ref{BFD,,BFD,ld.info,Using LD}, for
1363 more information.
1364
1365 @table @code
1366 @item -I @var{bfdname}
1367 @itemx --input-target=@var{bfdname}
1368 Object format of the input file. @code{nlmconv} can usually determine
1369 the format of a given file (so no default is necessary).
1370 @xref{Target Selection}, for more information.
1371
1372 @item -O @var{bfdname}
1373 @itemx --output-target=@var{bfdname}
1374 Object format of the output file. @code{nlmconv} infers the output
1375 format based on the input format, e.g. for a @samp{i386} input file the
1376 output format is @samp{nlm32-i386}.
1377 @xref{Target Selection}, for more information.
1378
1379 @item -T @var{headerfile}
1380 @itemx --header-file=@var{headerfile}
1381 Reads @var{headerfile} for NLM header information. For instructions on
1382 writing the NLM command file language used in header files, see@ see the
1383 @samp{linkers} section, of the @cite{NLM Development and Tools
1384 Overview}, which is part of the NLM Software Developer's Kit, available
1385 from Novell, Inc.
1386
1387 @item -h
1388 @itemx --help
1389 Prints a usage summary.
1390
1391 @item -V
1392 @itemx --version
1393 Prints the version number for @code{nlmconv}.
1394 @end table
1395
1396 @node Selecting The Target System
1397 @chapter Selecting the target system
1398
1399 You can specify three aspects of the target system to the @sc{gnu}
1400 binary file utilities, each in several ways:
1401
1402 @itemize @bullet
1403 @item
1404 the target
1405
1406 @item
1407 the architecture
1408
1409 @item
1410 the linker emulation (which applies to the linker only)
1411 @end itemize
1412
1413 In the following summaries, the lists of ways to specify values are in
1414 order of decreasing precedence. The ways listed first override those
1415 listed later.
1416
1417 The commands to list valid values only list the values for which the
1418 programs you are running were configured. If they were configured with
1419 @samp{--with-targets=all}, the commands list most of the available
1420 values, but a few are left out; not all targets can be configured in at
1421 once because some of them can only be configured @dfn{native} (on hosts
1422 with the same type as the target system).
1423
1424 @menu
1425 * Target Selection::
1426 * Architecture Selection::
1427 * Linker Emulation Selection::
1428 @end menu
1429
1430 @node Target Selection
1431 @section Target Selection
1432
1433 A @dfn{target} is an object file format. A given target may be
1434 supported for multiple architectures (@pxref{Architecture Selection}).
1435 A target selection may also have variations for different operating
1436 systems or architectures.
1437
1438 The command to list valid target values is @samp{objdump -i}
1439 (the first column of output contains the relevant information).
1440
1441 Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
1442 @samp{a.out-sunos-big}.
1443
1444 @subheading @code{objdump} Target
1445
1446 Ways to specify:
1447
1448 @enumerate
1449 @item
1450 command line option: @samp{-b} or @samp{--target}
1451
1452 @item
1453 environment variable @code{GNUTARGET}
1454
1455 @item
1456 deduced from the input file
1457 @end enumerate
1458
1459 @subheading @code{objcopy} and @code{strip} Input Target
1460
1461 Ways to specify:
1462
1463 @enumerate
1464 @item
1465 command line options: @samp{-I} or @samp{--input-target}, or @samp{-F} or @samp{--target}
1466
1467 @item
1468 environment variable @code{GNUTARGET}
1469
1470 @item
1471 deduced from the input file
1472 @end enumerate
1473
1474 @subheading @code{objcopy} and @code{strip} Output Target
1475
1476 Ways to specify:
1477
1478 @enumerate
1479 @item
1480 command line options: @samp{-O} or @samp{--output-target}, or @samp{-F} or @samp{--target}
1481
1482 @item
1483 the input target (see ``@code{objcopy} and @code{strip} Input Target'' above)
1484
1485 @item
1486 environment variable @code{GNUTARGET}
1487
1488 @item
1489 deduced from the input file
1490 @end enumerate
1491
1492 @subheading @code{nm}, @code{size}, and @code{strings} Target
1493
1494 Ways to specify:
1495
1496 @enumerate
1497 @item
1498 command line option: @samp{--target}
1499
1500 @item
1501 environment variable @code{GNUTARGET}
1502
1503 @item
1504 deduced from the input file
1505 @end enumerate
1506
1507 @subheading Linker Input Target
1508
1509 Ways to specify:
1510
1511 @enumerate
1512 @item
1513 command line option: @samp{-b} or @samp{--format}
1514 (@pxref{Options,,Options,ld.info,Using LD})
1515
1516 @item
1517 script command @code{TARGET}
1518 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1519
1520 @item
1521 environment variable @code{GNUTARGET}
1522 (@pxref{Environment,,Environment,ld.info,Using LD})
1523
1524 @item
1525 the default target of the selected linker emulation
1526 (@pxref{Linker Emulation Selection})
1527 @end enumerate
1528
1529 @subheading Linker Output Target
1530
1531 Ways to specify:
1532
1533 @enumerate
1534 @item
1535 command line option: @samp{-oformat}
1536 (@pxref{Options,,Options,ld.info,Using LD})
1537
1538 @item
1539 script command @code{OUTPUT_FORMAT}
1540 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1541
1542 @item
1543 the linker input target (see ``Linker Input Target'' above)
1544 @end enumerate
1545
1546 @node Architecture Selection
1547 @section Architecture selection
1548
1549 An @dfn{architecture} is a type of @sc{cpu} on which an object file is
1550 to run. Its name may contain a colon, separating the name of the
1551 processor family from the name of the particular @sc{cpu}.
1552
1553 The command to list valid architecture values is @samp{objdump -i} (the
1554 second column contains the relevant information).
1555
1556 Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
1557
1558 @subheading @code{objdump} Architecture
1559
1560 Ways to specify:
1561
1562 @enumerate
1563 @item
1564 command line option: @samp{-m} or @samp{--architecture}
1565
1566 @item
1567 deduced from the input file
1568 @end enumerate
1569
1570 @subheading @code{objcopy}, @code{nm}, @code{size}, @code{strings} Architecture
1571
1572 Ways to specify:
1573
1574 @enumerate
1575 @item
1576 deduced from the input file
1577 @end enumerate
1578
1579 @subheading Linker Input Architecture
1580
1581 Ways to specify:
1582
1583 @enumerate
1584 @item
1585 deduced from the input file
1586 @end enumerate
1587
1588 @subheading Linker Output Architecture
1589
1590 Ways to specify:
1591
1592 @enumerate
1593 @item
1594 script command @code{OUTPUT_ARCH}
1595 (@pxref{Option Commands,,Option Commands,ld.info,Using LD})
1596
1597 @item
1598 the default architecture from the linker output target
1599 (@pxref{Target Selection})
1600 @end enumerate
1601
1602 @node Linker Emulation Selection
1603 @section Linker emulation selection
1604
1605 A linker @dfn{emulation} is a ``personality'' of the linker, which gives
1606 the linker default values for the other aspects of the target system.
1607 In particular, it consists of
1608
1609 @itemize @bullet
1610 @item
1611 the linker script
1612
1613 @item
1614 the target
1615
1616 @item
1617 several ``hook'' functions that are run at certain stages of the linking
1618 process to do special things that some targets require
1619 @end itemize
1620
1621 The command to list valid linker emulation values is @samp{ld -V}.
1622
1623 Sample values: @samp{hp300bsd}, @samp{mipslit}, @samp{sun4}.
1624
1625 Ways to specify:
1626
1627 @enumerate
1628 @item
1629 command line option: @samp{-m}
1630 (@pxref{Options,,Options,ld.info,Using LD})
1631
1632 @item
1633 environment variable @code{LDEMULATION}
1634
1635 @item
1636 compiled-in @code{DEFAULT_EMULATION} from @file{Makefile},
1637 which comes from @code{EMUL} in @file{config/@var{target}.mt}
1638 @end enumerate
1639
1640 @node Index
1641 @unnumbered Index
1642
1643 @printindex cp
1644
1645 @contents
1646 @bye