Update to libcap-2.28.
[linux_from_scratch.git] / chapter06 / binutils.xml
blob721590376fbdc811726044b8ba6f8873ffaec6e8
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4   <!ENTITY % general-entities SYSTEM "../general.ent">
5   %general-entities;
6 ]>
8 <sect1 id="ch-system-binutils" role="wrap">
9   <?dbhtml filename="binutils.html"?>
11   <sect1info condition="script">
12     <productname>binutils</productname>
13     <productnumber>&binutils-version;</productnumber>
14     <address>&binutils-url;</address>
15   </sect1info>
17   <title>Binutils-&binutils-version;</title>
19   <indexterm zone="ch-system-binutils">
20     <primary sortas="a-Binutils">Binutils</primary>
21   </indexterm>
23   <sect2 role="package">
24     <title/>
26     <para>The Binutils package contains a linker, an assembler, and other
27     tools for handling object files.</para>
29     <segmentedlist>
30       <segtitle>&buildtime;</segtitle>
31       <segtitle>&diskspace;</segtitle>
33       <seglistitem>
34         <seg>&binutils-ch6-sbu;</seg>
35         <seg>&binutils-ch6-du;</seg>
36       </seglistitem>
37     </segmentedlist>
39   </sect2>
41   <sect2 role="installation">
42     <title>Installation of Binutils</title>
44     <para>Verify that the PTYs are working properly inside the chroot
45     environment by performing a simple test:</para>
47 <screen><userinput remap="test">expect -c "spawn ls"</userinput></screen>
49     <para>This command should output the following:</para>
51 <screen><computeroutput>spawn ls</computeroutput></screen>
53     <para>If, instead, the output includes the message below, then the environment
54     is not set up for proper PTY operation.  This issue needs to be resolved before
55     running the test suites for Binutils and GCC:</para>
57 <screen><computeroutput>The system has no more ptys.
58 Ask your system administrator to create more.</computeroutput></screen>
60     <para>Now remove one test that prevents the tests from running
61     to completion:</para>
63 <screen><userinput remap="pre">sed -i '/@\tincremental_copy/d' gold/testsuite/Makefile.in</userinput></screen>
65     <para>The Binutils documentation recommends building Binutils 
66     in a dedicated build directory:</para>
68 <screen><userinput remap="pre">mkdir -v build
69 cd       build</userinput></screen>
71     <para>Prepare Binutils for compilation:</para>
73 <screen><userinput remap="configure">../configure --prefix=/usr       \
74              --enable-gold       \
75              --enable-ld=default \
76              --enable-plugins    \
77              --enable-shared     \
78              --disable-werror    \
79              --enable-64-bit-bfd \
80              --with-system-zlib</userinput></screen>
81     <variablelist>
82       <title>The meaning of the configure parameters:</title>
84       <varlistentry>
85         <term><parameter>--enable-gold</parameter></term>
86         <listitem>
87           <para>Build the gold linker and install it as ld.gold (along side the
88           default linker).</para>
89         </listitem>
90       </varlistentry>
92       <varlistentry>
93         <term><parameter>--enable-ld=default</parameter></term>
94         <listitem>
95           <para>Build the original bdf linker and install it as both ld (the
96           default linker) and ld.bfd.</para>
97         </listitem>
98       </varlistentry>
100       <varlistentry>
101         <term><parameter>--enable-plugins</parameter></term>
102         <listitem>
103           <para>Enables plugin support for the linker.</para>
104         </listitem>
105       </varlistentry>
107       <varlistentry>
108         <term><parameter>--enable-64-bit-bfd</parameter></term>
109         <listitem>
110            <para>Enables 64-bit support (on hosts with narrower word sizes).
111            May not be needed on 64-bit systems, but does no harm.</para>
112         </listitem>
113       </varlistentry>
115       <varlistentry>
116         <term><parameter>--with-system-zlib</parameter></term>
117         <listitem>
118           <para>Use the installed zlib library rather than building the
119           included version.</para>
120         </listitem>
121       </varlistentry>
123     </variablelist>
125     <para>Compile the package:</para>
127 <screen><userinput remap="make">make tooldir=/usr</userinput></screen>
129     <variablelist>
130       <title>The meaning of the make parameter:</title>
132       <varlistentry>
133         <term><parameter>tooldir=/usr</parameter></term>
134         <listitem>
135           <para>Normally, the tooldir (the directory where the executables will
136           ultimately be located) is set to <filename
137           class="directory">$(exec_prefix)/$(target_alias)</filename>. For
138           example, x86_64 machines would expand that to <filename
139           class="directory">/usr/x86_64-unknown-linux-gnu</filename>. Because this is
140           a custom system, this target-specific directory in <filename
141           class="directory">/usr</filename> is not required. <filename
142           class="directory">$(exec_prefix)/$(target_alias)</filename> would be
143           used if the system was used to cross-compile (for example, compiling a
144           package on an Intel machine that generates code that can be executed
145           on PowerPC machines).</para>
146         </listitem>
147       </varlistentry>
149     </variablelist>
151     <important>
152       <para>The test suite for Binutils in this section is considered critical.
153       Do not skip it under any circumstances.</para>
154     </important>
156     <para>Test the results:</para>
158 <screen><userinput remap="test">make -k check</userinput></screen>
160     <para>The ver_test_pr16504.sh test is known to fail.</para>
162     <para>Install the package:</para>
164 <screen><userinput remap="install">make tooldir=/usr install</userinput></screen>
166   </sect2>
168   <sect2 id="contents-binutils" role="content">
169     <title>Contents of Binutils</title>
171     <segmentedlist>
172       <segtitle>Installed programs</segtitle>
173       <segtitle>Installed libraries</segtitle>
174       <segtitle>Installed directory</segtitle>
176       <seglistitem>
177         <seg>addr2line, ar, as, c++filt, dwp, elfedit, gprof, ld, ld.bfd, ld.gold, nm,
178         objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
179         <seg>libbfd.{a,so} and libopcodes.{a,so}</seg>
180         <seg>/usr/lib/ldscripts</seg>
181       </seglistitem>
182     </segmentedlist>
184     <variablelist>
185       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
186       <?dbfo list-presentation="list"?>
187       <?dbhtml list-presentation="table"?>
189       <varlistentry id="addr2line">
190         <term><command>addr2line</command></term>
191         <listitem>
192           <para>Translates program addresses to file names and line numbers;
193           given an address and the name of an executable, it uses the debugging
194           information in the executable to determine which source file and line
195           number are associated with the address</para>
196           <indexterm zone="ch-system-binutils addr2line">
197             <primary sortas="b-addr2line">addr2line</primary>
198           </indexterm>
199         </listitem>
200       </varlistentry>
202       <varlistentry id="ar">
203         <term><command>ar</command></term>
204         <listitem>
205           <para>Creates, modifies, and extracts from archives</para>
206           <indexterm zone="ch-system-binutils ar">
207             <primary sortas="b-ar">ar</primary>
208           </indexterm>
209         </listitem>
210       </varlistentry>
212       <varlistentry id="as">
213         <term><command>as</command></term>
214         <listitem>
215           <para>An assembler that assembles the output of <command>gcc</command>
216           into object files</para>
217           <indexterm zone="ch-system-binutils as">
218             <primary sortas="b-as">as</primary>
219           </indexterm>
220         </listitem>
221       </varlistentry>
223       <varlistentry id="c-filt">
224         <term><command>c++filt</command></term>
225         <listitem>
226           <para>Used by the linker to de-mangle C++ and Java symbols and to keep
227           overloaded functions from clashing</para>
228           <indexterm zone="ch-system-binutils c-filt">
229             <primary sortas="b-c++filt">c++filt</primary>
230           </indexterm>
231         </listitem>
232       </varlistentry>
234       <varlistentry id="dwp">
235         <term><command>dwp</command></term>
236         <listitem>
237           <para>The DWARF packaging utility</para>
238           <indexterm zone="ch-system-binutils dwp">
239             <primary sortas="dwp">dwp</primary>
240           </indexterm>
241         </listitem>
242       </varlistentry>
244       <varlistentry id="elfedit">
245         <term><command>elfedit</command></term>
246         <listitem>
247           <para>Updates the ELF header of ELF files</para>
248           <indexterm zone="ch-system-binutils elfedit">
249             <primary sortas="b-elfedit">elfedit</primary>
250           </indexterm>
251         </listitem>
252       </varlistentry>
254       <varlistentry id="gprof">
255         <term><command>gprof</command></term>
256         <listitem>
257           <para>Displays call graph profile data</para>
258           <indexterm zone="ch-system-binutils gprof">
259             <primary sortas="b-gprof">gprof</primary>
260           </indexterm>
261         </listitem>
262       </varlistentry>
264       <varlistentry id="ld">
265         <term><command>ld</command></term>
266         <listitem>
267           <para>A linker that combines a number of object and archive files
268           into a single file, relocating their data and tying up symbol
269           references</para>
270           <indexterm zone="ch-system-binutils ld">
271             <primary sortas="b-ld">ld</primary>
272           </indexterm>
273         </listitem>
274       </varlistentry>
276       <varlistentry id="ld.gold">
277         <term><command>ld.gold</command></term>
278         <listitem>
279           <para>A cut down version of ld that only supports the 
280           elf object file format</para>
281           <indexterm zone="ch-system-binutils ld.gold">
282             <primary sortas="b-ld.gold">ld.gold</primary>
283           </indexterm>
284         </listitem>
285       </varlistentry>
287       <varlistentry id="ld.bfd">
288         <term><command>ld.bfd</command></term>
289         <listitem>
290           <para>Hard link to <command>ld</command></para>
291           <indexterm zone="ch-system-binutils ld.bfd">
292             <primary sortas="b-ld.bfd">ld.bfd</primary>
293           </indexterm>
294         </listitem>
295       </varlistentry>
297       <varlistentry id="nm">
298         <term><command>nm</command></term>
299         <listitem>
300           <para>Lists the symbols occurring in a given object file</para>
301           <indexterm zone="ch-system-binutils nm">
302             <primary sortas="b-nm">nm</primary>
303           </indexterm>
304         </listitem>
305       </varlistentry>
307       <varlistentry id="objcopy">
308         <term><command>objcopy</command></term>
309         <listitem>
310           <para>Translates one type of object file into another</para>
311           <indexterm zone="ch-system-binutils objcopy">
312             <primary sortas="b-objcopy">objcopy</primary>
313           </indexterm>
314         </listitem>
315       </varlistentry>
317       <varlistentry id="objdump">
318         <term><command>objdump</command></term>
319         <listitem>
320           <para>Displays information about the given object file, with options
321           controlling the particular information to display; the information
322           shown is useful to programmers who are working on the compilation
323           tools</para>
324           <indexterm zone="ch-system-binutils objdump">
325             <primary sortas="b-objdump">objdump</primary>
326           </indexterm>
327         </listitem>
328       </varlistentry>
330       <varlistentry id="ranlib">
331         <term><command>ranlib</command></term>
332         <listitem>
333           <para>Generates an index of the contents of an archive and stores it
334           in the archive; the index lists all of the symbols defined by archive
335           members that are relocatable object files</para>
336           <indexterm zone="ch-system-binutils ranlib">
337             <primary sortas="b-ranlib">ranlib</primary>
338           </indexterm>
339         </listitem>
340       </varlistentry>
342       <varlistentry id="readelf">
343         <term><command>readelf</command></term>
344         <listitem>
345           <para>Displays information about ELF type binaries</para>
346           <indexterm zone="ch-system-binutils readelf">
347             <primary sortas="b-readelf">readelf</primary>
348           </indexterm>
349         </listitem>
350       </varlistentry>
352       <varlistentry id="size">
353         <term><command>size</command></term>
354         <listitem>
355           <para>Lists the section sizes and the total size for the given
356           object files</para>
357           <indexterm zone="ch-system-binutils size">
358             <primary sortas="b-size">size</primary>
359           </indexterm>
360         </listitem>
361       </varlistentry>
363       <varlistentry id="strings">
364         <term><command>strings</command></term>
365         <listitem>
366           <para>Outputs, for each given file, the sequences of printable
367           characters that are of at least the specified length (defaulting to
368           four); for object files, it prints, by default, only the strings from
369           the initializing and loading sections while for other types of files, it
370           scans the entire file</para>
371           <indexterm zone="ch-system-binutils strings">
372             <primary sortas="b-strings">strings</primary>
373           </indexterm>
374         </listitem>
375       </varlistentry>
377       <varlistentry id="strip">
378         <term><command>strip</command></term>
379         <listitem>
380           <para>Discards symbols from object files</para>
381           <indexterm zone="ch-system-binutils strip">
382             <primary sortas="b-strip">strip</primary>
383           </indexterm>
384         </listitem>
385       </varlistentry>
387       <varlistentry id="libbfd">
388         <term><filename class="libraryfile">libbfd</filename></term>
389         <listitem>
390           <para>The Binary File Descriptor library</para>
391           <indexterm zone="ch-system-binutils libbfd">
392             <primary sortas="c-libbfd">libbfd</primary>
393           </indexterm>
394         </listitem>
395       </varlistentry>
397       <varlistentry id="libopcodes">
398         <term><filename class="libraryfile">libopcodes</filename></term>
399         <listitem>
400           <para>A library for dealing with opcodes&mdash;the <quote>readable
401           text</quote> versions of instructions for the processor;
402           it is used for building utilities like
403           <command>objdump</command></para>
404           <indexterm zone="ch-system-binutils libopcodes">
405             <primary sortas="c-libopcodes">libopcodes</primary>
406           </indexterm>
407         </listitem>
408       </varlistentry>
410     </variablelist>
412   </sect2>
414 </sect1>