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