📄 binutils.html
字号:
output is off, output is like that of <SAMP>`ar -t <VAR>archive</VAR><VAR>module</VAR>...'</SAMP>. When verbose output is on, the listing is like<SAMP>`ar -tv <VAR>archive</VAR> <VAR>module</VAR>...'</SAMP>.Output normally goes to the standard output stream; however, if youspecify <VAR>outputfile</VAR> as a final argument, <CODE>ar</CODE> directs theoutput to that file.<DT><CODE>END</CODE><DD>Exit from <CODE>ar</CODE>, with a <CODE>0</CODE> exit code to indicate successfulcompletion. This command does not save the output file; if you havechanged the current archive since the last <CODE>SAVE</CODE> command, thosechanges are lost.<DT><CODE>EXTRACT <VAR>module</VAR>, <VAR>module</VAR>, ... <VAR>module</VAR></CODE><DD>Extract each named <VAR>module</VAR> from the current archive, writing theminto the current directory as separate files. Equivalent to <SAMP>`ar -x<VAR>archive</VAR> <VAR>module</VAR>...'</SAMP>.Requires prior use of <CODE>OPEN</CODE> or <CODE>CREATE</CODE>.<DT><CODE>LIST</CODE><DD>Display full contents of the current archive, in "verbose" styleregardless of the state of <CODE>VERBOSE</CODE>. The effect is like <SAMP>`artv <VAR>archive</VAR>'</SAMP>). (This single command is a GNU <CODE>ld</CODE>enhancement, rather than present for MRI compatibility.)Requires prior use of <CODE>OPEN</CODE> or <CODE>CREATE</CODE>.<DT><CODE>OPEN <VAR>archive</VAR></CODE><DD>Opens an existing archive for use as the current archive (required formany other commands). Any changes as the result of subsequent commandswill not actually affect <VAR>archive</VAR> until you next use <CODE>SAVE</CODE>.<DT><CODE>REPLACE <VAR>module</VAR>, <VAR>module</VAR>, ... <VAR>module</VAR></CODE><DD>In the current archive, replace each existing <VAR>module</VAR> (named inthe <CODE>REPLACE</CODE> arguments) from files in the current working directory.To execute this command without errors, both the file, and the module inthe current archive, must exist. Requires prior use of <CODE>OPEN</CODE> or <CODE>CREATE</CODE>.<DT><CODE>VERBOSE</CODE><DD>Toggle an internal flag governing the output from <CODE>DIRECTORY</CODE>.When the flag is on, <CODE>DIRECTORY</CODE> output matches output from<SAMP>`ar -tv '</SAMP>....<DT><CODE>SAVE</CODE><DD>Commit your changes to the current archive, and actually save it as afile with the name specified in the last <CODE>CREATE</CODE> or <CODE>OPEN</CODE>command. Requires prior use of <CODE>OPEN</CODE> or <CODE>CREATE</CODE>.</DL><P>The GNU linker <CODE>ld</CODE> is now described in a separate manual.See section `Overview' in <CITE>Using LD: the GNU linker</CITE>.<H1><A NAME="SEC4" HREF="binutils_toc.html#TOC4">nm</A></H1><P><A NAME="IDX27"></A><A NAME="IDX28"></A></P><PRE>nm [ -a | --debug-syms ] [ -g | --extern-only ] [ -B ] [ -C | --demangle ] [ -D | --dynamic ] [ -s | --print-armap ] [ -A | -o | --print-file-name ] [ -n | -v | --numeric-sort ] [ -p | --no-sort ] [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] [ -t <VAR>radix</VAR> | --radix=<VAR>radix</VAR> ] [ -P | --portability ] [ --target=<VAR>bfdname</VAR> ] [ -f <VAR>format</VAR> | --format=<VAR>format</VAR> ] [ --defined-only ] [ --no-demangle ] [ -V | --version ] [ --help ] [ <VAR>objfile</VAR>... ]</PRE><P>GNU <CODE>nm</CODE> lists the symbols from object files <VAR>objfile</VAR>....If no object files are listed as arguments, <CODE>nm</CODE> assumes<TT>`a.out'</TT>. Alternatively a list of files may be specified using the syntax <CODE>@listfile</CODE>. Here <CODE>listfile</CODE> is the name of a file containing a list of file names, one per line.</P><P>For each symbol, <CODE>nm</CODE> shows:</P><UL><LI>The symbol value, in the radix selected by options (see below), orhexadecimal by default.<LI>The symbol type. At least the following types are used; others are, aswell, depending on the object file format. If lowercase, the symbol islocal; if uppercase, the symbol is global (external).<DL COMPACT><DT><CODE>A</CODE><DD>The symbol's value is absolute, and will not be changed by furtherlinking.<DT><CODE>B</CODE><DD>The symbol is in the uninitialized data section (known as BSS).<DT><CODE>C</CODE><DD>The symbol is common. Common symbols are uninitialized data. Whenlinking, multiple common symbols may appear with the same name. If thesymbol is defined anywhere, the common symbols are treated as undefinedreferences. For more details on common symbols, see the discussion of--warn-common in section `Linker options' in <CITE>The GNU linker</CITE>.<DT><CODE>D</CODE><DD>The symbol is in the initialized data section.<DT><CODE>G</CODE><DD>The symbol is in an initialized data section for small objects. Someobject file formats permit more efficient access to small data objects,such as a global int variable as opposed to a large global array.<DT><CODE>I</CODE><DD>The symbol is an indirect reference to another symbol. This is a GNUextension to the a.out object file format which is rarely used.<DT><CODE>N</CODE><DD>The symbol is a debugging symbol.<DT><CODE>R</CODE><DD>The symbol is in a read only data section.<DT><CODE>S</CODE><DD>The symbol is in an uninitialized data section for small objects.<DT><CODE>T</CODE><DD>The symbol is in the text (code) section.<DT><CODE>U</CODE><DD>The symbol is undefined.<DT><CODE>W</CODE><DD>The symbol is weak. When a weak defined symbol is linked with a normaldefined symbol, the normal defined symbol is used with no error. When aweak undefined symbol is linked and the symbol is not defined, the valueof the weak symbol becomes zero with no error.<DT><CODE>-</CODE><DD>The symbol is a stabs symbol in an a.out object file. In this case, thenext values printed are the stabs other field, the stabs desc field, andthe stab type. Stabs symbols are used to hold debugging information;for more information, see section `Stabs Overview' in <CITE>The "stabs" debug format</CITE>.<DT><CODE>?</CODE><DD>The symbol type is unknown, or object file format specific.</DL><LI>The symbol name.</UL><P>The long and short forms of options, shown here as alternatives, areequivalent.</P><DL COMPACT><DT><CODE>-A</CODE><DD><DT><CODE>-o</CODE><DD><DT><CODE>--print-file-name</CODE><DD><A NAME="IDX29"></A><A NAME="IDX30"></A><A NAME="IDX31"></A>Precede each symbol by the name of the input file (or archive element)in which it was found, rather than identifying the input file once only,before all of its symbols.<DT><CODE>-a</CODE><DD><DT><CODE>--debug-syms</CODE><DD><A NAME="IDX32"></A>Display all symbols, even debugger-only symbols; normally these are notlisted.<DT><CODE>-B</CODE><DD><A NAME="IDX33"></A><A NAME="IDX34"></A>The same as <SAMP>`--format=bsd'</SAMP> (for compatibility with the MIPS <CODE>nm</CODE>).<DT><CODE>-C</CODE><DD><DT><CODE>--demangle</CODE><DD><A NAME="IDX35"></A>Decode (<EM>demangle</EM>) low-level symbol names into user-level names.Besides removing any initial underscore prepended by the system, thismakes C++ function names readable. See section <A HREF="binutils.html#SEC11">c++filt</A>, for more informationon demangling.<DT><CODE>--no-demangle</CODE><DD>Do not demangle low-level symbol names. This is the default.<DT><CODE>-D</CODE><DD><DT><CODE>--dynamic</CODE><DD><A NAME="IDX36"></A>Display the dynamic symbols rather than the normal symbols. This isonly meaningful for dynamic objects, such as certain types of sharedlibraries.<DT><CODE>-f <VAR>format</VAR></CODE><DD><DT><CODE>--format=<VAR>format</VAR></CODE><DD><A NAME="IDX37"></A><A NAME="IDX38"></A>Use the output format <VAR>format</VAR>, which can be <CODE>bsd</CODE>,<CODE>sysv</CODE>, or <CODE>posix</CODE>. The default is <CODE>bsd</CODE>.Only the first character of <VAR>format</VAR> is significant; it can beeither upper or lower case.<DT><CODE>-g</CODE><DD><DT><CODE>--extern-only</CODE><DD><A NAME="IDX39"></A>Display only external symbols.<DT><CODE>-n</CODE><DD><DT><CODE>-v</CODE><DD><DT><CODE>--numeric-sort</CODE><DD>Sort symbols numerically by their addresses, rather than alphabeticallyby their names. <DT><CODE>-p</CODE><DD><DT><CODE>--no-sort</CODE><DD><A NAME="IDX40"></A>Do not bother to sort the symbols in any order; print them in the orderencountered.<DT><CODE>-P</CODE><DD><DT><CODE>--portability</CODE><DD>Use the POSIX.2 standard output format instead of the default format.Equivalent to <SAMP>`-f posix'</SAMP>.<DT><CODE>-s</CODE><DD><DT><CODE>--print-armap</CODE><DD><A NAME="IDX41"></A>When listing symbols from archive members, include the index: a mapping(stored in the archive by <CODE>ar</CODE> or <CODE>ranlib</CODE>) of which modulescontain definitions for which names.<DT><CODE>-r</CODE><DD><DT><CODE>--reverse-sort</CODE><DD>Reverse the order of the sort (whether numeric or alphabetic); let thelast come first.<DT><CODE>--size-sort</CODE><DD>Sort symbols by size. The size is computed as the difference betweenthe value of the symbol and the value of the symbol with the next highervalue. The size of the symbol is printed, rather than the value.<DT><CODE>-t <VAR>radix</VAR></CODE><DD><DT><CODE>--radix=<VAR>radix</VAR></CODE><DD>Use <VAR>radix</VAR> as the radix for printing the symbol values. It must be<SAMP>`d'</SAMP> for decimal, <SAMP>`o'</SAMP> for octal, or <SAMP>`x'</SAMP> for hexadecimal.<DT><CODE>--target=<VAR>bfdname</VAR></CODE><DD><A NAME="IDX42"></A>Specify an object code format other than your system's default format.See section <A HREF="binutils.html#SEC13">Target Selection</A>, for more information.<DT><CODE>-u</CODE><DD><DT><CODE>--undefined-only</CODE><DD><A NAME="IDX43"></A><A NAME="IDX44"></A>Display only undefined symbols (those external to each object file).<DT><CODE>--defined-only</CODE><DD><A NAME="IDX45"></A><A NAME="IDX46"></A>Display only defined symbols for each object file.<DT><CODE>-V</CODE><DD><DT><CODE>--version</CODE><DD>Show the version number of <CODE>nm</CODE> and exit.<DT><CODE>--help</CODE><DD>Show a summary of the options to <CODE>nm</CODE> and exit.</DL><H1><A NAME="SEC5" HREF="binutils_toc.html#TOC5">objcopy</A></H1><PRE>objcopy [ -F <VAR>bfdname</VAR> | --target=<VAR>bfdname</VAR> ] [ -I <VAR>bfdname</VAR> | --input-target=<VAR>bfdname</VAR> ] [ -O <VAR>bfdname</VAR> | --output-target=<VAR>bfdname</VAR> ] [ -S | --strip-all ] [ -g | --strip-debug ] [ -K <VAR>symbolname</VAR> | --keep-symbol=<VAR>symbolname</VAR> ] [ -N <VAR>symbolname</VAR> | --strip-symbol=<VAR>symbolname</VAR> ] [ -x | --discard-all ] [ -X | --discard-locals ] [ -b <VAR>byte</VAR> | --byte=<VAR>byte</VAR> ] [ -i <VAR>interleave</VAR> | --interleave=<VAR>interleave</VAR> ] [ -R <VAR>sectionname</VAR> | --remove-section=<VAR>sectionname</VAR> ] [ --debugging ] [ --gap-fill=<VAR>val</VAR> ] [ --pad-to=<VAR>address</VAR> ] [ --set-start=<VAR>val</VAR> ] [ --adjust-start=<VAR>incr</VAR> ] [ --adjust-vma=<VAR>incr</VAR> ] [ --adjust-section-vma=<VAR>section</VAR>{=,+,-}<VAR>val</VAR> ] [ --adjust-warnings ] [ --no-adjust-warnings ] [ --set-section-flags=<VAR>section</VAR>=<VAR>flags</VAR> ] [ --add-section=<VAR>sectionname</VAR>=<VAR>filename</VAR> ] [ --remove-leading-char ] [ -v | --verbose ] [ -V | --version ] [ --help ] <VAR>infile</VAR> [<VAR>outfile</VAR>]</PRE><P>The GNU <CODE>objcopy</CODE> utility copies the contents of an objectfile to another. <CODE>objcopy</CODE> uses the GNU BFD Library toread and write the object files. It can write the destination objectfile in a format different from that of the source object file. Theexact behavior of <CODE>objcopy</CODE> is controlled by command-line options.</P><P><CODE>objcopy</CODE> creates temporary files to do its translations anddeletes them afterward. <CODE>objcopy</CODE> uses BFD to do all itstranslation work; it has access to all the formats described in BFDand thus is able to recognize most formats without being toldexplicitly. See section `BFD' in <CITE>Using LD</CITE>.</P><P><CODE>objcopy</CODE> can be used to generate S-records by using an outputtarget of <SAMP>`srec'</SAMP> (e.g., use <SAMP>`-O srec'</SAMP>).</P><P><CODE>objcopy</CODE> can be used to generate a raw binary file by using anoutput target of <SAMP>`binary'</SAMP> (e.g., use <SAMP>`-O binary'</SAMP>). When<CODE>objcopy</CODE> generates a raw binary file, it will essentially producea memory dump of the contents of the input object file. All symbols andrelocation information will be discarded. The memory dump will start atthe virtual address of the lowest section copied into the output file.</P><P>When generating an S-record or a raw binary file, it may be helpful touse <SAMP>`-S'</SAMP> to remove sections containing debugging information. Insome cases <SAMP>`-R'</SAMP> will be useful to remove sections which containinformation which is not needed by the binary file.</P><DL COMPACT><DT><CODE><VAR>infile</VAR></CODE><DD><DT><CODE><VAR>outfile</VAR></CODE><DD>The source and output files, respectively.If you do not specify <VAR>outfile</VAR>, <CODE>objcopy</CODE> creates atemporary file and destructively renames the result withthe name of <VAR>infile</VAR>.<DT><CODE>-I <VAR>bfdname</VAR></CODE><DD><DT><CODE>--input-target=<VAR>bfdname</VAR></CODE><DD>Consider the source file's object format to be <VAR>bfdname</VAR>, rather thanattempting to deduce it. See section <A HREF="binutils.html#SEC13">Target Selection</A>, for more information.<DT><CODE>-O <VAR>bfdname</VAR></CODE><DD><DT><CODE>--output-target=<VAR>bfdname</VAR></CODE><DD>Write the output file using the object format <VAR>bfdname</VAR>.See section <A HREF="binutils.html#SEC13">Target Selection</A>, for more information.<DT><CODE>-F <VAR>bfdname</VAR></CODE><DD><DT><CODE>--target=<VAR>bfdname</VAR></CODE><DD>Use <VAR>bfdname</VAR> as the object format for both the input and the outputfile; i.e., simply transfer data from source to destination with notranslation. See section <A HREF="binutils.html#SEC13">Target Selection</A>, for more information.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -