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">
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>
17 <title>Binutils-&binutils-version;</title>
19 <indexterm zone="ch-system-binutils">
20 <primary sortas="a-Binutils">Binutils</primary>
23 <sect2 role="package">
26 <para>The Binutils package contains a linker, an assembler, and other
27 tools for handling object files.</para>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
34 <seg>&binutils-ch6-sbu;</seg>
35 <seg>&binutils-ch6-du;</seg>
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 \
75 --with-system-zlib</userinput></screen>
77 <title>The meaning of the configure parameters:</title>
80 <term><parameter>--enable-gold</parameter></term>
82 <para>Build the gold linker and install it as ld.gold (along side the
83 default linker).</para>
88 <term><parameter>--enable-ld=default</parameter></term>
90 <para>Build the original bdf linker and install it as both ld (the
91 default linker) and ld.bfd.</para>
96 <term><parameter>--enable-plugins</parameter></term>
98 <para>Enables plugin support for the linker.</para>
103 <term><parameter>--enable-64-bit-bfd</parameter></term>
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>
111 <term><parameter>--with-system-zlib</parameter></term>
113 <para>Use the installed zlib library rather than building the
114 included version.</para>
120 <para>Compile the package:</para>
122 <screen><userinput remap="make">make tooldir=/usr</userinput></screen>
125 <title>The meaning of the make parameter:</title>
128 <term><parameter>tooldir=/usr</parameter></term>
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>
147 <para>The test suite for Binutils in this section is considered critical.
148 Do not skip it under any circumstances.</para>
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>
163 <sect2 id="contents-binutils" role="content">
164 <title>Contents of Binutils</title>
167 <segtitle>Installed programs</segtitle>
168 <segtitle>Installed libraries</segtitle>
169 <segtitle>Installed directory</segtitle>
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>
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>
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>
197 <varlistentry id="ar">
198 <term><command>ar</command></term>
200 <para>Creates, modifies, and extracts from archives</para>
201 <indexterm zone="ch-system-binutils ar">
202 <primary sortas="b-ar">ar</primary>
207 <varlistentry id="as">
208 <term><command>as</command></term>
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>
218 <varlistentry id="c-filt">
219 <term><command>c++filt</command></term>
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>
229 <varlistentry id="elfedit">
230 <term><command>elfedit</command></term>
232 <para>Updates the ELF header of ELF files</para>
233 <indexterm zone="ch-system-binutils elfedit">
234 <primary sortas="b-elfedit">elfedit</primary>
239 <varlistentry id="gprof">
240 <term><command>gprof</command></term>
242 <para>Displays call graph profile data</para>
243 <indexterm zone="ch-system-binutils gprof">
244 <primary sortas="b-gprof">gprof</primary>
249 <varlistentry id="ld">
250 <term><command>ld</command></term>
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
255 <indexterm zone="ch-system-binutils ld">
256 <primary sortas="b-ld">ld</primary>
261 <varlistentry id="ld.gold">
262 <term><command>ld.gold</command></term>
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>
272 <varlistentry id="ld.bfd">
273 <term><command>ld.bfd</command></term>
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>
282 <varlistentry id="nm">
283 <term><command>nm</command></term>
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>
292 <varlistentry id="objcopy">
293 <term><command>objcopy</command></term>
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>
302 <varlistentry id="objdump">
303 <term><command>objdump</command></term>
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
309 <indexterm zone="ch-system-binutils objdump">
310 <primary sortas="b-objdump">objdump</primary>
315 <varlistentry id="ranlib">
316 <term><command>ranlib</command></term>
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>
327 <varlistentry id="readelf">
328 <term><command>readelf</command></term>
330 <para>Displays information about ELF type binaries</para>
331 <indexterm zone="ch-system-binutils readelf">
332 <primary sortas="b-readelf">readelf</primary>
337 <varlistentry id="size">
338 <term><command>size</command></term>
340 <para>Lists the section sizes and the total size for the given
342 <indexterm zone="ch-system-binutils size">
343 <primary sortas="b-size">size</primary>
348 <varlistentry id="strings">
349 <term><command>strings</command></term>
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>
362 <varlistentry id="strip">
363 <term><command>strip</command></term>
365 <para>Discards symbols from object files</para>
366 <indexterm zone="ch-system-binutils strip">
367 <primary sortas="b-strip">strip</primary>
372 <varlistentry id="libbfd">
373 <term><filename class="libraryfile">libbfd</filename></term>
375 <para>The Binary File Descriptor library</para>
376 <indexterm zone="ch-system-binutils libbfd">
377 <primary sortas="c-libbfd">libbfd</primary>
382 <varlistentry id="libopcodes">
383 <term><filename class="libraryfile">libopcodes</filename></term>
385 <para>A library for dealing with opcodes—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>