]>
Commit | Line | Data |
---|---|---|
de5fd53b RP |
1 | \input texinfo |
2 | @setfilename binutils.info | |
3 | @synindex ky cp | |
4 | @c | |
5 | @c This file documents the GNU binary utilities "ar", "ld", "objdump", "nm", | |
6 | @c "size", "strip", and "ranlib". | |
7 | @c | |
8 | @c Copyright (C) 1991 Free Software Foundation, Inc. | |
9 | @c | |
10 | @c This text may be freely distributed under the terms of the GNU | |
11 | @c General Public License. | |
12 | @c | |
13 | @c $Id$ | |
15c1f44d | 14 | @iftex |
de5fd53b RP |
15 | @finalout |
16 | @c @smallbook | |
15c1f44d | 17 | @end iftex |
de5fd53b RP |
18 | @c @cropmarks |
19 | @setchapternewpage odd | |
20 | @settitle GNU Binary Utilities | |
21 | @titlepage | |
15c1f44d RP |
22 | @title The GNU Binary Utilities |
23 | @subtitle Version 1.90 | |
de5fd53b | 24 | @sp 1 |
2f3c1742 | 25 | @subtitle October 1991 |
15c1f44d RP |
26 | @author Roland H. Pesch |
27 | @author Cygnus Support | |
de5fd53b RP |
28 | @page |
29 | ||
30 | @tex | |
31 | \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ | |
32 | \xdef\manvers{\$Revision$} % For use in headers, footers too | |
33 | {\parskip=0pt \hfill Cygnus Support\par \hfill \manvers\par \hfill | |
34 | \TeX{}info \texinfoversion\par } | |
35 | @end tex | |
36 | ||
37 | @vskip 0pt plus 1filll | |
38 | Copyright @copyright{} 1991 Free Software Foundation, Inc. | |
39 | ||
40 | Permission is granted to make and distribute verbatim copies of | |
41 | this manual provided the copyright notice and this permission notice | |
42 | are preserved on all copies. | |
43 | ||
44 | Permission is granted to copy and distribute modified versions of this | |
45 | manual under the conditions for verbatim copying, provided also that | |
46 | the entire resulting derived work is distributed under the terms of a | |
47 | permission notice identical to this one. | |
48 | ||
49 | Permission is granted to copy and distribute translations of this manual | |
50 | into another language, under the above conditions for modified versions. | |
51 | @end titlepage | |
52 | ||
de5fd53b | 53 | @node Top, ar, (dir), (dir) |
2f3c1742 RP |
54 | @chapter Introduction |
55 | ||
715eb31f | 56 | @cindex version |
2f3c1742 | 57 | This brief manual contains preliminary documentation for the GNU binary |
9f06bb91 RP |
58 | utilities (collectively version 1.90): |
59 | @table @code | |
60 | @item ar | |
61 | Create, modify, and extract from archives | |
62 | ||
63 | @item nm | |
64 | List symbols from object files | |
65 | ||
66 | @item objdump | |
67 | Display information from object files | |
68 | ||
69 | @item ranlib | |
70 | Generate index to archive contents | |
71 | ||
72 | @item size | |
73 | List section sizes and total size | |
74 | ||
75 | @item strip | |
76 | Discard symbols | |
77 | @end table | |
de5fd53b | 78 | |
2f3c1742 | 79 | @ifinfo |
de5fd53b RP |
80 | Copyright @copyright{} 1991 Free Software Foundation, Inc. |
81 | ||
82 | Permission is granted to make and distribute verbatim copies of | |
83 | this manual provided the copyright notice and this permission notice | |
84 | are preserved on all copies. | |
85 | ||
86 | @ignore | |
87 | Permission is granted to process this file through TeX and print the | |
88 | results, provided the printed document carries a copying permission | |
89 | notice identical to this one except for the removal of this paragraph | |
90 | (this paragraph not being relevant to the printed manual). | |
91 | ||
92 | @end ignore | |
93 | ||
94 | Permission is granted to copy and distribute modified versions of this | |
95 | manual under the conditions for verbatim copying, provided also that | |
96 | the entire resulting derived work is distributed under the terms of a | |
97 | permission notice identical to this one. | |
98 | ||
99 | Permission is granted to copy and distribute translations of this manual | |
100 | into another language, under the above conditions for modified versions. | |
101 | @end ifinfo | |
102 | ||
103 | @menu | |
715eb31f RP |
104 | * ar:: Create, modify, and extract from archives |
105 | * ld:: See ld.info | |
106 | * nm:: List symbols from object files | |
107 | * objdump:: Display information from object files | |
108 | * ranlib:: Generate index to archive contents | |
109 | * size:: List section sizes and total size | |
110 | * strip:: Discard symbols | |
111 | * Index:: | |
de5fd53b RP |
112 | @end menu |
113 | ||
114 | @node ar, ld, Top, Top | |
115 | @chapter ar | |
116 | ||
715eb31f RP |
117 | @kindex ar |
118 | @cindex archives | |
119 | @cindex collections of files | |
de5fd53b | 120 | @smallexample |
2f3c1742 | 121 | ar [-]@var{p}@var{mod} [ @var{membername} ] @var{archive} @var{files}@dots{} |
de5fd53b RP |
122 | @end smallexample |
123 | ||
9f06bb91 | 124 | The GNU @code{ar} program creates, modifies, and extracts from |
de5fd53b RP |
125 | archives. An @dfn{archive} is a single file holding a collection of |
126 | other files in a structure that makes it possible to retrieve | |
127 | the original individual files (called @dfn{members} of the archive). | |
128 | ||
129 | The original files' contents, mode (permissions), timestamp, owner, and | |
130 | group are preserved in the archive, and may be reconstituted on | |
131 | extraction. | |
132 | ||
715eb31f | 133 | @cindex name length |
050f05e7 RP |
134 | GNU @code{ar} can maintain archives whose members have names of any |
135 | length; however, depending on how @code{ar} is configured on your | |
136 | system, a limit on member-name length may be imposed (for compatibility | |
137 | with archive formats maintained with other tools). If it exists, the | |
138 | limit is often 15 characters (typical of formats related to a.out) or 16 | |
139 | characters (typical of formats related to coff). | |
de5fd53b | 140 | |
715eb31f | 141 | @cindex libraries |
de5fd53b RP |
142 | @code{ar} is considered a binary utility because archives of this sort |
143 | are most often used as @dfn{libraries} holding commonly needed | |
144 | subroutines. | |
145 | ||
715eb31f | 146 | @cindex symbol index |
de5fd53b | 147 | @code{ar} will create an index to the symbols defined in relocatable |
c9629e6e | 148 | object modules in the archive when you specify the modifier @samp{s}. |
de5fd53b | 149 | Once created, this index is updated in the archive whenever @code{ar} |
8706a92c RP |
150 | makes a change to its contents (save for the @samp{q} update operation). |
151 | An archive with such an index speeds up linking to the library, and | |
152 | allows routines in the library to call each other without regard to | |
153 | their placement in the archive. | |
154 | ||
2f3c1742 | 155 | You may use @samp{nm -s} or @samp{nm +print-armap} to list this index |
de5fd53b RP |
156 | table. If an archive lacks the table, another form of @code{ar} called |
157 | @code{ranlib} can be used to add just the table. | |
158 | ||
159 | @code{ar} insists on at least two arguments to execute: one | |
160 | keyletter specifying the @emph{operation} (optionally accompanied by other | |
161 | keyletters specifying @emph{modifiers}), and the archive name to act on. | |
162 | ||
163 | Most operations can also accept further @var{files} arguments, | |
164 | specifying particular files to operate on. | |
165 | ||
c9629e6e RP |
166 | GNU @code{ar} allows you to mix the operation code @var{p} and modifier |
167 | flags @var{mod} in any order, within the first command-line argument. | |
de5fd53b | 168 | |
9f06bb91 | 169 | If you wish, you may begin the first command-line argument with a |
de5fd53b RP |
170 | dash. |
171 | ||
715eb31f | 172 | @cindex operations on archive |
2f3c1742 | 173 | The @var{p} keyletter specifies what operation to execute; it may be |
de5fd53b RP |
174 | any of the following, but you must specify only one of them: |
175 | ||
176 | @table @code | |
177 | @item d | |
715eb31f | 178 | @cindex deleting from archive |
de5fd53b RP |
179 | @emph{Delete} modules from the archive. Specify the names of modules to |
180 | be deleted as @var{files}; the archive is untouched if you | |
181 | specify no files to delete. | |
182 | ||
c9629e6e | 183 | If you specify the @samp{v} modifier, @code{ar} will list each module |
de5fd53b RP |
184 | as it is deleted. |
185 | ||
186 | @item m | |
715eb31f | 187 | @cindex moving in archive |
de5fd53b RP |
188 | Use this operation to @emph{move} members in an archive. |
189 | ||
190 | The ordering of members in an archive can make a difference in how | |
191 | programs are linked using the library, if a symbol is defined in more | |
192 | than one member. | |
193 | ||
c9629e6e | 194 | If no modifiers are used with @code{m}, any members you name in the |
de5fd53b | 195 | @var{files} arguments are moved to the @emph{end} of the archive; |
c9629e6e | 196 | you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a |
de5fd53b RP |
197 | specified place instead. |
198 | ||
199 | @item p | |
715eb31f | 200 | @cindex printing from archive |
de5fd53b | 201 | @emph{Print} the specified members of the archive, to the standard |
c9629e6e | 202 | output file. If the @samp{v} modifier is specified, show the member |
de5fd53b RP |
203 | name before copying its contents to standard output. |
204 | ||
050f05e7 | 205 | If you specify no @var{files}, all the files in the archive are printed. |
de5fd53b RP |
206 | |
207 | @item q | |
715eb31f | 208 | @cindex quick append to archive |
de5fd53b | 209 | @emph{Quick append}; add @var{files} to the end of @var{archive}, |
8706a92c | 210 | without checking for replacement. |
de5fd53b | 211 | |
c9629e6e | 212 | The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this |
de5fd53b RP |
213 | operation; new members are always placed at the end of the archive. |
214 | ||
c9629e6e | 215 | The modifier @samp{v} makes @code{ar} list each file as it is appended. |
de5fd53b | 216 | |
8706a92c RP |
217 | Since the point of this operation is speed, the archive's symbol table |
218 | index is not updated, even if it already existed; you can use @samp{ar s} or | |
219 | @code{ranlib} explicitly to update the symbol table index. | |
de5fd53b RP |
220 | |
221 | @item r | |
715eb31f | 222 | @cindex replacement in archive |
de5fd53b RP |
223 | Insert @var{files} into @var{archive} (with @emph{replacement}). This |
224 | operation differs from @samp{q} in that any previously existing members | |
225 | are deleted if their names match those being added. | |
226 | ||
227 | If one of the files named in @var{files} doesn't exist, @code{ar} | |
228 | displays an error message, and leaves undisturbed any existing members | |
229 | of the archive matching that name. | |
230 | ||
231 | By default, new members are added at the end of the file; but you may | |
c9629e6e | 232 | use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request |
de5fd53b RP |
233 | placement relative to some existing member. |
234 | ||
c9629e6e | 235 | The modifier @samp{v} used with this operation elicits a line of |
de5fd53b RP |
236 | output for each file inserted, along with one of the letters @samp{a} or |
237 | @samp{r} to indicate whether the file was appended (no old member | |
238 | deleted) or replaced. | |
239 | ||
240 | @item t | |
715eb31f | 241 | @cindex contents of archive |
de5fd53b RP |
242 | Display a @emph{table} listing the contents of @var{archive}, or those |
243 | of the files listed in @var{files} that are present in the | |
244 | archive. Normally only the member name is shown; if you also want to | |
245 | see the modes (permissions), timestamp, owner, group, and size, you can | |
c9629e6e | 246 | request that by also specifying the @samp{v} modifier. |
de5fd53b RP |
247 | |
248 | If you do not specify any @var{files}, all files in the archive | |
050f05e7 | 249 | are listed. |
de5fd53b | 250 | |
715eb31f RP |
251 | @cindex repeated names in archive |
252 | @cindex name duplication in archive | |
de5fd53b RP |
253 | If there is more than one file with the same name (say, @samp{fie}) in |
254 | an archive (say @samp{b.a}), @samp{ar t b.a fie} will list only the | |
255 | first instance; to see them all, you must ask for a complete | |
256 | listing---in our example, @samp{ar t b.a}. | |
257 | @c WRS only; per Gumby, this is implementation-dependent, and in a more | |
258 | @c recent case in fact works the other way. | |
259 | ||
260 | @item x | |
715eb31f | 261 | @cindex extract from archive |
2f3c1742 | 262 | @emph{Extract} members (named @var{files}) from the archive. You can |
c9629e6e | 263 | use the @samp{v} modifier with this operation, to request that |
2f3c1742 | 264 | @code{ar} list each name as it extracts it. |
de5fd53b RP |
265 | |
266 | If you do not specify any @var{files}, all files in the archive | |
050f05e7 | 267 | are extracted. |
de5fd53b RP |
268 | |
269 | @end table | |
270 | ||
2f3c1742 RP |
271 | A number of modifiers (@var{mod}) may immediately follow the @var{p} |
272 | keyletter, to specify variations on an operation's behavior: | |
de5fd53b RP |
273 | |
274 | @table @code | |
275 | @item a | |
715eb31f | 276 | @cindex relative placement in archive |
de5fd53b RP |
277 | Add new files @emph{after} an existing member of the |
278 | archive. If you use the modifier @code{a}, the name of an existing archive | |
279 | member must be present as the @var{membername} argument, before the | |
280 | @var{archive} specification. | |
281 | ||
282 | @item b | |
283 | Add new files @emph{before} an existing member of the | |
284 | archive. If you use the modifier @code{b}, the name of an existing archive | |
285 | member must be present as the @var{membername} argument, before the | |
286 | @var{archive} specification. (same as @samp{i}). | |
287 | ||
288 | @item c | |
715eb31f | 289 | @cindex creating archives |
de5fd53b RP |
290 | @emph{Create} the archive. The specified @var{archive} is always |
291 | created if it didn't exist, when you request an update. But a warning is | |
292 | issued unless you specify in advance that you expect to create it, by | |
c9629e6e | 293 | using this modifier. |
de5fd53b RP |
294 | |
295 | @item i | |
296 | Insert new files @emph{before} an existing member of the | |
297 | archive. If you use the modifier @code{i}, the name of an existing archive | |
298 | member must be present as the @var{membername} argument, before the | |
299 | @var{archive} specification. (same as @samp{b}). | |
300 | ||
301 | @item l | |
c9629e6e | 302 | This modifier is accepted but not used. |
050f05e7 RP |
303 | @c whaffor ar l modifier??? presumably compat; with |
304 | @c what???---pesch@@cygnus.com, 25jan91 | |
de5fd53b RP |
305 | |
306 | @item o | |
715eb31f | 307 | @cindex dates in archive |
de5fd53b | 308 | Preserve the @emph{original} dates of members when extracting them. If |
c9629e6e | 309 | you do not specify this modifier, files extracted from the archive |
de5fd53b RP |
310 | will be stamped with the time of extraction. |
311 | ||
312 | @item s | |
715eb31f | 313 | @cindex writing archive index |
de5fd53b | 314 | Write an object-file index into the archive, or update an existing one, |
c9629e6e | 315 | even if no other change is made to the archive. You may use this modifier |
de5fd53b RP |
316 | flag either with any operation, or alone. Running @samp{ar s} on an |
317 | archive is equivalent to running @samp{ranlib} on it. | |
318 | ||
319 | @item u | |
715eb31f | 320 | @cindex updating an archive |
c9629e6e | 321 | Normally, @code{ar r}@dots{} inserts all files |
de5fd53b RP |
322 | listed into the archive. If you would like to insert @emph{only} those |
323 | of the files you list that are newer than existing members of the same | |
c9629e6e RP |
324 | names, use this modifier. The @samp{u} modifier is allowed only for the |
325 | operation @samp{r} (replace). In particular, the combination @samp{qu} is | |
326 | not allowed, since checking the timestamps would lose any speed | |
327 | advantage from the operation @samp{q}. | |
de5fd53b | 328 | |
de5fd53b | 329 | @item v |
c9629e6e | 330 | This modifier requests the @emph{verbose} version of an operation. Many |
de5fd53b | 331 | operations display additional information, such as filenames processed, |
c9629e6e | 332 | when the modifier @samp{v} is appended. |
de5fd53b RP |
333 | |
334 | @end table | |
335 | ||
336 | @node ld, nm, ar, Top | |
337 | @chapter ld | |
715eb31f RP |
338 | @cindex linker |
339 | @kindex ld | |
de5fd53b | 340 | The GNU linker @code{ld} is now described in a separate manual. |
9f06bb91 | 341 | @xref{Top,, Overview,, GLD: the GNU linker}. |
de5fd53b RP |
342 | |
343 | @node nm, objdump, ld, Top | |
344 | @chapter nm | |
715eb31f RP |
345 | @cindex symbols |
346 | @kindex nm | |
de5fd53b RP |
347 | |
348 | @smallexample | |
349 | nm [ -a | +debug-syms ] [ -g | +extern-only ] | |
2f3c1742 RP |
350 | [ -s | +print-armap ] [ -o | +print-file-name ] |
351 | [ -n | +numeric-sort ] [ -p | +no-sort ] | |
352 | [ -r | +reverse-sort ] [ -u | +undefined-only ] | |
c9629e6e | 353 | [ +target @var{bfdname} ] |
de5fd53b RP |
354 | [ @var{objfiles}@dots{} ] |
355 | @end smallexample | |
356 | ||
357 | GNU @code{nm} will list the symbols from object files @var{objfiles}. | |
de5fd53b RP |
358 | |
359 | The long and short forms of options, shown here as alternatives, are | |
360 | equivalent. | |
361 | ||
362 | @table @code | |
363 | @item @var{objfiles}@dots{} | |
715eb31f | 364 | @kindex a.out |
de5fd53b RP |
365 | Object files whose symbols are to be listed. If no object files are |
366 | listed as arguments, @code{nm} assumes @samp{a.out}. | |
367 | ||
9f06bb91 RP |
368 | @item -a |
369 | @itemx +debug-syms | |
715eb31f | 370 | @cindex debugging symbols |
de5fd53b RP |
371 | Display debugger-only symbols; normally these are not listed. |
372 | ||
9f06bb91 RP |
373 | @item -g |
374 | @itemx +extern-only | |
715eb31f | 375 | @cindex external symbols |
de5fd53b RP |
376 | Display only external symbols. |
377 | ||
9f06bb91 RP |
378 | @item -p |
379 | @itemx +no-sort | |
715eb31f | 380 | @cindex sorting symbols |
2f3c1742 RP |
381 | Don't bother to sort the symbols in any order; just print them in the |
382 | order encountered. | |
383 | ||
9f06bb91 RP |
384 | @item -n |
385 | @itemx +numeric-sort | |
de5fd53b RP |
386 | Sort symbols numerically by their addresses, not alphabetically by their |
387 | names. | |
388 | ||
9f06bb91 RP |
389 | @item -s |
390 | @itemx +print-armap | |
715eb31f RP |
391 | @cindex symbol index, listing |
392 | When listing symbols from archive members, include the index: a mapping | |
393 | (stored in the archive by @code{ar} or @code{ranlib}) of what modules | |
394 | contain definitions for what names. | |
2f3c1742 | 395 | |
9f06bb91 RP |
396 | @item -o |
397 | @itemx +print-file-name | |
715eb31f RP |
398 | @cindex input file name |
399 | @cindex file name | |
400 | @cindex source file name | |
de5fd53b RP |
401 | Precede each symbol by the name of the input file where it was found, |
402 | rather than identifying the input file once only before all of its | |
403 | symbols. | |
404 | ||
9f06bb91 RP |
405 | @item -r |
406 | @itemx +reverse-sort | |
de5fd53b RP |
407 | Reverse the sense of the sort (whether numeric or alphabetic); let the |
408 | last come first. | |
409 | ||
2f3c1742 RP |
410 | @item +target @var{bfdname} |
411 | @c @item +target | |
715eb31f | 412 | @cindex object code format |
2f3c1742 RP |
413 | Specify an object code format other than your system's default format. |
414 | @xref{objdump}, for information on listing available formats. | |
415 | @c FIXME what *does* +target/no arg do? | |
416 | ||
9f06bb91 RP |
417 | @item -u |
418 | @itemx +undefined-only | |
715eb31f RP |
419 | @cindex external symbols |
420 | @cindex undefined symbols | |
de5fd53b RP |
421 | Display only undefined symbols (those external to each object file). |
422 | ||
423 | @end table | |
424 | ||
425 | @node objdump, ranlib, nm, Top | |
426 | @chapter objdump | |
427 | ||
715eb31f RP |
428 | @cindex object file information |
429 | @kindex objdump | |
430 | ||
de5fd53b | 431 | @smallexample |
f036c5d5 RP |
432 | objdump [ -a ] [ -b @var{bfdname} ] [ -d ] [ -f ] |
433 | [ -h | +header ] [ -i ] [ -j @var{section} ] [ -l ] | |
434 | [ -m @var{machine} ] [ -r | +reloc ] [ -s ] | |
435 | [ -t | +syms ] [ -x ] | |
436 | @var{objfiles}@dots{} | |
de5fd53b RP |
437 | @end smallexample |
438 | ||
439 | @code{objdump} displays information about one or more object files. | |
440 | The options control what particular information to display. This | |
441 | information is mostly useful to programmers who are working on the | |
442 | compilation tools, as opposed to programmers who just want their | |
443 | program to compile and work. | |
444 | ||
445 | The long and short forms of options, shown here as alternatives, are | |
446 | equivalent. | |
447 | ||
448 | @table @code | |
449 | @item @var{objfiles}@dots{} | |
715eb31f RP |
450 | The object files to be examined. When you specify archives, |
451 | @code{objdump} shows information on each of the member object files. | |
de5fd53b | 452 | |
2f3c1742 RP |
453 | @item -a |
454 | @c print_arelt_descr | |
715eb31f | 455 | @cindex archive headers |
2f3c1742 | 456 | If any files from @var{objfiles} are archives, display the archive |
715eb31f RP |
457 | header information (in a format similar to @samp{ls -l}). Besides the |
458 | information you could list with @samp{ar tv}, @samp{objdump -a} shows | |
459 | the object file format of each archive member. | |
2f3c1742 RP |
460 | |
461 | @c suggest longname +target or +format or +bfd | |
462 | @item -b @var{bfdname} | |
715eb31f | 463 | @cindex object code format |
2f3c1742 RP |
464 | You can specify a particular object-code format for your object files as |
465 | @var{bfdname}. This may not be necessary; @var{objdump} can | |
466 | automatically recognize many formats. For example, | |
467 | @example | |
468 | objdump -b oasys -m vax -h fu.o | |
469 | @end example | |
470 | @noindent | |
471 | Displays summary information from the section headers (@samp{-h}) of | |
c9629e6e | 472 | @file{fu.o}, which is explicitly identified (@samp{-m}) as a Vax object |
2f3c1742 | 473 | file in the format produced by Oasys compilers. You can list the |
c9629e6e | 474 | formats available with the @samp{-i} option. |
2f3c1742 RP |
475 | |
476 | @item -d | |
715eb31f RP |
477 | @cindex disassembling object code |
478 | @cindex machine instructions | |
2f3c1742 RP |
479 | Disassemble. Display the assembler mnemonics for the machine |
480 | instructions from @var{objfiles}. | |
481 | ||
482 | @item -f | |
715eb31f | 483 | @cindex object file header |
2f3c1742 RP |
484 | File header. Display summary information from the overall header of |
485 | each file in @var{objfiles}. | |
486 | ||
9f06bb91 RP |
487 | @item -h |
488 | @itemx +header | |
715eb31f | 489 | @cindex section headers |
2f3c1742 RP |
490 | Header. Display summary information from the section headers of the |
491 | object file. | |
492 | ||
493 | @item -i | |
715eb31f RP |
494 | @cindex architectures available |
495 | @cindex object formats available | |
2f3c1742 RP |
496 | Display a list showing all architectures and object formats available |
497 | for specification with @code{-b} or @code{-m}. | |
498 | ||
499 | @c suggest longname +section | |
500 | @item -j @var{name} | |
715eb31f | 501 | @cindex section information |
2f3c1742 RP |
502 | Display information only for section @var{name} |
503 | ||
504 | @c suggest longname +label or +linespec | |
505 | @item -l | |
715eb31f | 506 | @cindex source filenames for object files |
2f3c1742 RP |
507 | Label the display (using debugging information) with the source filename |
508 | and line numbers corresponding to the object code shown. | |
509 | ||
510 | @c suggest longname +architecture | |
511 | @item -m @var{machine} | |
715eb31f | 512 | @cindex architecture |
2f3c1742 RP |
513 | Specify the object files @var{objfiles} are for architecture |
514 | @var{machine}. You can list available architectures using the @samp{-i} | |
515 | option. | |
516 | ||
9f06bb91 RP |
517 | @item -r |
518 | @itemx +reloc | |
715eb31f | 519 | @cindex relocation entries, in object file |
de5fd53b RP |
520 | Relocation. Print the relocation entries of the file. |
521 | ||
2f3c1742 | 522 | @item -s |
715eb31f RP |
523 | @cindex sections, full contents |
524 | @cindex object file sections | |
2f3c1742 RP |
525 | Display the full contents of any sections requested. |
526 | ||
9f06bb91 RP |
527 | @item -t |
528 | @itemx +syms | |
715eb31f | 529 | @cindex symbol table entries, printing |
de5fd53b RP |
530 | Symbol Table. Print the symbol table entries of the file. |
531 | This is similar to the information provided by the @samp{nm} program. | |
532 | ||
2f3c1742 | 533 | @item -x |
715eb31f RP |
534 | @cindex all header information, object file |
535 | @cindex header information, all | |
2f3c1742 | 536 | Display all available header information, including the symbol table and |
c9629e6e | 537 | relocation entries. Using @samp{-x} is equivalent to specifying all of |
715eb31f | 538 | @samp{-a -f -h -r -t}. |
2f3c1742 | 539 | |
de5fd53b RP |
540 | @end table |
541 | ||
542 | @node ranlib, size, objdump, Top | |
543 | @chapter ranlib | |
544 | ||
715eb31f RP |
545 | @kindex ranlib |
546 | @cindex archive contents | |
547 | @cindex symbol index | |
548 | ||
de5fd53b | 549 | @smallexample |
2f3c1742 | 550 | ranlib @var{archive} |
de5fd53b RP |
551 | @end smallexample |
552 | ||
c9629e6e | 553 | @code{ranlib} generates an index to the contents of an archive, and |
de5fd53b RP |
554 | stores it in the archive. The index lists each symbol defined by a |
555 | member of an archive that is a relocatable object file. | |
556 | ||
75470b8e | 557 | You may use @samp{nm -s} or @samp{nm +print-armap} to list this index. |
de5fd53b RP |
558 | |
559 | An archive with such an index speeds up linking to the library, and | |
560 | allows routines in the library to call each other without regard to | |
561 | their placement in the archive. | |
562 | ||
c9629e6e RP |
563 | The GNU @code{ranlib} program is another form of GNU @code{ar}; running |
564 | @code{ranlib} is completely equivalent to executing @samp{ar -s}. | |
565 | @xref{ar}. | |
566 | ||
de5fd53b RP |
567 | @node size, strip, ranlib, Top |
568 | @chapter size | |
569 | ||
715eb31f RP |
570 | @kindex size |
571 | @cindex section sizes | |
572 | ||
de5fd53b | 573 | @smallexample |
c9629e6e RP |
574 | size [ -A | -B | +format @var{compatibility} ] |
575 | [ +help ] [ -d | -o | -x | +radix @var{number} ] | |
ec34e28b | 576 | [ +target @var{bfdname} ] [ -V | +version ] |
2f3c1742 | 577 | @var{objfiles}@dots{} |
de5fd53b RP |
578 | @end smallexample |
579 | ||
2f3c1742 RP |
580 | The GNU @code{size} utility lists the section sizes---and the total |
581 | size---for each of the object files @var{objfiles} in its argument list. | |
582 | By default, one line of output is generated for each object file or each | |
583 | module in an archive. | |
de5fd53b | 584 | |
2f3c1742 RP |
585 | The command line options have the following meanings: |
586 | @table @code | |
c9629e6e RP |
587 | @item @var{objfiles}@dots{} |
588 | The object files to be examined. | |
2f3c1742 | 589 | |
9f06bb91 | 590 | @item -A |
2f3c1742 | 591 | @itemx -B |
9f06bb91 | 592 | @itemx +format @var{compatibility} |
715eb31f | 593 | @cindex size display format |
2f3c1742 RP |
594 | Using one of these options, you can choose whether the output from GNU |
595 | @code{size} resembles output from System V @code{size} (using @samp{-A}, | |
ec34e28b RP |
596 | or @samp{+format sysv}), or Berkeley @code{size} (using @samp{-B}, or |
597 | @samp{+format berkeley}). The default is the one-line format similar to | |
2f3c1742 RP |
598 | Berkeley's. |
599 | @c Bonus for doc-source readers: you can also say +format=strange (or | |
600 | @c anything else that starts with 's') for sysv, and +format=boring (or | |
601 | @c anything else that starts with 'b') for Berkeley. | |
602 | ||
603 | Here is an example of the Berkeley (default) format of output from | |
604 | @code{size}: | |
de5fd53b | 605 | @smallexample |
2f3c1742 | 606 | eg$ size +format Berkeley ranlib size |
15c1f44d RP |
607 | text data bss dec hex filename |
608 | 294880 81920 11592 388392 5ed28 ranlib | |
609 | 294880 81920 11888 388688 5ee50 size | |
2f3c1742 RP |
610 | @end smallexample |
611 | ||
612 | @noindent | |
613 | This is the same data, but displayed closer to System V conventions: | |
de5fd53b | 614 | |
2f3c1742 | 615 | @smallexample |
2f3c1742 RP |
616 | eg$ size +format SysV ranlib size |
617 | ranlib : | |
15c1f44d RP |
618 | section size addr |
619 | .text 294880 8192 | |
620 | .data 81920 303104 | |
621 | .bss 11592 385024 | |
622 | Total 388392 | |
2f3c1742 RP |
623 | |
624 | ||
625 | size : | |
15c1f44d RP |
626 | section size addr |
627 | .text 294880 8192 | |
628 | .data 81920 303104 | |
629 | .bss 11888 385024 | |
630 | Total 388688 | |
f036c5d5 | 631 | @end smallexample |
2f3c1742 | 632 | |
c9629e6e RP |
633 | @item +help |
634 | Show a summary of acceptable arguments and options. | |
635 | ||
9f06bb91 | 636 | @item -d |
c9629e6e RP |
637 | @itemx -o |
638 | @itemx -x | |
9f06bb91 | 639 | @itemx +radix @var{number} |
715eb31f RP |
640 | @cindex size number format |
641 | @cindex radix for section sizes | |
c9629e6e RP |
642 | Using one of these options, you can control whether the size of each |
643 | section is given in decimal (@samp{-d}, or @samp{+radix 10}); octal | |
644 | (@samp{-o}, or @samp{+radix 8}); or hexadecimal (@samp{-x}, or | |
645 | @samp{+radix 16}). In @samp{+radix @var{number}}, only the three | |
646 | values (8, 10, 16) are supported. The total size is always given in two | |
647 | radices; decimal and hexadecimal for @samp{-d} or @samp{-x} output, or | |
648 | octal and hexadecimal if you're using @samp{-o}. | |
649 | ||
2f3c1742 | 650 | @item +target @var{bfdname} |
715eb31f | 651 | @cindex object code format |
2f3c1742 RP |
652 | You can specify a particular object-code format for @var{objfiles} as |
653 | @var{bfdname}. This may not be necessary; @var{size} can | |
654 | automatically recognize many formats. @xref{objdump}, for information | |
655 | on listing available formats. | |
656 | ||
9f06bb91 RP |
657 | @item -V |
658 | @itemx +version | |
2f3c1742 RP |
659 | Display version number information on @code{size} itself. |
660 | ||
661 | @end table | |
662 | ||
715eb31f | 663 | @node strip, Index, size, Top |
de5fd53b RP |
664 | @chapter strip |
665 | ||
715eb31f RP |
666 | @kindex strip |
667 | @cindex removing symbols | |
668 | @cindex discarding symbols | |
669 | ||
de5fd53b | 670 | @smallexample |
2f3c1742 | 671 | strip [ -s | +strip-all ] [ -g | -S | +strip-debug ] |
de5fd53b | 672 | [ -x | +discard-all ] [ -X | +discard-locals ] |
2f3c1742 | 673 | [ -T @var{bfdname} ] |
de5fd53b RP |
674 | @var{objfiles}@dots{} |
675 | @end smallexample | |
676 | ||
677 | GNU @code{strip} will discard all symbols from object files | |
678 | @var{objfiles}, if no options are specified; or only certain symbols, | |
679 | depending on its command-line options. | |
680 | ||
681 | @code{strip} will not execute unless at least one object file is listed. | |
682 | ||
c9629e6e | 683 | @quotation |
de5fd53b RP |
684 | @emph{WARNING:} @code{strip} modifies the files named in its argument, |
685 | rather than writing modified copies under different names. | |
c9629e6e | 686 | @end quotation |
de5fd53b RP |
687 | |
688 | The long and short forms of options, shown here as alternatives, are | |
689 | equivalent. | |
690 | ||
691 | @table @code | |
9f06bb91 RP |
692 | @item -s |
693 | @itemx +strip-all | |
715eb31f | 694 | @cindex all symbols, discarding |
de5fd53b RP |
695 | This is the default case: strip all symbol entries from @var{objfiles}. |
696 | ||
9f06bb91 | 697 | @item -g |
2f3c1742 | 698 | @itemx -S |
9f06bb91 | 699 | @itemx +strip-debug |
715eb31f | 700 | @cindex debugging symbols, discarding |
de5fd53b RP |
701 | Discard only debugging symbol information from @var{objfiles}. |
702 | ||
9f06bb91 RP |
703 | @item -x |
704 | @itemx +discard-all | |
715eb31f | 705 | @cindex local symbols, discarding |
de5fd53b RP |
706 | Discard all symbols local to each file in @var{objfiles}. |
707 | @emph{WARNING:} Note that @code{+discard-all} discards only @emph{local} | |
708 | symbols, in spite of its name. | |
709 | ||
9f06bb91 RP |
710 | @item -X |
711 | @itemx +discard-locals | |
de5fd53b RP |
712 | Discard local symbols starting with @samp{L} from each file in |
713 | @var{objfiles}. (Some compilers produce internally-used symbols that | |
714 | begin with @samp{L}.) | |
de5fd53b | 715 | |
2f3c1742 | 716 | @item -T @var{bfdname} |
715eb31f | 717 | @cindex object code format |
2f3c1742 RP |
718 | You can specify a particular object-code format @var{bfdname} for |
719 | @var{objfiles}. This may not be necessary; @var{strip} can automatically | |
720 | recognize many formats. @xref{objdump}, for information on listing | |
721 | available formats. | |
722 | @end table | |
de5fd53b | 723 | |
715eb31f RP |
724 | @node Index, , strip, Top |
725 | @unnumbered Index | |
726 | ||
727 | @printindex cp | |
728 | ||
de5fd53b RP |
729 | @contents |
730 | @bye |