📄 binutils.html
字号:
<HTML><HEAD><TITLE>Installing Binutils-2.11.2</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.63"><LINKREL="HOME"TITLE="Linux From Scratch"HREF="../index.html"><LINKREL="UP"TITLE="Preparing the LFS system"HREF="../chapter05/chapter05.html"><LINKREL="PREVIOUS"TITLE="Installing Bash-2.05a"HREF="../chapter05/bash.html"><LINKREL="NEXT"TITLE="Installing Bzip2-1.0.1"HREF="../chapter05/bzip2.html"></HEAD><BODYCLASS="sect1"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Linux From Scratch: Version 3.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="../chapter05/bash.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Chapter 5. Preparing the LFS system</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="../chapter05/bzip2.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="sect1"><H1CLASS="sect1"><ANAME="ch05-binutils">5.5. Installing Binutils-2.11.2</A></H1><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen">Estimated build time: 6 minutesEstimated required disk space: 96 MB</PRE></FONT></TD></TR></TABLE><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN866">5.5.1. Installation of Binutils</A></H2><P>This package is known to behave badly when you have changed its defaultoptimization flags (including the -march and -mcpu options). Binutils is best left alone, so we recommend you unsetting CFLAGS, CXXFLAGS and othersuch variables/settings that would change the default optimization thatit comes with.</P><P>Install Binutils by running the following commands:</P><P><TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="100%"><TR><TD><FONTCOLOR="#000000"><PRECLASS="screen"><TTCLASS="userinput"><B>./configure --prefix=$LFS/usr --disable-nls &&make LDFLAGS=-all-static tooldir=$LFS/usr &&make tooldir=$LFS/usr install</B></TT></PRE></FONT></TD></TR></TABLE></P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN873">5.5.2. Command explanations</A></H2><P><TTCLASS="userinput"><B>--disable-nls:</B></TT> This option disabledinternationalization (also known as i18n). We don't need this for ourstatic programs and nls often causes problems when you're linkingstatically.</P><P><TTCLASS="userinput"><B>LDFLAGS=-all-static:</B></TT> Setting the variable LDFLAGSto the value -all-static causes binutils to be linked statically.</P><P><TTCLASS="userinput"><B>tooldir=$LFS/usr:</B></TT> Normally, the tooldir (thedirectory where the executables from binutils end up in) is set to$(exec_prefix)/$(target_alias) which expands into, for example, /usr/i686-pc-linux-gnu. Since we only build for our own system, we don'tneed this target specific directory in $LFS/usr. That setup would be usedif the system was used to cross-compile (for example compiling a package on the Intel machine that generates code that can beexecuted on Apple PowerPC machines).</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN881">5.5.3. Contents</A></H2><P>The Binutils package contains the addr2line, as, ar, c++filt, gasp, gprof, ld, nm, objcopy, objdump, ranlib, readelf, size, strings and strip programs</P></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN884">5.5.4. Description</A></H2><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN886">5.5.4.1. addr2line</A></H3><P>addr2line translates program addresses into file names and line numbers. Given an address and an executable, it uses the debugging information in the executable to figure out which file name and line number are associated with a given address.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN889">5.5.4.2. as</A></H3><P>as is primarily intended to assemble the output of the GNU C compiler gcc for use by the linker ld.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN892">5.5.4.3. ar</A></H3><P>The ar program creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN895">5.5.4.4. c++filt</A></H3><P>The C++ language provides function overloading, which means that it is possible towrite many functions with the same name (providing each takes parameters of different types). All C++ function names are encoded into a low-level assembly label (this process is known as mangling). The c++filt program does the inverse mapping: it decodes (demangles) low-level names into user-level names so that the linker can keep these overloaded functions from clashing.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN898">5.5.4.5. gasp</A></H3><P>Gasp is the Assembler Macro Preprocessor.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN901">5.5.4.6. gprof</A></H3><P>gprof displays call graph profile data.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN904">5.5.4.7. ld</A></H3><P>ld combines a number of object and archive files, relocates their data and ties up symbol references. Often the last step in building a new compiled program to run is a call to ld.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN907">5.5.4.8. nm</A></H3><P>nm lists the symbols from object files.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN910">5.5.4.9. objcopy</A></H3><P>objcopy utility copies the contents of an object file to another. objcopy uses the GNU BFD Library to read and write the object files. It can write the destination object file in a format different from that of the sourceobject file.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN913">5.5.4.10. objdump</A></H3><P>objdump displays information about one or more object files. The options control what particular information to display. This information is mostly useful to programmers who are working on the compilation tools, as opposed toprogrammers who just want their program to compile and work.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN916">5.5.4.11. ranlib</A></H3><P>ranlib generates an index to the contents of an archive, and stores it in the archive. The index lists each symbol defined by a member of an archive that is a relocatable object file.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN919">5.5.4.12. readelf</A></H3><P>readelf displays information about elf type binaries.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN922">5.5.4.13. size</A></H3><P>size lists the section sizes --and the total size-- for each of the object files objfile in its argument list. By default, one line of output is generated for each object file or each module in an archive.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN925">5.5.4.14. strings</A></H3><P>For each file given, strings prints the printable character sequences that are at least 4 characters long (or the number specified with anoption to the program) and are followed by an unprintable character. By default, it only prints the strings from the initialized and loaded sections of object files; for other types of files, it prints the strings from the whole file.</P><P>strings is mainly useful for determining the contents of non-text files.</P></DIV><DIVCLASS="sect3"><H3CLASS="sect3"><ANAME="AEN929">5.5.4.15. strip</A></H3><P>strip discards all or specific symbols from object files. The list of object files may include archives. At least one object file must begiven. strip modifies the files named in its argument, rather than writing modified copies under different names.</P></DIV></DIV><DIVCLASS="sect2"><H2CLASS="sect2"><ANAME="AEN932">5.5.5. Dependencies</A></H2><P>Binutils-2.11.2 needs the following to be installed:</P><PCLASS="literallayout"><br>sh from the bash package<br><br>ar from the binutils package<br>as from the binutils package<br>ld from the binutils package<br>nm from the binutils package<br>ranlib from the binutils package<br><br>cmp from the diffutils package<br><br>chmod from the fileutils package<br>cp from the fileutils package<br>ln from the fileutils package<br>ls from the fileutils package<br>mkdir from the fileutils package<br>mv from the fileutils package<br>rm from the fileutils package<br>rmdir from the fileutils package<br>touch from the fileutils package<br><br>gcc from the gcc package<br><br>egrep from the grep package<br>grep from the grep package<br><br>make from the make package<br><br>sed from the sed package<br><br>basename from the sh-utils package<br>expr from the sh-utils package<br>sleep from the sh-utils package<br>uname from the sh-utils package<br><br>makeinfo from the texinfo package<br><br>cat from the textutils package<br>sort from the textutils package<br>tail from the textutils package<br>tr from the textutils package<br>true from the sh-utils package<br>uniq from the textutils package<br></P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="../chapter05/bash.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../index.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="../chapter05/bzip2.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Installing Bash-2.05a</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="../chapter05/chapter05.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Installing Bzip2-1.0.1</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -