* doc/binutils.texi: Add --dwarf-check option.
[deliverable/binutils-gdb.git] / binutils / doc / binutils.texi
1 \input texinfo @c -*- Texinfo -*-
2 @setfilename binutils.info
3 @settitle @sc{gnu} Binary Utilities
4 @finalout
5 @synindex ky cp
6
7 @c man begin INCLUDE
8 @include bfdver.texi
9 @c man end
10
11 @copying
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
15 2010, 2011, 2012
16 Free Software Foundation, Inc.
17
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.3
20 or any later version published by the Free Software Foundation;
21 with no Invariant Sections, with no Front-Cover Texts, and with no
22 Back-Cover Texts. A copy of the license is included in the
23 section entitled ``GNU Free Documentation License''.
24
25 @c man end
26 @end copying
27
28 @dircategory Software development
29 @direntry
30 * Binutils: (binutils). The GNU binary utilities.
31 @end direntry
32
33 @dircategory Individual utilities
34 @direntry
35 * addr2line: (binutils)addr2line. Convert addresses to file and line.
36 * ar: (binutils)ar. Create, modify, and extract from archives.
37 * c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols.
38 * cxxfilt: (binutils)c++filt. MS-DOS name for c++filt.
39 * dlltool: (binutils)dlltool. Create files needed to build and use DLLs.
40 * nlmconv: (binutils)nlmconv. Converts object code into an NLM.
41 * nm: (binutils)nm. List symbols from object files.
42 * objcopy: (binutils)objcopy. Copy and translate object files.
43 * objdump: (binutils)objdump. Display information from object files.
44 * ranlib: (binutils)ranlib. Generate index to archive contents.
45 * readelf: (binutils)readelf. Display the contents of ELF format files.
46 * size: (binutils)size. List section sizes and total size.
47 * strings: (binutils)strings. List printable strings from files.
48 * strip: (binutils)strip. Discard symbols.
49 * elfedit: (binutils)elfedit. Update the ELF header of ELF files.
50 * windmc: (binutils)windmc. Generator for Windows message resources.
51 * windres: (binutils)windres. Manipulate Windows resources.
52 @end direntry
53
54 @titlepage
55 @title The @sc{gnu} Binary Utilities
56 @ifset VERSION_PACKAGE
57 @subtitle @value{VERSION_PACKAGE}
58 @end ifset
59 @subtitle Version @value{VERSION}
60 @sp 1
61 @subtitle @value{UPDATED}
62 @author Roland H. Pesch
63 @author Jeffrey M. Osier
64 @author Cygnus Support
65 @page
66
67 @tex
68 {\parskip=0pt \hfill Cygnus Support\par \hfill
69 Texinfo \texinfoversion\par }
70 @end tex
71
72 @vskip 0pt plus 1filll
73 @insertcopying
74 @end titlepage
75 @contents
76
77 @node Top
78 @top Introduction
79
80 @cindex version
81 This brief manual contains documentation for the @sc{gnu} binary
82 utilities
83 @ifset VERSION_PACKAGE
84 @value{VERSION_PACKAGE}
85 @end ifset
86 version @value{VERSION}:
87
88 @iftex
89 @table @code
90 @item ar
91 Create, modify, and extract from archives
92
93 @item nm
94 List symbols from object files
95
96 @item objcopy
97 Copy and translate object files
98
99 @item objdump
100 Display information from object files
101
102 @item ranlib
103 Generate index to archive contents
104
105 @item readelf
106 Display the contents of ELF format files.
107
108 @item size
109 List file section sizes and total size
110
111 @item strings
112 List printable strings from files
113
114 @item strip
115 Discard symbols
116
117 @item elfedit
118 Update the ELF header of ELF files.
119
120 @item c++filt
121 Demangle encoded C++ symbols (on MS-DOS, this program is named
122 @code{cxxfilt})
123
124 @item addr2line
125 Convert addresses into file names and line numbers
126
127 @item nlmconv
128 Convert object code into a Netware Loadable Module
129
130 @item windres
131 Manipulate Windows resources
132
133 @item windmc
134 Genertor for Windows message resources
135
136 @item dlltool
137 Create the files needed to build and use Dynamic Link Libraries
138 @end table
139 @end iftex
140
141 This document is distributed under the terms of the GNU Free
142 Documentation License version 1.3. A copy of the license is included
143 in the section entitled ``GNU Free Documentation License''.
144
145 @menu
146 * ar:: Create, modify, and extract from archives
147 * nm:: List symbols from object files
148 * objcopy:: Copy and translate object files
149 * objdump:: Display information from object files
150 * ranlib:: Generate index to archive contents
151 * readelf:: Display the contents of ELF format files
152 * size:: List section sizes and total size
153 * strings:: List printable strings from files
154 * strip:: Discard symbols
155 * elfedit:: Update the ELF header of ELF files
156 * c++filt:: Filter to demangle encoded C++ symbols
157 * cxxfilt: c++filt. MS-DOS name for c++filt
158 * addr2line:: Convert addresses to file and line
159 * nlmconv:: Converts object code into an NLM
160 * windres:: Manipulate Windows resources
161 * windmc:: Generator for Windows message resources
162 * dlltool:: Create files needed to build and use DLLs
163 * Common Options:: Command-line options for all utilities
164 * Selecting the Target System:: How these utilities determine the target
165 * Reporting Bugs:: Reporting Bugs
166 * GNU Free Documentation License:: GNU Free Documentation License
167 * Binutils Index:: Binutils Index
168 @end menu
169
170 @node ar
171 @chapter ar
172
173 @kindex ar
174 @cindex archives
175 @cindex collections of files
176
177 @c man title ar create, modify, and extract from archives
178
179 @smallexample
180 ar [@option{--plugin} @var{name}] [-]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] [@option{--target} @var{bfdname}] @var{archive} [@var{member}@dots{}]
181 ar -M [ <mri-script ]
182 @end smallexample
183
184 @c man begin DESCRIPTION ar
185
186 The @sc{gnu} @command{ar} program creates, modifies, and extracts from
187 archives. An @dfn{archive} is a single file holding a collection of
188 other files in a structure that makes it possible to retrieve
189 the original individual files (called @dfn{members} of the archive).
190
191 The original files' contents, mode (permissions), timestamp, owner, and
192 group are preserved in the archive, and can be restored on
193 extraction.
194
195 @cindex name length
196 @sc{gnu} @command{ar} can maintain archives whose members have names of any
197 length; however, depending on how @command{ar} is configured on your
198 system, a limit on member-name length may be imposed for compatibility
199 with archive formats maintained with other tools. If it exists, the
200 limit is often 15 characters (typical of formats related to a.out) or 16
201 characters (typical of formats related to coff).
202
203 @cindex libraries
204 @command{ar} is considered a binary utility because archives of this sort
205 are most often used as @dfn{libraries} holding commonly needed
206 subroutines.
207
208 @cindex symbol index
209 @command{ar} creates an index to the symbols defined in relocatable
210 object modules in the archive when you specify the modifier @samp{s}.
211 Once created, this index is updated in the archive whenever @command{ar}
212 makes a change to its contents (save for the @samp{q} update operation).
213 An archive with such an index speeds up linking to the library, and
214 allows routines in the library to call each other without regard to
215 their placement in the archive.
216
217 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
218 table. If an archive lacks the table, another form of @command{ar} called
219 @command{ranlib} can be used to add just the table.
220
221 @cindex thin archives
222 @sc{gnu} @command{ar} can optionally create a @emph{thin} archive,
223 which contains a symbol index and references to the original copies
224 of the member files of the archives. Such an archive is useful
225 for building libraries for use within a local build, where the
226 relocatable objects are expected to remain available, and copying the
227 contents of each object would only waste time and space. Thin archives
228 are also @emph{flattened}, so that adding one or more archives to a
229 thin archive will add the elements of the nested archive individually.
230 The paths to the elements of the archive are stored relative to the
231 archive itself.
232
233 @cindex compatibility, @command{ar}
234 @cindex @command{ar} compatibility
235 @sc{gnu} @command{ar} is designed to be compatible with two different
236 facilities. You can control its activity using command-line options,
237 like the different varieties of @command{ar} on Unix systems; or, if you
238 specify the single command-line option @option{-M}, you can control it
239 with a script supplied via standard input, like the MRI ``librarian''
240 program.
241
242 @c man end
243
244 @menu
245 * ar cmdline:: Controlling @command{ar} on the command line
246 * ar scripts:: Controlling @command{ar} with a script
247 @end menu
248
249 @page
250 @node ar cmdline
251 @section Controlling @command{ar} on the Command Line
252
253 @smallexample
254 @c man begin SYNOPSIS ar
255 ar [@option{--plugin} @var{name}] [@option{-X32_64}] [@option{-}]@var{p}[@var{mod} [@var{relpos}] [@var{count}]] [@option{--target} @var{bfdname}] @var{archive} [@var{member}@dots{}]
256 @c man end
257 @end smallexample
258
259 @cindex Unix compatibility, @command{ar}
260 When you use @command{ar} in the Unix style, @command{ar} insists on at least two
261 arguments to execute: one keyletter specifying the @emph{operation}
262 (optionally accompanied by other keyletters specifying
263 @emph{modifiers}), and the archive name to act on.
264
265 Most operations can also accept further @var{member} arguments,
266 specifying particular files to operate on.
267
268 @c man begin OPTIONS ar
269
270 @sc{gnu} @command{ar} allows you to mix the operation code @var{p} and modifier
271 flags @var{mod} in any order, within the first command-line argument.
272
273 If you wish, you may begin the first command-line argument with a
274 dash.
275
276 @cindex operations on archive
277 The @var{p} keyletter specifies what operation to execute; it may be
278 any of the following, but you must specify only one of them:
279
280 @table @samp
281 @item d
282 @cindex deleting from archive
283 @emph{Delete} modules from the archive. Specify the names of modules to
284 be deleted as @var{member}@dots{}; the archive is untouched if you
285 specify no files to delete.
286
287 If you specify the @samp{v} modifier, @command{ar} lists each module
288 as it is deleted.
289
290 @item m
291 @cindex moving in archive
292 Use this operation to @emph{move} members in an archive.
293
294 The ordering of members in an archive can make a difference in how
295 programs are linked using the library, if a symbol is defined in more
296 than one member.
297
298 If no modifiers are used with @code{m}, any members you name in the
299 @var{member} arguments are moved to the @emph{end} of the archive;
300 you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
301 specified place instead.
302
303 @item p
304 @cindex printing from archive
305 @emph{Print} the specified members of the archive, to the standard
306 output file. If the @samp{v} modifier is specified, show the member
307 name before copying its contents to standard output.
308
309 If you specify no @var{member} arguments, all the files in the archive are
310 printed.
311
312 @item q
313 @cindex quick append to archive
314 @emph{Quick append}; Historically, add the files @var{member}@dots{} to the end of
315 @var{archive}, without checking for replacement.
316
317 The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
318 operation; new members are always placed at the end of the archive.
319
320 The modifier @samp{v} makes @command{ar} list each file as it is appended.
321
322 Since the point of this operation is speed, the archive's symbol table
323 index is not updated, even if it already existed; you can use @samp{ar s} or
324 @command{ranlib} explicitly to update the symbol table index.
325
326 However, too many different systems assume quick append rebuilds the
327 index, so @sc{gnu} @command{ar} implements @samp{q} as a synonym for @samp{r}.
328
329 @item r
330 @cindex replacement in archive
331 Insert the files @var{member}@dots{} into @var{archive} (with
332 @emph{replacement}). This operation differs from @samp{q} in that any
333 previously existing members are deleted if their names match those being
334 added.
335
336 If one of the files named in @var{member}@dots{} does not exist, @command{ar}
337 displays an error message, and leaves undisturbed any existing members
338 of the archive matching that name.
339
340 By default, new members are added at the end of the file; but you may
341 use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
342 placement relative to some existing member.
343
344 The modifier @samp{v} used with this operation elicits a line of
345 output for each file inserted, along with one of the letters @samp{a} or
346 @samp{r} to indicate whether the file was appended (no old member
347 deleted) or replaced.
348
349 @item s
350 @cindex ranlib
351 Add an index to the archive, or update it if it already exists. Note
352 this command is an exception to the rule that there can only be one
353 command letter, as it is possible to use it as either a command or a
354 modifier. In either case it does the same thing.
355
356 @item t
357 @cindex contents of archive
358 Display a @emph{table} listing the contents of @var{archive}, or those
359 of the files listed in @var{member}@dots{} that are present in the
360 archive. Normally only the member name is shown; if you also want to
361 see the modes (permissions), timestamp, owner, group, and size, you can
362 request that by also specifying the @samp{v} modifier.
363
364 If you do not specify a @var{member}, all files in the archive
365 are listed.
366
367 @cindex repeated names in archive
368 @cindex name duplication in archive
369 If there is more than one file with the same name (say, @samp{fie}) in
370 an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
371 first instance; to see them all, you must ask for a complete
372 listing---in our example, @samp{ar t b.a}.
373 @c WRS only; per Gumby, this is implementation-dependent, and in a more
374 @c recent case in fact works the other way.
375
376 @item x
377 @cindex extract from archive
378 @emph{Extract} members (named @var{member}) from the archive. You can
379 use the @samp{v} modifier with this operation, to request that
380 @command{ar} list each name as it extracts it.
381
382 If you do not specify a @var{member}, all files in the archive
383 are extracted.
384
385 Files cannot be extracted from a thin archive.
386
387 @item --help
388 Displays the list of command line options supported by @command{ar}
389 and then exits.
390
391 @item --version
392 Displays the version information of @command{ar} and then exits.
393
394 @end table
395
396 A number of modifiers (@var{mod}) may immediately follow the @var{p}
397 keyletter, to specify variations on an operation's behavior:
398
399 @table @samp
400 @item a
401 @cindex relative placement in archive
402 Add new files @emph{after} an existing member of the
403 archive. If you use the modifier @samp{a}, the name of an existing archive
404 member must be present as the @var{relpos} argument, before the
405 @var{archive} specification.
406
407 @item b
408 Add new files @emph{before} an existing member of the
409 archive. If you use the modifier @samp{b}, the name of an existing archive
410 member must be present as the @var{relpos} argument, before the
411 @var{archive} specification. (same as @samp{i}).
412
413 @item c
414 @cindex creating archives
415 @emph{Create} the archive. The specified @var{archive} is always
416 created if it did not exist, when you request an update. But a warning is
417 issued unless you specify in advance that you expect to create it, by
418 using this modifier.
419
420 @item D
421 @cindex deterministic archives
422 @kindex --enable-deterministic-archives
423 Operate in @emph{deterministic} mode. When adding files and the archive
424 index use zero for UIDs, GIDs, timestamps, and use consistent file modes
425 for all files. When this option is used, if @command{ar} is used with
426 identical options and identical input files, multiple runs will create
427 identical output files regardless of the input files' owners, groups,
428 file modes, or modification times.
429
430 If @file{binutils} was configured with
431 @option{--enable-deterministic-archives}, then this mode is on by default.
432 It can be disabled with the @samp{U} modifier, below.
433
434 @item f
435 Truncate names in the archive. @sc{gnu} @command{ar} will normally permit file
436 names of any length. This will cause it to create archives which are
437 not compatible with the native @command{ar} program on some systems. If
438 this is a concern, the @samp{f} modifier may be used to truncate file
439 names when putting them in the archive.
440
441 @item i
442 Insert new files @emph{before} an existing member of the
443 archive. If you use the modifier @samp{i}, the name of an existing archive
444 member must be present as the @var{relpos} argument, before the
445 @var{archive} specification. (same as @samp{b}).
446
447 @item l
448 This modifier is accepted but not used.
449 @c whaffor ar l modifier??? presumably compat; with
450 @c what???---doc@@cygnus.com, 25jan91
451
452 @item N
453 Uses the @var{count} parameter. This is used if there are multiple
454 entries in the archive with the same name. Extract or delete instance
455 @var{count} of the given name from the archive.
456
457 @item o
458 @cindex dates in archive
459 Preserve the @emph{original} dates of members when extracting them. If
460 you do not specify this modifier, files extracted from the archive
461 are stamped with the time of extraction.
462
463 @item P
464 Use the full path name when matching names in the archive. @sc{gnu}
465 @command{ar} can not create an archive with a full path name (such archives
466 are not POSIX complaint), but other archive creators can. This option
467 will cause @sc{gnu} @command{ar} to match file names using a complete path
468 name, which can be convenient when extracting a single file from an
469 archive created by another tool.
470
471 @item s
472 @cindex writing archive index
473 Write an object-file index into the archive, or update an existing one,
474 even if no other change is made to the archive. You may use this modifier
475 flag either with any operation, or alone. Running @samp{ar s} on an
476 archive is equivalent to running @samp{ranlib} on it.
477
478 @item S
479 @cindex not writing archive index
480 Do not generate an archive symbol table. This can speed up building a
481 large library in several steps. The resulting archive can not be used
482 with the linker. In order to build a symbol table, you must omit the
483 @samp{S} modifier on the last execution of @samp{ar}, or you must run
484 @samp{ranlib} on the archive.
485
486 @item T
487 @cindex creating thin archive
488 Make the specified @var{archive} a @emph{thin} archive. If it already
489 exists and is a regular archive, the existing members must be present
490 in the same directory as @var{archive}.
491
492 @item u
493 @cindex updating an archive
494 Normally, @samp{ar r}@dots{} inserts all files
495 listed into the archive. If you would like to insert @emph{only} those
496 of the files you list that are newer than existing members of the same
497 names, use this modifier. The @samp{u} modifier is allowed only for the
498 operation @samp{r} (replace). In particular, the combination @samp{qu} is
499 not allowed, since checking the timestamps would lose any speed
500 advantage from the operation @samp{q}.
501
502 @item U
503 @cindex deterministic archives
504 @kindex --enable-deterministic-archives
505 Do @emph{not} operate in @emph{deterministic} mode. This is the inverse
506 of the @samp{D} modifier, above: added files and the archive index will
507 get their actual UID, GID, timestamp, and file mode values.
508
509 This is the default unless @file{binutils} was configured with
510 @option{--enable-deterministic-archives}.
511
512 @item v
513 This modifier requests the @emph{verbose} version of an operation. Many
514 operations display additional information, such as filenames processed,
515 when the modifier @samp{v} is appended.
516
517 @item V
518 This modifier shows the version number of @command{ar}.
519 @end table
520
521 @command{ar} ignores an initial option spelt @samp{-X32_64}, for
522 compatibility with AIX. The behaviour produced by this option is the
523 default for @sc{gnu} @command{ar}. @command{ar} does not support any of the other
524 @samp{-X} options; in particular, it does not support @option{-X32}
525 which is the default for AIX @command{ar}.
526
527 The optional command line switch @option{--plugin} @var{name} causes
528 @command{ar} to load the plugin called @var{name} which adds support
529 for more file formats. This option is only available if the toolchain
530 has been built with plugin support enabled.
531
532 The optional command line switch @option{--target} @var{bfdname}
533 specifies that the archive members are in an object code format
534 different from your system's default format. See
535 @xref{Target Selection}, for more information.
536
537 @c man end
538
539 @ignore
540 @c man begin SEEALSO ar
541 nm(1), ranlib(1), and the Info entries for @file{binutils}.
542 @c man end
543 @end ignore
544
545 @node ar scripts
546 @section Controlling @command{ar} with a Script
547
548 @smallexample
549 ar -M [ <@var{script} ]
550 @end smallexample
551
552 @cindex MRI compatibility, @command{ar}
553 @cindex scripts, @command{ar}
554 If you use the single command-line option @samp{-M} with @command{ar}, you
555 can control its operation with a rudimentary command language. This
556 form of @command{ar} operates interactively if standard input is coming
557 directly from a terminal. During interactive use, @command{ar} prompts for
558 input (the prompt is @samp{AR >}), and continues executing even after
559 errors. If you redirect standard input to a script file, no prompts are
560 issued, and @command{ar} abandons execution (with a nonzero exit code)
561 on any error.
562
563 The @command{ar} command language is @emph{not} designed to be equivalent
564 to the command-line options; in fact, it provides somewhat less control
565 over archives. The only purpose of the command language is to ease the
566 transition to @sc{gnu} @command{ar} for developers who already have scripts
567 written for the MRI ``librarian'' program.
568
569 The syntax for the @command{ar} command language is straightforward:
570 @itemize @bullet
571 @item
572 commands are recognized in upper or lower case; for example, @code{LIST}
573 is the same as @code{list}. In the following descriptions, commands are
574 shown in upper case for clarity.
575
576 @item
577 a single command may appear on each line; it is the first word on the
578 line.
579
580 @item
581 empty lines are allowed, and have no effect.
582
583 @item
584 comments are allowed; text after either of the characters @samp{*}
585 or @samp{;} is ignored.
586
587 @item
588 Whenever you use a list of names as part of the argument to an @command{ar}
589 command, you can separate the individual names with either commas or
590 blanks. Commas are shown in the explanations below, for clarity.
591
592 @item
593 @samp{+} is used as a line continuation character; if @samp{+} appears
594 at the end of a line, the text on the following line is considered part
595 of the current command.
596 @end itemize
597
598 Here are the commands you can use in @command{ar} scripts, or when using
599 @command{ar} interactively. Three of them have special significance:
600
601 @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
602 a temporary file required for most of the other commands.
603
604 @code{SAVE} commits the changes so far specified by the script. Prior
605 to @code{SAVE}, commands affect only the temporary copy of the current
606 archive.
607
608 @table @code
609 @item ADDLIB @var{archive}
610 @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
611 Add all the contents of @var{archive} (or, if specified, each named
612 @var{module} from @var{archive}) to the current archive.
613
614 Requires prior use of @code{OPEN} or @code{CREATE}.
615
616 @item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
617 @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
618 @c else like "ar q..."
619 Add each named @var{member} as a module in the current archive.
620
621 Requires prior use of @code{OPEN} or @code{CREATE}.
622
623 @item CLEAR
624 Discard the contents of the current archive, canceling the effect of
625 any operations since the last @code{SAVE}. May be executed (with no
626 effect) even if no current archive is specified.
627
628 @item CREATE @var{archive}
629 Creates an archive, and makes it the current archive (required for many
630 other commands). The new archive is created with a temporary name; it
631 is not actually saved as @var{archive} until you use @code{SAVE}.
632 You can overwrite existing archives; similarly, the contents of any
633 existing file named @var{archive} will not be destroyed until @code{SAVE}.
634
635 @item DELETE @var{module}, @var{module}, @dots{} @var{module}
636 Delete each listed @var{module} from the current archive; equivalent to
637 @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
638
639 Requires prior use of @code{OPEN} or @code{CREATE}.
640
641 @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
642 @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
643 List each named @var{module} present in @var{archive}. The separate
644 command @code{VERBOSE} specifies the form of the output: when verbose
645 output is off, output is like that of @samp{ar -t @var{archive}
646 @var{module}@dots{}}. When verbose output is on, the listing is like
647 @samp{ar -tv @var{archive} @var{module}@dots{}}.
648
649 Output normally goes to the standard output stream; however, if you
650 specify @var{outputfile} as a final argument, @command{ar} directs the
651 output to that file.
652
653 @item END
654 Exit from @command{ar}, with a @code{0} exit code to indicate successful
655 completion. This command does not save the output file; if you have
656 changed the current archive since the last @code{SAVE} command, those
657 changes are lost.
658
659 @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
660 Extract each named @var{module} from the current archive, writing them
661 into the current directory as separate files. Equivalent to @samp{ar -x
662 @var{archive} @var{module}@dots{}}.
663
664 Requires prior use of @code{OPEN} or @code{CREATE}.
665
666 @ignore
667 @c FIXME Tokens but no commands???
668 @item FULLDIR
669
670 @item HELP
671 @end ignore
672
673 @item LIST
674 Display full contents of the current archive, in ``verbose'' style
675 regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
676 tv @var{archive}}. (This single command is a @sc{gnu} @command{ar}
677 enhancement, rather than present for MRI compatibility.)
678
679 Requires prior use of @code{OPEN} or @code{CREATE}.
680
681 @item OPEN @var{archive}
682 Opens an existing archive for use as the current archive (required for
683 many other commands). Any changes as the result of subsequent commands
684 will not actually affect @var{archive} until you next use @code{SAVE}.
685
686 @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
687 In the current archive, replace each existing @var{module} (named in
688 the @code{REPLACE} arguments) from files in the current working directory.
689 To execute this command without errors, both the file, and the module in
690 the current archive, must exist.
691
692 Requires prior use of @code{OPEN} or @code{CREATE}.
693
694 @item VERBOSE
695 Toggle an internal flag governing the output from @code{DIRECTORY}.
696 When the flag is on, @code{DIRECTORY} output matches output from
697 @samp{ar -tv }@dots{}.
698
699 @item SAVE
700 Commit your changes to the current archive, and actually save it as a
701 file with the name specified in the last @code{CREATE} or @code{OPEN}
702 command.
703
704 Requires prior use of @code{OPEN} or @code{CREATE}.
705
706 @end table
707
708 @iftex
709 @node ld
710 @chapter ld
711 @cindex linker
712 @kindex ld
713 The @sc{gnu} linker @command{ld} is now described in a separate manual.
714 @xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
715 @end iftex
716
717 @node nm
718 @chapter nm
719 @cindex symbols
720 @kindex nm
721
722 @c man title nm list symbols from object files
723
724 @smallexample
725 @c man begin SYNOPSIS nm
726 nm [@option{-a}|@option{--debug-syms}]
727 [@option{-g}|@option{--extern-only}][@option{--plugin} @var{name}]
728 [@option{-B}] [@option{-C}|@option{--demangle}[=@var{style}]] [@option{-D}|@option{--dynamic}]
729 [@option{-S}|@option{--print-size}] [@option{-s}|@option{--print-armap}]
730 [@option{-A}|@option{-o}|@option{--print-file-name}][@option{--special-syms}]
731 [@option{-n}|@option{-v}|@option{--numeric-sort}] [@option{-p}|@option{--no-sort}]
732 [@option{-r}|@option{--reverse-sort}] [@option{--size-sort}] [@option{-u}|@option{--undefined-only}]
733 [@option{-t} @var{radix}|@option{--radix=}@var{radix}] [@option{-P}|@option{--portability}]
734 [@option{--target=}@var{bfdname}] [@option{-f}@var{format}|@option{--format=}@var{format}]
735 [@option{--defined-only}] [@option{-l}|@option{--line-numbers}] [@option{--no-demangle}]
736 [@option{-V}|@option{--version}] [@option{-X 32_64}] [@option{--help}] [@var{objfile}@dots{}]
737 @c man end
738 @end smallexample
739
740 @c man begin DESCRIPTION nm
741 @sc{gnu} @command{nm} lists the symbols from object files @var{objfile}@dots{}.
742 If no object files are listed as arguments, @command{nm} assumes the file
743 @file{a.out}.
744
745 For each symbol, @command{nm} shows:
746
747 @itemize @bullet
748 @item
749 The symbol value, in the radix selected by options (see below), or
750 hexadecimal by default.
751
752 @item
753 The symbol type. At least the following types are used; others are, as
754 well, depending on the object file format. If lowercase, the symbol is
755 usually local; if uppercase, the symbol is global (external). There
756 are however a few lowercase symbols that are shown for special global
757 symbols (@code{u}, @code{v} and @code{w}).
758
759 @c Some more detail on exactly what these symbol types are used for
760 @c would be nice.
761 @table @code
762 @item A
763 The symbol's value is absolute, and will not be changed by further
764 linking.
765
766 @item B
767 @itemx b
768 The symbol is in the uninitialized data section (known as BSS).
769
770 @item C
771 The symbol is common. Common symbols are uninitialized data. When
772 linking, multiple common symbols may appear with the same name. If the
773 symbol is defined anywhere, the common symbols are treated as undefined
774 references.
775 @ifclear man
776 For more details on common symbols, see the discussion of
777 --warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}.
778 @end ifclear
779
780 @item D
781 @itemx d
782 The symbol is in the initialized data section.
783
784 @item G
785 @itemx g
786 The symbol is in an initialized data section for small objects. Some
787 object file formats permit more efficient access to small data objects,
788 such as a global int variable as opposed to a large global array.
789
790 @item i
791 For PE format files this indicates that the symbol is in a section
792 specific to the implementation of DLLs. For ELF format files this
793 indicates that the symbol is an indirect function. This is a GNU
794 extension to the standard set of ELF symbol types. It indicates a
795 symbol which if referenced by a relocation does not evaluate to its
796 address, but instead must be invoked at runtime. The runtime
797 execution will then return the value to be used in the relocation.
798
799 @item N
800 The symbol is a debugging symbol.
801
802 @item p
803 The symbols is in a stack unwind section.
804
805 @item R
806 @itemx r
807 The symbol is in a read only data section.
808
809 @item S
810 @itemx s
811 The symbol is in an uninitialized data section for small objects.
812
813 @item T
814 @itemx t
815 The symbol is in the text (code) section.
816
817 @item U
818 The symbol is undefined.
819
820 @item u
821 The symbol is a unique global symbol. This is a GNU extension to the
822 standard set of ELF symbol bindings. For such a symbol the dynamic linker
823 will make sure that in the entire process there is just one symbol with
824 this name and type in use.
825
826 @item V
827 @itemx v
828 The symbol is a weak object. When a weak defined symbol is linked with
829 a normal defined symbol, the normal defined symbol is used with no error.
830 When a weak undefined symbol is linked and the symbol is not defined,
831 the value of the weak symbol becomes zero with no error. On some
832 systems, uppercase indicates that a default value has been specified.
833
834 @item W
835 @itemx w
836 The symbol is a weak symbol that has not been specifically tagged as a
837 weak object symbol. When a weak defined symbol is linked with a normal
838 defined symbol, the normal defined symbol is used with no error.
839 When a weak undefined symbol is linked and the symbol is not defined,
840 the value of the symbol is determined in a system-specific manner without
841 error. On some systems, uppercase indicates that a default value has been
842 specified.
843
844 @item -
845 The symbol is a stabs symbol in an a.out object file. In this case, the
846 next values printed are the stabs other field, the stabs desc field, and
847 the stab type. Stabs symbols are used to hold debugging information.
848 @ifclear man
849 For more information, see @ref{Top,Stabs,Stabs Overview,stabs.info, The
850 ``stabs'' debug format}.
851 @end ifclear
852
853 @item ?
854 The symbol type is unknown, or object file format specific.
855 @end table
856
857 @item
858 The symbol name.
859 @end itemize
860
861 @c man end
862
863 @c man begin OPTIONS nm
864 The long and short forms of options, shown here as alternatives, are
865 equivalent.
866
867 @table @env
868 @item -A
869 @itemx -o
870 @itemx --print-file-name
871 @cindex input file name
872 @cindex file name
873 @cindex source file name
874 Precede each symbol by the name of the input file (or archive member)
875 in which it was found, rather than identifying the input file once only,
876 before all of its symbols.
877
878 @item -a
879 @itemx --debug-syms
880 @cindex debugging symbols
881 Display all symbols, even debugger-only symbols; normally these are not
882 listed.
883
884 @item -B
885 @cindex @command{nm} format
886 @cindex @command{nm} compatibility
887 The same as @option{--format=bsd} (for compatibility with the MIPS @command{nm}).
888
889 @item -C
890 @itemx --demangle[=@var{style}]
891 @cindex demangling in nm
892 Decode (@dfn{demangle}) low-level symbol names into user-level names.
893 Besides removing any initial underscore prepended by the system, this
894 makes C++ function names readable. Different compilers have different
895 mangling styles. The optional demangling style argument can be used to
896 choose an appropriate demangling style for your compiler. @xref{c++filt},
897 for more information on demangling.
898
899 @item --no-demangle
900 Do not demangle low-level symbol names. This is the default.
901
902 @item -D
903 @itemx --dynamic
904 @cindex dynamic symbols
905 Display the dynamic symbols rather than the normal symbols. This is
906 only meaningful for dynamic objects, such as certain types of shared
907 libraries.
908
909 @item -f @var{format}
910 @itemx --format=@var{format}
911 @cindex @command{nm} format
912 @cindex @command{nm} compatibility
913 Use the output format @var{format}, which can be @code{bsd},
914 @code{sysv}, or @code{posix}. The default is @code{bsd}.
915 Only the first character of @var{format} is significant; it can be
916 either upper or lower case.
917
918 @item -g
919 @itemx --extern-only
920 @cindex external symbols
921 Display only external symbols.
922
923 @item --plugin @var{name}
924 @cindex load plugin
925 Load the plugin called @var{name} to add support for extra target
926 types. This option is only available if the toolchain has been built
927 with plugin support enabled.
928
929 @item -l
930 @itemx --line-numbers
931 @cindex symbol line numbers
932 For each symbol, use debugging information to try to find a filename and
933 line number. For a defined symbol, look for the line number of the
934 address of the symbol. For an undefined symbol, look for the line
935 number of a relocation entry which refers to the symbol. If line number
936 information can be found, print it after the other symbol information.
937
938 @item -n
939 @itemx -v
940 @itemx --numeric-sort
941 Sort symbols numerically by their addresses, rather than alphabetically
942 by their names.
943
944 @item -p
945 @itemx --no-sort
946 @cindex sorting symbols
947 Do not bother to sort the symbols in any order; print them in the order
948 encountered.
949
950 @item -P
951 @itemx --portability
952 Use the POSIX.2 standard output format instead of the default format.
953 Equivalent to @samp{-f posix}.
954
955 @item -S
956 @itemx --print-size
957 Print both value and size of defined symbols for the @code{bsd} output style.
958 This option has no effect for object formats that do not record symbol
959 sizes, unless @samp{--size-sort} is also used in which case a
960 calculated size is displayed.
961
962 @item -s
963 @itemx --print-armap
964 @cindex symbol index, listing
965 When listing symbols from archive members, include the index: a mapping
966 (stored in the archive by @command{ar} or @command{ranlib}) of which modules
967 contain definitions for which names.
968
969 @item -r
970 @itemx --reverse-sort
971 Reverse the order of the sort (whether numeric or alphabetic); let the
972 last come first.
973
974 @item --size-sort
975 Sort symbols by size. The size is computed as the difference between
976 the value of the symbol and the value of the symbol with the next higher
977 value. If the @code{bsd} output format is used the size of the symbol
978 is printed, rather than the value, and @samp{-S} must be used in order
979 both size and value to be printed.
980
981 @item --special-syms
982 Display symbols which have a target-specific special meaning. These
983 symbols are usually used by the target for some special processing and
984 are not normally helpful when included included in the normal symbol
985 lists. For example for ARM targets this option would skip the mapping
986 symbols used to mark transitions between ARM code, THUMB code and
987 data.
988
989 @item -t @var{radix}
990 @itemx --radix=@var{radix}
991 Use @var{radix} as the radix for printing the symbol values. It must be
992 @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
993
994 @item --target=@var{bfdname}
995 @cindex object code format
996 Specify an object code format other than your system's default format.
997 @xref{Target Selection}, for more information.
998
999 @item -u
1000 @itemx --undefined-only
1001 @cindex external symbols
1002 @cindex undefined symbols
1003 Display only undefined symbols (those external to each object file).
1004
1005 @item --defined-only
1006 @cindex external symbols
1007 @cindex undefined symbols
1008 Display only defined symbols for each object file.
1009
1010 @item -V
1011 @itemx --version
1012 Show the version number of @command{nm} and exit.
1013
1014 @item -X
1015 This option is ignored for compatibility with the AIX version of
1016 @command{nm}. It takes one parameter which must be the string
1017 @option{32_64}. The default mode of AIX @command{nm} corresponds
1018 to @option{-X 32}, which is not supported by @sc{gnu} @command{nm}.
1019
1020 @item --help
1021 Show a summary of the options to @command{nm} and exit.
1022 @end table
1023
1024 @c man end
1025
1026 @ignore
1027 @c man begin SEEALSO nm
1028 ar(1), objdump(1), ranlib(1), and the Info entries for @file{binutils}.
1029 @c man end
1030 @end ignore
1031
1032 @node objcopy
1033 @chapter objcopy
1034
1035 @c man title objcopy copy and translate object files
1036
1037 @smallexample
1038 @c man begin SYNOPSIS objcopy
1039 objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
1040 [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
1041 [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
1042 [@option{-B} @var{bfdarch}|@option{--binary-architecture=}@var{bfdarch}]
1043 [@option{-S}|@option{--strip-all}]
1044 [@option{-g}|@option{--strip-debug}]
1045 [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
1046 [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}]
1047 [@option{--strip-unneeded-symbol=}@var{symbolname}]
1048 [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}]
1049 [@option{--localize-hidden}]
1050 [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
1051 [@option{--globalize-symbol=}@var{symbolname}]
1052 [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
1053 [@option{-w}|@option{--wildcard}]
1054 [@option{-x}|@option{--discard-all}]
1055 [@option{-X}|@option{--discard-locals}]
1056 [@option{-b} @var{byte}|@option{--byte=}@var{byte}]
1057 [@option{-i} [@var{breadth}]|@option{--interleave}[=@var{breadth}]]
1058 [@option{--interleave-width=}@var{width}]
1059 [@option{-j} @var{sectionname}|@option{--only-section=}@var{sectionname}]
1060 [@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
1061 [@option{-p}|@option{--preserve-dates}]
1062 [@option{-D}|@option{--enable-deterministic-archives}]
1063 [@option{--debugging}]
1064 [@option{--gap-fill=}@var{val}]
1065 [@option{--pad-to=}@var{address}]
1066 [@option{--set-start=}@var{val}]
1067 [@option{--adjust-start=}@var{incr}]
1068 [@option{--change-addresses=}@var{incr}]
1069 [@option{--change-section-address} @var{section}@{=,+,-@}@var{val}]
1070 [@option{--change-section-lma} @var{section}@{=,+,-@}@var{val}]
1071 [@option{--change-section-vma} @var{section}@{=,+,-@}@var{val}]
1072 [@option{--change-warnings}] [@option{--no-change-warnings}]
1073 [@option{--set-section-flags} @var{section}=@var{flags}]
1074 [@option{--add-section} @var{sectionname}=@var{filename}]
1075 [@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
1076 [@option{--long-section-names} @{enable,disable,keep@}]
1077 [@option{--change-leading-char}] [@option{--remove-leading-char}]
1078 [@option{--reverse-bytes=}@var{num}]
1079 [@option{--srec-len=}@var{ival}] [@option{--srec-forceS3}]
1080 [@option{--redefine-sym} @var{old}=@var{new}]
1081 [@option{--redefine-syms=}@var{filename}]
1082 [@option{--weaken}]
1083 [@option{--keep-symbols=}@var{filename}]
1084 [@option{--strip-symbols=}@var{filename}]
1085 [@option{--strip-unneeded-symbols=}@var{filename}]
1086 [@option{--keep-global-symbols=}@var{filename}]
1087 [@option{--localize-symbols=}@var{filename}]
1088 [@option{--globalize-symbols=}@var{filename}]
1089 [@option{--weaken-symbols=}@var{filename}]
1090 [@option{--alt-machine-code=}@var{index}]
1091 [@option{--prefix-symbols=}@var{string}]
1092 [@option{--prefix-sections=}@var{string}]
1093 [@option{--prefix-alloc-sections=}@var{string}]
1094 [@option{--add-gnu-debuglink=}@var{path-to-file}]
1095 [@option{--keep-file-symbols}]
1096 [@option{--only-keep-debug}]
1097 [@option{--strip-dwo}]
1098 [@option{--extract-dwo}]
1099 [@option{--extract-symbol}]
1100 [@option{--writable-text}]
1101 [@option{--readonly-text}]
1102 [@option{--pure}]
1103 [@option{--impure}]
1104 [@option{--file-alignment=}@var{num}]
1105 [@option{--heap=}@var{size}]
1106 [@option{--image-base=}@var{address}]
1107 [@option{--section-alignment=}@var{num}]
1108 [@option{--stack=}@var{size}]
1109 [@option{--subsystem=}@var{which}:@var{major}.@var{minor}]
1110 [@option{--compress-debug-sections}]
1111 [@option{--decompress-debug-sections}]
1112 [@option{--dwarf-depth=@var{n}}]
1113 [@option{--dwarf-start=@var{n}}]
1114 [@option{-v}|@option{--verbose}]
1115 [@option{-V}|@option{--version}]
1116 [@option{--help}] [@option{--info}]
1117 @var{infile} [@var{outfile}]
1118 @c man end
1119 @end smallexample
1120
1121 @c man begin DESCRIPTION objcopy
1122 The @sc{gnu} @command{objcopy} utility copies the contents of an object
1123 file to another. @command{objcopy} uses the @sc{gnu} @sc{bfd} Library to
1124 read and write the object files. It can write the destination object
1125 file in a format different from that of the source object file. The
1126 exact behavior of @command{objcopy} is controlled by command-line options.
1127 Note that @command{objcopy} should be able to copy a fully linked file
1128 between any two formats. However, copying a relocatable object file
1129 between any two formats may not work as expected.
1130
1131 @command{objcopy} creates temporary files to do its translations and
1132 deletes them afterward. @command{objcopy} uses @sc{bfd} to do all its
1133 translation work; it has access to all the formats described in @sc{bfd}
1134 and thus is able to recognize most formats without being told
1135 explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
1136
1137 @command{objcopy} can be used to generate S-records by using an output
1138 target of @samp{srec} (e.g., use @samp{-O srec}).
1139
1140 @command{objcopy} can be used to generate a raw binary file by using an
1141 output target of @samp{binary} (e.g., use @option{-O binary}). When
1142 @command{objcopy} generates a raw binary file, it will essentially produce
1143 a memory dump of the contents of the input object file. All symbols and
1144 relocation information will be discarded. The memory dump will start at
1145 the load address of the lowest section copied into the output file.
1146
1147 When generating an S-record or a raw binary file, it may be helpful to
1148 use @option{-S} to remove sections containing debugging information. In
1149 some cases @option{-R} will be useful to remove sections which contain
1150 information that is not needed by the binary file.
1151
1152 Note---@command{objcopy} is not able to change the endianness of its input
1153 files. If the input format has an endianness (some formats do not),
1154 @command{objcopy} can only copy the inputs into file formats that have the
1155 same endianness or which have no endianness (e.g., @samp{srec}).
1156 (However, see the @option{--reverse-bytes} option.)
1157
1158 @c man end
1159
1160 @c man begin OPTIONS objcopy
1161
1162 @table @env
1163 @item @var{infile}
1164 @itemx @var{outfile}
1165 The input and output files, respectively.
1166 If you do not specify @var{outfile}, @command{objcopy} creates a
1167 temporary file and destructively renames the result with
1168 the name of @var{infile}.
1169
1170 @item -I @var{bfdname}
1171 @itemx --input-target=@var{bfdname}
1172 Consider the source file's object format to be @var{bfdname}, rather than
1173 attempting to deduce it. @xref{Target Selection}, for more information.
1174
1175 @item -O @var{bfdname}
1176 @itemx --output-target=@var{bfdname}
1177 Write the output file using the object format @var{bfdname}.
1178 @xref{Target Selection}, for more information.
1179
1180 @item -F @var{bfdname}
1181 @itemx --target=@var{bfdname}
1182 Use @var{bfdname} as the object format for both the input and the output
1183 file; i.e., simply transfer data from source to destination with no
1184 translation. @xref{Target Selection}, for more information.
1185
1186 @item -B @var{bfdarch}
1187 @itemx --binary-architecture=@var{bfdarch}
1188 Useful when transforming a architecture-less input file into an object file.
1189 In this case the output architecture can be set to @var{bfdarch}. This
1190 option will be ignored if the input file has a known @var{bfdarch}. You
1191 can access this binary data inside a program by referencing the special
1192 symbols that are created by the conversion process. These symbols are
1193 called _binary_@var{objfile}_start, _binary_@var{objfile}_end and
1194 _binary_@var{objfile}_size. e.g. you can transform a picture file into
1195 an object file and then access it in your code using these symbols.
1196
1197 @item -j @var{sectionname}
1198 @itemx --only-section=@var{sectionname}
1199 Copy only the named section from the input file to the output file.
1200 This option may be given more than once. Note that using this option
1201 inappropriately may make the output file unusable.
1202
1203 @item -R @var{sectionname}
1204 @itemx --remove-section=@var{sectionname}
1205 Remove any section named @var{sectionname} from the output file. This
1206 option may be given more than once. Note that using this option
1207 inappropriately may make the output file unusable.
1208
1209 @item -S
1210 @itemx --strip-all
1211 Do not copy relocation and symbol information from the source file.
1212
1213 @item -g
1214 @itemx --strip-debug
1215 Do not copy debugging symbols or sections from the source file.
1216
1217 @item --strip-unneeded
1218 Strip all symbols that are not needed for relocation processing.
1219
1220 @item -K @var{symbolname}
1221 @itemx --keep-symbol=@var{symbolname}
1222 When stripping symbols, keep symbol @var{symbolname} even if it would
1223 normally be stripped. This option may be given more than once.
1224
1225 @item -N @var{symbolname}
1226 @itemx --strip-symbol=@var{symbolname}
1227 Do not copy symbol @var{symbolname} from the source file. This option
1228 may be given more than once.
1229
1230 @item --strip-unneeded-symbol=@var{symbolname}
1231 Do not copy symbol @var{symbolname} from the source file unless it is needed
1232 by a relocation. This option may be given more than once.
1233
1234 @item -G @var{symbolname}
1235 @itemx --keep-global-symbol=@var{symbolname}
1236 Keep only symbol @var{symbolname} global. Make all other symbols local
1237 to the file, so that they are not visible externally. This option may
1238 be given more than once.
1239
1240 @item --localize-hidden
1241 In an ELF object, mark all symbols that have hidden or internal visibility
1242 as local. This option applies on top of symbol-specific localization options
1243 such as @option{-L}.
1244
1245 @item -L @var{symbolname}
1246 @itemx --localize-symbol=@var{symbolname}
1247 Make symbol @var{symbolname} local to the file, so that it is not
1248 visible externally. This option may be given more than once.
1249
1250 @item -W @var{symbolname}
1251 @itemx --weaken-symbol=@var{symbolname}
1252 Make symbol @var{symbolname} weak. This option may be given more than once.
1253
1254 @item --globalize-symbol=@var{symbolname}
1255 Give symbol @var{symbolname} global scoping so that it is visible
1256 outside of the file in which it is defined. This option may be given
1257 more than once.
1258
1259 @item -w
1260 @itemx --wildcard
1261 Permit regular expressions in @var{symbolname}s used in other command
1262 line options. The question mark (?), asterisk (*), backslash (\) and
1263 square brackets ([]) operators can be used anywhere in the symbol
1264 name. If the first character of the symbol name is the exclamation
1265 point (!) then the sense of the switch is reversed for that symbol.
1266 For example:
1267
1268 @smallexample
1269 -w -W !foo -W fo*
1270 @end smallexample
1271
1272 would cause objcopy to weaken all symbols that start with ``fo''
1273 except for the symbol ``foo''.
1274
1275 @item -x
1276 @itemx --discard-all
1277 Do not copy non-global symbols from the source file.
1278 @c FIXME any reason to prefer "non-global" to "local" here?
1279
1280 @item -X
1281 @itemx --discard-locals
1282 Do not copy compiler-generated local symbols.
1283 (These usually start with @samp{L} or @samp{.}.)
1284
1285 @item -b @var{byte}
1286 @itemx --byte=@var{byte}
1287 If interleaving has been enabled via the @option{--interleave} option
1288 then start the range of bytes to keep at the @var{byte}th byte.
1289 @var{byte} can be in the range from 0 to @var{breadth}-1, where
1290 @var{breadth} is the value given by the @option{--interleave} option.
1291
1292 @item -i [@var{breadth}]
1293 @itemx --interleave[=@var{breadth}]
1294 Only copy a range out of every @var{breadth} bytes. (Header data is
1295 not affected). Select which byte in the range begins the copy with
1296 the @option{--byte} option. Select the width of the range with the
1297 @option{--interleave-width} option.
1298
1299 This option is useful for creating files to program @sc{rom}. It is
1300 typically used with an @code{srec} output target. Note that
1301 @command{objcopy} will complain if you do not specify the
1302 @option{--byte} option as well.
1303
1304 The default interleave breadth is 4, so with @option{--byte} set to 0,
1305 @command{objcopy} would copy the first byte out of every four bytes
1306 from the input to the output.
1307
1308 @item --interleave-width=@var{width}
1309 When used with the @option{--interleave} option, copy @var{width}
1310 bytes at a time. The start of the range of bytes to be copied is set
1311 by the @option{--byte} option, and the extent of the range is set with
1312 the @option{--interleave} option.
1313
1314 The default value for this option is 1. The value of @var{width} plus
1315 the @var{byte} value set by the @option{--byte} option must not exceed
1316 the interleave breadth set by the @option{--interleave} option.
1317
1318 This option can be used to create images for two 16-bit flashes interleaved
1319 in a 32-bit bus by passing @option{-b 0 -i 4 --interleave-width=2}
1320 and @option{-b 2 -i 4 --interleave-width=2} to two @command{objcopy}
1321 commands. If the input was '12345678' then the outputs would be
1322 '1256' and '3478' respectively.
1323
1324 @item -p
1325 @itemx --preserve-dates
1326 Set the access and modification dates of the output file to be the same
1327 as those of the input file.
1328
1329 @item -D
1330 @itemx --enable-deterministic-archives
1331 Operate in @emph{deterministic} mode. When copying archive members
1332 and writing the archive index, use zero for UIDs, GIDs, timestamps,
1333 and use consistent file modes for all files.
1334
1335 @item --debugging
1336 Convert debugging information, if possible. This is not the default
1337 because only certain debugging formats are supported, and the
1338 conversion process can be time consuming.
1339
1340 @item --gap-fill @var{val}
1341 Fill gaps between sections with @var{val}. This operation applies to
1342 the @emph{load address} (LMA) of the sections. It is done by increasing
1343 the size of the section with the lower address, and filling in the extra
1344 space created with @var{val}.
1345
1346 @item --pad-to @var{address}
1347 Pad the output file up to the load address @var{address}. This is
1348 done by increasing the size of the last section. The extra space is
1349 filled in with the value specified by @option{--gap-fill} (default zero).
1350
1351 @item --set-start @var{val}
1352 Set the start address of the new file to @var{val}. Not all object file
1353 formats support setting the start address.
1354
1355 @item --change-start @var{incr}
1356 @itemx --adjust-start @var{incr}
1357 @cindex changing start address
1358 Change the start address by adding @var{incr}. Not all object file
1359 formats support setting the start address.
1360
1361 @item --change-addresses @var{incr}
1362 @itemx --adjust-vma @var{incr}
1363 @cindex changing object addresses
1364 Change the VMA and LMA addresses of all sections, as well as the start
1365 address, by adding @var{incr}. Some object file formats do not permit
1366 section addresses to be changed arbitrarily. Note that this does not
1367 relocate the sections; if the program expects sections to be loaded at a
1368 certain address, and this option is used to change the sections such
1369 that they are loaded at a different address, the program may fail.
1370
1371 @item --change-section-address @var{section}@{=,+,-@}@var{val}
1372 @itemx --adjust-section-vma @var{section}@{=,+,-@}@var{val}
1373 @cindex changing section address
1374 Set or change both the VMA address and the LMA address of the named
1375 @var{section}. If @samp{=} is used, the section address is set to
1376 @var{val}. Otherwise, @var{val} is added to or subtracted from the
1377 section address. See the comments under @option{--change-addresses},
1378 above. If @var{section} does not exist in the input file, a warning will
1379 be issued, unless @option{--no-change-warnings} is used.
1380
1381 @item --change-section-lma @var{section}@{=,+,-@}@var{val}
1382 @cindex changing section LMA
1383 Set or change the LMA address of the named @var{section}. The LMA
1384 address is the address where the section will be loaded into memory at
1385 program load time. Normally this is the same as the VMA address, which
1386 is the address of the section at program run time, but on some systems,
1387 especially those where a program is held in ROM, the two can be
1388 different. If @samp{=} is used, the section address is set to
1389 @var{val}. Otherwise, @var{val} is added to or subtracted from the
1390 section address. See the comments under @option{--change-addresses},
1391 above. If @var{section} does not exist in the input file, a warning
1392 will be issued, unless @option{--no-change-warnings} is used.
1393
1394 @item --change-section-vma @var{section}@{=,+,-@}@var{val}
1395 @cindex changing section VMA
1396 Set or change the VMA address of the named @var{section}. The VMA
1397 address is the address where the section will be located once the
1398 program has started executing. Normally this is the same as the LMA
1399 address, which is the address where the section will be loaded into
1400 memory, but on some systems, especially those where a program is held in
1401 ROM, the two can be different. If @samp{=} is used, the section address
1402 is set to @var{val}. Otherwise, @var{val} is added to or subtracted
1403 from the section address. See the comments under
1404 @option{--change-addresses}, above. If @var{section} does not exist in
1405 the input file, a warning will be issued, unless
1406 @option{--no-change-warnings} is used.
1407
1408 @item --change-warnings
1409 @itemx --adjust-warnings
1410 If @option{--change-section-address} or @option{--change-section-lma} or
1411 @option{--change-section-vma} is used, and the named section does not
1412 exist, issue a warning. This is the default.
1413
1414 @item --no-change-warnings
1415 @itemx --no-adjust-warnings
1416 Do not issue a warning if @option{--change-section-address} or
1417 @option{--adjust-section-lma} or @option{--adjust-section-vma} is used, even
1418 if the named section does not exist.
1419
1420 @item --set-section-flags @var{section}=@var{flags}
1421 Set the flags for the named section. The @var{flags} argument is a
1422 comma separated string of flag names. The recognized names are
1423 @samp{alloc}, @samp{contents}, @samp{load}, @samp{noload},
1424 @samp{readonly}, @samp{code}, @samp{data}, @samp{rom}, @samp{share}, and
1425 @samp{debug}. You can set the @samp{contents} flag for a section which
1426 does not have contents, but it is not meaningful to clear the
1427 @samp{contents} flag of a section which does have contents--just remove
1428 the section instead. Not all flags are meaningful for all object file
1429 formats.
1430
1431 @item --add-section @var{sectionname}=@var{filename}
1432 Add a new section named @var{sectionname} while copying the file. The
1433 contents of the new section are taken from the file @var{filename}. The
1434 size of the section will be the size of the file. This option only
1435 works on file formats which can support sections with arbitrary names.
1436
1437 @item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
1438 Rename a section from @var{oldname} to @var{newname}, optionally
1439 changing the section's flags to @var{flags} in the process. This has
1440 the advantage over usng a linker script to perform the rename in that
1441 the output stays as an object file and does not become a linked
1442 executable.
1443
1444 This option is particularly helpful when the input format is binary,
1445 since this will always create a section called .data. If for example,
1446 you wanted instead to create a section called .rodata containing binary
1447 data you could use the following command line to achieve it:
1448
1449 @smallexample
1450 objcopy -I binary -O <output_format> -B <architecture> \
1451 --rename-section .data=.rodata,alloc,load,readonly,data,contents \
1452 <input_binary_file> <output_object_file>
1453 @end smallexample
1454
1455 @item --long-section-names @{enable,disable,keep@}
1456 Controls the handling of long section names when processing @code{COFF}
1457 and @code{PE-COFF} object formats. The default behaviour, @samp{keep},
1458 is to preserve long section names if any are present in the input file.
1459 The @samp{enable} and @samp{disable} options forcibly enable or disable
1460 the use of long section names in the output object; when @samp{disable}
1461 is in effect, any long section names in the input object will be truncated.
1462 The @samp{enable} option will only emit long section names if any are
1463 present in the inputs; this is mostly the same as @samp{keep}, but it
1464 is left undefined whether the @samp{enable} option might force the
1465 creation of an empty string table in the output file.
1466
1467 @item --change-leading-char
1468 Some object file formats use special characters at the start of
1469 symbols. The most common such character is underscore, which compilers
1470 often add before every symbol. This option tells @command{objcopy} to
1471 change the leading character of every symbol when it converts between
1472 object file formats. If the object file formats use the same leading
1473 character, this option has no effect. Otherwise, it will add a
1474 character, or remove a character, or change a character, as
1475 appropriate.
1476
1477 @item --remove-leading-char
1478 If the first character of a global symbol is a special symbol leading
1479 character used by the object file format, remove the character. The
1480 most common symbol leading character is underscore. This option will
1481 remove a leading underscore from all global symbols. This can be useful
1482 if you want to link together objects of different file formats with
1483 different conventions for symbol names. This is different from
1484 @option{--change-leading-char} because it always changes the symbol name
1485 when appropriate, regardless of the object file format of the output
1486 file.
1487
1488 @item --reverse-bytes=@var{num}
1489 Reverse the bytes in a section with output contents. A section length must
1490 be evenly divisible by the value given in order for the swap to be able to
1491 take place. Reversing takes place before the interleaving is performed.
1492
1493 This option is used typically in generating ROM images for problematic
1494 target systems. For example, on some target boards, the 32-bit words
1495 fetched from 8-bit ROMs are re-assembled in little-endian byte order
1496 regardless of the CPU byte order. Depending on the programming model, the
1497 endianness of the ROM may need to be modified.
1498
1499 Consider a simple file with a section containing the following eight
1500 bytes: @code{12345678}.
1501
1502 Using @samp{--reverse-bytes=2} for the above example, the bytes in the
1503 output file would be ordered @code{21436587}.
1504
1505 Using @samp{--reverse-bytes=4} for the above example, the bytes in the
1506 output file would be ordered @code{43218765}.
1507
1508 By using @samp{--reverse-bytes=2} for the above example, followed by
1509 @samp{--reverse-bytes=4} on the output file, the bytes in the second
1510 output file would be ordered @code{34127856}.
1511
1512 @item --srec-len=@var{ival}
1513 Meaningful only for srec output. Set the maximum length of the Srecords
1514 being produced to @var{ival}. This length covers both address, data and
1515 crc fields.
1516
1517 @item --srec-forceS3
1518 Meaningful only for srec output. Avoid generation of S1/S2 records,
1519 creating S3-only record format.
1520
1521 @item --redefine-sym @var{old}=@var{new}
1522 Change the name of a symbol @var{old}, to @var{new}. This can be useful
1523 when one is trying link two things together for which you have no
1524 source, and there are name collisions.
1525
1526 @item --redefine-syms=@var{filename}
1527 Apply @option{--redefine-sym} to each symbol pair "@var{old} @var{new}"
1528 listed in the file @var{filename}. @var{filename} is simply a flat file,
1529 with one symbol pair per line. Line comments may be introduced by the hash
1530 character. This option may be given more than once.
1531
1532 @item --weaken
1533 Change all global symbols in the file to be weak. This can be useful
1534 when building an object which will be linked against other objects using
1535 the @option{-R} option to the linker. This option is only effective when
1536 using an object file format which supports weak symbols.
1537
1538 @item --keep-symbols=@var{filename}
1539 Apply @option{--keep-symbol} option to each symbol listed in the file
1540 @var{filename}. @var{filename} is simply a flat file, with one symbol
1541 name per line. Line comments may be introduced by the hash character.
1542 This option may be given more than once.
1543
1544 @item --strip-symbols=@var{filename}
1545 Apply @option{--strip-symbol} option to each symbol listed in the file
1546 @var{filename}. @var{filename} is simply a flat file, with one symbol
1547 name per line. Line comments may be introduced by the hash character.
1548 This option may be given more than once.
1549
1550 @item --strip-unneeded-symbols=@var{filename}
1551 Apply @option{--strip-unneeded-symbol} option to each symbol listed in
1552 the file @var{filename}. @var{filename} is simply a flat file, with one
1553 symbol name per line. Line comments may be introduced by the hash
1554 character. This option may be given more than once.
1555
1556 @item --keep-global-symbols=@var{filename}
1557 Apply @option{--keep-global-symbol} option to each symbol listed in the
1558 file @var{filename}. @var{filename} is simply a flat file, with one
1559 symbol name per line. Line comments may be introduced by the hash
1560 character. This option may be given more than once.
1561
1562 @item --localize-symbols=@var{filename}
1563 Apply @option{--localize-symbol} option to each symbol listed in the file
1564 @var{filename}. @var{filename} is simply a flat file, with one symbol
1565 name per line. Line comments may be introduced by the hash character.
1566 This option may be given more than once.
1567
1568 @item --globalize-symbols=@var{filename}
1569 Apply @option{--globalize-symbol} option to each symbol listed in the file
1570 @var{filename}. @var{filename} is simply a flat file, with one symbol
1571 name per line. Line comments may be introduced by the hash character.
1572 This option may be given more than once.
1573
1574 @item --weaken-symbols=@var{filename}
1575 Apply @option{--weaken-symbol} option to each symbol listed in the file
1576 @var{filename}. @var{filename} is simply a flat file, with one symbol
1577 name per line. Line comments may be introduced by the hash character.
1578 This option may be given more than once.
1579
1580 @item --alt-machine-code=@var{index}
1581 If the output architecture has alternate machine codes, use the
1582 @var{index}th code instead of the default one. This is useful in case
1583 a machine is assigned an official code and the tool-chain adopts the
1584 new code, but other applications still depend on the original code
1585 being used. For ELF based architectures if the @var{index}
1586 alternative does not exist then the value is treated as an absolute
1587 number to be stored in the e_machine field of the ELF header.
1588
1589 @item --writable-text
1590 Mark the output text as writable. This option isn't meaningful for all
1591 object file formats.
1592
1593 @item --readonly-text
1594 Make the output text write protected. This option isn't meaningful for all
1595 object file formats.
1596
1597 @item --pure
1598 Mark the output file as demand paged. This option isn't meaningful for all
1599 object file formats.
1600
1601 @item --impure
1602 Mark the output file as impure. This option isn't meaningful for all
1603 object file formats.
1604
1605 @item --prefix-symbols=@var{string}
1606 Prefix all symbols in the output file with @var{string}.
1607
1608 @item --prefix-sections=@var{string}
1609 Prefix all section names in the output file with @var{string}.
1610
1611 @item --prefix-alloc-sections=@var{string}
1612 Prefix all the names of all allocated sections in the output file with
1613 @var{string}.
1614
1615 @item --add-gnu-debuglink=@var{path-to-file}
1616 Creates a .gnu_debuglink section which contains a reference to @var{path-to-file}
1617 and adds it to the output file.
1618
1619 @item --keep-file-symbols
1620 When stripping a file, perhaps with @option{--strip-debug} or
1621 @option{--strip-unneeded}, retain any symbols specifying source file names,
1622 which would otherwise get stripped.
1623
1624 @item --only-keep-debug
1625 Strip a file, removing contents of any sections that would not be
1626 stripped by @option{--strip-debug} and leaving the debugging sections
1627 intact. In ELF files, this preserves all note sections in the output.
1628
1629 The intention is that this option will be used in conjunction with
1630 @option{--add-gnu-debuglink} to create a two part executable. One a
1631 stripped binary which will occupy less space in RAM and in a
1632 distribution and the second a debugging information file which is only
1633 needed if debugging abilities are required. The suggested procedure
1634 to create these files is as follows:
1635
1636 @enumerate
1637 @item Link the executable as normal. Assuming that is is called
1638 @code{foo} then...
1639 @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
1640 create a file containing the debugging info.
1641 @item Run @code{objcopy --strip-debug foo} to create a
1642 stripped executable.
1643 @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
1644 to add a link to the debugging info into the stripped executable.
1645 @end enumerate
1646
1647 Note---the choice of @code{.dbg} as an extension for the debug info
1648 file is arbitrary. Also the @code{--only-keep-debug} step is
1649 optional. You could instead do this:
1650
1651 @enumerate
1652 @item Link the executable as normal.
1653 @item Copy @code{foo} to @code{foo.full}
1654 @item Run @code{objcopy --strip-debug foo}
1655 @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
1656 @end enumerate
1657
1658 i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
1659 full executable. It does not have to be a file created by the
1660 @option{--only-keep-debug} switch.
1661
1662 Note---this switch is only intended for use on fully linked files. It
1663 does not make sense to use it on object files where the debugging
1664 information may be incomplete. Besides the gnu_debuglink feature
1665 currently only supports the presence of one filename containing
1666 debugging information, not multiple filenames on a one-per-object-file
1667 basis.
1668
1669 @item --strip-dwo
1670 Remove the contents of all DWARF .dwo sections, leaving the
1671 remaining debugging sections and all symbols intact.
1672 This option is intended for use by the compiler as part of
1673 the @option{-gsplit-dwarf} option, which splits debug information
1674 between the .o file and a separate .dwo file. The compiler
1675 generates all debug information in the same file, then uses
1676 the @option{--extract-dwo} option to copy the .dwo sections to
1677 the .dwo file, then the @option{--strip-dwo} option to remove
1678 those sections from the original .o file.
1679
1680 @item --extract-dwo
1681 Extract the contents of all DWARF .dwo sections. See the
1682 @option{--strip-dwo} option for more information.
1683
1684 @item --file-alignment @var{num}
1685 Specify the file alignment. Sections in the file will always begin at
1686 file offsets which are multiples of this number. This defaults to
1687 512.
1688 [This option is specific to PE targets.]
1689
1690 @item --heap @var{reserve}
1691 @itemx --heap @var{reserve},@var{commit}
1692 Specify the number of bytes of memory to reserve (and optionally commit)
1693 to be used as heap for this program.
1694 [This option is specific to PE targets.]
1695
1696 @item --image-base @var{value}
1697 Use @var{value} as the base address of your program or dll. This is
1698 the lowest memory location that will be used when your program or dll
1699 is loaded. To reduce the need to relocate and improve performance of
1700 your dlls, each should have a unique base address and not overlap any
1701 other dlls. The default is 0x400000 for executables, and 0x10000000
1702 for dlls.
1703 [This option is specific to PE targets.]
1704
1705 @item --section-alignment @var{num}
1706 Sets the section alignment. Sections in memory will always begin at
1707 addresses which are a multiple of this number. Defaults to 0x1000.
1708 [This option is specific to PE targets.]
1709
1710 @item --stack @var{reserve}
1711 @itemx --stack @var{reserve},@var{commit}
1712 Specify the number of bytes of memory to reserve (and optionally commit)
1713 to be used as stack for this program.
1714 [This option is specific to PE targets.]
1715
1716 @item --subsystem @var{which}
1717 @itemx --subsystem @var{which}:@var{major}
1718 @itemx --subsystem @var{which}:@var{major}.@var{minor}
1719 Specifies the subsystem under which your program will execute. The
1720 legal values for @var{which} are @code{native}, @code{windows},
1721 @code{console}, @code{posix}, @code{efi-app}, @code{efi-bsd},
1722 @code{efi-rtd}, @code{sal-rtd}, and @code{xbox}. You may optionally set
1723 the subsystem version also. Numeric values are also accepted for
1724 @var{which}.
1725 [This option is specific to PE targets.]
1726
1727 @item --extract-symbol
1728 Keep the file's section flags and symbols but remove all section data.
1729 Specifically, the option:
1730
1731 @itemize
1732 @item removes the contents of all sections;
1733 @item sets the size of every section to zero; and
1734 @item sets the file's start address to zero.
1735 @end itemize
1736
1737 This option is used to build a @file{.sym} file for a VxWorks kernel.
1738 It can also be a useful way of reducing the size of a @option{--just-symbols}
1739 linker input file.
1740
1741 @item --compress-debug-sections
1742 Compress DWARF debug sections using zlib.
1743
1744 @item --decompress-debug-sections
1745 Decompress DWARF debug sections using zlib.
1746
1747 @item -V
1748 @itemx --version
1749 Show the version number of @command{objcopy}.
1750
1751 @item -v
1752 @itemx --verbose
1753 Verbose output: list all object files modified. In the case of
1754 archives, @samp{objcopy -V} lists all members of the archive.
1755
1756 @item --help
1757 Show a summary of the options to @command{objcopy}.
1758
1759 @item --info
1760 Display a list showing all architectures and object formats available.
1761 @end table
1762
1763 @c man end
1764
1765 @ignore
1766 @c man begin SEEALSO objcopy
1767 ld(1), objdump(1), and the Info entries for @file{binutils}.
1768 @c man end
1769 @end ignore
1770
1771 @node objdump
1772 @chapter objdump
1773
1774 @cindex object file information
1775 @kindex objdump
1776
1777 @c man title objdump display information from object files.
1778
1779 @smallexample
1780 @c man begin SYNOPSIS objdump
1781 objdump [@option{-a}|@option{--archive-headers}]
1782 [@option{-b} @var{bfdname}|@option{--target=@var{bfdname}}]
1783 [@option{-C}|@option{--demangle}[=@var{style}] ]
1784 [@option{-d}|@option{--disassemble}]
1785 [@option{-D}|@option{--disassemble-all}]
1786 [@option{-z}|@option{--disassemble-zeroes}]
1787 [@option{-EB}|@option{-EL}|@option{--endian=}@{big | little @}]
1788 [@option{-f}|@option{--file-headers}]
1789 [@option{-F}|@option{--file-offsets}]
1790 [@option{--file-start-context}]
1791 [@option{-g}|@option{--debugging}]
1792 [@option{-e}|@option{--debugging-tags}]
1793 [@option{-h}|@option{--section-headers}|@option{--headers}]
1794 [@option{-i}|@option{--info}]
1795 [@option{-j} @var{section}|@option{--section=}@var{section}]
1796 [@option{-l}|@option{--line-numbers}]
1797 [@option{-S}|@option{--source}]
1798 [@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
1799 [@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
1800 [@option{-p}|@option{--private-headers}]
1801 [@option{-P} @var{options}|@option{--private=}@var{options}]
1802 [@option{-r}|@option{--reloc}]
1803 [@option{-R}|@option{--dynamic-reloc}]
1804 [@option{-s}|@option{--full-contents}]
1805 [@option{-W[lLiaprmfFsoRt]}|
1806 @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
1807 [@option{-G}|@option{--stabs}]
1808 [@option{-t}|@option{--syms}]
1809 [@option{-T}|@option{--dynamic-syms}]
1810 [@option{-x}|@option{--all-headers}]
1811 [@option{-w}|@option{--wide}]
1812 [@option{--start-address=}@var{address}]
1813 [@option{--stop-address=}@var{address}]
1814 [@option{--prefix-addresses}]
1815 [@option{--[no-]show-raw-insn}]
1816 [@option{--adjust-vma=}@var{offset}]
1817 [@option{--special-syms}]
1818 [@option{--prefix=}@var{prefix}]
1819 [@option{--prefix-strip=}@var{level}]
1820 [@option{--insn-width=}@var{width}]
1821 [@option{-V}|@option{--version}]
1822 [@option{-H}|@option{--help}]
1823 @var{objfile}@dots{}
1824 @c man end
1825 @end smallexample
1826
1827 @c man begin DESCRIPTION objdump
1828
1829 @command{objdump} displays information about one or more object files.
1830 The options control what particular information to display. This
1831 information is mostly useful to programmers who are working on the
1832 compilation tools, as opposed to programmers who just want their
1833 program to compile and work.
1834
1835 @var{objfile}@dots{} are the object files to be examined. When you
1836 specify archives, @command{objdump} shows information on each of the member
1837 object files.
1838
1839 @c man end
1840
1841 @c man begin OPTIONS objdump
1842
1843 The long and short forms of options, shown here as alternatives, are
1844 equivalent. At least one option from the list
1845 @option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-P,-r,-R,-s,-S,-t,-T,-V,-x} must be given.
1846
1847 @table @env
1848 @item -a
1849 @itemx --archive-header
1850 @cindex archive headers
1851 If any of the @var{objfile} files are archives, display the archive
1852 header information (in a format similar to @samp{ls -l}). Besides the
1853 information you could list with @samp{ar tv}, @samp{objdump -a} shows
1854 the object file format of each archive member.
1855
1856 @item --adjust-vma=@var{offset}
1857 @cindex section addresses in objdump
1858 @cindex VMA in objdump
1859 When dumping information, first add @var{offset} to all the section
1860 addresses. This is useful if the section addresses do not correspond to
1861 the symbol table, which can happen when putting sections at particular
1862 addresses when using a format which can not represent section addresses,
1863 such as a.out.
1864
1865 @item -b @var{bfdname}
1866 @itemx --target=@var{bfdname}
1867 @cindex object code format
1868 Specify that the object-code format for the object files is
1869 @var{bfdname}. This option may not be necessary; @var{objdump} can
1870 automatically recognize many formats.
1871
1872 For example,
1873 @example
1874 objdump -b oasys -m vax -h fu.o
1875 @end example
1876 @noindent
1877 displays summary information from the section headers (@option{-h}) of
1878 @file{fu.o}, which is explicitly identified (@option{-m}) as a VAX object
1879 file in the format produced by Oasys compilers. You can list the
1880 formats available with the @option{-i} option.
1881 @xref{Target Selection}, for more information.
1882
1883 @item -C
1884 @itemx --demangle[=@var{style}]
1885 @cindex demangling in objdump
1886 Decode (@dfn{demangle}) low-level symbol names into user-level names.
1887 Besides removing any initial underscore prepended by the system, this
1888 makes C++ function names readable. Different compilers have different
1889 mangling styles. The optional demangling style argument can be used to
1890 choose an appropriate demangling style for your compiler. @xref{c++filt},
1891 for more information on demangling.
1892
1893 @item -g
1894 @itemx --debugging
1895 Display debugging information. This attempts to parse STABS and IEEE
1896 debugging format information stored in the file and print it out using
1897 a C like syntax. If neither of these formats are found this option
1898 falls back on the @option{-W} option to print any DWARF information in
1899 the file.
1900
1901 @item -e
1902 @itemx --debugging-tags
1903 Like @option{-g}, but the information is generated in a format compatible
1904 with ctags tool.
1905
1906 @item -d
1907 @itemx --disassemble
1908 @cindex disassembling object code
1909 @cindex machine instructions
1910 Display the assembler mnemonics for the machine instructions from
1911 @var{objfile}. This option only disassembles those sections which are
1912 expected to contain instructions.
1913
1914 @item -D
1915 @itemx --disassemble-all
1916 Like @option{-d}, but disassemble the contents of all sections, not just
1917 those expected to contain instructions.
1918
1919 If the target is an ARM architecture this switch also has the effect
1920 of forcing the disassembler to decode pieces of data found in code
1921 sections as if they were instructions.
1922
1923 @item --prefix-addresses
1924 When disassembling, print the complete address on each line. This is
1925 the older disassembly format.
1926
1927 @item -EB
1928 @itemx -EL
1929 @itemx --endian=@{big|little@}
1930 @cindex endianness
1931 @cindex disassembly endianness
1932 Specify the endianness of the object files. This only affects
1933 disassembly. This can be useful when disassembling a file format which
1934 does not describe endianness information, such as S-records.
1935
1936 @item -f
1937 @itemx --file-headers
1938 @cindex object file header
1939 Display summary information from the overall header of
1940 each of the @var{objfile} files.
1941
1942 @item -F
1943 @itemx --file-offsets
1944 @cindex object file offsets
1945 When disassembling sections, whenever a symbol is displayed, also
1946 display the file offset of the region of data that is about to be
1947 dumped. If zeroes are being skipped, then when disassembly resumes,
1948 tell the user how many zeroes were skipped and the file offset of the
1949 location from where the disassembly resumes. When dumping sections,
1950 display the file offset of the location from where the dump starts.
1951
1952 @item --file-start-context
1953 @cindex source code context
1954 Specify that when displaying interlisted source code/disassembly
1955 (assumes @option{-S}) from a file that has not yet been displayed, extend the
1956 context to the start of the file.
1957
1958 @item -h
1959 @itemx --section-headers
1960 @itemx --headers
1961 @cindex section headers
1962 Display summary information from the section headers of the
1963 object file.
1964
1965 File segments may be relocated to nonstandard addresses, for example by
1966 using the @option{-Ttext}, @option{-Tdata}, or @option{-Tbss} options to
1967 @command{ld}. However, some object file formats, such as a.out, do not
1968 store the starting address of the file segments. In those situations,
1969 although @command{ld} relocates the sections correctly, using @samp{objdump
1970 -h} to list the file section headers cannot show the correct addresses.
1971 Instead, it shows the usual addresses, which are implicit for the
1972 target.
1973
1974 @item -H
1975 @itemx --help
1976 Print a summary of the options to @command{objdump} and exit.
1977
1978 @item -i
1979 @itemx --info
1980 @cindex architectures available
1981 @cindex object formats available
1982 Display a list showing all architectures and object formats available
1983 for specification with @option{-b} or @option{-m}.
1984
1985 @item -j @var{name}
1986 @itemx --section=@var{name}
1987 @cindex section information
1988 Display information only for section @var{name}.
1989
1990 @item -l
1991 @itemx --line-numbers
1992 @cindex source filenames for object files
1993 Label the display (using debugging information) with the filename and
1994 source line numbers corresponding to the object code or relocs shown.
1995 Only useful with @option{-d}, @option{-D}, or @option{-r}.
1996
1997 @item -m @var{machine}
1998 @itemx --architecture=@var{machine}
1999 @cindex architecture
2000 @cindex disassembly architecture
2001 Specify the architecture to use when disassembling object files. This
2002 can be useful when disassembling object files which do not describe
2003 architecture information, such as S-records. You can list the available
2004 architectures with the @option{-i} option.
2005
2006 If the target is an ARM architecture then this switch has an
2007 additional effect. It restricts the disassembly to only those
2008 instructions supported by the architecture specified by @var{machine}.
2009 If it is necessary to use this switch because the input file does not
2010 contain any architecture information, but it is also desired to
2011 disassemble all the instructions use @option{-marm}.
2012
2013 @item -M @var{options}
2014 @itemx --disassembler-options=@var{options}
2015 Pass target specific information to the disassembler. Only supported on
2016 some targets. If it is necessary to specify more than one
2017 disassembler option then multiple @option{-M} options can be used or
2018 can be placed together into a comma separated list.
2019
2020 If the target is an ARM architecture then this switch can be used to
2021 select which register name set is used during disassembler. Specifying
2022 @option{-M reg-names-std} (the default) will select the register names as
2023 used in ARM's instruction set documentation, but with register 13 called
2024 'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying
2025 @option{-M reg-names-apcs} will select the name set used by the ARM
2026 Procedure Call Standard, whilst specifying @option{-M reg-names-raw} will
2027 just use @samp{r} followed by the register number.
2028
2029 There are also two variants on the APCS register naming scheme enabled
2030 by @option{-M reg-names-atpcs} and @option{-M reg-names-special-atpcs} which
2031 use the ARM/Thumb Procedure Call Standard naming conventions. (Either
2032 with the normal register names or the special register names).
2033
2034 This option can also be used for ARM architectures to force the
2035 disassembler to interpret all instructions as Thumb instructions by
2036 using the switch @option{--disassembler-options=force-thumb}. This can be
2037 useful when attempting to disassemble thumb code produced by other
2038 compilers.
2039
2040 For the x86, some of the options duplicate functions of the @option{-m}
2041 switch, but allow finer grained control. Multiple selections from the
2042 following may be specified as a comma separated string.
2043 @option{x86-64}, @option{i386} and @option{i8086} select disassembly for
2044 the given architecture. @option{intel} and @option{att} select between
2045 intel syntax mode and AT&T syntax mode.
2046 @option{intel-mnemonic} and @option{att-mnemonic} select between
2047 intel mnemonic mode and AT&T mnemonic mode. @option{intel-mnemonic}
2048 implies @option{intel} and @option{att-mnemonic} implies @option{att}.
2049 @option{addr64}, @option{addr32},
2050 @option{addr16}, @option{data32} and @option{data16} specify the default
2051 address size and operand size. These four options will be overridden if
2052 @option{x86-64}, @option{i386} or @option{i8086} appear later in the
2053 option string. Lastly, @option{suffix}, when in AT&T mode,
2054 instructs the disassembler to print a mnemonic suffix even when the
2055 suffix could be inferred by the operands.
2056
2057 For PowerPC, @option{booke} controls the disassembly of BookE
2058 instructions. @option{32} and @option{64} select PowerPC and
2059 PowerPC64 disassembly, respectively. @option{e300} selects
2060 disassembly for the e300 family. @option{440} selects disassembly for
2061 the PowerPC 440. @option{ppcps} selects disassembly for the paired
2062 single instructions of the PPC750CL.
2063
2064 For MIPS, this option controls the printing of instruction mnemonic
2065 names and register names in disassembled instructions. Multiple
2066 selections from the following may be specified as a comma separated
2067 string, and invalid options are ignored:
2068
2069 @table @code
2070 @item no-aliases
2071 Print the 'raw' instruction mnemonic instead of some pseudo
2072 instruction mnemonic. I.e., print 'daddu' or 'or' instead of 'move',
2073 'sll' instead of 'nop', etc.
2074
2075 @item gpr-names=@var{ABI}
2076 Print GPR (general-purpose register) names as appropriate
2077 for the specified ABI. By default, GPR names are selected according to
2078 the ABI of the binary being disassembled.
2079
2080 @item fpr-names=@var{ABI}
2081 Print FPR (floating-point register) names as
2082 appropriate for the specified ABI. By default, FPR numbers are printed
2083 rather than names.
2084
2085 @item cp0-names=@var{ARCH}
2086 Print CP0 (system control coprocessor; coprocessor 0) register names
2087 as appropriate for the CPU or architecture specified by
2088 @var{ARCH}. By default, CP0 register names are selected according to
2089 the architecture and CPU of the binary being disassembled.
2090
2091 @item hwr-names=@var{ARCH}
2092 Print HWR (hardware register, used by the @code{rdhwr} instruction) names
2093 as appropriate for the CPU or architecture specified by
2094 @var{ARCH}. By default, HWR names are selected according to
2095 the architecture and CPU of the binary being disassembled.
2096
2097 @item reg-names=@var{ABI}
2098 Print GPR and FPR names as appropriate for the selected ABI.
2099
2100 @item reg-names=@var{ARCH}
2101 Print CPU-specific register names (CP0 register and HWR names)
2102 as appropriate for the selected CPU or architecture.
2103 @end table
2104
2105 For any of the options listed above, @var{ABI} or
2106 @var{ARCH} may be specified as @samp{numeric} to have numbers printed
2107 rather than names, for the selected types of registers.
2108 You can list the available values of @var{ABI} and @var{ARCH} using
2109 the @option{--help} option.
2110
2111 For VAX, you can specify function entry addresses with @option{-M
2112 entry:0xf00ba}. You can use this multiple times to properly
2113 disassemble VAX binary files that don't contain symbol tables (like
2114 ROM dumps). In these cases, the function entry mask would otherwise
2115 be decoded as VAX instructions, which would probably lead the rest
2116 of the function being wrongly disassembled.
2117
2118 @item -p
2119 @itemx --private-headers
2120 Print information that is specific to the object file format. The exact
2121 information printed depends upon the object file format. For some
2122 object file formats, no additional information is printed.
2123
2124 @item -P @var{options}
2125 @itemx --private=@var{options}
2126 Print information that is specific to the object file format. The
2127 argument @var{options} is a comma separated list that depends on the
2128 format (the lists of options is displayed with the help).
2129
2130 For XCOFF, the available options are: @option{header}, @option{aout},
2131 @option{sections}, @option{syms}, @option{relocs}, @option{lineno},
2132 @option{loader}, @option{except}, @option{typchk}, @option{traceback}
2133 and @option{toc}.
2134
2135 @item -r
2136 @itemx --reloc
2137 @cindex relocation entries, in object file
2138 Print the relocation entries of the file. If used with @option{-d} or
2139 @option{-D}, the relocations are printed interspersed with the
2140 disassembly.
2141
2142 @item -R
2143 @itemx --dynamic-reloc
2144 @cindex dynamic relocation entries, in object file
2145 Print the dynamic relocation entries of the file. This is only
2146 meaningful for dynamic objects, such as certain types of shared
2147 libraries. As for @option{-r}, if used with @option{-d} or
2148 @option{-D}, the relocations are printed interspersed with the
2149 disassembly.
2150
2151 @item -s
2152 @itemx --full-contents
2153 @cindex sections, full contents
2154 @cindex object file sections
2155 Display the full contents of any sections requested. By default all
2156 non-empty sections are displayed.
2157
2158 @item -S
2159 @itemx --source
2160 @cindex source disassembly
2161 @cindex disassembly, with source
2162 Display source code intermixed with disassembly, if possible. Implies
2163 @option{-d}.
2164
2165 @item --prefix=@var{prefix}
2166 @cindex Add prefix to absolute paths
2167 Specify @var{prefix} to add to the absolute paths when used with
2168 @option{-S}.
2169
2170 @item --prefix-strip=@var{level}
2171 @cindex Strip absolute paths
2172 Indicate how many initial directory names to strip off the hardwired
2173 absolute paths. It has no effect without @option{--prefix=}@var{prefix}.
2174
2175 @item --show-raw-insn
2176 When disassembling instructions, print the instruction in hex as well as
2177 in symbolic form. This is the default except when
2178 @option{--prefix-addresses} is used.
2179
2180 @item --no-show-raw-insn
2181 When disassembling instructions, do not print the instruction bytes.
2182 This is the default when @option{--prefix-addresses} is used.
2183
2184 @item --insn-width=@var{width}
2185 @cindex Instruction width
2186 Display @var{width} bytes on a single line when disassembling
2187 instructions.
2188
2189 @item -W[lLiaprmfFsoRt]
2190 @itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]
2191 @cindex DWARF
2192 @cindex debug symbols
2193 Displays the contents of the debug sections in the file, if any are
2194 present. If one of the optional letters or words follows the switch
2195 then only data found in those specific sections will be dumped.
2196
2197 Note that there is no single letter option to display the content of
2198 trace sections or .gdb_index.
2199
2200 Note: the output from the @option{=info} option can also be affected
2201 by the options @option{--dwarf-depth}, the @option{--dwarf-start} and
2202 the @option{--dwarf-check}.
2203
2204 @item --dwarf-depth=@var{n}
2205 Limit the dump of the @code{.debug_info} section to @var{n} children.
2206 This is only useful with @option{--dwarf=info}. The default is
2207 to print all DIEs; the special value 0 for @var{n} will also have this
2208 effect.
2209
2210 With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
2211 levels will not be printed. The range for @var{n} is zero-based.
2212
2213 @item --dwarf-start=@var{n}
2214 Print only DIEs beginning with the DIE numbered @var{n}. This is only
2215 useful with @option{--dwarf=info}.
2216
2217 If specified, this option will suppress printing of any header
2218 information and all DIEs before the DIE numbered @var{n}. Only
2219 siblings and children of the specified DIE will be printed.
2220
2221 This can be used in conjunction with @option{--dwarf-depth}.
2222
2223 @item --dwarf-check
2224 Enable additional checks for consistency of Dwarf information.
2225
2226 @item -G
2227 @itemx --stabs
2228 @cindex stab
2229 @cindex .stab
2230 @cindex debug symbols
2231 @cindex ELF object file format
2232 Display the full contents of any sections requested. Display the
2233 contents of the .stab and .stab.index and .stab.excl sections from an
2234 ELF file. This is only useful on systems (such as Solaris 2.0) in which
2235 @code{.stab} debugging symbol-table entries are carried in an ELF
2236 section. In most other file formats, debugging symbol-table entries are
2237 interleaved with linkage symbols, and are visible in the @option{--syms}
2238 output.
2239 @ifclear man
2240 For more information on stabs symbols, see @ref{Top,Stabs,Stabs
2241 Overview,stabs.info, The ``stabs'' debug format}.
2242 @end ifclear
2243
2244 @item --start-address=@var{address}
2245 @cindex start-address
2246 Start displaying data at the specified address. This affects the output
2247 of the @option{-d}, @option{-r} and @option{-s} options.
2248
2249 @item --stop-address=@var{address}
2250 @cindex stop-address
2251 Stop displaying data at the specified address. This affects the output
2252 of the @option{-d}, @option{-r} and @option{-s} options.
2253
2254 @item -t
2255 @itemx --syms
2256 @cindex symbol table entries, printing
2257 Print the symbol table entries of the file.
2258 This is similar to the information provided by the @samp{nm} program,
2259 although the display format is different. The format of the output
2260 depends upon the format of the file being dumped, but there are two main
2261 types. One looks like this:
2262
2263 @smallexample
2264 [ 4](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
2265 [ 6](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 fred
2266 @end smallexample
2267
2268 where the number inside the square brackets is the number of the entry
2269 in the symbol table, the @var{sec} number is the section number, the
2270 @var{fl} value are the symbol's flag bits, the @var{ty} number is the
2271 symbol's type, the @var{scl} number is the symbol's storage class and
2272 the @var{nx} value is the number of auxilary entries associated with
2273 the symbol. The last two fields are the symbol's value and its name.
2274
2275 The other common output format, usually seen with ELF based files,
2276 looks like this:
2277
2278 @smallexample
2279 00000000 l d .bss 00000000 .bss
2280 00000000 g .text 00000000 fred
2281 @end smallexample
2282
2283 Here the first number is the symbol's value (sometimes refered to as
2284 its address). The next field is actually a set of characters and
2285 spaces indicating the flag bits that are set on the symbol. These
2286 characters are described below. Next is the section with which the
2287 symbol is associated or @emph{*ABS*} if the section is absolute (ie
2288 not connected with any section), or @emph{*UND*} if the section is
2289 referenced in the file being dumped, but not defined there.
2290
2291 After the section name comes another field, a number, which for common
2292 symbols is the alignment and for other symbol is the size. Finally
2293 the symbol's name is displayed.
2294
2295 The flag characters are divided into 7 groups as follows:
2296 @table @code
2297 @item l
2298 @itemx g
2299 @itemx u
2300 @itemx !
2301 The symbol is a local (l), global (g), unique global (u), neither
2302 global nor local (a space) or both global and local (!). A
2303 symbol can be neither local or global for a variety of reasons, e.g.,
2304 because it is used for debugging, but it is probably an indication of
2305 a bug if it is ever both local and global. Unique global symbols are
2306 a GNU extension to the standard set of ELF symbol bindings. For such
2307 a symbol the dynamic linker will make sure that in the entire process
2308 there is just one symbol with this name and type in use.
2309
2310 @item w
2311 The symbol is weak (w) or strong (a space).
2312
2313 @item C
2314 The symbol denotes a constructor (C) or an ordinary symbol (a space).
2315
2316 @item W
2317 The symbol is a warning (W) or a normal symbol (a space). A warning
2318 symbol's name is a message to be displayed if the symbol following the
2319 warning symbol is ever referenced.
2320
2321 @item I
2322 @item i
2323 The symbol is an indirect reference to another symbol (I), a function
2324 to be evaluated during reloc processing (i) or a normal symbol (a
2325 space).
2326
2327 @item d
2328 @itemx D
2329 The symbol is a debugging symbol (d) or a dynamic symbol (D) or a
2330 normal symbol (a space).
2331
2332 @item F
2333 @item f
2334 @item O
2335 The symbol is the name of a function (F) or a file (f) or an object
2336 (O) or just a normal symbol (a space).
2337 @end table
2338
2339 @item -T
2340 @itemx --dynamic-syms
2341 @cindex dynamic symbol table entries, printing
2342 Print the dynamic symbol table entries of the file. This is only
2343 meaningful for dynamic objects, such as certain types of shared
2344 libraries. This is similar to the information provided by the @samp{nm}
2345 program when given the @option{-D} (@option{--dynamic}) option.
2346
2347 @item --special-syms
2348 When displaying symbols include those which the target considers to be
2349 special in some way and which would not normally be of interest to the
2350 user.
2351
2352 @item -V
2353 @itemx --version
2354 Print the version number of @command{objdump} and exit.
2355
2356 @item -x
2357 @itemx --all-headers
2358 @cindex all header information, object file
2359 @cindex header information, all
2360 Display all available header information, including the symbol table and
2361 relocation entries. Using @option{-x} is equivalent to specifying all of
2362 @option{-a -f -h -p -r -t}.
2363
2364 @item -w
2365 @itemx --wide
2366 @cindex wide output, printing
2367 Format some lines for output devices that have more than 80 columns.
2368 Also do not truncate symbol names when they are displayed.
2369
2370 @item -z
2371 @itemx --disassemble-zeroes
2372 Normally the disassembly output will skip blocks of zeroes. This
2373 option directs the disassembler to disassemble those blocks, just like
2374 any other data.
2375 @end table
2376
2377 @c man end
2378
2379 @ignore
2380 @c man begin SEEALSO objdump
2381 nm(1), readelf(1), and the Info entries for @file{binutils}.
2382 @c man end
2383 @end ignore
2384
2385 @node ranlib
2386 @chapter ranlib
2387
2388 @kindex ranlib
2389 @cindex archive contents
2390 @cindex symbol index
2391
2392 @c man title ranlib generate index to archive.
2393
2394 @smallexample
2395 @c man begin SYNOPSIS ranlib
2396 ranlib [@option{--plugin} @var{name}] [@option{-DhHvVt}] @var{archive}
2397 @c man end
2398 @end smallexample
2399
2400 @c man begin DESCRIPTION ranlib
2401
2402 @command{ranlib} generates an index to the contents of an archive and
2403 stores it in the archive. The index lists each symbol defined by a
2404 member of an archive that is a relocatable object file.
2405
2406 You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
2407
2408 An archive with such an index speeds up linking to the library and
2409 allows routines in the library to call each other without regard to
2410 their placement in the archive.
2411
2412 The @sc{gnu} @command{ranlib} program is another form of @sc{gnu} @command{ar}; running
2413 @command{ranlib} is completely equivalent to executing @samp{ar -s}.
2414 @xref{ar}.
2415
2416 @c man end
2417
2418 @c man begin OPTIONS ranlib
2419
2420 @table @env
2421 @item -h
2422 @itemx -H
2423 @itemx --help
2424 Show usage information for @command{ranlib}.
2425
2426 @item -v
2427 @itemx -V
2428 @itemx --version
2429 Show the version number of @command{ranlib}.
2430
2431 @item -D
2432 @cindex deterministic archives
2433 @kindex --enable-deterministic-archives
2434 Operate in @emph{deterministic} mode. The symbol map archive member's
2435 header will show zero for the UID, GID, and timestamp. When this
2436 option is used, multiple runs will produce identical output files.
2437
2438 This is the default unless @file{binutils} was configured with
2439 @option{--enable-deterministic-archives}.
2440
2441 @item -t
2442 Update the timestamp of the symbol map of an archive.
2443
2444 @item -U
2445 @cindex deterministic archives
2446 @kindex --enable-deterministic-archives
2447 Do @emph{not} operate in @emph{deterministic} mode. This is the
2448 inverse of the @samp{-D} option, above: the archive index will get
2449 actual UID, GID, timestamp, and file mode values.
2450
2451 This is the default unless @file{binutils} was configured with
2452 @option{--enable-deterministic-archives}.
2453 @end table
2454
2455 @c man end
2456
2457 @ignore
2458 @c man begin SEEALSO ranlib
2459 ar(1), nm(1), and the Info entries for @file{binutils}.
2460 @c man end
2461 @end ignore
2462
2463 @node size
2464 @chapter size
2465
2466 @kindex size
2467 @cindex section sizes
2468
2469 @c man title size list section sizes and total size.
2470
2471 @smallexample
2472 @c man begin SYNOPSIS size
2473 size [@option{-A}|@option{-B}|@option{--format=}@var{compatibility}]
2474 [@option{--help}]
2475 [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}]
2476 [@option{--common}]
2477 [@option{-t}|@option{--totals}]
2478 [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}]
2479 [@var{objfile}@dots{}]
2480 @c man end
2481 @end smallexample
2482
2483 @c man begin DESCRIPTION size
2484
2485 The @sc{gnu} @command{size} utility lists the section sizes---and the total
2486 size---for each of the object or archive files @var{objfile} in its
2487 argument list. By default, one line of output is generated for each
2488 object file or each module in an archive.
2489
2490 @var{objfile}@dots{} are the object files to be examined.
2491 If none are specified, the file @code{a.out} will be used.
2492
2493 @c man end
2494
2495 @c man begin OPTIONS size
2496
2497 The command line options have the following meanings:
2498
2499 @table @env
2500 @item -A
2501 @itemx -B
2502 @itemx --format=@var{compatibility}
2503 @cindex @command{size} display format
2504 Using one of these options, you can choose whether the output from @sc{gnu}
2505 @command{size} resembles output from System V @command{size} (using @option{-A},
2506 or @option{--format=sysv}), or Berkeley @command{size} (using @option{-B}, or
2507 @option{--format=berkeley}). The default is the one-line format similar to
2508 Berkeley's.
2509 @c Bonus for doc-source readers: you can also say --format=strange (or
2510 @c anything else that starts with 's') for sysv, and --format=boring (or
2511 @c anything else that starts with 'b') for Berkeley.
2512
2513 Here is an example of the Berkeley (default) format of output from
2514 @command{size}:
2515 @smallexample
2516 $ size --format=Berkeley ranlib size
2517 text data bss dec hex filename
2518 294880 81920 11592 388392 5ed28 ranlib
2519 294880 81920 11888 388688 5ee50 size
2520 @end smallexample
2521
2522 @noindent
2523 This is the same data, but displayed closer to System V conventions:
2524
2525 @smallexample
2526 $ size --format=SysV ranlib size
2527 ranlib :
2528 section size addr
2529 .text 294880 8192
2530 .data 81920 303104
2531 .bss 11592 385024
2532 Total 388392
2533
2534
2535 size :
2536 section size addr
2537 .text 294880 8192
2538 .data 81920 303104
2539 .bss 11888 385024
2540 Total 388688
2541 @end smallexample
2542
2543 @item --help
2544 Show a summary of acceptable arguments and options.
2545
2546 @item -d
2547 @itemx -o
2548 @itemx -x
2549 @itemx --radix=@var{number}
2550 @cindex @command{size} number format
2551 @cindex radix for section sizes
2552 Using one of these options, you can control whether the size of each
2553 section is given in decimal (@option{-d}, or @option{--radix=10}); octal
2554 (@option{-o}, or @option{--radix=8}); or hexadecimal (@option{-x}, or
2555 @option{--radix=16}). In @option{--radix=@var{number}}, only the three
2556 values (8, 10, 16) are supported. The total size is always given in two
2557 radices; decimal and hexadecimal for @option{-d} or @option{-x} output, or
2558 octal and hexadecimal if you're using @option{-o}.
2559
2560 @item --common
2561 Print total size of common symbols in each file. When using Berkeley
2562 format these are included in the bss size.
2563
2564 @item -t
2565 @itemx --totals
2566 Show totals of all objects listed (Berkeley format listing mode only).
2567
2568 @item --target=@var{bfdname}
2569 @cindex object code format
2570 Specify that the object-code format for @var{objfile} is
2571 @var{bfdname}. This option may not be necessary; @command{size} can
2572 automatically recognize many formats.
2573 @xref{Target Selection}, for more information.
2574
2575 @item -V
2576 @itemx --version
2577 Display the version number of @command{size}.
2578 @end table
2579
2580 @c man end
2581
2582 @ignore
2583 @c man begin SEEALSO size
2584 ar(1), objdump(1), readelf(1), and the Info entries for @file{binutils}.
2585 @c man end
2586 @end ignore
2587
2588 @node strings
2589 @chapter strings
2590 @kindex strings
2591 @cindex listings strings
2592 @cindex printing strings
2593 @cindex strings, printing
2594
2595 @c man title strings print the strings of printable characters in files.
2596
2597 @smallexample
2598 @c man begin SYNOPSIS strings
2599 strings [@option{-afovV}] [@option{-}@var{min-len}]
2600 [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
2601 [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
2602 [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
2603 [@option{-}] [@option{--all}] [@option{--print-file-name}]
2604 [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
2605 [@option{--help}] [@option{--version}] @var{file}@dots{}
2606 @c man end
2607 @end smallexample
2608
2609 @c man begin DESCRIPTION strings
2610
2611 For each @var{file} given, @sc{gnu} @command{strings} prints the printable
2612 character sequences that are at least 4 characters long (or the number
2613 given with the options below) and are followed by an unprintable
2614 character. By default, it only prints the strings from the initialized
2615 and loaded sections of object files; for other types of files, it prints
2616 the strings from the whole file.
2617
2618 @command{strings} is mainly useful for determining the contents of non-text
2619 files.
2620
2621 @c man end
2622
2623 @c man begin OPTIONS strings
2624
2625 @table @env
2626 @item -a
2627 @itemx --all
2628 @itemx -
2629 Do not scan only the initialized and loaded sections of object files;
2630 scan the whole files.
2631
2632 @item -f
2633 @itemx --print-file-name
2634 Print the name of the file before each string.
2635
2636 @item --help
2637 Print a summary of the program usage on the standard output and exit.
2638
2639 @item -@var{min-len}
2640 @itemx -n @var{min-len}
2641 @itemx --bytes=@var{min-len}
2642 Print sequences of characters that are at least @var{min-len} characters
2643 long, instead of the default 4.
2644
2645 @item -o
2646 Like @samp{-t o}. Some other versions of @command{strings} have @option{-o}
2647 act like @samp{-t d} instead. Since we can not be compatible with both
2648 ways, we simply chose one.
2649
2650 @item -t @var{radix}
2651 @itemx --radix=@var{radix}
2652 Print the offset within the file before each string. The single
2653 character argument specifies the radix of the offset---@samp{o} for
2654 octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
2655
2656 @item -e @var{encoding}
2657 @itemx --encoding=@var{encoding}
2658 Select the character encoding of the strings that are to be found.
2659 Possible values for @var{encoding} are: @samp{s} = single-7-bit-byte
2660 characters (ASCII, ISO 8859, etc., default), @samp{S} =
2661 single-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
2662 16-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
2663 littleendian. Useful for finding wide character strings. (@samp{l}
2664 and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings).
2665
2666 @item -T @var{bfdname}
2667 @itemx --target=@var{bfdname}
2668 @cindex object code format
2669 Specify an object code format other than your system's default format.
2670 @xref{Target Selection}, for more information.
2671
2672 @item -v
2673 @itemx -V
2674 @itemx --version
2675 Print the program version number on the standard output and exit.
2676 @end table
2677
2678 @c man end
2679
2680 @ignore
2681 @c man begin SEEALSO strings
2682 ar(1), nm(1), objdump(1), ranlib(1), readelf(1)
2683 and the Info entries for @file{binutils}.
2684 @c man end
2685 @end ignore
2686
2687 @node strip
2688 @chapter strip
2689
2690 @kindex strip
2691 @cindex removing symbols
2692 @cindex discarding symbols
2693 @cindex symbols, discarding
2694
2695 @c man title strip Discard symbols from object files.
2696
2697 @smallexample
2698 @c man begin SYNOPSIS strip
2699 strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
2700 [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname}]
2701 [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname}]
2702 [@option{-s}|@option{--strip-all}]
2703 [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
2704 [@option{--strip-dwo}]
2705 [@option{-K} @var{symbolname} |@option{--keep-symbol=}@var{symbolname}]
2706 [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
2707 [@option{-w}|@option{--wildcard}]
2708 [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
2709 [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
2710 [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
2711 [@option{-D}|@option{--enable-deterministic-archives}]
2712 [@option{--keep-file-symbols}]
2713 [@option{--only-keep-debug}]
2714 [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
2715 [@option{--help}] [@option{--info}]
2716 @var{objfile}@dots{}
2717 @c man end
2718 @end smallexample
2719
2720 @c man begin DESCRIPTION strip
2721
2722 @sc{gnu} @command{strip} discards all symbols from object files
2723 @var{objfile}. The list of object files may include archives.
2724 At least one object file must be given.
2725
2726 @command{strip} modifies the files named in its argument,
2727 rather than writing modified copies under different names.
2728
2729 @c man end
2730
2731 @c man begin OPTIONS strip
2732
2733 @table @env
2734 @item -F @var{bfdname}
2735 @itemx --target=@var{bfdname}
2736 Treat the original @var{objfile} as a file with the object
2737 code format @var{bfdname}, and rewrite it in the same format.
2738 @xref{Target Selection}, for more information.
2739
2740 @item --help
2741 Show a summary of the options to @command{strip} and exit.
2742
2743 @item --info
2744 Display a list showing all architectures and object formats available.
2745
2746 @item -I @var{bfdname}
2747 @itemx --input-target=@var{bfdname}
2748 Treat the original @var{objfile} as a file with the object
2749 code format @var{bfdname}.
2750 @xref{Target Selection}, for more information.
2751
2752 @item -O @var{bfdname}
2753 @itemx --output-target=@var{bfdname}
2754 Replace @var{objfile} with a file in the output format @var{bfdname}.
2755 @xref{Target Selection}, for more information.
2756
2757 @item -R @var{sectionname}
2758 @itemx --remove-section=@var{sectionname}
2759 Remove any section named @var{sectionname} from the output file. This
2760 option may be given more than once. Note that using this option
2761 inappropriately may make the output file unusable.
2762
2763 @item -s
2764 @itemx --strip-all
2765 Remove all symbols.
2766
2767 @item -g
2768 @itemx -S
2769 @itemx -d
2770 @itemx --strip-debug
2771 Remove debugging symbols only.
2772
2773 @item --strip-dwo
2774 Remove the contents of all DWARF .dwo sections, leaving the
2775 remaining debugging sections and all symbols intact.
2776 See the description of this option in the @command{objcopy} section
2777 for more information.
2778
2779 @item --strip-unneeded
2780 Remove all symbols that are not needed for relocation processing.
2781
2782 @item -K @var{symbolname}
2783 @itemx --keep-symbol=@var{symbolname}
2784 When stripping symbols, keep symbol @var{symbolname} even if it would
2785 normally be stripped. This option may be given more than once.
2786
2787 @item -N @var{symbolname}
2788 @itemx --strip-symbol=@var{symbolname}
2789 Remove symbol @var{symbolname} from the source file. This option may be
2790 given more than once, and may be combined with strip options other than
2791 @option{-K}.
2792
2793 @item -o @var{file}
2794 Put the stripped output in @var{file}, rather than replacing the
2795 existing file. When this argument is used, only one @var{objfile}
2796 argument may be specified.
2797
2798 @item -p
2799 @itemx --preserve-dates
2800 Preserve the access and modification dates of the file.
2801
2802 @item -D
2803 @itemx --enable-deterministic-archives
2804 Operate in @emph{deterministic} mode. When copying archive members
2805 and writing the archive index, use zero for UIDs, GIDs, timestamps,
2806 and use consistent file modes for all files.
2807
2808 @item -w
2809 @itemx --wildcard
2810 Permit regular expressions in @var{symbolname}s used in other command
2811 line options. The question mark (?), asterisk (*), backslash (\) and
2812 square brackets ([]) operators can be used anywhere in the symbol
2813 name. If the first character of the symbol name is the exclamation
2814 point (!) then the sense of the switch is reversed for that symbol.
2815 For example:
2816
2817 @smallexample
2818 -w -K !foo -K fo*
2819 @end smallexample
2820
2821 would cause strip to only keep symbols that start with the letters
2822 ``fo'', but to discard the symbol ``foo''.
2823
2824 @item -x
2825 @itemx --discard-all
2826 Remove non-global symbols.
2827
2828 @item -X
2829 @itemx --discard-locals
2830 Remove compiler-generated local symbols.
2831 (These usually start with @samp{L} or @samp{.}.)
2832
2833 @item --keep-file-symbols
2834 When stripping a file, perhaps with @option{--strip-debug} or
2835 @option{--strip-unneeded}, retain any symbols specifying source file names,
2836 which would otherwise get stripped.
2837
2838 @item --only-keep-debug
2839 Strip a file, removing contents of any sections that would not be
2840 stripped by @option{--strip-debug} and leaving the debugging sections
2841 intact. In ELF files, this preserves all note sections in the output.
2842
2843 The intention is that this option will be used in conjunction with
2844 @option{--add-gnu-debuglink} to create a two part executable. One a
2845 stripped binary which will occupy less space in RAM and in a
2846 distribution and the second a debugging information file which is only
2847 needed if debugging abilities are required. The suggested procedure
2848 to create these files is as follows:
2849
2850 @enumerate
2851 @item Link the executable as normal. Assuming that is is called
2852 @code{foo} then...
2853 @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
2854 create a file containing the debugging info.
2855 @item Run @code{objcopy --strip-debug foo} to create a
2856 stripped executable.
2857 @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
2858 to add a link to the debugging info into the stripped executable.
2859 @end enumerate
2860
2861 Note---the choice of @code{.dbg} as an extension for the debug info
2862 file is arbitrary. Also the @code{--only-keep-debug} step is
2863 optional. You could instead do this:
2864
2865 @enumerate
2866 @item Link the executable as normal.
2867 @item Copy @code{foo} to @code{foo.full}
2868 @item Run @code{strip --strip-debug foo}
2869 @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
2870 @end enumerate
2871
2872 i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
2873 full executable. It does not have to be a file created by the
2874 @option{--only-keep-debug} switch.
2875
2876 Note---this switch is only intended for use on fully linked files. It
2877 does not make sense to use it on object files where the debugging
2878 information may be incomplete. Besides the gnu_debuglink feature
2879 currently only supports the presence of one filename containing
2880 debugging information, not multiple filenames on a one-per-object-file
2881 basis.
2882
2883 @item -V
2884 @itemx --version
2885 Show the version number for @command{strip}.
2886
2887 @item -v
2888 @itemx --verbose
2889 Verbose output: list all object files modified. In the case of
2890 archives, @samp{strip -v} lists all members of the archive.
2891 @end table
2892
2893 @c man end
2894
2895 @ignore
2896 @c man begin SEEALSO strip
2897 the Info entries for @file{binutils}.
2898 @c man end
2899 @end ignore
2900
2901 @node c++filt, addr2line, elfedit, Top
2902 @chapter c++filt
2903
2904 @kindex c++filt
2905 @cindex demangling C++ symbols
2906
2907 @c man title cxxfilt Demangle C++ and Java symbols.
2908
2909 @smallexample
2910 @c man begin SYNOPSIS cxxfilt
2911 c++filt [@option{-_}|@option{--strip-underscore}]
2912 [@option{-n}|@option{--no-strip-underscore}]
2913 [@option{-p}|@option{--no-params}]
2914 [@option{-t}|@option{--types}]
2915 [@option{-i}|@option{--no-verbose}]
2916 [@option{-s} @var{format}|@option{--format=}@var{format}]
2917 [@option{--help}] [@option{--version}] [@var{symbol}@dots{}]
2918 @c man end
2919 @end smallexample
2920
2921 @c man begin DESCRIPTION cxxfilt
2922
2923 @kindex cxxfilt
2924 The C++ and Java languages provide function overloading, which means
2925 that you can write many functions with the same name, providing that
2926 each function takes parameters of different types. In order to be
2927 able to distinguish these similarly named functions C++ and Java
2928 encode them into a low-level assembler name which uniquely identifies
2929 each different version. This process is known as @dfn{mangling}. The
2930 @command{c++filt}
2931 @footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
2932 MS-DOS this program is named @command{CXXFILT}.}
2933 program does the inverse mapping: it decodes (@dfn{demangles}) low-level
2934 names into user-level names so that they can be read.
2935
2936 Every alphanumeric word (consisting of letters, digits, underscores,
2937 dollars, or periods) seen in the input is a potential mangled name.
2938 If the name decodes into a C++ name, the C++ name replaces the
2939 low-level name in the output, otherwise the original word is output.
2940 In this way you can pass an entire assembler source file, containing
2941 mangled names, through @command{c++filt} and see the same source file
2942 containing demangled names.
2943
2944 You can also use @command{c++filt} to decipher individual symbols by
2945 passing them on the command line:
2946
2947 @example
2948 c++filt @var{symbol}
2949 @end example
2950
2951 If no @var{symbol} arguments are given, @command{c++filt} reads symbol
2952 names from the standard input instead. All the results are printed on
2953 the standard output. The difference between reading names from the
2954 command line versus reading names from the standard input is that
2955 command line arguments are expected to be just mangled names and no
2956 checking is performed to separate them from surrounding text. Thus
2957 for example:
2958
2959 @smallexample
2960 c++filt -n _Z1fv
2961 @end smallexample
2962
2963 will work and demangle the name to ``f()'' whereas:
2964
2965 @smallexample
2966 c++filt -n _Z1fv,
2967 @end smallexample
2968
2969 will not work. (Note the extra comma at the end of the mangled
2970 name which makes it invalid). This command however will work:
2971
2972 @smallexample
2973 echo _Z1fv, | c++filt -n
2974 @end smallexample
2975
2976 and will display ``f(),'', i.e., the demangled name followed by a
2977 trailing comma. This behaviour is because when the names are read
2978 from the standard input it is expected that they might be part of an
2979 assembler source file where there might be extra, extraneous
2980 characters trailing after a mangled name. For example:
2981
2982 @smallexample
2983 .type _Z1fv, @@function
2984 @end smallexample
2985
2986 @c man end
2987
2988 @c man begin OPTIONS cxxfilt
2989
2990 @table @env
2991 @item -_
2992 @itemx --strip-underscore
2993 On some systems, both the C and C++ compilers put an underscore in front
2994 of every name. For example, the C name @code{foo} gets the low-level
2995 name @code{_foo}. This option removes the initial underscore. Whether
2996 @command{c++filt} removes the underscore by default is target dependent.
2997
2998 @item -n
2999 @itemx --no-strip-underscore
3000 Do not remove the initial underscore.
3001
3002 @item -p
3003 @itemx --no-params
3004 When demangling the name of a function, do not display the types of
3005 the function's parameters.
3006
3007 @item -t
3008 @itemx --types
3009 Attempt to demangle types as well as function names. This is disabled
3010 by default since mangled types are normally only used internally in
3011 the compiler, and they can be confused with non-mangled names. For example,
3012 a function called ``a'' treated as a mangled type name would be
3013 demangled to ``signed char''.
3014
3015 @item -i
3016 @itemx --no-verbose
3017 Do not include implementation details (if any) in the demangled
3018 output.
3019
3020 @item -s @var{format}
3021 @itemx --format=@var{format}
3022 @command{c++filt} can decode various methods of mangling, used by
3023 different compilers. The argument to this option selects which
3024 method it uses:
3025
3026 @table @code
3027 @item auto
3028 Automatic selection based on executable (the default method)
3029 @item gnu
3030 the one used by the @sc{gnu} C++ compiler (g++)
3031 @item lucid
3032 the one used by the Lucid compiler (lcc)
3033 @item arm
3034 the one specified by the C++ Annotated Reference Manual
3035 @item hp
3036 the one used by the HP compiler (aCC)
3037 @item edg
3038 the one used by the EDG compiler
3039 @item gnu-v3
3040 the one used by the @sc{gnu} C++ compiler (g++) with the V3 ABI.
3041 @item java
3042 the one used by the @sc{gnu} Java compiler (gcj)
3043 @item gnat
3044 the one used by the @sc{gnu} Ada compiler (GNAT).
3045 @end table
3046
3047 @item --help
3048 Print a summary of the options to @command{c++filt} and exit.
3049
3050 @item --version
3051 Print the version number of @command{c++filt} and exit.
3052 @end table
3053
3054 @c man end
3055
3056 @ignore
3057 @c man begin SEEALSO cxxfilt
3058 the Info entries for @file{binutils}.
3059 @c man end
3060 @end ignore
3061
3062 @quotation
3063 @emph{Warning:} @command{c++filt} is a new utility, and the details of its
3064 user interface are subject to change in future releases. In particular,
3065 a command-line option may be required in the future to decode a name
3066 passed as an argument on the command line; in other words,
3067
3068 @example
3069 c++filt @var{symbol}
3070 @end example
3071
3072 @noindent
3073 may in a future release become
3074
3075 @example
3076 c++filt @var{option} @var{symbol}
3077 @end example
3078 @end quotation
3079
3080 @node addr2line
3081 @chapter addr2line
3082
3083 @kindex addr2line
3084 @cindex address to file name and line number
3085
3086 @c man title addr2line convert addresses into file names and line numbers.
3087
3088 @smallexample
3089 @c man begin SYNOPSIS addr2line
3090 addr2line [@option{-a}|@option{--addresses}]
3091 [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
3092 [@option{-C}|@option{--demangle}[=@var{style}]]
3093 [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
3094 [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
3095 [@option{-i}|@option{--inlines}]
3096 [@option{-p}|@option{--pretty-print}]
3097 [@option{-j}|@option{--section=}@var{name}]
3098 [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
3099 [addr addr @dots{}]
3100 @c man end
3101 @end smallexample
3102
3103 @c man begin DESCRIPTION addr2line
3104
3105 @command{addr2line} translates addresses into file names and line numbers.
3106 Given an address in an executable or an offset in a section of a relocatable
3107 object, it uses the debugging information to figure out which file name and
3108 line number are associated with it.
3109
3110 The executable or relocatable object to use is specified with the @option{-e}
3111 option. The default is the file @file{a.out}. The section in the relocatable
3112 object to use is specified with the @option{-j} option.
3113
3114 @command{addr2line} has two modes of operation.
3115
3116 In the first, hexadecimal addresses are specified on the command line,
3117 and @command{addr2line} displays the file name and line number for each
3118 address.
3119
3120 In the second, @command{addr2line} reads hexadecimal addresses from
3121 standard input, and prints the file name and line number for each
3122 address on standard output. In this mode, @command{addr2line} may be used
3123 in a pipe to convert dynamically chosen addresses.
3124
3125 The format of the output is @samp{FILENAME:LINENO}. The file name and
3126 line number for each input address is printed on separate lines.
3127
3128 If the @option{-f} option is used, then each @samp{FILENAME:LINENO}
3129 line is preceded by @samp{FUNCTIONNAME} which is the name of the
3130 function containing the address.
3131
3132 If the @option{-i} option is used and the code at the given address is
3133 present there because of inlining by the compiler then the
3134 @samp{@{FUNCTIONNAME@} FILENAME:LINENO} information for the inlining
3135 function will be displayed afterwards. This continues recursively
3136 until there is no more inlining to report.
3137
3138 If the @option{-a} option is used then the output is prefixed by the
3139 input address.
3140
3141 If the @option{-p} option is used then the output for each input
3142 address is displayed on one, possibly quite long, line. If
3143 @option{-p} is not used then the output is broken up into multiple
3144 lines, based on the paragraphs above.
3145
3146 If the file name or function name can not be determined,
3147 @command{addr2line} will print two question marks in their place. If the
3148 line number can not be determined, @command{addr2line} will print 0.
3149
3150 @c man end
3151
3152 @c man begin OPTIONS addr2line
3153
3154 The long and short forms of options, shown here as alternatives, are
3155 equivalent.
3156
3157 @table @env
3158 @item -a
3159 @itemx --addresses
3160 Display the address before the function name, file and line number
3161 information. The address is printed with a @samp{0x} prefix to easily
3162 identify it.
3163
3164 @item -b @var{bfdname}
3165 @itemx --target=@var{bfdname}
3166 @cindex object code format
3167 Specify that the object-code format for the object files is
3168 @var{bfdname}.
3169
3170 @item -C
3171 @itemx --demangle[=@var{style}]
3172 @cindex demangling in objdump
3173 Decode (@dfn{demangle}) low-level symbol names into user-level names.
3174 Besides removing any initial underscore prepended by the system, this
3175 makes C++ function names readable. Different compilers have different
3176 mangling styles. The optional demangling style argument can be used to
3177 choose an appropriate demangling style for your compiler. @xref{c++filt},
3178 for more information on demangling.
3179
3180 @item -e @var{filename}
3181 @itemx --exe=@var{filename}
3182 Specify the name of the executable for which addresses should be
3183 translated. The default file is @file{a.out}.
3184
3185 @item -f
3186 @itemx --functions
3187 Display function names as well as file and line number information.
3188
3189 @item -s
3190 @itemx --basenames
3191 Display only the base of each file name.
3192
3193 @item -i
3194 @itemx --inlines
3195 If the address belongs to a function that was inlined, the source
3196 information for all enclosing scopes back to the first non-inlined
3197 function will also be printed. For example, if @code{main} inlines
3198 @code{callee1} which inlines @code{callee2}, and address is from
3199 @code{callee2}, the source information for @code{callee1} and @code{main}
3200 will also be printed.
3201
3202 @item -j
3203 @itemx --section
3204 Read offsets relative to the specified section instead of absolute addresses.
3205
3206 @item -p
3207 @itemx --pretty-print
3208 Make the output more human friendly: each location are printed on one line.
3209 If option @option{-i} is specified, lines for all enclosing scopes are
3210 prefixed with @samp{(inlined by)}.
3211 @end table
3212
3213 @c man end
3214
3215 @ignore
3216 @c man begin SEEALSO addr2line
3217 Info entries for @file{binutils}.
3218 @c man end
3219 @end ignore
3220
3221 @node nlmconv
3222 @chapter nlmconv
3223
3224 @command{nlmconv} converts a relocatable object file into a NetWare
3225 Loadable Module.
3226
3227 @ignore
3228 @command{nlmconv} currently works with @samp{i386} object
3229 files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC}
3230 object files in @sc{elf}, or @code{a.out} format@footnote{
3231 @command{nlmconv} should work with any @samp{i386} or @sc{sparc} object
3232 format in the Binary File Descriptor library. It has only been tested
3233 with the above formats.}.
3234 @end ignore
3235
3236 @quotation
3237 @emph{Warning:} @command{nlmconv} is not always built as part of the binary
3238 utilities, since it is only useful for NLM targets.
3239 @end quotation
3240
3241 @c man title nlmconv converts object code into an NLM.
3242
3243 @smallexample
3244 @c man begin SYNOPSIS nlmconv
3245 nlmconv [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
3246 [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
3247 [@option{-T} @var{headerfile}|@option{--header-file=}@var{headerfile}]
3248 [@option{-d}|@option{--debug}] [@option{-l} @var{linker}|@option{--linker=}@var{linker}]
3249 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3250 @var{infile} @var{outfile}
3251 @c man end
3252 @end smallexample
3253
3254 @c man begin DESCRIPTION nlmconv
3255
3256 @command{nlmconv} converts the relocatable @samp{i386} object file
3257 @var{infile} into the NetWare Loadable Module @var{outfile}, optionally
3258 reading @var{headerfile} for NLM header information. For instructions
3259 on writing the NLM command file language used in header files, see the
3260 @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM
3261 Development and Tools Overview}, which is part of the NLM Software
3262 Developer's Kit (``NLM SDK''), available from Novell, Inc.
3263 @command{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read
3264 @var{infile};
3265 @ifclear man
3266 see @ref{BFD,,BFD,ld.info,Using LD}, for more information.
3267 @end ifclear
3268
3269 @command{nlmconv} can perform a link step. In other words, you can list
3270 more than one object file for input if you list them in the definitions
3271 file (rather than simply specifying one input file on the command line).
3272 In this case, @command{nlmconv} calls the linker for you.
3273
3274 @c man end
3275
3276 @c man begin OPTIONS nlmconv
3277
3278 @table @env
3279 @item -I @var{bfdname}
3280 @itemx --input-target=@var{bfdname}
3281 Object format of the input file. @command{nlmconv} can usually determine
3282 the format of a given file (so no default is necessary).
3283 @xref{Target Selection}, for more information.
3284
3285 @item -O @var{bfdname}
3286 @itemx --output-target=@var{bfdname}
3287 Object format of the output file. @command{nlmconv} infers the output
3288 format based on the input format, e.g. for a @samp{i386} input file the
3289 output format is @samp{nlm32-i386}.
3290 @xref{Target Selection}, for more information.
3291
3292 @item -T @var{headerfile}
3293 @itemx --header-file=@var{headerfile}
3294 Reads @var{headerfile} for NLM header information. For instructions on
3295 writing the NLM command file language used in header files, see@ see the
3296 @samp{linkers} section, of the @cite{NLM Development and Tools
3297 Overview}, which is part of the NLM Software Developer's Kit, available
3298 from Novell, Inc.
3299
3300 @item -d
3301 @itemx --debug
3302 Displays (on standard error) the linker command line used by @command{nlmconv}.
3303
3304 @item -l @var{linker}
3305 @itemx --linker=@var{linker}
3306 Use @var{linker} for any linking. @var{linker} can be an absolute or a
3307 relative pathname.
3308
3309 @item -h
3310 @itemx --help
3311 Prints a usage summary.
3312
3313 @item -V
3314 @itemx --version
3315 Prints the version number for @command{nlmconv}.
3316 @end table
3317
3318 @c man end
3319
3320 @ignore
3321 @c man begin SEEALSO nlmconv
3322 the Info entries for @file{binutils}.
3323 @c man end
3324 @end ignore
3325
3326 @node windmc
3327 @chapter windmc
3328
3329 @command{windmc} may be used to generator Windows message resources.
3330
3331 @quotation
3332 @emph{Warning:} @command{windmc} is not always built as part of the binary
3333 utilities, since it is only useful for Windows targets.
3334 @end quotation
3335
3336 @c man title windmc generates Windows message resources.
3337
3338 @smallexample
3339 @c man begin SYNOPSIS windmc
3340 windmc [options] input-file
3341 @c man end
3342 @end smallexample
3343
3344 @c man begin DESCRIPTION windmc
3345
3346 @command{windmc} reads message definitions from an input file (.mc) and
3347 translate them into a set of output files. The output files may be of
3348 four kinds:
3349
3350 @table @code
3351 @item h
3352 A C header file containing the message definitions.
3353
3354 @item rc
3355 A resource file compilable by the @command{windres} tool.
3356
3357 @item bin
3358 One or more binary files containing the resource data for a specific
3359 message language.
3360
3361 @item dbg
3362 A C include file that maps message id's to their symbolic name.
3363 @end table
3364
3365 The exact description of these different formats is available in
3366 documentation from Microsoft.
3367
3368 When @command{windmc} converts from the @code{mc} format to the @code{bin}
3369 format, @code{rc}, @code{h}, and optional @code{dbg} it is acting like the
3370 Windows Message Compiler.
3371
3372 @c man end
3373
3374 @c man begin OPTIONS windmc
3375
3376 @table @env
3377 @item -a
3378 @itemx --ascii_in
3379 Specifies that the input file specified is ASCII. This is the default
3380 behaviour.
3381
3382 @item -A
3383 @itemx --ascii_out
3384 Specifies that messages in the output @code{bin} files should be in ASCII
3385 format.
3386
3387 @item -b
3388 @itemx --binprefix
3389 Specifies that @code{bin} filenames should have to be prefixed by the
3390 basename of the source file.
3391
3392 @item -c
3393 @itemx --customflag
3394 Sets the customer bit in all message id's.
3395
3396 @item -C @var{codepage}
3397 @itemx --codepage_in @var{codepage}
3398 Sets the default codepage to be used to convert input file to UTF16. The
3399 default is ocdepage 1252.
3400
3401 @item -d
3402 @itemx --decimal_values
3403 Outputs the constants in the header file in decimal. Default is using
3404 hexadecimal output.
3405
3406 @item -e @var{ext}
3407 @itemx --extension @var{ext}
3408 The extension for the header file. The default is .h extension.
3409
3410 @item -F @var{target}
3411 @itemx --target @var{target}
3412 Specify the BFD format to use for a bin file as output. This
3413 is a BFD target name; you can use the @option{--help} option to see a list
3414 of supported targets. Normally @command{windmc} will use the default
3415 format, which is the first one listed by the @option{--help} option.
3416 @ifclear man
3417 @ref{Target Selection}.
3418 @end ifclear
3419
3420 @item -h @var{path}
3421 @itemx --headerdir @var{path}
3422 The target directory of the generated header file. The default is the
3423 current directory.
3424
3425 @item -H
3426 @itemx --help
3427 Displays a list of command line options and then exits.
3428
3429 @item -m @var{characters}
3430 @itemx --maxlength @var{characters}
3431 Instructs @command{windmc} to generate a warning if the length
3432 of any message exceeds the number specified.
3433
3434 @item -n
3435 @itemx --nullterminate
3436 Terminate message text in @code{bin} files by zero. By default they are
3437 terminated by CR/LF.
3438
3439 @item -o
3440 @itemx --hresult_use
3441 Not yet implemented. Instructs @code{windmc} to generate an OLE2 header
3442 file, using HRESULT definitions. Status codes are used if the flag is not
3443 specified.
3444
3445 @item -O @var{codepage}
3446 @itemx --codepage_out @var{codepage}
3447 Sets the default codepage to be used to output text files. The default
3448 is ocdepage 1252.
3449
3450 @item -r @var{path}
3451 @itemx --rcdir @var{path}
3452 The target directory for the generated @code{rc} script and the generated
3453 @code{bin} files that the resource compiler script includes. The default
3454 is the current directory.
3455
3456 @item -u
3457 @itemx --unicode_in
3458 Specifies that the input file is UTF16.
3459
3460 @item -U
3461 @itemx --unicode_out
3462 Specifies that messages in the output @code{bin} file should be in UTF16
3463 format. This is the default behaviour.
3464
3465 @item -v
3466 @item --verbose
3467 Enable verbose mode.
3468
3469 @item -V
3470 @item --version
3471 Prints the version number for @command{windmc}.
3472
3473 @item -x @var{path}
3474 @itemx --xdgb @var{path}
3475 The path of the @code{dbg} C include file that maps message id's to the
3476 symbolic name. No such file is generated without specifying the switch.
3477 @end table
3478
3479 @c man end
3480
3481 @ignore
3482 @c man begin SEEALSO windmc
3483 the Info entries for @file{binutils}.
3484 @c man end
3485 @end ignore
3486
3487 @node windres
3488 @chapter windres
3489
3490 @command{windres} may be used to manipulate Windows resources.
3491
3492 @quotation
3493 @emph{Warning:} @command{windres} is not always built as part of the binary
3494 utilities, since it is only useful for Windows targets.
3495 @end quotation
3496
3497 @c man title windres manipulate Windows resources.
3498
3499 @smallexample
3500 @c man begin SYNOPSIS windres
3501 windres [options] [input-file] [output-file]
3502 @c man end
3503 @end smallexample
3504
3505 @c man begin DESCRIPTION windres
3506
3507 @command{windres} reads resources from an input file and copies them into
3508 an output file. Either file may be in one of three formats:
3509
3510 @table @code
3511 @item rc
3512 A text format read by the Resource Compiler.
3513
3514 @item res
3515 A binary format generated by the Resource Compiler.
3516
3517 @item coff
3518 A COFF object or executable.
3519 @end table
3520
3521 The exact description of these different formats is available in
3522 documentation from Microsoft.
3523
3524 When @command{windres} converts from the @code{rc} format to the @code{res}
3525 format, it is acting like the Windows Resource Compiler. When
3526 @command{windres} converts from the @code{res} format to the @code{coff}
3527 format, it is acting like the Windows @code{CVTRES} program.
3528
3529 When @command{windres} generates an @code{rc} file, the output is similar
3530 but not identical to the format expected for the input. When an input
3531 @code{rc} file refers to an external filename, an output @code{rc} file
3532 will instead include the file contents.
3533
3534 If the input or output format is not specified, @command{windres} will
3535 guess based on the file name, or, for the input file, the file contents.
3536 A file with an extension of @file{.rc} will be treated as an @code{rc}
3537 file, a file with an extension of @file{.res} will be treated as a
3538 @code{res} file, and a file with an extension of @file{.o} or
3539 @file{.exe} will be treated as a @code{coff} file.
3540
3541 If no output file is specified, @command{windres} will print the resources
3542 in @code{rc} format to standard output.
3543
3544 The normal use is for you to write an @code{rc} file, use @command{windres}
3545 to convert it to a COFF object file, and then link the COFF file into
3546 your application. This will make the resources described in the
3547 @code{rc} file available to Windows.
3548
3549 @c man end
3550
3551 @c man begin OPTIONS windres
3552
3553 @table @env
3554 @item -i @var{filename}
3555 @itemx --input @var{filename}
3556 The name of the input file. If this option is not used, then
3557 @command{windres} will use the first non-option argument as the input file
3558 name. If there are no non-option arguments, then @command{windres} will
3559 read from standard input. @command{windres} can not read a COFF file from
3560 standard input.
3561
3562 @item -o @var{filename}
3563 @itemx --output @var{filename}
3564 The name of the output file. If this option is not used, then
3565 @command{windres} will use the first non-option argument, after any used
3566 for the input file name, as the output file name. If there is no
3567 non-option argument, then @command{windres} will write to standard output.
3568 @command{windres} can not write a COFF file to standard output. Note,
3569 for compatibility with @command{rc} the option @option{-fo} is also
3570 accepted, but its use is not recommended.
3571
3572 @item -J @var{format}
3573 @itemx --input-format @var{format}
3574 The input format to read. @var{format} may be @samp{res}, @samp{rc}, or
3575 @samp{coff}. If no input format is specified, @command{windres} will
3576 guess, as described above.
3577
3578 @item -O @var{format}
3579 @itemx --output-format @var{format}
3580 The output format to generate. @var{format} may be @samp{res},
3581 @samp{rc}, or @samp{coff}. If no output format is specified,
3582 @command{windres} will guess, as described above.
3583
3584 @item -F @var{target}
3585 @itemx --target @var{target}
3586 Specify the BFD format to use for a COFF file as input or output. This
3587 is a BFD target name; you can use the @option{--help} option to see a list
3588 of supported targets. Normally @command{windres} will use the default
3589 format, which is the first one listed by the @option{--help} option.
3590 @ifclear man
3591 @ref{Target Selection}.
3592 @end ifclear
3593
3594 @item --preprocessor @var{program}
3595 When @command{windres} reads an @code{rc} file, it runs it through the C
3596 preprocessor first. This option may be used to specify the preprocessor
3597 to use, including any leading arguments. The default preprocessor
3598 argument is @code{gcc -E -xc-header -DRC_INVOKED}.
3599
3600 @item --preprocessor-arg @var{option}
3601 When @command{windres} reads an @code{rc} file, it runs it through
3602 the C preprocessor first. This option may be used to specify additional
3603 text to be passed to preprocessor on its command line.
3604 This option can be used multiple times to add multiple options to the
3605 preprocessor command line.
3606
3607 @item -I @var{directory}
3608 @itemx --include-dir @var{directory}
3609 Specify an include directory to use when reading an @code{rc} file.
3610 @command{windres} will pass this to the preprocessor as an @option{-I}
3611 option. @command{windres} will also search this directory when looking for
3612 files named in the @code{rc} file. If the argument passed to this command
3613 matches any of the supported @var{formats} (as described in the @option{-J}
3614 option), it will issue a deprecation warning, and behave just like the
3615 @option{-J} option. New programs should not use this behaviour. If a
3616 directory happens to match a @var{format}, simple prefix it with @samp{./}
3617 to disable the backward compatibility.
3618
3619 @item -D @var{target}
3620 @itemx --define @var{sym}[=@var{val}]
3621 Specify a @option{-D} option to pass to the preprocessor when reading an
3622 @code{rc} file.
3623
3624 @item -U @var{target}
3625 @itemx --undefine @var{sym}
3626 Specify a @option{-U} option to pass to the preprocessor when reading an
3627 @code{rc} file.
3628
3629 @item -r
3630 Ignored for compatibility with rc.
3631
3632 @item -v
3633 Enable verbose mode. This tells you what the preprocessor is if you
3634 didn't specify one.
3635
3636 @item -c @var{val}
3637 @item --codepage @var{val}
3638 Specify the default codepage to use when reading an @code{rc} file.
3639 @var{val} should be a hexadecimal prefixed by @samp{0x} or decimal
3640 codepage code. The valid range is from zero up to 0xffff, but the
3641 validity of the codepage is host and configuration dependent.
3642
3643 @item -l @var{val}
3644 @item --language @var{val}
3645 Specify the default language to use when reading an @code{rc} file.
3646 @var{val} should be a hexadecimal language code. The low eight bits are
3647 the language, and the high eight bits are the sublanguage.
3648
3649 @item --use-temp-file
3650 Use a temporary file to instead of using popen to read the output of
3651 the preprocessor. Use this option if the popen implementation is buggy
3652 on the host (eg., certain non-English language versions of Windows 95 and
3653 Windows 98 are known to have buggy popen where the output will instead
3654 go the console).
3655
3656 @item --no-use-temp-file
3657 Use popen, not a temporary file, to read the output of the preprocessor.
3658 This is the default behaviour.
3659
3660 @item -h
3661 @item --help
3662 Prints a usage summary.
3663
3664 @item -V
3665 @item --version
3666 Prints the version number for @command{windres}.
3667
3668 @item --yydebug
3669 If @command{windres} is compiled with @code{YYDEBUG} defined as @code{1},
3670 this will turn on parser debugging.
3671 @end table
3672
3673 @c man end
3674
3675 @ignore
3676 @c man begin SEEALSO windres
3677 the Info entries for @file{binutils}.
3678 @c man end
3679 @end ignore
3680
3681 @node dlltool
3682 @chapter dlltool
3683 @cindex DLL
3684 @kindex dlltool
3685
3686 @command{dlltool} is used to create the files needed to create dynamic
3687 link libraries (DLLs) on systems which understand PE format image
3688 files such as Windows. A DLL contains an export table which contains
3689 information that the runtime loader needs to resolve references from a
3690 referencing program.
3691
3692 The export table is generated by this program by reading in a
3693 @file{.def} file or scanning the @file{.a} and @file{.o} files which
3694 will be in the DLL. A @file{.o} file can contain information in
3695 special @samp{.drectve} sections with export information.
3696
3697 @quotation
3698 @emph{Note:} @command{dlltool} is not always built as part of the
3699 binary utilities, since it is only useful for those targets which
3700 support DLLs.
3701 @end quotation
3702
3703 @c man title dlltool Create files needed to build and use DLLs.
3704
3705 @smallexample
3706 @c man begin SYNOPSIS dlltool
3707 dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
3708 [@option{-b}|@option{--base-file} @var{base-file-name}]
3709 [@option{-e}|@option{--output-exp} @var{exports-file-name}]
3710 [@option{-z}|@option{--output-def} @var{def-file-name}]
3711 [@option{-l}|@option{--output-lib} @var{library-file-name}]
3712 [@option{-y}|@option{--output-delaylib} @var{library-file-name}]
3713 [@option{--export-all-symbols}] [@option{--no-export-all-symbols}]
3714 [@option{--exclude-symbols} @var{list}]
3715 [@option{--no-default-excludes}]
3716 [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
3717 [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
3718 [@option{-a}|@option{--add-indirect}]
3719 [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
3720 [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
3721 [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
3722 [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}]
3723 [@option{--use-nul-prefixed-import-tables}]
3724 [@option{-I}|@option{--identify} @var{library-file-name}] [@option{--identify-strict}]
3725 [@option{-i}|@option{--interwork}]
3726 [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
3727 [@option{-v}|@option{--verbose}]
3728 [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
3729 [@option{--no-leading-underscore}] [@option{--leading-underscore}]
3730 [object-file @dots{}]
3731 @c man end
3732 @end smallexample
3733
3734 @c man begin DESCRIPTION dlltool
3735
3736 @command{dlltool} reads its inputs, which can come from the @option{-d} and
3737 @option{-b} options as well as object files specified on the command
3738 line. It then processes these inputs and if the @option{-e} option has
3739 been specified it creates a exports file. If the @option{-l} option
3740 has been specified it creates a library file and if the @option{-z} option
3741 has been specified it creates a def file. Any or all of the @option{-e},
3742 @option{-l} and @option{-z} options can be present in one invocation of
3743 dlltool.
3744
3745 When creating a DLL, along with the source for the DLL, it is necessary
3746 to have three other files. @command{dlltool} can help with the creation of
3747 these files.
3748
3749 The first file is a @file{.def} file which specifies which functions are
3750 exported from the DLL, which functions the DLL imports, and so on. This
3751 is a text file and can be created by hand, or @command{dlltool} can be used
3752 to create it using the @option{-z} option. In this case @command{dlltool}
3753 will scan the object files specified on its command line looking for
3754 those functions which have been specially marked as being exported and
3755 put entries for them in the @file{.def} file it creates.
3756
3757 In order to mark a function as being exported from a DLL, it needs to
3758 have an @option{-export:<name_of_function>} entry in the @samp{.drectve}
3759 section of the object file. This can be done in C by using the
3760 asm() operator:
3761
3762 @smallexample
3763 asm (".section .drectve");
3764 asm (".ascii \"-export:my_func\"");
3765
3766 int my_func (void) @{ @dots{} @}
3767 @end smallexample
3768
3769 The second file needed for DLL creation is an exports file. This file
3770 is linked with the object files that make up the body of the DLL and it
3771 handles the interface between the DLL and the outside world. This is a
3772 binary file and it can be created by giving the @option{-e} option to
3773 @command{dlltool} when it is creating or reading in a @file{.def} file.
3774
3775 The third file needed for DLL creation is the library file that programs
3776 will link with in order to access the functions in the DLL (an `import
3777 library'). This file can be created by giving the @option{-l} option to
3778 dlltool when it is creating or reading in a @file{.def} file.
3779
3780 If the @option{-y} option is specified, dlltool generates a delay-import
3781 library that can be used instead of the normal import library to allow
3782 a program to link to the dll only as soon as an imported function is
3783 called for the first time. The resulting executable will need to be
3784 linked to the static delayimp library containing __delayLoadHelper2(),
3785 which in turn will import LoadLibraryA and GetProcAddress from kernel32.
3786
3787 @command{dlltool} builds the library file by hand, but it builds the
3788 exports file by creating temporary files containing assembler statements
3789 and then assembling these. The @option{-S} command line option can be
3790 used to specify the path to the assembler that dlltool will use,
3791 and the @option{-f} option can be used to pass specific flags to that
3792 assembler. The @option{-n} can be used to prevent dlltool from deleting
3793 these temporary assembler files when it is done, and if @option{-n} is
3794 specified twice then this will prevent dlltool from deleting the
3795 temporary object files it used to build the library.
3796
3797 Here is an example of creating a DLL from a source file @samp{dll.c} and
3798 also creating a program (from an object file called @samp{program.o})
3799 that uses that DLL:
3800
3801 @smallexample
3802 gcc -c dll.c
3803 dlltool -e exports.o -l dll.lib dll.o
3804 gcc dll.o exports.o -o dll.dll
3805 gcc program.o dll.lib -o program
3806 @end smallexample
3807
3808
3809 @command{dlltool} may also be used to query an existing import library
3810 to determine the name of the DLL to which it is associated. See the
3811 description of the @option{-I} or @option{--identify} option.
3812
3813 @c man end
3814
3815 @c man begin OPTIONS dlltool
3816
3817 The command line options have the following meanings:
3818
3819 @table @env
3820
3821 @item -d @var{filename}
3822 @itemx --input-def @var{filename}
3823 @cindex input .def file
3824 Specifies the name of a @file{.def} file to be read in and processed.
3825
3826 @item -b @var{filename}
3827 @itemx --base-file @var{filename}
3828 @cindex base files
3829 Specifies the name of a base file to be read in and processed. The
3830 contents of this file will be added to the relocation section in the
3831 exports file generated by dlltool.
3832
3833 @item -e @var{filename}
3834 @itemx --output-exp @var{filename}
3835 Specifies the name of the export file to be created by dlltool.
3836
3837 @item -z @var{filename}
3838 @itemx --output-def @var{filename}
3839 Specifies the name of the @file{.def} file to be created by dlltool.
3840
3841 @item -l @var{filename}
3842 @itemx --output-lib @var{filename}
3843 Specifies the name of the library file to be created by dlltool.
3844
3845 @item -y @var{filename}
3846 @itemx --output-delaylib @var{filename}
3847 Specifies the name of the delay-import library file to be created by dlltool.
3848
3849 @item --export-all-symbols
3850 Treat all global and weak defined symbols found in the input object
3851 files as symbols to be exported. There is a small list of symbols which
3852 are not exported by default; see the @option{--no-default-excludes}
3853 option. You may add to the list of symbols to not export by using the
3854 @option{--exclude-symbols} option.
3855
3856 @item --no-export-all-symbols
3857 Only export symbols explicitly listed in an input @file{.def} file or in
3858 @samp{.drectve} sections in the input object files. This is the default
3859 behaviour. The @samp{.drectve} sections are created by @samp{dllexport}
3860 attributes in the source code.
3861
3862 @item --exclude-symbols @var{list}
3863 Do not export the symbols in @var{list}. This is a list of symbol names
3864 separated by comma or colon characters. The symbol names should not
3865 contain a leading underscore. This is only meaningful when
3866 @option{--export-all-symbols} is used.
3867
3868 @item --no-default-excludes
3869 When @option{--export-all-symbols} is used, it will by default avoid
3870 exporting certain special symbols. The current list of symbols to avoid
3871 exporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0},
3872 @samp{impure_ptr}. You may use the @option{--no-default-excludes} option
3873 to go ahead and export these special symbols. This is only meaningful
3874 when @option{--export-all-symbols} is used.
3875
3876 @item -S @var{path}
3877 @itemx --as @var{path}
3878 Specifies the path, including the filename, of the assembler to be used
3879 to create the exports file.
3880
3881 @item -f @var{options}
3882 @itemx --as-flags @var{options}
3883 Specifies any specific command line options to be passed to the
3884 assembler when building the exports file. This option will work even if
3885 the @option{-S} option is not used. This option only takes one argument,
3886 and if it occurs more than once on the command line, then later
3887 occurrences will override earlier occurrences. So if it is necessary to
3888 pass multiple options to the assembler they should be enclosed in
3889 double quotes.
3890
3891 @item -D @var{name}
3892 @itemx --dll-name @var{name}
3893 Specifies the name to be stored in the @file{.def} file as the name of
3894 the DLL when the @option{-e} option is used. If this option is not
3895 present, then the filename given to the @option{-e} option will be
3896 used as the name of the DLL.
3897
3898 @item -m @var{machine}
3899 @itemx -machine @var{machine}
3900 Specifies the type of machine for which the library file should be
3901 built. @command{dlltool} has a built in default type, depending upon how
3902 it was created, but this option can be used to override that. This is
3903 normally only useful when creating DLLs for an ARM processor, when the
3904 contents of the DLL are actually encode using Thumb instructions.
3905
3906 @item -a
3907 @itemx --add-indirect
3908 Specifies that when @command{dlltool} is creating the exports file it
3909 should add a section which allows the exported functions to be
3910 referenced without using the import library. Whatever the hell that
3911 means!
3912
3913 @item -U
3914 @itemx --add-underscore
3915 Specifies that when @command{dlltool} is creating the exports file it
3916 should prepend an underscore to the names of @emph{all} exported symbols.
3917
3918 @item --no-leading-underscore
3919 @item --leading-underscore
3920 Specifies whether standard symbol should be forced to be prefixed, or
3921 not.
3922
3923 @item --add-stdcall-underscore
3924 Specifies that when @command{dlltool} is creating the exports file it
3925 should prepend an underscore to the names of exported @emph{stdcall}
3926 functions. Variable names and non-stdcall function names are not modified.
3927 This option is useful when creating GNU-compatible import libs for third
3928 party DLLs that were built with MS-Windows tools.
3929
3930 @item -k
3931 @itemx --kill-at
3932 Specifies that when @command{dlltool} is creating the exports file it
3933 should not append the string @samp{@@ <number>}. These numbers are
3934 called ordinal numbers and they represent another way of accessing the
3935 function in a DLL, other than by name.
3936
3937 @item -A
3938 @itemx --add-stdcall-alias
3939 Specifies that when @command{dlltool} is creating the exports file it
3940 should add aliases for stdcall symbols without @samp{@@ <number>}
3941 in addition to the symbols with @samp{@@ <number>}.
3942
3943 @item -p
3944 @itemx --ext-prefix-alias @var{prefix}
3945 Causes @command{dlltool} to create external aliases for all DLL
3946 imports with the specified prefix. The aliases are created for both
3947 external and import symbols with no leading underscore.
3948
3949 @item -x
3950 @itemx --no-idata4
3951 Specifies that when @command{dlltool} is creating the exports and library
3952 files it should omit the @code{.idata4} section. This is for compatibility
3953 with certain operating systems.
3954
3955 @item --use-nul-prefixed-import-tables
3956 Specifies that when @command{dlltool} is creating the exports and library
3957 files it should prefix the @code{.idata4} and @code{.idata5} by zero an
3958 element. This emulates old gnu import library generation of
3959 @code{dlltool}. By default this option is turned off.
3960
3961 @item -c
3962 @itemx --no-idata5
3963 Specifies that when @command{dlltool} is creating the exports and library
3964 files it should omit the @code{.idata5} section. This is for compatibility
3965 with certain operating systems.
3966
3967 @item -I @var{filename}
3968 @itemx --identify @var{filename}
3969 Specifies that @command{dlltool} should inspect the import library
3970 indicated by @var{filename} and report, on @code{stdout}, the name(s)
3971 of the associated DLL(s). This can be performed in addition to any
3972 other operations indicated by the other options and arguments.
3973 @command{dlltool} fails if the import library does not exist or is not
3974 actually an import library. See also @option{--identify-strict}.
3975
3976 @item --identify-strict
3977 Modifies the behavior of the @option{--identify} option, such
3978 that an error is reported if @var{filename} is associated with
3979 more than one DLL.
3980
3981 @item -i
3982 @itemx --interwork
3983 Specifies that @command{dlltool} should mark the objects in the library
3984 file and exports file that it produces as supporting interworking
3985 between ARM and Thumb code.
3986
3987 @item -n
3988 @itemx --nodelete
3989 Makes @command{dlltool} preserve the temporary assembler files it used to
3990 create the exports file. If this option is repeated then dlltool will
3991 also preserve the temporary object files it uses to create the library
3992 file.
3993
3994 @item -t @var{prefix}
3995 @itemx --temp-prefix @var{prefix}
3996 Makes @command{dlltool} use @var{prefix} when constructing the names of
3997 temporary assembler and object files. By default, the temp file prefix
3998 is generated from the pid.
3999
4000 @item -v
4001 @itemx --verbose
4002 Make dlltool describe what it is doing.
4003
4004 @item -h
4005 @itemx --help
4006 Displays a list of command line options and then exits.
4007
4008 @item -V
4009 @itemx --version
4010 Displays dlltool's version number and then exits.
4011
4012 @end table
4013
4014 @c man end
4015
4016 @menu
4017 * def file format:: The format of the dlltool @file{.def} file
4018 @end menu
4019
4020 @node def file format
4021 @section The format of the @command{dlltool} @file{.def} file
4022
4023 A @file{.def} file contains any number of the following commands:
4024
4025 @table @asis
4026
4027 @item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]}
4028 The result is going to be named @var{name}@code{.exe}.
4029
4030 @item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
4031 The result is going to be named @var{name}@code{.dll}.
4032 Note: If you want to use LIBRARY as name then you need to quote. Otherwise
4033 this will fail due a necessary hack for libtool (see PR binutils/13710 for more
4034 details).
4035
4036 @item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) ) [ == } @var{its_name} @code{]}
4037 @item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *}
4038 Declares @var{name1} as an exported symbol from the DLL, with optional
4039 ordinal number @var{integer}, or declares @var{name1} as an alias
4040 (forward) of the function @var{external-name} in the DLL.
4041 If @var{its_name} is specified, this name is used as string in export table.
4042 @var{module-name}.
4043 Note: The @code{EXPORTS} has to be the last command in .def file, as keywords
4044 are treated - beside @code{LIBRARY} - as simple name-identifiers.
4045 If you want to use LIBRARY as name then you need to quote it.
4046
4047 @item @code{IMPORTS ( (} @var{internal-name} @code{=} @var{module-name} @code{.} @var{integer} @code{) | [} @var{internal-name} @code{= ]} @var{module-name} @code{.} @var{external-name} @code{) [ == ) @var{its_name} @code{]} *}
4048 Declares that @var{external-name} or the exported function whose
4049 ordinal number is @var{integer} is to be imported from the file
4050 @var{module-name}. If @var{internal-name} is specified then this is
4051 the name that the imported function will be referred to in the body of
4052 the DLL.
4053 If @var{its_name} is specified, this name is used as string in import table.
4054 Note: The @code{IMPORTS} has to be the last command in .def file, as keywords
4055 are treated - beside @code{LIBRARY} - as simple name-identifiers.
4056 If you want to use LIBRARY as name then you need to quote it.
4057
4058 @item @code{DESCRIPTION} @var{string}
4059 Puts @var{string} into the output @file{.exp} file in the
4060 @code{.rdata} section.
4061
4062 @item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4063 @item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
4064 Generates @code{--stack} or @code{--heap}
4065 @var{number-reserve},@var{number-commit} in the output @code{.drectve}
4066 section. The linker will see this and act upon it.
4067
4068 @item @code{CODE} @var{attr} @code{+}
4069 @item @code{DATA} @var{attr} @code{+}
4070 @item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *}
4071 Generates @code{--attr} @var{section-name} @var{attr} in the output
4072 @code{.drectve} section, where @var{attr} is one of @code{READ},
4073 @code{WRITE}, @code{EXECUTE} or @code{SHARED}. The linker will see
4074 this and act upon it.
4075
4076 @end table
4077
4078 @ignore
4079 @c man begin SEEALSO dlltool
4080 The Info pages for @file{binutils}.
4081 @c man end
4082 @end ignore
4083
4084 @node readelf
4085 @chapter readelf
4086
4087 @cindex ELF file information
4088 @kindex readelf
4089
4090 @c man title readelf Displays information about ELF files.
4091
4092 @smallexample
4093 @c man begin SYNOPSIS readelf
4094 readelf [@option{-a}|@option{--all}]
4095 [@option{-h}|@option{--file-header}]
4096 [@option{-l}|@option{--program-headers}|@option{--segments}]
4097 [@option{-S}|@option{--section-headers}|@option{--sections}]
4098 [@option{-g}|@option{--section-groups}]
4099 [@option{-t}|@option{--section-details}]
4100 [@option{-e}|@option{--headers}]
4101 [@option{-s}|@option{--syms}|@option{--symbols}]
4102 [@option{--dyn-syms}]
4103 [@option{-n}|@option{--notes}]
4104 [@option{-r}|@option{--relocs}]
4105 [@option{-u}|@option{--unwind}]
4106 [@option{-d}|@option{--dynamic}]
4107 [@option{-V}|@option{--version-info}]
4108 [@option{-A}|@option{--arch-specific}]
4109 [@option{-D}|@option{--use-dynamic}]
4110 [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
4111 [@option{-p} <number or name>|@option{--string-dump=}<number or name>]
4112 [@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
4113 [@option{-c}|@option{--archive-index}]
4114 [@option{-w[lLiaprmfFsoRt]}|
4115 @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]]
4116 [@option{--dwarf-depth=@var{n}}]
4117 [@option{--dwarf-start=@var{n}}]
4118 [@option{-I}|@option{--histogram}]
4119 [@option{-v}|@option{--version}]
4120 [@option{-W}|@option{--wide}]
4121 [@option{-H}|@option{--help}]
4122 @var{elffile}@dots{}
4123 @c man end
4124 @end smallexample
4125
4126 @c man begin DESCRIPTION readelf
4127
4128 @command{readelf} displays information about one or more ELF format object
4129 files. The options control what particular information to display.
4130
4131 @var{elffile}@dots{} are the object files to be examined. 32-bit and
4132 64-bit ELF files are supported, as are archives containing ELF files.
4133
4134 This program performs a similar function to @command{objdump} but it
4135 goes into more detail and it exists independently of the @sc{bfd}
4136 library, so if there is a bug in @sc{bfd} then readelf will not be
4137 affected.
4138
4139 @c man end
4140
4141 @c man begin OPTIONS readelf
4142
4143 The long and short forms of options, shown here as alternatives, are
4144 equivalent. At least one option besides @samp{-v} or @samp{-H} must be
4145 given.
4146
4147 @table @env
4148 @item -a
4149 @itemx --all
4150 Equivalent to specifying @option{--file-header},
4151 @option{--program-headers}, @option{--sections}, @option{--symbols},
4152 @option{--relocs}, @option{--dynamic}, @option{--notes} and
4153 @option{--version-info}.
4154
4155 @item -h
4156 @itemx --file-header
4157 @cindex ELF file header information
4158 Displays the information contained in the ELF header at the start of the
4159 file.
4160
4161 @item -l
4162 @itemx --program-headers
4163 @itemx --segments
4164 @cindex ELF program header information
4165 @cindex ELF segment information
4166 Displays the information contained in the file's segment headers, if it
4167 has any.
4168
4169 @item -S
4170 @itemx --sections
4171 @itemx --section-headers
4172 @cindex ELF section information
4173 Displays the information contained in the file's section headers, if it
4174 has any.
4175
4176 @item -g
4177 @itemx --section-groups
4178 @cindex ELF section group information
4179 Displays the information contained in the file's section groups, if it
4180 has any.
4181
4182 @item -t
4183 @itemx --section-details
4184 @cindex ELF section information
4185 Displays the detailed section information. Implies @option{-S}.
4186
4187 @item -s
4188 @itemx --symbols
4189 @itemx --syms
4190 @cindex ELF symbol table information
4191 Displays the entries in symbol table section of the file, if it has one.
4192
4193 @item --dyn-syms
4194 @cindex ELF dynamic symbol table information
4195 Displays the entries in dynamic symbol table section of the file, if it
4196 has one.
4197
4198 @item -e
4199 @itemx --headers
4200 Display all the headers in the file. Equivalent to @option{-h -l -S}.
4201
4202 @item -n
4203 @itemx --notes
4204 @cindex ELF notes
4205 Displays the contents of the NOTE segments and/or sections, if any.
4206
4207 @item -r
4208 @itemx --relocs
4209 @cindex ELF reloc information
4210 Displays the contents of the file's relocation section, if it has one.
4211
4212 @item -u
4213 @itemx --unwind
4214 @cindex unwind information
4215 Displays the contents of the file's unwind section, if it has one. Only
4216 the unwind sections for IA64 ELF files, as well as ARM unwind tables
4217 (@code{.ARM.exidx} / @code{.ARM.extab}) are currently supported.
4218
4219 @item -d
4220 @itemx --dynamic
4221 @cindex ELF dynamic section information
4222 Displays the contents of the file's dynamic section, if it has one.
4223
4224 @item -V
4225 @itemx --version-info
4226 @cindex ELF version sections informations
4227 Displays the contents of the version sections in the file, it they
4228 exist.
4229
4230 @item -A
4231 @itemx --arch-specific
4232 Displays architecture-specific information in the file, if there
4233 is any.
4234
4235 @item -D
4236 @itemx --use-dynamic
4237 When displaying symbols, this option makes @command{readelf} use the
4238 symbol hash tables in the file's dynamic section, rather than the
4239 symbol table sections.
4240
4241 @item -x <number or name>
4242 @itemx --hex-dump=<number or name>
4243 Displays the contents of the indicated section as a hexadecimal bytes.
4244 A number identifies a particular section by index in the section table;
4245 any other string identifies all sections with that name in the object file.
4246
4247 @item -R <number or name>
4248 @itemx --relocated-dump=<number or name>
4249 Displays the contents of the indicated section as a hexadecimal
4250 bytes. A number identifies a particular section by index in the
4251 section table; any other string identifies all sections with that name
4252 in the object file. The contents of the section will be relocated
4253 before they are displayed.
4254
4255 @item -p <number or name>
4256 @itemx --string-dump=<number or name>
4257 Displays the contents of the indicated section as printable strings.
4258 A number identifies a particular section by index in the section table;
4259 any other string identifies all sections with that name in the object file.
4260
4261 @item -c
4262 @itemx --archive-index
4263 @cindex Archive file symbol index information
4264 Displays the file symbol index infomation contained in the header part
4265 of binary archives. Performs the same function as the @option{t}
4266 command to @command{ar}, but without using the BFD library. @xref{ar}.
4267
4268 @item -w[lLiaprmfFsoRt]
4269 @itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index]
4270 Displays the contents of the debug sections in the file, if any are
4271 present. If one of the optional letters or words follows the switch
4272 then only data found in those specific sections will be dumped.
4273
4274 Note that there is no single letter option to display the content of
4275 trace sections or .gdb_index.
4276
4277 Note: the @option{=decodedline} option will display the interpreted
4278 contents of a .debug_line section whereas the @option{=rawline} option
4279 dumps the contents in a raw format.
4280
4281 Note: the @option{=frames-interp} option will display the interpreted
4282 contents of a .debug_frame section whereas the @option{=frames} option
4283 dumps the contents in a raw format.
4284
4285 Note: the output from the @option{=info} option can also be affected
4286 by the options @option{--dwarf-depth} and @option{--dwarf-start}.
4287
4288 @item --dwarf-depth=@var{n}
4289 Limit the dump of the @code{.debug_info} section to @var{n} children.
4290 This is only useful with @option{--debug-dump=info}. The default is
4291 to print all DIEs; the special value 0 for @var{n} will also have this
4292 effect.
4293
4294 With a non-zero value for @var{n}, DIEs at or deeper than @var{n}
4295 levels will not be printed. The range for @var{n} is zero-based.
4296
4297 @item --dwarf-start=@var{n}
4298 Print only DIEs beginning with the DIE numbered @var{n}. This is only
4299 useful with @option{--debug-dump=info}.
4300
4301 If specified, this option will suppress printing of any header
4302 information and all DIEs before the DIE numbered @var{n}. Only
4303 siblings and children of the specified DIE will be printed.
4304
4305 This can be used in conjunction with @option{--dwarf-depth}.
4306
4307 @item -I
4308 @itemx --histogram
4309 Display a histogram of bucket list lengths when displaying the contents
4310 of the symbol tables.
4311
4312 @item -v
4313 @itemx --version
4314 Display the version number of readelf.
4315
4316 @item -W
4317 @itemx --wide
4318 Don't break output lines to fit into 80 columns. By default
4319 @command{readelf} breaks section header and segment listing lines for
4320 64-bit ELF files, so that they fit into 80 columns. This option causes
4321 @command{readelf} to print each section header resp. each segment one a
4322 single line, which is far more readable on terminals wider than 80 columns.
4323
4324 @item -H
4325 @itemx --help
4326 Display the command line options understood by @command{readelf}.
4327
4328 @end table
4329
4330 @c man end
4331
4332 @ignore
4333 @c man begin SEEALSO readelf
4334 objdump(1), and the Info entries for @file{binutils}.
4335 @c man end
4336 @end ignore
4337
4338 @node elfedit
4339 @chapter elfedit
4340
4341 @cindex Update ELF header
4342 @kindex elfedit
4343
4344 @c man title elfedit Update the ELF header of ELF files.
4345
4346 @smallexample
4347 @c man begin SYNOPSIS elfedit
4348 elfedit [@option{--input-mach=}@var{machine}]
4349 [@option{--input-type=}@var{type}]
4350 [@option{--input-osabi=}@var{osabi}]
4351 @option{--output-mach=}@var{machine}
4352 @option{--output-type=}@var{type}
4353 @option{--output-osabi=}@var{osabi}
4354 [@option{-v}|@option{--version}]
4355 [@option{-h}|@option{--help}]
4356 @var{elffile}@dots{}
4357 @c man end
4358 @end smallexample
4359
4360 @c man begin DESCRIPTION elfedit
4361
4362 @command{elfedit} updates the ELF header of ELF files which have
4363 the matching ELF machine and file types. The options control how and
4364 which fields in the ELF header should be updated.
4365
4366 @var{elffile}@dots{} are the ELF files to be updated. 32-bit and
4367 64-bit ELF files are supported, as are archives containing ELF files.
4368 @c man end
4369
4370 @c man begin OPTIONS elfedit
4371
4372 The long and short forms of options, shown here as alternatives, are
4373 equivalent. At least one of the @option{--output-mach},
4374 @option{--output-type} and @option{--output-osabi} options must be given.
4375
4376 @table @env
4377
4378 @itemx --input-mach=@var{machine}
4379 Set the matching input ELF machine type to @var{machine}. If
4380 @option{--input-mach} isn't specified, it will match any ELF
4381 machine types.
4382
4383 The supported ELF machine types are, @var{L1OM}, @var{K1OM} and
4384 @var{x86-64}.
4385
4386 @itemx --output-mach=@var{machine}
4387 Change the ELF machine type in the ELF header to @var{machine}. The
4388 supported ELF machine types are the same as @option{--input-mach}.
4389
4390 @itemx --input-type=@var{type}
4391 Set the matching input ELF file type to @var{type}. If
4392 @option{--input-type} isn't specified, it will match any ELF file types.
4393
4394 The supported ELF file types are, @var{rel}, @var{exec} and @var{dyn}.
4395
4396 @itemx --output-type=@var{type}
4397 Change the ELF file type in the ELF header to @var{type}. The
4398 supported ELF types are the same as @option{--input-type}.
4399
4400 @itemx --input-osabi=@var{osabi}
4401 Set the matching input ELF file OSABI to @var{osabi}. If
4402 @option{--input-osabi} isn't specified, it will match any ELF OSABIs.
4403
4404 The supported ELF OSABIs are, @var{none}, @var{HPUX}, @var{NetBSD},
4405 @var{GNU}, @var{Linux} (alias for @var{GNU}),
4406 @var{Solaris}, @var{AIX}, @var{Irix},
4407 @var{FreeBSD}, @var{TRU64}, @var{Modesto}, @var{OpenBSD}, @var{OpenVMS},
4408 @var{NSK}, @var{AROS} and @var{FenixOS}.
4409
4410 @itemx --output-osabi=@var{osabi}
4411 Change the ELF OSABI in the ELF header to @var{osabi}. The
4412 supported ELF OSABI are the same as @option{--input-osabi}.
4413
4414 @item -v
4415 @itemx --version
4416 Display the version number of @command{elfedit}.
4417
4418 @item -h
4419 @itemx --help
4420 Display the command line options understood by @command{elfedit}.
4421
4422 @end table
4423
4424 @c man end
4425
4426 @ignore
4427 @c man begin SEEALSO elfedit
4428 readelf(1), and the Info entries for @file{binutils}.
4429 @c man end
4430 @end ignore
4431
4432 @node Common Options
4433 @chapter Common Options
4434
4435 The following command-line options are supported by all of the
4436 programs described in this manual.
4437
4438 @c man begin OPTIONS
4439 @table @env
4440 @include at-file.texi
4441 @c man end
4442
4443 @item --help
4444 Display the command-line options supported by the program.
4445
4446 @item --version
4447 Display the version number of the program.
4448
4449 @c man begin OPTIONS
4450 @end table
4451 @c man end
4452
4453 @node Selecting the Target System
4454 @chapter Selecting the Target System
4455
4456 You can specify two aspects of the target system to the @sc{gnu}
4457 binary file utilities, each in several ways:
4458
4459 @itemize @bullet
4460 @item
4461 the target
4462
4463 @item
4464 the architecture
4465 @end itemize
4466
4467 In the following summaries, the lists of ways to specify values are in
4468 order of decreasing precedence. The ways listed first override those
4469 listed later.
4470
4471 The commands to list valid values only list the values for which the
4472 programs you are running were configured. If they were configured with
4473 @option{--enable-targets=all}, the commands list most of the available
4474 values, but a few are left out; not all targets can be configured in at
4475 once because some of them can only be configured @dfn{native} (on hosts
4476 with the same type as the target system).
4477
4478 @menu
4479 * Target Selection::
4480 * Architecture Selection::
4481 @end menu
4482
4483 @node Target Selection
4484 @section Target Selection
4485
4486 A @dfn{target} is an object file format. A given target may be
4487 supported for multiple architectures (@pxref{Architecture Selection}).
4488 A target selection may also have variations for different operating
4489 systems or architectures.
4490
4491 The command to list valid target values is @samp{objdump -i}
4492 (the first column of output contains the relevant information).
4493
4494 Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
4495 @samp{a.out-sunos-big}.
4496
4497 You can also specify a target using a configuration triplet. This is
4498 the same sort of name that is passed to @file{configure} to specify a
4499 target. When you use a configuration triplet as an argument, it must be
4500 fully canonicalized. You can see the canonical version of a triplet by
4501 running the shell script @file{config.sub} which is included with the
4502 sources.
4503
4504 Some sample configuration triplets are: @samp{m68k-hp-bsd},
4505 @samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
4506
4507 @subheading @command{objdump} Target
4508
4509 Ways to specify:
4510
4511 @enumerate
4512 @item
4513 command line option: @option{-b} or @option{--target}
4514
4515 @item
4516 environment variable @code{GNUTARGET}
4517
4518 @item
4519 deduced from the input file
4520 @end enumerate
4521
4522 @subheading @command{objcopy} and @command{strip} Input Target
4523
4524 Ways to specify:
4525
4526 @enumerate
4527 @item
4528 command line options: @option{-I} or @option{--input-target}, or @option{-F} or @option{--target}
4529
4530 @item
4531 environment variable @code{GNUTARGET}
4532
4533 @item
4534 deduced from the input file
4535 @end enumerate
4536
4537 @subheading @command{objcopy} and @command{strip} Output Target
4538
4539 Ways to specify:
4540
4541 @enumerate
4542 @item
4543 command line options: @option{-O} or @option{--output-target}, or @option{-F} or @option{--target}
4544
4545 @item
4546 the input target (see ``@command{objcopy} and @command{strip} Input Target'' above)
4547
4548 @item
4549 environment variable @code{GNUTARGET}
4550
4551 @item
4552 deduced from the input file
4553 @end enumerate
4554
4555 @subheading @command{nm}, @command{size}, and @command{strings} Target
4556
4557 Ways to specify:
4558
4559 @enumerate
4560 @item
4561 command line option: @option{--target}
4562
4563 @item
4564 environment variable @code{GNUTARGET}
4565
4566 @item
4567 deduced from the input file
4568 @end enumerate
4569
4570 @node Architecture Selection
4571 @section Architecture Selection
4572
4573 An @dfn{architecture} is a type of @sc{cpu} on which an object file is
4574 to run. Its name may contain a colon, separating the name of the
4575 processor family from the name of the particular @sc{cpu}.
4576
4577 The command to list valid architecture values is @samp{objdump -i} (the
4578 second column contains the relevant information).
4579
4580 Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
4581
4582 @subheading @command{objdump} Architecture
4583
4584 Ways to specify:
4585
4586 @enumerate
4587 @item
4588 command line option: @option{-m} or @option{--architecture}
4589
4590 @item
4591 deduced from the input file
4592 @end enumerate
4593
4594 @subheading @command{objcopy}, @command{nm}, @command{size}, @command{strings} Architecture
4595
4596 Ways to specify:
4597
4598 @enumerate
4599 @item
4600 deduced from the input file
4601 @end enumerate
4602
4603 @node Reporting Bugs
4604 @chapter Reporting Bugs
4605 @cindex bugs
4606 @cindex reporting bugs
4607
4608 Your bug reports play an essential role in making the binary utilities
4609 reliable.
4610
4611 Reporting a bug may help you by bringing a solution to your problem, or
4612 it may not. But in any case the principal function of a bug report is
4613 to help the entire community by making the next version of the binary
4614 utilities work better. Bug reports are your contribution to their
4615 maintenance.
4616
4617 In order for a bug report to serve its purpose, you must include the
4618 information that enables us to fix the bug.
4619
4620 @menu
4621 * Bug Criteria:: Have you found a bug?
4622 * Bug Reporting:: How to report bugs
4623 @end menu
4624
4625 @node Bug Criteria
4626 @section Have You Found a Bug?
4627 @cindex bug criteria
4628
4629 If you are not sure whether you have found a bug, here are some guidelines:
4630
4631 @itemize @bullet
4632 @cindex fatal signal
4633 @cindex crash
4634 @item
4635 If a binary utility gets a fatal signal, for any input whatever, that is
4636 a bug. Reliable utilities never crash.
4637
4638 @cindex error on valid input
4639 @item
4640 If a binary utility produces an error message for valid input, that is a
4641 bug.
4642
4643 @item
4644 If you are an experienced user of binary utilities, your suggestions for
4645 improvement are welcome in any case.
4646 @end itemize
4647
4648 @node Bug Reporting
4649 @section How to Report Bugs
4650 @cindex bug reports
4651 @cindex bugs, reporting
4652
4653 A number of companies and individuals offer support for @sc{gnu}
4654 products. If you obtained the binary utilities from a support
4655 organization, we recommend you contact that organization first.
4656
4657 You can find contact information for many support companies and
4658 individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
4659 distribution.
4660
4661 @ifset BUGURL
4662 In any event, we also recommend that you send bug reports for the binary
4663 utilities to @value{BUGURL}.
4664 @end ifset
4665
4666 The fundamental principle of reporting bugs usefully is this:
4667 @strong{report all the facts}. If you are not sure whether to state a
4668 fact or leave it out, state it!
4669
4670 Often people omit facts because they think they know what causes the
4671 problem and assume that some details do not matter. Thus, you might
4672 assume that the name of a file you use in an example does not matter.
4673 Well, probably it does not, but one cannot be sure. Perhaps the bug is
4674 a stray memory reference which happens to fetch from the location where
4675 that pathname is stored in memory; perhaps, if the pathname were
4676 different, the contents of that location would fool the utility into
4677 doing the right thing despite the bug. Play it safe and give a
4678 specific, complete example. That is the easiest thing for you to do,
4679 and the most helpful.
4680
4681 Keep in mind that the purpose of a bug report is to enable us to fix the bug if
4682 it is new to us. Therefore, always write your bug reports on the assumption
4683 that the bug has not been reported previously.
4684
4685 Sometimes people give a few sketchy facts and ask, ``Does this ring a
4686 bell?'' This cannot help us fix a bug, so it is basically useless. We
4687 respond by asking for enough details to enable us to investigate.
4688 You might as well expedite matters by sending them to begin with.
4689
4690 To enable us to fix the bug, you should include all these things:
4691
4692 @itemize @bullet
4693 @item
4694 The version of the utility. Each utility announces it if you start it
4695 with the @option{--version} argument.
4696
4697 Without this, we will not know whether there is any point in looking for
4698 the bug in the current version of the binary utilities.
4699
4700 @item
4701 Any patches you may have applied to the source, including any patches
4702 made to the @code{BFD} library.
4703
4704 @item
4705 The type of machine you are using, and the operating system name and
4706 version number.
4707
4708 @item
4709 What compiler (and its version) was used to compile the utilities---e.g.
4710 ``@code{gcc-2.7}''.
4711
4712 @item
4713 The command arguments you gave the utility to observe the bug. To
4714 guarantee you will not omit something important, list them all. A copy
4715 of the Makefile (or the output from make) is sufficient.
4716
4717 If we were to try to guess the arguments, we would probably guess wrong
4718 and then we might not encounter the bug.
4719
4720 @item
4721 A complete input file, or set of input files, that will reproduce the
4722 bug. If the utility is reading an object file or files, then it is
4723 generally most helpful to send the actual object files.
4724
4725 If the source files were produced exclusively using @sc{gnu} programs
4726 (e.g., @command{gcc}, @command{gas}, and/or the @sc{gnu} @command{ld}), then it
4727 may be OK to send the source files rather than the object files. In
4728 this case, be sure to say exactly what version of @command{gcc}, or
4729 whatever, was used to produce the object files. Also say how
4730 @command{gcc}, or whatever, was configured.
4731
4732 @item
4733 A description of what behavior you observe that you believe is
4734 incorrect. For example, ``It gets a fatal signal.''
4735
4736 Of course, if the bug is that the utility gets a fatal signal, then we
4737 will certainly notice it. But if the bug is incorrect output, we might
4738 not notice unless it is glaringly wrong. You might as well not give us
4739 a chance to make a mistake.
4740
4741 Even if the problem you experience is a fatal signal, you should still
4742 say so explicitly. Suppose something strange is going on, such as your
4743 copy of the utility is out of sync, or you have encountered a bug in
4744 the C library on your system. (This has happened!) Your copy might
4745 crash and ours would not. If you told us to expect a crash, then when
4746 ours fails to crash, we would know that the bug was not happening for
4747 us. If you had not told us to expect a crash, then we would not be able
4748 to draw any conclusion from our observations.
4749
4750 @item
4751 If you wish to suggest changes to the source, send us context diffs, as
4752 generated by @command{diff} with the @option{-u}, @option{-c}, or @option{-p}
4753 option. Always send diffs from the old file to the new file. If you
4754 wish to discuss something in the @command{ld} source, refer to it by
4755 context, not by line number.
4756
4757 The line numbers in our development sources will not match those in your
4758 sources. Your line numbers would convey no useful information to us.
4759 @end itemize
4760
4761 Here are some things that are not necessary:
4762
4763 @itemize @bullet
4764 @item
4765 A description of the envelope of the bug.
4766
4767 Often people who encounter a bug spend a lot of time investigating
4768 which changes to the input file will make the bug go away and which
4769 changes will not affect it.
4770
4771 This is often time consuming and not very useful, because the way we
4772 will find the bug is by running a single example under the debugger
4773 with breakpoints, not by pure deduction from a series of examples.
4774 We recommend that you save your time for something else.
4775
4776 Of course, if you can find a simpler example to report @emph{instead}
4777 of the original one, that is a convenience for us. Errors in the
4778 output will be easier to spot, running under the debugger will take
4779 less time, and so on.
4780
4781 However, simplification is not vital; if you do not want to do this,
4782 report the bug anyway and send us the entire test case you used.
4783
4784 @item
4785 A patch for the bug.
4786
4787 A patch for the bug does help us if it is a good one. But do not omit
4788 the necessary information, such as the test case, on the assumption that
4789 a patch is all we need. We might see problems with your patch and decide
4790 to fix the problem another way, or we might not understand it at all.
4791
4792 Sometimes with programs as complicated as the binary utilities it is
4793 very hard to construct an example that will make the program follow a
4794 certain path through the code. If you do not send us the example, we
4795 will not be able to construct one, so we will not be able to verify that
4796 the bug is fixed.
4797
4798 And if we cannot understand what bug you are trying to fix, or why your
4799 patch should be an improvement, we will not install it. A test case will
4800 help us to understand.
4801
4802 @item
4803 A guess about what the bug is or what it depends on.
4804
4805 Such guesses are usually wrong. Even we cannot guess right about such
4806 things without first using the debugger to find the facts.
4807 @end itemize
4808
4809 @node GNU Free Documentation License
4810 @appendix GNU Free Documentation License
4811
4812 @include fdl.texi
4813
4814 @node Binutils Index
4815 @unnumbered Binutils Index
4816
4817 @printindex cp
4818
4819 @bye
This page took 0.127016 seconds and 5 git commands to generate.