]>
Commit | Line | Data |
---|---|---|
765a273f | 1 | \input texinfo @c -*- Texinfo -*- |
c72af735 RP |
2 | @setfilename binutils.info |
3 | ||
9abcc3b8 RP |
4 | @ifinfo |
5 | @format | |
6 | START-INFO-DIR-ENTRY | |
d6391983 | 7 | * Binutils:: The GNU binary utilities "ar", "ld", "objcopy", |
ba7c8e29 | 8 | "objdump", "nm", "size", "strings", "strip", and "ranlib". |
9abcc3b8 RP |
9 | END-INFO-DIR-ENTRY |
10 | @end format | |
11 | @end ifinfo | |
c72af735 | 12 | |
8b2c2275 | 13 | @ifinfo |
e32341a7 | 14 | Copyright @copyright{} 1991, 1992, 1993 Free Software Foundation, Inc. |
8b2c2275 RP |
15 | |
16 | Permission is granted to make and distribute verbatim copies of | |
17 | this manual provided the copyright notice and this permission notice | |
18 | are preserved on all copies. | |
19 | ||
20 | @ignore | |
21 | Permission is granted to process this file through TeX and print the | |
22 | results, provided the printed document carries a copying permission | |
23 | notice identical to this one except for the removal of this paragraph | |
24 | (this paragraph not being relevant to the printed manual). | |
25 | ||
26 | @end ignore | |
27 | ||
28 | Permission is granted to copy and distribute modified versions of this | |
29 | manual under the conditions for verbatim copying, provided also that | |
30 | the entire resulting derived work is distributed under the terms of a | |
31 | permission notice identical to this one. | |
32 | ||
33 | Permission is granted to copy and distribute translations of this manual | |
34 | into another language, under the above conditions for modified versions. | |
35 | @end ifinfo | |
36 | ||
c72af735 RP |
37 | @synindex ky cp |
38 | @c | |
df14d957 | 39 | @c This file documents the GNU binary utilities "ar", "ld", "objcopy", |
ba7c8e29 | 40 | @c "objdump", "nm", "size", "strings", "strip", and "ranlib". |
c72af735 | 41 | @c |
e32341a7 | 42 | @c Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. |
c72af735 RP |
43 | @c |
44 | @c This text may be freely distributed under the terms of the GNU | |
45 | @c General Public License. | |
46 | @c | |
27e94bd5 | 47 | |
c72af735 RP |
48 | @setchapternewpage odd |
49 | @settitle GNU Binary Utilities | |
27e94bd5 RP |
50 | @c @smallbook |
51 | @c @cropmarks | |
4928b97b RP |
52 | @titlepage |
53 | @finalout | |
c72af735 | 54 | @title The GNU Binary Utilities |
b6216af2 | 55 | @subtitle Version 2.2 |
c72af735 | 56 | @sp 1 |
e32341a7 | 57 | @subtitle May 1993 |
c72af735 | 58 | @author Roland H. Pesch |
4961ce5b | 59 | @author Jeffrey M. Osier |
c72af735 RP |
60 | @author Cygnus Support |
61 | @page | |
62 | ||
63 | @tex | |
650a49f0 | 64 | {\parskip=0pt \hfill Cygnus Support\par \hfill |
c72af735 RP |
65 | \TeX{}info \texinfoversion\par } |
66 | @end tex | |
67 | ||
68 | @vskip 0pt plus 1filll | |
e32341a7 | 69 | Copyright @copyright{} 1991, 1992, 1993 Free Software Foundation, Inc. |
c72af735 RP |
70 | |
71 | Permission is granted to make and distribute verbatim copies of | |
72 | this manual provided the copyright notice and this permission notice | |
73 | are preserved on all copies. | |
74 | ||
75 | Permission is granted to copy and distribute modified versions of this | |
76 | manual under the conditions for verbatim copying, provided also that | |
77 | the entire resulting derived work is distributed under the terms of a | |
78 | permission notice identical to this one. | |
79 | ||
80 | Permission is granted to copy and distribute translations of this manual | |
81 | into another language, under the above conditions for modified versions. | |
82 | @end titlepage | |
83 | ||
84 | @node Top, ar, (dir), (dir) | |
85 | @chapter Introduction | |
86 | ||
87 | @cindex version | |
88 | This brief manual contains preliminary documentation for the GNU binary | |
b6216af2 | 89 | utilities (collectively version 2.2): |
8b2c2275 RP |
90 | |
91 | @iftex | |
c72af735 RP |
92 | @table @code |
93 | @item ar | |
94 | Create, modify, and extract from archives | |
95 | ||
96 | @item nm | |
97 | List symbols from object files | |
98 | ||
eed5eeab DM |
99 | @item objcopy |
100 | Copy and translate object files | |
101 | ||
c72af735 RP |
102 | @item objdump |
103 | Display information from object files | |
104 | ||
105 | @item ranlib | |
106 | Generate index to archive contents | |
107 | ||
108 | @item size | |
109 | List section sizes and total size | |
110 | ||
ba7c8e29 DM |
111 | @item strings |
112 | List printable strings from files | |
113 | ||
c72af735 RP |
114 | @item strip |
115 | Discard symbols | |
116 | @end table | |
8b2c2275 | 117 | @end iftex |
c72af735 RP |
118 | |
119 | @menu | |
8b2c2275 RP |
120 | * ar:: Create, modify, and extract from archives |
121 | * ld:(ld)Overview. Combine object and archive files | |
122 | * nm:: List symbols from object files | |
eed5eeab | 123 | * objcopy:: Copy and translate object files |
8b2c2275 RP |
124 | * objdump:: Display information from object files |
125 | * ranlib:: Generate index to archive contents | |
126 | * size:: List section sizes and total size | |
ba7c8e29 | 127 | * strings:: List printable strings from files |
8b2c2275 | 128 | * strip:: Discard symbols |
b6216af2 | 129 | * c++filt:: Filter to demangle encoded C++ symbols |
94e9ad77 | 130 | * nlmconv:: Converts object code into an NLM |
8b2c2275 | 131 | * Index:: |
c72af735 RP |
132 | @end menu |
133 | ||
eed5eeab | 134 | @node ar, nm, Top, Top |
c72af735 RP |
135 | @chapter ar |
136 | ||
137 | @kindex ar | |
138 | @cindex archives | |
139 | @cindex collections of files | |
140 | @smallexample | |
650a49f0 | 141 | ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}] |
4d9b5d5a | 142 | ar -M [ <mri-script ] |
c72af735 RP |
143 | @end smallexample |
144 | ||
145 | The GNU @code{ar} program creates, modifies, and extracts from | |
146 | archives. An @dfn{archive} is a single file holding a collection of | |
147 | other files in a structure that makes it possible to retrieve | |
148 | the original individual files (called @dfn{members} of the archive). | |
149 | ||
150 | The original files' contents, mode (permissions), timestamp, owner, and | |
ec40bbb8 | 151 | group are preserved in the archive, and can be restored on |
c72af735 RP |
152 | extraction. |
153 | ||
154 | @cindex name length | |
155 | GNU @code{ar} can maintain archives whose members have names of any | |
156 | length; however, depending on how @code{ar} is configured on your | |
ec40bbb8 DM |
157 | system, a limit on member-name length may be imposed for compatibility |
158 | with archive formats maintained with other tools. If it exists, the | |
c72af735 RP |
159 | limit is often 15 characters (typical of formats related to a.out) or 16 |
160 | characters (typical of formats related to coff). | |
161 | ||
162 | @cindex libraries | |
163 | @code{ar} is considered a binary utility because archives of this sort | |
164 | are most often used as @dfn{libraries} holding commonly needed | |
165 | subroutines. | |
166 | ||
167 | @cindex symbol index | |
e31e9a8d | 168 | @code{ar} creates an index to the symbols defined in relocatable |
c72af735 RP |
169 | object modules in the archive when you specify the modifier @samp{s}. |
170 | Once created, this index is updated in the archive whenever @code{ar} | |
171 | makes a change to its contents (save for the @samp{q} update operation). | |
172 | An archive with such an index speeds up linking to the library, and | |
173 | allows routines in the library to call each other without regard to | |
174 | their placement in the archive. | |
175 | ||
918c2f61 | 176 | You may use @samp{nm -s} or @samp{nm --print-armap} to list this index |
c72af735 RP |
177 | table. If an archive lacks the table, another form of @code{ar} called |
178 | @code{ranlib} can be used to add just the table. | |
179 | ||
765a273f RP |
180 | @cindex compatibility, @code{ar} |
181 | @cindex @code{ar} compatibility | |
182 | GNU @code{ar} is designed to be compatible with two different | |
183 | facilities. You can control its activity using command-line options, | |
184 | like the different varieties of @code{ar} on Unix systems; or, if you | |
185 | specify the single command-line option @samp{-M}, you can control it | |
186 | with a script supplied via standard input, like the MRI ``librarian'' | |
187 | program. | |
188 | ||
189 | @menu | |
190 | * ar-cmdline:: Controlling @code{ar} on the command line | |
191 | * ar-scripts:: Controlling @code{ar} with a script | |
192 | @end menu | |
193 | ||
194 | @page | |
195 | @node ar-cmdline, ar-scripts, ar, ar | |
196 | @section Controlling @code{ar} on the command line | |
197 | ||
198 | @smallexample | |
650a49f0 | 199 | ar [-]@var{p}[@var{mod} [@var{relpos}]] @var{archive} [@var{member}@dots{}] |
765a273f RP |
200 | @end smallexample |
201 | ||
202 | @cindex Unix compatibility, @code{ar} | |
203 | When you use @code{ar} in the Unix style, @code{ar} insists on at least two | |
204 | arguments to execute: one keyletter specifying the @emph{operation} | |
205 | (optionally accompanied by other keyletters specifying | |
206 | @emph{modifiers}), and the archive name to act on. | |
c72af735 | 207 | |
650a49f0 | 208 | Most operations can also accept further @var{member} arguments, |
c72af735 RP |
209 | specifying particular files to operate on. |
210 | ||
211 | GNU @code{ar} allows you to mix the operation code @var{p} and modifier | |
212 | flags @var{mod} in any order, within the first command-line argument. | |
213 | ||
214 | If you wish, you may begin the first command-line argument with a | |
215 | dash. | |
216 | ||
217 | @cindex operations on archive | |
218 | The @var{p} keyletter specifies what operation to execute; it may be | |
219 | any of the following, but you must specify only one of them: | |
220 | ||
221 | @table @code | |
222 | @item d | |
223 | @cindex deleting from archive | |
224 | @emph{Delete} modules from the archive. Specify the names of modules to | |
650a49f0 | 225 | be deleted as @var{member}@dots{}; the archive is untouched if you |
c72af735 RP |
226 | specify no files to delete. |
227 | ||
e31e9a8d | 228 | If you specify the @samp{v} modifier, @code{ar} lists each module |
c72af735 RP |
229 | as it is deleted. |
230 | ||
231 | @item m | |
232 | @cindex moving in archive | |
233 | Use this operation to @emph{move} members in an archive. | |
234 | ||
235 | The ordering of members in an archive can make a difference in how | |
236 | programs are linked using the library, if a symbol is defined in more | |
237 | than one member. | |
238 | ||
239 | If no modifiers are used with @code{m}, any members you name in the | |
650a49f0 | 240 | @var{member} arguments are moved to the @emph{end} of the archive; |
c72af735 RP |
241 | you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a |
242 | specified place instead. | |
243 | ||
244 | @item p | |
245 | @cindex printing from archive | |
246 | @emph{Print} the specified members of the archive, to the standard | |
247 | output file. If the @samp{v} modifier is specified, show the member | |
248 | name before copying its contents to standard output. | |
249 | ||
650a49f0 | 250 | If you specify no @var{member} arguments, all the files in the archive are |
ec40bbb8 | 251 | printed. |
c72af735 RP |
252 | |
253 | @item q | |
254 | @cindex quick append to archive | |
650a49f0 | 255 | @emph{Quick append}; add the files @var{member}@dots{} to the end of |
ec40bbb8 | 256 | @var{archive}, without checking for replacement. |
c72af735 RP |
257 | |
258 | The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this | |
259 | operation; new members are always placed at the end of the archive. | |
260 | ||
261 | The modifier @samp{v} makes @code{ar} list each file as it is appended. | |
262 | ||
263 | Since the point of this operation is speed, the archive's symbol table | |
264 | index is not updated, even if it already existed; you can use @samp{ar s} or | |
265 | @code{ranlib} explicitly to update the symbol table index. | |
266 | ||
267 | @item r | |
268 | @cindex replacement in archive | |
650a49f0 | 269 | Insert the files @var{member}@dots{} into @var{archive} (with |
ec40bbb8 DM |
270 | @emph{replacement}). This operation differs from @samp{q} in that any |
271 | previously existing members are deleted if their names match those being | |
272 | added. | |
c72af735 | 273 | |
650a49f0 | 274 | If one of the files named in @var{member}@dots{} does not exist, @code{ar} |
c72af735 RP |
275 | displays an error message, and leaves undisturbed any existing members |
276 | of the archive matching that name. | |
277 | ||
278 | By default, new members are added at the end of the file; but you may | |
279 | use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request | |
280 | placement relative to some existing member. | |
281 | ||
282 | The modifier @samp{v} used with this operation elicits a line of | |
283 | output for each file inserted, along with one of the letters @samp{a} or | |
284 | @samp{r} to indicate whether the file was appended (no old member | |
285 | deleted) or replaced. | |
286 | ||
287 | @item t | |
288 | @cindex contents of archive | |
289 | Display a @emph{table} listing the contents of @var{archive}, or those | |
650a49f0 | 290 | of the files listed in @var{member}@dots{} that are present in the |
c72af735 RP |
291 | archive. Normally only the member name is shown; if you also want to |
292 | see the modes (permissions), timestamp, owner, group, and size, you can | |
293 | request that by also specifying the @samp{v} modifier. | |
294 | ||
650a49f0 | 295 | If you do not specify a @var{member}, all files in the archive |
c72af735 RP |
296 | are listed. |
297 | ||
298 | @cindex repeated names in archive | |
299 | @cindex name duplication in archive | |
300 | If there is more than one file with the same name (say, @samp{fie}) in | |
e31e9a8d | 301 | an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the |
c72af735 RP |
302 | first instance; to see them all, you must ask for a complete |
303 | listing---in our example, @samp{ar t b.a}. | |
304 | @c WRS only; per Gumby, this is implementation-dependent, and in a more | |
305 | @c recent case in fact works the other way. | |
306 | ||
307 | @item x | |
308 | @cindex extract from archive | |
650a49f0 | 309 | @emph{Extract} members (named @var{member}) from the archive. You can |
c72af735 RP |
310 | use the @samp{v} modifier with this operation, to request that |
311 | @code{ar} list each name as it extracts it. | |
312 | ||
650a49f0 | 313 | If you do not specify a @var{member}, all files in the archive |
c72af735 RP |
314 | are extracted. |
315 | ||
316 | @end table | |
317 | ||
318 | A number of modifiers (@var{mod}) may immediately follow the @var{p} | |
319 | keyletter, to specify variations on an operation's behavior: | |
320 | ||
321 | @table @code | |
322 | @item a | |
323 | @cindex relative placement in archive | |
324 | Add new files @emph{after} an existing member of the | |
ec40bbb8 | 325 | archive. If you use the modifier @samp{a}, the name of an existing archive |
650a49f0 | 326 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
327 | @var{archive} specification. |
328 | ||
329 | @item b | |
330 | Add new files @emph{before} an existing member of the | |
ec40bbb8 | 331 | archive. If you use the modifier @samp{b}, the name of an existing archive |
650a49f0 | 332 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
333 | @var{archive} specification. (same as @samp{i}). |
334 | ||
335 | @item c | |
336 | @cindex creating archives | |
337 | @emph{Create} the archive. The specified @var{archive} is always | |
650a49f0 | 338 | created if it did not exist, when you request an update. But a warning is |
c72af735 RP |
339 | issued unless you specify in advance that you expect to create it, by |
340 | using this modifier. | |
341 | ||
342 | @item i | |
343 | Insert new files @emph{before} an existing member of the | |
ec40bbb8 | 344 | archive. If you use the modifier @samp{i}, the name of an existing archive |
650a49f0 | 345 | member must be present as the @var{relpos} argument, before the |
c72af735 RP |
346 | @var{archive} specification. (same as @samp{b}). |
347 | ||
348 | @item l | |
349 | This modifier is accepted but not used. | |
350 | @c whaffor ar l modifier??? presumably compat; with | |
351 | @c what???---pesch@@cygnus.com, 25jan91 | |
352 | ||
353 | @item o | |
354 | @cindex dates in archive | |
355 | Preserve the @emph{original} dates of members when extracting them. If | |
356 | you do not specify this modifier, files extracted from the archive | |
e31e9a8d | 357 | are stamped with the time of extraction. |
c72af735 RP |
358 | |
359 | @item s | |
360 | @cindex writing archive index | |
361 | Write an object-file index into the archive, or update an existing one, | |
362 | even if no other change is made to the archive. You may use this modifier | |
363 | flag either with any operation, or alone. Running @samp{ar s} on an | |
364 | archive is equivalent to running @samp{ranlib} on it. | |
365 | ||
366 | @item u | |
367 | @cindex updating an archive | |
b703c078 | 368 | Normally, @samp{ar r}@dots{} inserts all files |
c72af735 RP |
369 | listed into the archive. If you would like to insert @emph{only} those |
370 | of the files you list that are newer than existing members of the same | |
371 | names, use this modifier. The @samp{u} modifier is allowed only for the | |
372 | operation @samp{r} (replace). In particular, the combination @samp{qu} is | |
373 | not allowed, since checking the timestamps would lose any speed | |
374 | advantage from the operation @samp{q}. | |
375 | ||
376 | @item v | |
377 | This modifier requests the @emph{verbose} version of an operation. Many | |
378 | operations display additional information, such as filenames processed, | |
379 | when the modifier @samp{v} is appended. | |
4d9b5d5a DM |
380 | |
381 | @item V | |
382 | This modifier shows the version number of @code{ar}. | |
765a273f RP |
383 | @end table |
384 | ||
385 | @node ar-scripts, , ar-cmdline, ar | |
386 | @section Controlling @code{ar} with a script | |
387 | ||
388 | @smallexample | |
389 | ar -M [ <@var{script} ] | |
390 | @end smallexample | |
391 | ||
392 | @cindex MRI compatibility, @code{ar} | |
393 | @cindex scripts, @code{ar} | |
394 | If you use the single command-line option @samp{-M} with @code{ar}, you | |
395 | can control its operation with a rudimentary command language. This | |
e31e9a8d | 396 | form of @code{ar} operates interactively if standard input is coming |
765a273f RP |
397 | directly from a terminal. During interactive use, @code{ar} prompts for |
398 | input (the prompt is @samp{AR >}), and continues executing even after | |
399 | errors. If you redirect standard input to a script file, no prompts are | |
e31e9a8d | 400 | issued, and @code{ar} abandons execution (with a nonzero exit code) |
765a273f RP |
401 | on any error. |
402 | ||
403 | The @code{ar} command language is @emph{not} designed to be equivalent | |
404 | to the command-line options; in fact, it provides somewhat less control | |
405 | over archives. The only purpose of the command language is to ease the | |
406 | transition to GNU @code{ar} for developers who already have scripts | |
407 | written for the MRI ``librarian'' program. | |
408 | ||
409 | The syntax for the @code{ar} command language is straightforward: | |
410 | @itemize @bullet | |
411 | @item | |
412 | commands are recognized in upper or lower case; for example, @code{LIST} | |
413 | is the same as @code{list}. In the following descriptions, commands are | |
414 | shown in upper case for clarity. | |
415 | ||
416 | @item | |
417 | a single command may appear on each line; it is the first word on the | |
418 | line. | |
419 | ||
420 | @item | |
421 | empty lines are allowed, and have no effect. | |
422 | ||
423 | @item | |
424 | comments are allowed; text after either of the characters @samp{*} | |
425 | or @samp{;} is ignored. | |
426 | ||
427 | @item | |
428 | Whenever you use a list of names as part of the argument to an @code{ar} | |
429 | command, you can separate the individual names with either commas or | |
430 | blanks. Commas are shown in the explanations below, for clarity. | |
431 | ||
432 | @item | |
433 | @samp{+} is used as a line continuation character; if @samp{+} appears | |
434 | at the end of a line, the text on the following line is considered part | |
435 | of the current command. | |
436 | @end itemize | |
437 | ||
438 | Here are the commands you can use in @code{ar} scripts, or when using | |
439 | @code{ar} interactively. Three of them have special significance: | |
440 | ||
441 | @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is | |
442 | a temporary file required for most of the other commands. | |
443 | ||
444 | @code{SAVE} commits the changes so far specified by the script. Prior | |
445 | to @code{SAVE}, commands affect only the temporary copy of the current | |
446 | archive. | |
447 | ||
448 | @table @code | |
449 | @item ADDLIB @var{archive} | |
450 | @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module}) | |
451 | Add all the contents of @var{archive} (or, if specified, each named | |
452 | @var{module} from @var{archive}) to the current archive. | |
453 | ||
454 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
455 | ||
650a49f0 | 456 | @item ADDMOD @var{member}, @var{member}, @dots{} @var{member} |
765a273f RP |
457 | @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}" |
458 | @c else like "ar q..." | |
650a49f0 | 459 | Add each named @var{member} as a module in the current archive. |
765a273f RP |
460 | |
461 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
462 | ||
463 | @item CLEAR | |
464 | Discard the contents of the current archive, cancelling the effect of | |
465 | any operations since the last @code{SAVE}. May be executed (with no | |
466 | effect) even if no current archive is specified. | |
467 | ||
468 | @item CREATE @var{archive} | |
469 | Creates an archive, and makes it the current archive (required for many | |
470 | other commands). The new archive is created with a temporary name; it | |
471 | is not actually saved as @var{archive} until you use @code{SAVE}. | |
472 | You can overwrite existing archives; similarly, the contents of any | |
473 | existing file named @var{archive} will not be destroyed until @code{SAVE}. | |
474 | ||
475 | @item DELETE @var{module}, @var{module}, @dots{} @var{module} | |
476 | Delete each listed @var{module} from the current archive; equivalent to | |
477 | @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}. | |
478 | ||
479 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
480 | ||
481 | @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) | |
482 | @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile} | |
483 | List each named @var{module} present in @var{archive}. The separate | |
484 | command @code{VERBOSE} specifies the form of the output: when verbose | |
485 | output is off, output is like that of @samp{ar -t @var{archive} | |
b703c078 DM |
486 | @var{module}@dots{}}. When verbose output is on, the listing is like |
487 | @samp{ar -tv @var{archive} @var{module}@dots{}}. | |
765a273f RP |
488 | |
489 | Output normally goes to the standard output stream; however, if you | |
490 | specify @var{outputfile} as a final argument, @code{ar} directs the | |
491 | output to that file. | |
492 | ||
493 | @item END | |
494 | Exit from @code{ar}, with a @code{0} exit code to indicate successful | |
495 | completion. This command does not save the output file; if you have | |
496 | changed the current archive since the last @code{SAVE} command, those | |
497 | changes are lost. | |
498 | ||
499 | @item EXTRACT @var{module}, @var{module}, @dots{} @var{module} | |
500 | Extract each named @var{module} from the current archive, writing them | |
501 | into the current directory as separate files. Equivalent to @samp{ar -x | |
b703c078 | 502 | @var{archive} @var{module}@dots{}}. |
765a273f RP |
503 | |
504 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
505 | ||
506 | @ignore | |
507 | @c FIXME Tokens but no commands??? | |
508 | @item FULLDIR | |
509 | ||
510 | @item HELP | |
511 | @end ignore | |
512 | ||
513 | @item LIST | |
514 | Display full contents of the current archive, in ``verbose'' style | |
515 | regardless of the state of @code{VERBOSE}. The effect is like @samp{ar | |
516 | tv @var{archive}}). (This single command is a GNU @code{ld} | |
517 | enhancement, rather than present for MRI compatibility.) | |
518 | ||
519 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
520 | ||
521 | @item OPEN @var{archive} | |
522 | Opens an existing archive for use as the current archive (required for | |
523 | many other commands). Any changes as the result of subsequent commands | |
524 | will not actually affect @var{archive} until you next use @code{SAVE}. | |
525 | ||
526 | @item REPLACE @var{module}, @var{module}, @dots{} @var{module} | |
527 | In the current archive, replace each existing @var{module} (named in | |
528 | the @code{REPLACE} arguments) from files in the current working directory. | |
529 | To execute this command without errors, both the file, and the module in | |
530 | the current archive, must exist. | |
531 | ||
532 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
533 | ||
534 | @item VERBOSE | |
535 | Toggle an internal flag governing the output from @code{DIRECTORY}. | |
536 | When the flag is on, @code{DIRECTORY} output matches output from | |
b703c078 | 537 | @samp{ar -tv }@dots{}. |
765a273f RP |
538 | |
539 | @item SAVE | |
540 | Commit your changes to the current archive, and actually save it as a | |
541 | file with the name specified in the last @code{CREATE} or @code{OPEN} | |
542 | command. | |
543 | ||
544 | Requires prior use of @code{OPEN} or @code{CREATE}. | |
c72af735 RP |
545 | |
546 | @end table | |
547 | ||
8b2c2275 RP |
548 | @iftex |
549 | @node ld | |
c72af735 RP |
550 | @chapter ld |
551 | @cindex linker | |
552 | @kindex ld | |
553 | The GNU linker @code{ld} is now described in a separate manual. | |
27e94bd5 | 554 | @xref{Top,, Overview,, Using LD: the GNU linker}. |
8b2c2275 | 555 | @end iftex |
c72af735 | 556 | |
eed5eeab | 557 | @node nm, objcopy, ar, Top |
c72af735 RP |
558 | @chapter nm |
559 | @cindex symbols | |
560 | @kindex nm | |
561 | ||
562 | @smallexample | |
d6a4c375 DM |
563 | nm [ -a | --debug-syms ] [ -g | --extern-only ] |
564 | [ -B ] [ -C | --demangle ] | |
6cfbdb50 DM |
565 | [ -s | --print-armap ] [ -A | -o | --print-file-name ] |
566 | [ -n | -v | --numeric-sort ] [ -p | --no-sort ] | |
4d9b5d5a | 567 | [ -r | --reverse-sort ] [ -u | --undefined-only ] |
6cfbdb50 DM |
568 | [ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ] |
569 | [ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ] | |
b26ac613 | 570 | [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ] |
c72af735 RP |
571 | @end smallexample |
572 | ||
b703c078 | 573 | GNU @code{nm} lists the symbols from object files @var{objfile}@dots{}. |
6cfbdb50 DM |
574 | If no object files are listed as arguments, @code{nm} assumes |
575 | @file{a.out}. | |
576 | ||
577 | For each symbol, @code{nm} shows: | |
578 | ||
579 | @itemize @bullet | |
580 | @item | |
581 | The symbol value, in the radix selected by options (see below), or | |
582 | hexadecimal by default. | |
583 | ||
584 | @item | |
585 | The symbol type. At least the following types are used; others are, as | |
586 | well, depending on the object file format. If lowercase, the symbol is | |
587 | local; if uppercase, the symbol is global (external). | |
588 | ||
589 | @c Some more detail on exactly what these symbol types are used for | |
590 | @c would be nice. | |
591 | @table @code | |
592 | @item A | |
593 | Absolute. | |
594 | ||
595 | @item B | |
596 | BSS (uninitialized data). | |
597 | ||
598 | @item C | |
599 | Common. | |
600 | ||
601 | @item D | |
602 | Initialized data. | |
603 | ||
604 | @item I | |
605 | Indirect reference. | |
606 | ||
607 | @item T | |
608 | Text (program code). | |
609 | ||
610 | @item U | |
611 | Undefined. | |
612 | @end table | |
613 | ||
614 | @item | |
615 | The symbol name. | |
616 | @end itemize | |
c72af735 RP |
617 | |
618 | The long and short forms of options, shown here as alternatives, are | |
619 | equivalent. | |
620 | ||
621 | @table @code | |
6cfbdb50 DM |
622 | @item -A |
623 | @itemx -o | |
624 | @itemx --print-file-name | |
625 | @cindex input file name | |
626 | @cindex file name | |
627 | @cindex source file name | |
628 | Precede each symbol by the name of the input file (or archive element) | |
629 | in which it was found, rather than identifying the input file once only, | |
630 | before all of its symbols. | |
c72af735 RP |
631 | |
632 | @item -a | |
918c2f61 | 633 | @itemx --debug-syms |
c72af735 | 634 | @cindex debugging symbols |
6cfbdb50 DM |
635 | Display all symbols, even debugger-only symbols; normally these are not |
636 | listed. | |
637 | ||
68dd5295 DM |
638 | @item -B |
639 | @cindex @code{nm} format | |
640 | @cindex @code{nm} compatibility | |
d6a4c375 DM |
641 | The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}). |
642 | ||
643 | @item -C | |
644 | @itemx --demangle | |
645 | @cindex demangling C++ symbols | |
646 | Decode (@dfn{demangle}) low-level symbol names into user-level names. | |
647 | Besides removing any initial underscore prepended by the system, this | |
648 | makes C++ function names readable. @xref{c++filt}, for more information | |
649 | on demangling. | |
68dd5295 | 650 | |
6cfbdb50 DM |
651 | @item -f @var{format} |
652 | @itemx --format=@var{format} | |
68dd5295 DM |
653 | @cindex @code{nm} format |
654 | @cindex @code{nm} compatibility | |
6cfbdb50 DM |
655 | Use the output format @var{format}, which can be @code{bsd}, |
656 | @code{sysv}, or @code{posix}. The default is @code{bsd}. | |
b26ac613 | 657 | Only the first character of @var{format} is significant; it can be |
6cfbdb50 | 658 | either upper or lower case. |
c72af735 RP |
659 | |
660 | @item -g | |
918c2f61 | 661 | @itemx --extern-only |
c72af735 RP |
662 | @cindex external symbols |
663 | Display only external symbols. | |
664 | ||
b26ac613 DM |
665 | @item -n |
666 | @itemx -v | |
667 | @itemx --numeric-sort | |
668 | Sort symbols numerically by their addresses, rather than alphabetically | |
669 | by their names. | |
670 | ||
c72af735 | 671 | @item -p |
918c2f61 | 672 | @itemx --no-sort |
c72af735 | 673 | @cindex sorting symbols |
650a49f0 | 674 | Do not bother to sort the symbols in any order; print them in the order |
6cfbdb50 DM |
675 | encountered. |
676 | ||
677 | @item -P | |
678 | @itemx --portability | |
679 | Use the POSIX.2 standard output format instead of the default format. | |
680 | Equivalent to @samp{-f posix}. | |
c72af735 | 681 | |
c72af735 | 682 | @item -s |
918c2f61 | 683 | @itemx --print-armap |
c72af735 RP |
684 | @cindex symbol index, listing |
685 | When listing symbols from archive members, include the index: a mapping | |
ec40bbb8 DM |
686 | (stored in the archive by @code{ar} or @code{ranlib}) of which modules |
687 | contain definitions for which names. | |
c72af735 | 688 | |
c72af735 | 689 | @item -r |
918c2f61 | 690 | @itemx --reverse-sort |
ec40bbb8 | 691 | Reverse the order of the sort (whether numeric or alphabetic); let the |
c72af735 RP |
692 | last come first. |
693 | ||
6cfbdb50 DM |
694 | @item -t @var{radix} |
695 | @itemx --radix=@var{radix} | |
696 | Use @var{radix} as the radix for printing the symbol values. It must be | |
697 | @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal. | |
698 | ||
ec40bbb8 | 699 | @item --target=@var{bfdname} |
c72af735 RP |
700 | @cindex object code format |
701 | Specify an object code format other than your system's default format. | |
702 | @xref{objdump}, for information on listing available formats. | |
c72af735 RP |
703 | |
704 | @item -u | |
918c2f61 | 705 | @itemx --undefined-only |
c72af735 RP |
706 | @cindex external symbols |
707 | @cindex undefined symbols | |
708 | Display only undefined symbols (those external to each object file). | |
709 | ||
6cfbdb50 DM |
710 | @item -V |
711 | @itemx --version | |
b26ac613 DM |
712 | Show the version number of @code{nm} and exit. |
713 | ||
714 | @item --help | |
715 | Show a summary of the options to @code{nm} and exit. | |
c72af735 RP |
716 | @end table |
717 | ||
eed5eeab DM |
718 | @node objcopy, objdump, nm, Top |
719 | @chapter objcopy | |
720 | ||
721 | @smallexample | |
722 | objcopy [ -F @var{format} | --format=@var{format} ] | |
723 | [ -I @var{format} | --input-format=@var{format} ] | |
724 | [ -O @var{format} | --output-format=@var{format} ] | |
725 | [ -S | --strip-all ] [ -g | --strip-debug ] | |
726 | [ -x | --discard-all ] [ -X | --discard-locals ] | |
727 | [ -v | --verbose ] [ -V | --version ] [ --help ] | |
728 | @var{infile} [@var{outfile}] | |
729 | @end smallexample | |
730 | ||
731 | The GNU @code{objcopy} utility copies the contents of an object file to | |
732 | another. @code{objcopy} uses the GNU BFD Library to read and write the | |
733 | object files. It can write the destination object file in a format | |
734 | different from that of the source object file. The exact behavior of | |
735 | @code{objcopy} is controlled by command-line options. | |
736 | ||
737 | @code{objcopy} creates temporary files to do its translations and | |
738 | deletes them afterward. @code{objcopy} uses BFD to do all its | |
739 | translation work; it knows about all the formats BFD knows about, and | |
740 | thus is able to recognize most formats without being told explicitly. | |
741 | @xref{BFD,,BFD,ld.info,Using LD, the GNU linker}. | |
742 | ||
743 | @table @code | |
744 | @item @var{infile} | |
745 | @itemx @var{outfile} | |
746 | The source and output files respectively. | |
747 | If you do not specify @var{outfile}, @code{objcopy} creates a | |
748 | temporary file and destructively renames the result with | |
749 | the name of the input file. | |
750 | ||
751 | @item -I @var{format} | |
752 | @itemx --input-format=@var{format} | |
753 | Consider the source file's object format to be @var{format}, rather than | |
754 | attempting to deduce it. | |
755 | ||
756 | @item -O @var{format} | |
757 | @itemx --output-format=@var{format} | |
758 | Write the output file using the object format @var{format}. | |
759 | ||
760 | @item -F @var{format} | |
761 | @itemx --format=@var{format} | |
762 | Use @var{format} as the object format for both the input and the output | |
763 | file; i.e. simply transfer data from source to destination with no | |
764 | translation. | |
765 | ||
766 | @item -S | |
767 | @itemx --strip-all | |
768 | Do not copy relocation and symbol information from the source file. | |
769 | ||
770 | @item -g | |
771 | @itemx --strip-debug | |
772 | Do not copy debugging symbols from the source file. | |
773 | ||
774 | @item -x | |
775 | @itemx --discard-all | |
776 | Do not copy non-global symbols from the source file. | |
777 | @c FIXME any reason to prefer "non-global" to "local" here? | |
778 | ||
779 | @item -X | |
780 | @itemx --discard-locals | |
781 | Do not copy compiler-generated local symbols. | |
782 | (These usually start with @samp{L} or @samp{.}.) | |
783 | ||
784 | @item -V | |
785 | @itemx --version | |
786 | Show the version number of @code{objcopy}. | |
787 | ||
788 | @item -v | |
789 | @itemx --verbose | |
790 | Verbose output: list all object files modified. In the case of | |
791 | archives, @samp{objcopy -V} lists all members of the archive. | |
792 | ||
793 | @item --help | |
794 | Show a summary of the options to @code{objcopy}. | |
795 | @end table | |
796 | ||
797 | @node objdump, ranlib, objcopy, Top | |
c72af735 RP |
798 | @chapter objdump |
799 | ||
800 | @cindex object file information | |
801 | @kindex objdump | |
802 | ||
803 | @smallexample | |
4d9b5d5a DM |
804 | objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ] |
805 | [ -h | --header ] [ -i ] [ -j @var{section} ] [ -l ] | |
b26ac613 DM |
806 | [ -m @var{machine} ] [ -r | --reloc ] [ -s ] [ --stabs ] |
807 | [ -t | --syms ] [ -x ] [ --version ] [ --help ] | |
4d9b5d5a | 808 | @var{objfile}@dots{} |
c72af735 RP |
809 | @end smallexample |
810 | ||
811 | @code{objdump} displays information about one or more object files. | |
812 | The options control what particular information to display. This | |
813 | information is mostly useful to programmers who are working on the | |
814 | compilation tools, as opposed to programmers who just want their | |
815 | program to compile and work. | |
816 | ||
b26ac613 DM |
817 | @var{objfile}@dots{} are the object files to be examined. When you |
818 | specify archives, @code{objdump} shows information on each of the member | |
819 | object files. | |
820 | ||
c72af735 | 821 | The long and short forms of options, shown here as alternatives, are |
ed78872a | 822 | equivalent. At least one option besides @samp{-l} must be given. |
c72af735 RP |
823 | |
824 | @table @code | |
c72af735 RP |
825 | @item -a |
826 | @c print_arelt_descr | |
827 | @cindex archive headers | |
ec40bbb8 | 828 | If any of the @var{objfile} files are archives, display the archive |
c72af735 RP |
829 | header information (in a format similar to @samp{ls -l}). Besides the |
830 | information you could list with @samp{ar tv}, @samp{objdump -a} shows | |
831 | the object file format of each archive member. | |
832 | ||
c5f0c938 | 833 | @c suggest longname --target or --format or --bfd |
c72af735 RP |
834 | @item -b @var{bfdname} |
835 | @cindex object code format | |
ec40bbb8 DM |
836 | Specify that the object-code format for the object files is |
837 | @var{bfdname}. This option may not be necessary; @var{objdump} can | |
838 | automatically recognize many formats. | |
839 | ||
840 | For example, | |
c72af735 RP |
841 | @example |
842 | objdump -b oasys -m vax -h fu.o | |
843 | @end example | |
844 | @noindent | |
ec40bbb8 DM |
845 | displays summary information from the section headers (@samp{-h}) of |
846 | @file{fu.o}, which is explicitly identified (@samp{-m}) as a VAX object | |
c72af735 RP |
847 | file in the format produced by Oasys compilers. You can list the |
848 | formats available with the @samp{-i} option. | |
849 | ||
850 | @item -d | |
851 | @cindex disassembling object code | |
852 | @cindex machine instructions | |
853 | Disassemble. Display the assembler mnemonics for the machine | |
ec40bbb8 | 854 | instructions from @var{objfile}. |
c72af735 RP |
855 | |
856 | @item -f | |
857 | @cindex object file header | |
858 | File header. Display summary information from the overall header of | |
ec40bbb8 | 859 | each of the @var{objfile} files. |
c72af735 RP |
860 | |
861 | @item -h | |
c5f0c938 | 862 | @itemx --header |
c72af735 RP |
863 | @cindex section headers |
864 | Header. Display summary information from the section headers of the | |
865 | object file. | |
866 | ||
b26ac613 DM |
867 | @item --help |
868 | Print a summary of the options to @code{objdump} and exit. | |
869 | ||
c72af735 RP |
870 | @item -i |
871 | @cindex architectures available | |
872 | @cindex object formats available | |
873 | Display a list showing all architectures and object formats available | |
ec40bbb8 | 874 | for specification with @samp{-b} or @samp{-m}. |
c72af735 | 875 | |
c5f0c938 | 876 | @c suggest longname --section |
c72af735 RP |
877 | @item -j @var{name} |
878 | @cindex section information | |
ec40bbb8 | 879 | Display information only for section @var{name}. |
c72af735 | 880 | |
c5f0c938 | 881 | @c suggest longname --label or --linespec |
c72af735 RP |
882 | @item -l |
883 | @cindex source filenames for object files | |
884 | Label the display (using debugging information) with the source filename | |
885 | and line numbers corresponding to the object code shown. | |
886 | ||
c5f0c938 | 887 | @c suggest longname --architecture |
c72af735 RP |
888 | @item -m @var{machine} |
889 | @cindex architecture | |
ec40bbb8 | 890 | Specify that the object files @var{objfile} are for architecture |
c72af735 RP |
891 | @var{machine}. You can list available architectures using the @samp{-i} |
892 | option. | |
893 | ||
894 | @item -r | |
c5f0c938 | 895 | @itemx --reloc |
c72af735 RP |
896 | @cindex relocation entries, in object file |
897 | Relocation. Print the relocation entries of the file. | |
898 | ||
899 | @item -s | |
900 | @cindex sections, full contents | |
901 | @cindex object file sections | |
902 | Display the full contents of any sections requested. | |
903 | ||
c5f0c938 JG |
904 | @item --stabs |
905 | @cindex stab | |
906 | @cindex .stab | |
907 | @cindex debug symbols | |
908 | @cindex ELF object file format | |
c3c93fda JG |
909 | Display the full contents of any sections requested. Display the |
910 | contents of the .stab and .stab.index and .stab.excl sections from an | |
911 | ELF file. This is only useful on systems (such as Solaris 2.0) in which | |
912 | @code{.stab} debugging symbol-table entries are carried in an ELF | |
913 | section. In most other file formats, debugging symbol-table entries are | |
c5f0c938 JG |
914 | interleaved with linkage symbols, and are visible in the @samp{--syms} |
915 | output. | |
916 | ||
c72af735 | 917 | @item -t |
c5f0c938 | 918 | @itemx --syms |
c72af735 RP |
919 | @cindex symbol table entries, printing |
920 | Symbol Table. Print the symbol table entries of the file. | |
921 | This is similar to the information provided by the @samp{nm} program. | |
922 | ||
b26ac613 DM |
923 | @item --version |
924 | Print the version number of @code{objdump} and exit. | |
925 | ||
c72af735 RP |
926 | @item -x |
927 | @cindex all header information, object file | |
928 | @cindex header information, all | |
929 | Display all available header information, including the symbol table and | |
930 | relocation entries. Using @samp{-x} is equivalent to specifying all of | |
931 | @samp{-a -f -h -r -t}. | |
c72af735 RP |
932 | @end table |
933 | ||
934 | @node ranlib, size, objdump, Top | |
935 | @chapter ranlib | |
936 | ||
937 | @kindex ranlib | |
938 | @cindex archive contents | |
939 | @cindex symbol index | |
940 | ||
941 | @smallexample | |
4d9b5d5a | 942 | ranlib [-vV] @var{archive} |
c72af735 RP |
943 | @end smallexample |
944 | ||
ec40bbb8 | 945 | @code{ranlib} generates an index to the contents of an archive and |
c72af735 RP |
946 | stores it in the archive. The index lists each symbol defined by a |
947 | member of an archive that is a relocatable object file. | |
948 | ||
918c2f61 | 949 | You may use @samp{nm -s} or @samp{nm --print-armap} to list this index. |
c72af735 | 950 | |
ec40bbb8 | 951 | An archive with such an index speeds up linking to the library and |
c72af735 RP |
952 | allows routines in the library to call each other without regard to |
953 | their placement in the archive. | |
954 | ||
955 | The GNU @code{ranlib} program is another form of GNU @code{ar}; running | |
956 | @code{ranlib} is completely equivalent to executing @samp{ar -s}. | |
957 | @xref{ar}. | |
958 | ||
4d9b5d5a DM |
959 | @table @code |
960 | @item -v | |
961 | @itemx -V | |
962 | Show the version number of @code{ranlib}. | |
c3f471a4 | 963 | @end table |
4d9b5d5a | 964 | |
ba7c8e29 | 965 | @node size, strings, ranlib, Top |
c72af735 RP |
966 | @chapter size |
967 | ||
968 | @kindex size | |
969 | @cindex section sizes | |
970 | ||
971 | @smallexample | |
4d9b5d5a DM |
972 | size [ -A | -B | --format=@var{compatibility} ] |
973 | [ --help ] [ -d | -o | -x | --radix=@var{number} ] | |
974 | [ --target=@var{bfdname} ] [ -V | --version ] | |
975 | @var{objfile}@dots{} | |
c72af735 RP |
976 | @end smallexample |
977 | ||
978 | The GNU @code{size} utility lists the section sizes---and the total | |
ec40bbb8 DM |
979 | size---for each of the object or archive files @var{objfile} in its |
980 | argument list. By default, one line of output is generated for each | |
981 | object file or each module in an archive. | |
c72af735 | 982 | |
b26ac613 DM |
983 | @var{objfile}@dots{} are the object files to be examined. |
984 | ||
c72af735 | 985 | The command line options have the following meanings: |
c72af735 | 986 | |
b26ac613 | 987 | @table @code |
c72af735 RP |
988 | @item -A |
989 | @itemx -B | |
ec40bbb8 | 990 | @itemx --format=@var{compatibility} |
68dd5295 | 991 | @cindex @code{size} display format |
c72af735 RP |
992 | Using one of these options, you can choose whether the output from GNU |
993 | @code{size} resembles output from System V @code{size} (using @samp{-A}, | |
ec40bbb8 DM |
994 | or @samp{--format=sysv}), or Berkeley @code{size} (using @samp{-B}, or |
995 | @samp{--format=berkeley}). The default is the one-line format similar to | |
c72af735 | 996 | Berkeley's. |
918c2f61 PB |
997 | @c Bonus for doc-source readers: you can also say --format=strange (or |
998 | @c anything else that starts with 's') for sysv, and --format=boring (or | |
c72af735 RP |
999 | @c anything else that starts with 'b') for Berkeley. |
1000 | ||
1001 | Here is an example of the Berkeley (default) format of output from | |
1002 | @code{size}: | |
1003 | @smallexample | |
4d9b5d5a | 1004 | size --format Berkeley ranlib size |
c72af735 RP |
1005 | text data bss dec hex filename |
1006 | 294880 81920 11592 388392 5ed28 ranlib | |
1007 | 294880 81920 11888 388688 5ee50 size | |
1008 | @end smallexample | |
1009 | ||
1010 | @noindent | |
1011 | This is the same data, but displayed closer to System V conventions: | |
1012 | ||
1013 | @smallexample | |
4d9b5d5a | 1014 | size --format SysV ranlib size |
c72af735 RP |
1015 | ranlib : |
1016 | section size addr | |
1017 | .text 294880 8192 | |
1018 | .data 81920 303104 | |
1019 | .bss 11592 385024 | |
1020 | Total 388392 | |
1021 | ||
1022 | ||
1023 | size : | |
1024 | section size addr | |
1025 | .text 294880 8192 | |
1026 | .data 81920 303104 | |
1027 | .bss 11888 385024 | |
1028 | Total 388688 | |
1029 | @end smallexample | |
1030 | ||
918c2f61 | 1031 | @item --help |
c72af735 RP |
1032 | Show a summary of acceptable arguments and options. |
1033 | ||
1034 | @item -d | |
1035 | @itemx -o | |
1036 | @itemx -x | |
ec40bbb8 | 1037 | @itemx --radix=@var{number} |
68dd5295 | 1038 | @cindex @code{size} number format |
c72af735 RP |
1039 | @cindex radix for section sizes |
1040 | Using one of these options, you can control whether the size of each | |
ec40bbb8 DM |
1041 | section is given in decimal (@samp{-d}, or @samp{--radix=10}); octal |
1042 | (@samp{-o}, or @samp{--radix=8}); or hexadecimal (@samp{-x}, or | |
1043 | @samp{--radix=16}). In @samp{--radix=@var{number}}, only the three | |
c72af735 RP |
1044 | values (8, 10, 16) are supported. The total size is always given in two |
1045 | radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or | |
1046 | octal and hexadecimal if you're using @samp{-o}. | |
1047 | ||
ec40bbb8 | 1048 | @item --target=@var{bfdname} |
c72af735 | 1049 | @cindex object code format |
ec40bbb8 DM |
1050 | Specify that the object-code format for @var{objfile} is |
1051 | @var{bfdname}. This option may not be necessary; @code{size} can | |
c72af735 RP |
1052 | automatically recognize many formats. @xref{objdump}, for information |
1053 | on listing available formats. | |
1054 | ||
1055 | @item -V | |
918c2f61 | 1056 | @itemx --version |
4d9b5d5a | 1057 | Display the version number of @code{size}. |
c72af735 RP |
1058 | @end table |
1059 | ||
ba7c8e29 DM |
1060 | @node strings, strip, size, Top |
1061 | @chapter strings | |
1062 | @kindex strings | |
1063 | @cindex listings strings | |
1064 | @cindex printing strings | |
1065 | @cindex strings, printing | |
1066 | ||
1067 | @smallexample | |
b26ac613 | 1068 | strings [-afov] [-@var{min-len}] [-n @var{min-len}] [-t @var{radix}] [-] |
650a49f0 RP |
1069 | [--all] [--print-file-name] [--bytes=@var{min-len}] |
1070 | [--radix=@var{radix}] [--help] [--version] @var{file}@dots{} | |
ba7c8e29 DM |
1071 | @end smallexample |
1072 | ||
1073 | For each @var{file} given, GNU @code{strings} prints the printable | |
1074 | character sequences that are at least 4 characters long (or the number | |
1075 | given with the options below) and are followed by a NUL or newline | |
1076 | character. By default, it only prints the strings from the initialized | |
1077 | data sections of object files; for other types of files, it prints the | |
1078 | strings from the whole file. | |
1079 | ||
1080 | @code{strings} is mainly useful for determining the contents of non-text | |
1081 | files. | |
1082 | ||
1083 | @table @code | |
1084 | @item -a | |
1085 | @itemx --all | |
1086 | @itemx - | |
1087 | Do not scan only the initialized data section of object files; scan | |
1088 | the whole files. | |
1089 | ||
1090 | @item -f | |
1091 | @itemx --print-file-name | |
1092 | Print the name of the file before each string. | |
1093 | ||
b26ac613 | 1094 | @item --help |
ba7c8e29 DM |
1095 | Print a summary of the program usage on the standard output and exit. |
1096 | ||
ba7c8e29 | 1097 | @itemx -@var{min-len} |
b26ac613 | 1098 | @item -n @var{min-len} |
ba7c8e29 DM |
1099 | @itemx --bytes=@var{min-len} |
1100 | Print sequences of characters that are at least @var{min-len} characters | |
1101 | long, instead of the default 4. | |
1102 | ||
1103 | @item -o | |
b26ac613 DM |
1104 | Like @samp{-t o}. Some other versions of @code{strings} have @samp{-o} |
1105 | act like @samp{-t d} instead. Since we can not be compatible with both | |
1106 | ways, we simply chose one. | |
ba7c8e29 DM |
1107 | |
1108 | @item -t @var{radix} | |
1109 | @itemx --radix=@var{radix} | |
1110 | Print the offset within the file before each string. The single | |
1111 | character argument specifies the radix of the offset---@samp{o} for | |
1112 | octal, @samp{x} for hexadecimal, or @samp{d} for decimal. | |
1113 | ||
1114 | @item -v | |
1115 | @itemx --version | |
1116 | Print the program version number on the standard output and exit. | |
1117 | @end table | |
1118 | ||
1119 | @node strip, c++filt, strings, Top | |
c72af735 RP |
1120 | @chapter strip |
1121 | ||
1122 | @kindex strip | |
1123 | @cindex removing symbols | |
1124 | @cindex discarding symbols | |
1815e42c | 1125 | @cindex symbols, discarding |
c72af735 RP |
1126 | |
1127 | @smallexample | |
b703c078 DM |
1128 | strip [ -F @var{format} | --format=@var{format} | --target=@var{format} ] |
1129 | [ -I @var{format} | --input-format=@var{format} ] | |
1130 | [ -O @var{format} | --output-format=@var{format} ] | |
1131 | [ -s | --strip-all ] [ -S | -g | --strip-debug ] | |
1132 | [ -x | --discard-all ] [ -X | --discard-locals ] | |
b26ac613 | 1133 | [ -v | --verbose ] [ -V | --version ] [ --help ] |
b703c078 | 1134 | @var{objfile}@dots{} |
c72af735 RP |
1135 | @end smallexample |
1136 | ||
e31e9a8d | 1137 | GNU @code{strip} discards all symbols from object files |
ec40bbb8 | 1138 | @var{objfile}. The list of object files may include archives. |
b26ac613 | 1139 | At least one object file must be given. |
c72af735 | 1140 | |
ec40bbb8 | 1141 | @code{strip} modifies the files named in its argument, |
c72af735 | 1142 | rather than writing modified copies under different names. |
c72af735 | 1143 | |
c72af735 | 1144 | @table @code |
b26ac613 DM |
1145 | @item -F @var{format} |
1146 | @itemx --format=@var{format} | |
1147 | @itemx --target=@var{format} | |
1148 | Treat the original @var{objfile} as a file with the object | |
1149 | code format @var{format}, and rewrite it in the same format. | |
1150 | ||
1151 | @item --help | |
1152 | Show a summary of the options to @code{strip} and exit. | |
1153 | ||
918c2f61 PB |
1154 | @item -I @var{format} |
1155 | @itemx --input-format=@var{format} | |
ec40bbb8 DM |
1156 | Treat the original @var{objfile} as a file with the object |
1157 | code format @var{format}. | |
918c2f61 PB |
1158 | |
1159 | @item -O @var{format} | |
1160 | @itemx --output-format=@var{format} | |
ec40bbb8 | 1161 | Replace @var{objfile} with a file in the output format @var{format}. |
918c2f61 | 1162 | |
b703c078 DM |
1163 | @item -s |
1164 | @itemx --strip-all | |
1165 | Remove all symbols. | |
1166 | ||
918c2f61 PB |
1167 | @item -g |
1168 | @itemx -S | |
1169 | @itemx --strip-debug | |
1170 | Remove debugging symbols only. | |
1171 | ||
1172 | @item -x | |
1173 | @itemx --discard-all | |
1174 | Remove non-global symbols. | |
1175 | ||
1176 | @item -X | |
1177 | @itemx --discard-locals | |
1178 | Remove compiler-generated local symbols. | |
ec40bbb8 | 1179 | (These usually start with @samp{L} or @samp{.}.) |
918c2f61 PB |
1180 | |
1181 | @item -V | |
1182 | @itemx --version | |
ec40bbb8 | 1183 | Show the version number for @code{strip}. |
918c2f61 | 1184 | |
1815e42c | 1185 | @item -v |
918c2f61 PB |
1186 | @itemx --verbose |
1187 | Verbose output: list all object files modified. In the case of | |
1269d441 | 1188 | archives, @samp{strip -v} lists all members of the archive. |
c72af735 RP |
1189 | @end table |
1190 | ||
94e9ad77 | 1191 | @node c++filt, nlmconv, strip, Top |
b6216af2 PB |
1192 | @chapter c++filt |
1193 | ||
1194 | @kindex c++filt | |
1195 | @cindex demangling C++ symbols | |
1196 | ||
b26ac613 DM |
1197 | @smallexample |
1198 | c++filt [ -_ | --strip-underscores ] | |
1199 | [ -s @var{format} | --format=@var{format} ] | |
d6a4c375 | 1200 | [ --help ] [ --version ] [ @var{symbol}@dots{} ] |
b26ac613 DM |
1201 | @end smallexample |
1202 | ||
6c69b6bd JO |
1203 | The C++ language provides function overloading, which means that you can |
1204 | write many functions with the same name (providing each takes parameters | |
1205 | of different types). All C++ function names are encoded into a | |
b26ac613 | 1206 | low-level assembly label (this process is known as |
6c69b6bd JO |
1207 | @dfn{mangling}). The @code{c++filt} program does the inverse mapping: it |
1208 | decodes (@dfn{demangles}) low-level names into user-level names so that | |
1209 | the linker can keep these overloaded functions from clashing. | |
1210 | ||
1211 | Every alphanumeric word (consisting of letters, digits, underscores, | |
1212 | dollars, or periods) seen in the input is a potential label. If the | |
1213 | label decodes into a C++ name, the C++ name replaces the low-level | |
1214 | name in the output. | |
b6216af2 | 1215 | |
d6a4c375 | 1216 | You can use @code{c++filt} to decipher individual symbols: |
6c69b6bd JO |
1217 | |
1218 | @example | |
1219 | c++filt @var{symbol} | |
1220 | @end example | |
1221 | ||
d6a4c375 DM |
1222 | If no @var{symbol} arguments are given, @code{c++filt} reads symbol |
1223 | names from the standard input and writes the demangled names to the | |
1224 | standard output. All results are printed on the standard output. | |
b6216af2 | 1225 | |
b26ac613 DM |
1226 | @table @code |
1227 | @item -_ | |
94e9ad77 | 1228 | @itemx --strip-underscores |
b26ac613 DM |
1229 | On some systems, both the C and C++ compilers put an underscore in front |
1230 | of every name. For example, the C name @code{foo} gets the low-level | |
1231 | name @code{_foo}. This option removes the initial underscore. | |
1232 | ||
1233 | @item -s @var{format} | |
1234 | @itemx --format=@var{format} | |
1235 | GNU @code{nm} can decode three different methods of mangling, used by | |
1236 | different C++ compilers. The argument to this option selects which | |
1237 | method it uses: | |
1238 | ||
1239 | @table @code | |
1240 | @item gnu | |
1241 | the one used by the GNU compiler (the default method) | |
1242 | @item lucid | |
1243 | the one used by the Lucid compiler | |
1244 | @item arm | |
1245 | the one specified by the C++ Annotated Reference Manual | |
1246 | @end table | |
1247 | ||
1248 | @item --help | |
1249 | Print a summary of the options to @code{c++filt} and exit. | |
1250 | ||
1251 | @item --version | |
1252 | Print the version number of @code{c++filt} and exit. | |
1253 | @end table | |
b6216af2 | 1254 | |
5eac46ae JO |
1255 | @quotation |
1256 | @emph{Warning:} @code{c++filt} is a new utility, and the details of its | |
1257 | user interface are subject to change in future releases. In particular, | |
1258 | a command-line option may be required in the the future to decode a name | |
1259 | passed as an argument on the command line; in other words, | |
1260 | ||
1261 | @example | |
b26ac613 | 1262 | c++filt @var{symbol} |
5eac46ae JO |
1263 | @end example |
1264 | ||
1265 | @noindent | |
1266 | may in a future release become | |
1267 | ||
1268 | @example | |
b26ac613 | 1269 | c++filt @var{option} @var{symbol} |
5eac46ae JO |
1270 | @end example |
1271 | @end quotation | |
1272 | ||
94e9ad77 JO |
1273 | @node nlmconv, Index, c++filt, Top |
1274 | @chapter nlmconv | |
1275 | ||
1276 | @code{nlmconv} converts a relocatable object file into a NetWare | |
4961ce5b JO |
1277 | Loadable Module. @code{nlmconv} currently works with @samp{i386} object |
1278 | files in @code{coff}, @sc{elf}, or @code{a.out} format, and @sc{SPARC} | |
1279 | object files in @sc{elf}, or @code{a.out} format@footnote{ | |
1280 | @code{nlmconv} should work with any @samp{i386} or @sc{sparc} object | |
1281 | format in the Binary File Descriptor library. It has only been tested | |
1282 | with the above formats.}. | |
1283 | ||
1284 | @quotation | |
1285 | @emph{Warning:} @code{nlmconv} is not always built as part of the binary | |
1286 | utilities, since it is only useful for NLM targets. | |
1287 | @end quotation | |
94e9ad77 JO |
1288 | |
1289 | @smallexample | |
1290 | nlmconv [ -I @var{format} | --input-format=@var{format} ] | |
1291 | [ -O @var{format} | --output-format=@var{format} ] | |
1292 | [ -T @var{headerfile} | --header-file=@var{headerfile} ] | |
1293 | [ -h | --help ] [ -V | --version ] | |
1294 | @var{infile} @var{outfile} | |
1295 | @end smallexample | |
1296 | ||
1297 | @code{nlmconv} converts the relocatable @samp{i386} object file | |
1298 | @var{infile} into the NetWare Loadable Module @var{outfile}, optionally | |
1299 | reading @var{headerfile} for NLM header information. For instructions | |
5b0ba16d JO |
1300 | on writing the NLM command file language used in header files, see the |
1301 | @samp{linkers} section, @samp{NLMLINK} in particular, of the @cite{NLM | |
1302 | Development and Tools Overview}, which is part of the NLM Software | |
1303 | Developer's Kit (``NLM SDK''), available from Novell, Inc. | |
1304 | @code{nlmconv} uses the @sc{gnu} Binary File Descriptor library to read | |
1305 | @var{infile}; see @ref{BFD,,BFD,ld.info,Using LD, the GNU linker}, for | |
1306 | more information. | |
94e9ad77 JO |
1307 | |
1308 | @table @code | |
1309 | @item -I @var{format} | |
1310 | @itemx --input-format=@var{format} | |
1311 | Object format of the input file. @code{nlmconv} can usually determine | |
1312 | the format of a given file (so no default is necessary). @var{format} | |
1313 | arguments are normal BFD names; for a list of these, run | |
1314 | @w{@samp{objdump -i}}. | |
1315 | ||
1316 | @item -O @var{format} | |
1317 | @itemx --output-format=@var{format} | |
1318 | Object format of the output file. @code{nlmconv} infers the output | |
1319 | format based on the input format, e.g. for a @samp{i386} input file the | |
1320 | output format is @samp{nlm32-i386}. @var{format} arguments are normal | |
1321 | BFD names; for a list of these, run @w{@samp{objdump -i}}. | |
1322 | ||
1323 | @item -T @var{headerfile} | |
1324 | @itemx --header-file=@var{headerfile} | |
1325 | Reads @var{headerfile} for NLM header information. For instructions on | |
5b0ba16d JO |
1326 | writing the NLM command file language used in header files, see@ see the |
1327 | @samp{linkers} section, of the @cite{NLM Development and Tools | |
1328 | Overview}, which is part of the NLM Software Developer's Kit, available | |
1329 | from Novell, Inc. | |
94e9ad77 JO |
1330 | |
1331 | @item -h | |
1332 | @itemx --help | |
1333 | Prints a usage summary. | |
1334 | ||
1335 | @item -V | |
1336 | @itemx --version | |
1337 | Prints the version number for @code{nlmconv}. | |
1338 | @end table | |
1339 | ||
1340 | @node Index, , nlmconv, Top | |
c72af735 RP |
1341 | @unnumbered Index |
1342 | ||
1343 | @printindex cp | |
1344 | ||
1345 | @contents | |
1346 | @bye |