OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [binutils/] [doc/] [binutils.texi] - Blame information for rev 241

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.