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