source: chapter06/binutils.xml@ b324fb38

Last change on this file since b324fb38 was b3268eb, checked in by Jeremy Utley <jeremy@…>, 20 years ago

Corrected binutils patch error in chapter 6 - thanks Robert Connolly

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4361 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 10.3 KB
RevLine 
[673b0d8]1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
[a001133]6<sect1 id="ch-system-binutils" xreflabel="Binutils" role="wrap">
[673b0d8]7<title>Binutils-&binutils-version;</title>
8<?dbhtml filename="binutils.html"?>
9
10<indexterm zone="ch-system-binutils"><primary sortas="a-Binutils">Binutils</primary></indexterm>
[6370fa6]11
[a001133]12<sect2 role="package"><title/>
[5888299]13<para>The Binutils package contains a linker, an assembler, and other tools for
14handling object files.</para>
15
[a001133]16<segmentedlist>
17<segtitle>&buildtime;</segtitle>
18<segtitle>&diskspace;</segtitle>
19<seglistitem><seg>1.4 SBU</seg><seg>167 MB</seg></seglistitem>
20</segmentedlist>
21
22<segmentedlist>
23<segtitle>Binutils installation depends on</segtitle>
24<seglistitem><seg>Bash, Coreutils, Diffutils, GCC, Gettext,
25Glibc, Grep, Make, Perl, Sed, Texinfo</seg></seglistitem>
26</segmentedlist>
27</sect2>
28
29<sect2 role="installation">
30<title>Installation of Binutils</title>
[73aedd1d]31
32<para>Now is an appropriate time to verify that your pseudo terminals (PTYs) are
33working properly inside the chroot environment. We will again quickly check that
34everything is set up correctly by performing a simple test:</para>
35
36<screen><userinput>expect -c "spawn ls"</userinput></screen>
37
38<para>If you receive the message:</para>
39
[3c928f1]40<screen><computeroutput>The system has no more ptys. Ask your system administrator to create more.</computeroutput></screen>
[73aedd1d]41
42<para>Your chroot environment is not set up for proper PTY operation. In this
43case there is no point in running the test suites for Binutils and GCC until you
[9dfc02f]44are able to resolve the issue.</para>
[73aedd1d]45
46<para>This package is known to behave badly when you have changed its
[3c928f1]47default optimization flags (including the <parameter>-march</parameter> and <parameter>-mcpu</parameter> options).
[73aedd1d]48Therefore, if you have defined any environment variables that override
[673b0d8]49default optimizations, such as CFLAGS and CXXFLAGS, we recommend un-setting
[73aedd1d]50or modifying them when building Binutils.</para>
51
[af133c3]52<para>The current version of Binutils in use has a bug that causes strip to
53remove necessary information from certain library files. This patch fixes
54the problem:</para>
55
[b3268eb]56<screen><userinput>patch -Np1 -i ../binutils-&binutils-version;-fix_strip-1.patch</userinput></screen>
[af133c3]57
[73aedd1d]58<para>The Binutils documentation recommends building Binutils outside of the
59source directory in a dedicated build directory:</para>
60
61<screen><userinput>mkdir ../binutils-build
62cd ../binutils-build</userinput></screen>
63
64<para>Now prepare Binutils for compilation:</para>
65
[673b0d8]66<screen><userinput>../binutils-&binutils-version;/configure --prefix=/usr --enable-shared</userinput></screen>
[73aedd1d]67
68<para>Compile the package:</para>
69
70<screen><userinput>make tooldir=/usr</userinput></screen>
71
72<para>Normally, the <emphasis>tooldir</emphasis> (the directory where the
73executables end up) is set to $(exec_prefix)/$(target_alias), which expands
[3c928f1]74into, for example, <filename class="directory">/usr/i686-pc-linux-gnu</filename>. Since we only
[73aedd1d]75build for our own system, we don't need this target specific directory in
[3c928f1]76<filename class="directory">/usr</filename>. That setup would be used if the system was used to
[73aedd1d]77cross-compile (for example compiling a package on an Intel machine that
78generates code that can be executed on PowerPC machines).</para>
79
[90afe40d]80<important><para>The test suite for Binutils in this section is considered
81<emphasis>critical</emphasis>. Our advice is to not skip it under any
82circumstances.</para></important>
83
[73aedd1d]84<para>Test the results:</para>
85
[9dfc02f]86<screen><userinput>make -k check</userinput></screen>
[73aedd1d]87
[3be4d97]88<para>The test suite notes from <xref linkend="ch-tools-binutils-pass2"/> are still
[73aedd1d]89very much appropriate here. Be sure to refer back there should you have any
90doubts.</para>
91
92<para>Install the package:</para>
93
94<screen><userinput>make tooldir=/usr install</userinput></screen>
95
[3c928f1]96<para>Install the <filename class="headerfile">libiberty</filename> header file that is needed by
[73aedd1d]97some packages:</para>
98
[673b0d8]99<screen><userinput>cp ../binutils-&binutils-version;/include/libiberty.h /usr/include</userinput></screen>
[73aedd1d]100
101</sect2>
[6370fa6]102
[5888299]103
[c6cb3aa]104<sect2 id="contents-binutils" role="content"><title>Contents of Binutils</title>
[673b0d8]105
[c6cb3aa]106<segmentedlist>
107<segtitle>Installed programs</segtitle>
108<segtitle>Installed libraries</segtitle>
109<seglistitem><seg>addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump,
110ranlib, readelf, size, strings and strip</seg>
111<seg>libiberty.a, libbfd.[a,so] and libopcodes.[a,so]</seg></seglistitem>
112</segmentedlist>
[673b0d8]113
[c6cb3aa]114<variablelist><title>Short descriptions</title>
[673b0d8]115
[b8a819f]116<varlistentry id="addr2line">
117<term><command>addr2line</command></term>
[c6cb3aa]118<listitem>
[673b0d8]119<indexterm zone="ch-system-binutils addr2line"><primary sortas="b-addr2line">addr2line</primary></indexterm>
[c6cb3aa]120<para>translates program addresses to file
[673b0d8]121names and line numbers. Given an address and the name of an executable, it
122uses the debugging information in the executable to figure out which source
123file and line number are associated with the address.</para>
[c6cb3aa]124</listitem>
125</varlistentry>
[673b0d8]126
[b8a819f]127<varlistentry id="ar">
128<term><command>ar</command></term>
[c6cb3aa]129<listitem>
[673b0d8]130<indexterm zone="ch-system-binutils ar"><primary sortas="b-ar">ar</primary></indexterm>
[c6cb3aa]131<para>creates, modifies, and extracts from archives. An archive
[673b0d8]132is a single file holding a collection of other files in a structure that makes
133it possible to retrieve the original individual files (called members of
134the archive).</para>
[c6cb3aa]135</listitem>
136</varlistentry>
[673b0d8]137
[b8a819f]138<varlistentry id="as">
139<term><command>as</command></term>
[c6cb3aa]140<listitem>
[673b0d8]141<indexterm zone="ch-system-binutils as"><primary sortas="b-as">as</primary></indexterm>
[3c928f1]142<para>is an assembler. It assembles the output of <command>gcc</command> into object files.</para>
[c6cb3aa]143</listitem>
144</varlistentry>
[673b0d8]145
[b8a819f]146<varlistentry id="c-filt">
147<term><command>c++filt</command></term>
[c6cb3aa]148<listitem>
[673b0d8]149<indexterm zone="ch-system-binutils c-filt"><primary sortas="b-c++filt">c++filt</primary></indexterm>
[c6cb3aa]150<para>is used by the linker to de-mangle C++ and
[673b0d8]151Java symbols, to keep overloaded functions from clashing.</para>
[c6cb3aa]152</listitem>
153</varlistentry>
[673b0d8]154
[b8a819f]155<varlistentry id="gprof">
156<term><command>gprof</command></term>
[c6cb3aa]157<listitem>
[673b0d8]158<indexterm zone="ch-system-binutils gprof"><primary sortas="b-gprof">gprof</primary></indexterm>
[c6cb3aa]159<para>displays call graph profile data.</para>
160</listitem>
161</varlistentry>
[673b0d8]162
[b8a819f]163<varlistentry id="ld">
164<term><command>ld</command></term>
[c6cb3aa]165<listitem>
[673b0d8]166<indexterm zone="ch-system-binutils ld"><primary sortas="b-ld">ld</primary></indexterm>
[c6cb3aa]167<para>is a linker. It combines a number of object and archive files into a single file,
168relocating their data and tying up symbol references.</para>
169</listitem>
170</varlistentry>
171
[b8a819f]172<varlistentry id="nm">
173<term><command>nm</command></term>
[c6cb3aa]174<listitem>
[673b0d8]175<indexterm zone="ch-system-binutils nm"><primary sortas="b-nm">nm</primary></indexterm>
[c6cb3aa]176<para>lists the symbols occurring in a given object file.</para>
177</listitem>
178</varlistentry>
[73aedd1d]179
[b8a819f]180<varlistentry id="objcopy">
181<term><command>objcopy</command></term>
[c6cb3aa]182<listitem>
[673b0d8]183<indexterm zone="ch-system-binutils objcopy"><primary sortas="b-objcopy">objcopy</primary></indexterm>
[c6cb3aa]184<para>is used to translate one type of object file into another.</para>
185</listitem>
186</varlistentry>
[673b0d8]187
[b8a819f]188<varlistentry id="objdump">
189<term><command>objdump</command></term>
[c6cb3aa]190<listitem>
[673b0d8]191<indexterm zone="ch-system-binutils objdump"><primary sortas="b-objdump">objdump</primary></indexterm>
[c6cb3aa]192<para>displays information about the given object file, with options controlling what
193particular information to display. The information shown is mostly only useful to
194programmers who are working on the compilation tools.</para>
195</listitem>
196</varlistentry>
197
[b8a819f]198<varlistentry id="ranlib">
199<term><command>ranlib</command></term>
[c6cb3aa]200<listitem>
[673b0d8]201<indexterm zone="ch-system-binutils ranlib"><primary sortas="b-ranlib">ranlib</primary></indexterm>
[c6cb3aa]202<para>generates an index of the contents of an
[673b0d8]203archive, and stores it in the archive. The index lists all the symbols defined
204by archive members that are relocatable object files.</para>
[c6cb3aa]205</listitem>
206</varlistentry>
[673b0d8]207
[b8a819f]208<varlistentry id="readelf">
209<term><command>readelf</command></term>
[c6cb3aa]210<listitem>
[673b0d8]211<indexterm zone="ch-system-binutils readelf"><primary sortas="b-readelf">readelf</primary></indexterm>
[c6cb3aa]212<para>displays information about elf type binaries.</para>
213</listitem>
214</varlistentry>
[673b0d8]215
[b8a819f]216<varlistentry id="size">
217<term><command>size</command></term>
[c6cb3aa]218<listitem>
[673b0d8]219<indexterm zone="ch-system-binutils size"><primary sortas="b-size">size</primary></indexterm>
[c6cb3aa]220<para>lists the section sizes -- and the grand total -- for the given object files.</para>
221</listitem>
222</varlistentry>
[673b0d8]223
[b8a819f]224<varlistentry id="strings">
225<term><command>strings</command></term>
[c6cb3aa]226<listitem>
[673b0d8]227<indexterm zone="ch-system-binutils strings"><primary sortas="b-strings">strings</primary></indexterm>
[c6cb3aa]228<para>outputs, for each given file, the sequences
[673b0d8]229of printable characters that are of at least the specified length (defaulting to 4).
230For object files it prints, by default, only the strings from the initializing
231and loading sections. For other types of files it scans the whole file.</para>
[c6cb3aa]232</listitem>
233</varlistentry>
[673b0d8]234
[b8a819f]235<varlistentry id="strip">
236<term><command>strip</command></term>
[c6cb3aa]237<listitem>
[673b0d8]238<indexterm zone="ch-system-binutils strip"><primary sortas="b-strip">strip</primary></indexterm>
[c6cb3aa]239<para>discards symbols from object files.</para>
240</listitem>
241</varlistentry>
[673b0d8]242
[b8a819f]243<varlistentry id="libiberty">
[e63529b]244<term><filename class="libraryfile">libiberty</filename></term>
[c6cb3aa]245<listitem>
[673b0d8]246<indexterm zone="ch-system-binutils libiberty"><primary sortas="c-libiberty">libiberty</primary></indexterm>
[c6cb3aa]247<para>contains routines used by various GNU
[673b0d8]248programs, including getopt, obstack, strerror, strtol and strtoul.</para>
[c6cb3aa]249</listitem>
250</varlistentry>
[673b0d8]251
[b8a819f]252<varlistentry id="libbfd">
[e63529b]253<term><filename class="libraryfile">libbfd</filename></term>
[c6cb3aa]254<listitem>
[673b0d8]255<indexterm zone="ch-system-binutils libbfd"><primary sortas="c-libbfd">libbfd</primary></indexterm>
[c6cb3aa]256<para>is the Binary File Descriptor library.</para>
257</listitem>
258</varlistentry>
[673b0d8]259
[b8a819f]260<varlistentry id="libopcodes">
[e63529b]261<term><filename class="libraryfile">libopcodes</filename></term>
[c6cb3aa]262<listitem>
[673b0d8]263<indexterm zone="ch-system-binutils libopcodes"><primary sortas="c-libopcodes">libopcodes</primary></indexterm>
[c6cb3aa]264<para>is a library for dealing with opcodes.
[673b0d8]265It is used for building utilities like objdump. Opcodes are the <quote>readable
266text</quote> versions of instructions for the processor.</para>
[c6cb3aa]267</listitem>
268</varlistentry>
269</variablelist>
[673b0d8]270
271</sect2>
272
273</sect1>
Note: See TracBrowser for help on using the repository browser.