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