Move OpenSSL-1.1.0g from BLFS to LFS
[linux_from_scratch.git] / chapter06 / binutils.xml
blob4435db7e9c4de6c84a51cbbd66fb2b657fa63bbe
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>The Binutils documentation recommends building Binutils 
61     in a dedicated build directory:</para>
63 <screen><userinput remap="pre">mkdir -v build
64 cd       build</userinput></screen>
66     <para>Prepare Binutils for compilation:</para>
68 <screen><userinput remap="configure">../configure --prefix=/usr       \
69              --enable-gold       \
70              --enable-ld=default \
71              --enable-plugins    \
72              --enable-shared     \
73              --disable-werror    \
74              --enable-64-bit-bfd \
75              --with-system-zlib</userinput></screen>
76     <variablelist>
77       <title>The meaning of the configure parameters:</title>
79       <varlistentry>
80         <term><parameter>--enable-gold</parameter></term>
81         <listitem>
82           <para>Build the gold linker and install it as ld.gold (along side the
83           default linker).</para>
84         </listitem>
85       </varlistentry>
87       <varlistentry>
88         <term><parameter>--enable-ld=default</parameter></term>
89         <listitem>
90           <para>Build the original bdf linker and install it as both ld (the
91           default linker) and ld.bfd.</para>
92         </listitem>
93       </varlistentry>
95       <varlistentry>
96         <term><parameter>--enable-plugins</parameter></term>
97         <listitem>
98           <para>Enables plugin support for the linker.</para>
99         </listitem>
100       </varlistentry>
102       <varlistentry>
103         <term><parameter>--enable-64-bit-bfd</parameter></term>
104         <listitem>
105            <para>Enables 64-bit support (on hosts with narrower word sizes).
106            May not be needed on 64-bit systems, but does no harm.</para>
107         </listitem>
108       </varlistentry>
110       <varlistentry>
111         <term><parameter>--with-system-zlib</parameter></term>
112         <listitem>
113           <para>Use the installed zlib library rather than building the
114           included version.</para>
115         </listitem>
116       </varlistentry>
118     </variablelist>
120     <para>Compile the package:</para>
122 <screen><userinput remap="make">make tooldir=/usr</userinput></screen>
124     <variablelist>
125       <title>The meaning of the make parameter:</title>
127       <varlistentry>
128         <term><parameter>tooldir=/usr</parameter></term>
129         <listitem>
130           <para>Normally, the tooldir (the directory where the executables will
131           ultimately be located) is set to <filename
132           class="directory">$(exec_prefix)/$(target_alias)</filename>. For
133           example, x86_64 machines would expand that to <filename
134           class="directory">/usr/x86_64-unknown-linux-gnu</filename>. Because this is
135           a custom system, this target-specific directory in <filename
136           class="directory">/usr</filename> is not required. <filename
137           class="directory">$(exec_prefix)/$(target_alias)</filename> would be
138           used if the system was used to cross-compile (for example, compiling a
139           package on an Intel machine that generates code that can be executed
140           on PowerPC machines).</para>
141         </listitem>
142       </varlistentry>
144     </variablelist>
146     <important>
147       <para>The test suite for Binutils in this section is considered critical.
148       Do not skip it under any circumstances.</para>
149     </important>
151     <para>Test the results:</para>
153 <screen><userinput remap="test">make -k check</userinput></screen>
155     <para>One test, debug_msg.sh, is known to fail.</para>
157     <para>Install the package:</para>
159 <screen><userinput remap="install">make tooldir=/usr install</userinput></screen>
161   </sect2>
163   <sect2 id="contents-binutils" role="content">
164     <title>Contents of Binutils</title>
166     <segmentedlist>
167       <segtitle>Installed programs</segtitle>
168       <segtitle>Installed libraries</segtitle>
169       <segtitle>Installed directory</segtitle>
171       <seglistitem>
172         <seg>addr2line, ar, as, c++filt, elfedit, gprof, ld, ld.bfd, ld.gold, nm,
173         objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
174         <seg>libbfd.{a,so} and libopcodes.{a,so}</seg>
175         <seg>/usr/lib/ldscripts</seg>
176       </seglistitem>
177     </segmentedlist>
179     <variablelist>
180       <bridgehead renderas="sect3">Short Descriptions</bridgehead>
181       <?dbfo list-presentation="list"?>
182       <?dbhtml list-presentation="table"?>
184       <varlistentry id="addr2line">
185         <term><command>addr2line</command></term>
186         <listitem>
187           <para>Translates program addresses to file names and line numbers;
188           given an address and the name of an executable, it uses the debugging
189           information in the executable to determine which source file and line
190           number are associated with the address</para>
191           <indexterm zone="ch-system-binutils addr2line">
192             <primary sortas="b-addr2line">addr2line</primary>
193           </indexterm>
194         </listitem>
195       </varlistentry>
197       <varlistentry id="ar">
198         <term><command>ar</command></term>
199         <listitem>
200           <para>Creates, modifies, and extracts from archives</para>
201           <indexterm zone="ch-system-binutils ar">
202             <primary sortas="b-ar">ar</primary>
203           </indexterm>
204         </listitem>
205       </varlistentry>
207       <varlistentry id="as">
208         <term><command>as</command></term>
209         <listitem>
210           <para>An assembler that assembles the output of <command>gcc</command>
211           into object files</para>
212           <indexterm zone="ch-system-binutils as">
213             <primary sortas="b-as">as</primary>
214           </indexterm>
215         </listitem>
216       </varlistentry>
218       <varlistentry id="c-filt">
219         <term><command>c++filt</command></term>
220         <listitem>
221           <para>Used by the linker to de-mangle C++ and Java symbols and to keep
222           overloaded functions from clashing</para>
223           <indexterm zone="ch-system-binutils c-filt">
224             <primary sortas="b-c++filt">c++filt</primary>
225           </indexterm>
226         </listitem>
227       </varlistentry>
229       <varlistentry id="elfedit">
230         <term><command>elfedit</command></term>
231         <listitem>
232           <para>Updates the ELF header of ELF files</para>
233           <indexterm zone="ch-system-binutils elfedit">
234             <primary sortas="b-elfedit">elfedit</primary>
235           </indexterm>
236         </listitem>
237       </varlistentry>
239       <varlistentry id="gprof">
240         <term><command>gprof</command></term>
241         <listitem>
242           <para>Displays call graph profile data</para>
243           <indexterm zone="ch-system-binutils gprof">
244             <primary sortas="b-gprof">gprof</primary>
245           </indexterm>
246         </listitem>
247       </varlistentry>
249       <varlistentry id="ld">
250         <term><command>ld</command></term>
251         <listitem>
252           <para>A linker that combines a number of object and archive files
253           into a single file, relocating their data and tying up symbol
254           references</para>
255           <indexterm zone="ch-system-binutils ld">
256             <primary sortas="b-ld">ld</primary>
257           </indexterm>
258         </listitem>
259       </varlistentry>
261       <varlistentry id="ld.gold">
262         <term><command>ld.gold</command></term>
263         <listitem>
264           <para>A cut down version of ld that only supports the 
265           elf object file format</para>
266           <indexterm zone="ch-system-binutils ld.gold">
267             <primary sortas="b-ld.gold">ld.gold</primary>
268           </indexterm>
269         </listitem>
270       </varlistentry>
272       <varlistentry id="ld.bfd">
273         <term><command>ld.bfd</command></term>
274         <listitem>
275           <para>Hard link to <command>ld</command></para>
276           <indexterm zone="ch-system-binutils ld.bfd">
277             <primary sortas="b-ld.bfd">ld.bfd</primary>
278           </indexterm>
279         </listitem>
280       </varlistentry>
282       <varlistentry id="nm">
283         <term><command>nm</command></term>
284         <listitem>
285           <para>Lists the symbols occurring in a given object file</para>
286           <indexterm zone="ch-system-binutils nm">
287             <primary sortas="b-nm">nm</primary>
288           </indexterm>
289         </listitem>
290       </varlistentry>
292       <varlistentry id="objcopy">
293         <term><command>objcopy</command></term>
294         <listitem>
295           <para>Translates one type of object file into another</para>
296           <indexterm zone="ch-system-binutils objcopy">
297             <primary sortas="b-objcopy">objcopy</primary>
298           </indexterm>
299         </listitem>
300       </varlistentry>
302       <varlistentry id="objdump">
303         <term><command>objdump</command></term>
304         <listitem>
305           <para>Displays information about the given object file, with options
306           controlling the particular information to display; the information
307           shown is useful to programmers who are working on the compilation
308           tools</para>
309           <indexterm zone="ch-system-binutils objdump">
310             <primary sortas="b-objdump">objdump</primary>
311           </indexterm>
312         </listitem>
313       </varlistentry>
315       <varlistentry id="ranlib">
316         <term><command>ranlib</command></term>
317         <listitem>
318           <para>Generates an index of the contents of an archive and stores it
319           in the archive; the index lists all of the symbols defined by archive
320           members that are relocatable object files</para>
321           <indexterm zone="ch-system-binutils ranlib">
322             <primary sortas="b-ranlib">ranlib</primary>
323           </indexterm>
324         </listitem>
325       </varlistentry>
327       <varlistentry id="readelf">
328         <term><command>readelf</command></term>
329         <listitem>
330           <para>Displays information about ELF type binaries</para>
331           <indexterm zone="ch-system-binutils readelf">
332             <primary sortas="b-readelf">readelf</primary>
333           </indexterm>
334         </listitem>
335       </varlistentry>
337       <varlistentry id="size">
338         <term><command>size</command></term>
339         <listitem>
340           <para>Lists the section sizes and the total size for the given
341           object files</para>
342           <indexterm zone="ch-system-binutils size">
343             <primary sortas="b-size">size</primary>
344           </indexterm>
345         </listitem>
346       </varlistentry>
348       <varlistentry id="strings">
349         <term><command>strings</command></term>
350         <listitem>
351           <para>Outputs, for each given file, the sequences of printable
352           characters that are of at least the specified length (defaulting to
353           four); for object files, it prints, by default, only the strings from
354           the initializing and loading sections while for other types of files, it
355           scans the entire file</para>
356           <indexterm zone="ch-system-binutils strings">
357             <primary sortas="b-strings">strings</primary>
358           </indexterm>
359         </listitem>
360       </varlistentry>
362       <varlistentry id="strip">
363         <term><command>strip</command></term>
364         <listitem>
365           <para>Discards symbols from object files</para>
366           <indexterm zone="ch-system-binutils strip">
367             <primary sortas="b-strip">strip</primary>
368           </indexterm>
369         </listitem>
370       </varlistentry>
372       <varlistentry id="libbfd">
373         <term><filename class="libraryfile">libbfd</filename></term>
374         <listitem>
375           <para>The Binary File Descriptor library</para>
376           <indexterm zone="ch-system-binutils libbfd">
377             <primary sortas="c-libbfd">libbfd</primary>
378           </indexterm>
379         </listitem>
380       </varlistentry>
382       <varlistentry id="libopcodes">
383         <term><filename class="libraryfile">libopcodes</filename></term>
384         <listitem>
385           <para>A library for dealing with opcodes&mdash;the <quote>readable
386           text</quote> versions of instructions for the processor;
387           it is used for building utilities like
388           <command>objdump</command></para>
389           <indexterm zone="ch-system-binutils libopcodes">
390             <primary sortas="c-libopcodes">libopcodes</primary>
391           </indexterm>
392         </listitem>
393       </varlistentry>
395     </variablelist>
397   </sect2>
399 </sect1>