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