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