source: clfs-embedded/BOOK/cross-tools/common/binutils.xml @ c01e552

Last change on this file since c01e552 was c01e552, checked in by Andrew Bradford <andrew@…>, 9 years ago

Add musl patches for gcc and binutils

  • Property mode set to 100644
File size: 12.2 KB
Line 
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]>
7
8<sect1 id="ch-cross-tools-binutils" role="wrap">
9  <?dbhtml filename="binutils.html"?>
10
11  <title>Cross Binutils-&binutils-version;</title>
12
13  <indexterm zone="ch-cross-tools-binutils">
14    <primary sortas="a-Binutils">Binutils</primary>
15    <secondary>cross tools</secondary>
16  </indexterm>
17
18  <sect2 role="package">
19    <title/>
20
21    <para>The Binutils package contains a linker, an assembler, and other
22    tools for handling object files.</para>
23
24  </sect2>
25
26  <sect2 role="installation">
27    <title>Installation of Cross Binutils</title>
28
29    <para os="a">It is important that Binutils be the first package compiled
30    because both the C library and GCC perform various tests on the available
31    linker and assembler to determine which of their own features to
32    enable.</para>
33
34  <para>In order to work with musl-libc, bintuils needs to be patched:</para>
35
36<screen><userinput>patch -Np1 -i ../&binutils-musl-patch;</userinput></screen>
37
38    <para os="b">The Binutils documentation recommends building Binutils outside of the
39    source directory in a dedicated build directory:</para>
40
41<screen os="c"><userinput>mkdir -v ../binutils-build
42cd ../binutils-build</userinput></screen>
43
44    <para os="d">Prepare Binutils for compilation:</para>
45
46<screen os="e"><userinput>../binutils-&binutils-version;/configure \
47   --prefix=${CLFS}/cross-tools \
48   --target=${CLFS_TARGET} \
49   --with-sysroot=${CLFS}/cross-tools/sysroot \
50   --disable-nls \
51   --disable-multilib</userinput></screen>
52
53    <variablelist os="f">
54      <title>The meaning of the configure options:</title>
55
56      <varlistentry os="f1">
57        <term><parameter>--prefix=${CLFS}/cross-tools</parameter></term>
58        <listitem>
59          <para>This tells the configure script to prepare to install the
60          package in the <filename class="directory">${CLFS}/cross-tools</filename>
61          directory.</para>
62        </listitem>
63      </varlistentry>
64
65      <varlistentry os="f3">
66        <term><parameter>--target=${CLFS_TARGET}</parameter></term>
67        <listitem>
68          <para>When used with --host, this creates a cross-architecture
69          executable that creates files for ${CLFS_TARGET} but runs on
70          the host system.</para>
71        </listitem>
72      </varlistentry>
73
74      <varlistentry os="f4">
75        <term><parameter>--with-sysroot=${CLFS}/cross-tools/sysroot</parameter></term>
76        <listitem>
77          <para>This tells configure that ${CLFS} is going to be the root
78          of our system. It will now use the specified sysroot, ${CLFS}, as
79          a prefix of the default search paths.</para>
80        </listitem>
81      </varlistentry>
82
83      <varlistentry os="f5">
84        <term><parameter>--disable-nls</parameter></term>
85        <listitem>
86          <para>This disables internationalization as i18n is not needed for the
87          cross-compile tools.</para>
88        </listitem>
89      </varlistentry>
90
91      <varlistentry os="f7">
92        <term><parameter>--disable-multilib</parameter></term>
93        <listitem>
94          <para>This option disables the building of a multilib
95          capable binutils.</para>
96        </listitem>
97      </varlistentry>
98
99    </variablelist>
100
101    <para os="g">Compile the package:</para>
102
103<screen os="h"><userinput>make configure-host
104make</userinput></screen>
105
106    <variablelist os="i">
107      <title>The meaning of the make options:</title>
108
109      <varlistentry os="i1">
110        <term><parameter>configure-host</parameter></term>
111        <listitem>
112          <para>This checks the host environment and makes sure all the
113          necessary tools are available to compile Binutils.</para>
114        </listitem>
115      </varlistentry>
116
117    </variablelist>
118
119    <para os="j">Install the package:</para>
120
121<screen os="k"><userinput>make install</userinput></screen>
122
123  </sect2>
124
125  <sect2 id="contents-binutils" role="content">
126    <title>Contents of Binutils</title>
127
128    <segmentedlist>
129      <segtitle>Installed programs</segtitle>
130      <segtitle>Installed libraries</segtitle>
131
132      <seglistitem>
133        <seg>addr2line, ar, as, c++filt, elfedit, gprof, ld, nm, objcopy,
134        objdump, ranlib, readelf, size, strings, and strip</seg>
135        <seg>libiberty.a, libbfd.[a,so], and libopcodes.[a,so]</seg>
136      </seglistitem>
137    </segmentedlist>
138
139    <variablelist>
140      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
141      <?dbfo list-presentation="list"?>
142      <?dbhtml list-presentation="table"?>
143
144      <varlistentry id="addr2line">
145        <term><command>addr2line</command></term>
146        <listitem>
147          <para>Translates program addresses to file names and line numbers;
148          given an address and the name of an executable, it uses the debugging
149          information in the executable to determine which source file and line
150          number are associated with the address</para>
151          <indexterm zone="ch-cross-tools-binutils addr2line">
152            <primary sortas="b-addr2line">addr2line</primary>
153          </indexterm>
154        </listitem>
155      </varlistentry>
156
157      <varlistentry id="ar">
158        <term><command>ar</command></term>
159        <listitem>
160          <para>Creates, modifies, and extracts from archives</para>
161          <indexterm zone="ch-cross-tools-binutils ar">
162            <primary sortas="b-ar">ar</primary>
163          </indexterm>
164        </listitem>
165      </varlistentry>
166
167      <varlistentry id="as">
168        <term><command>as</command></term>
169        <listitem>
170          <para>An assembler that assembles the output of <command>gcc</command>
171          into object files</para>
172          <indexterm zone="ch-cross-tools-binutils as">
173            <primary sortas="b-as">as</primary>
174          </indexterm>
175        </listitem>
176      </varlistentry>
177
178      <varlistentry id="c-filt">
179        <term><command>c++filt</command></term>
180        <listitem>
181          <para>Used by the linker to de-mangle C++ and Java symbols and to keep
182          overloaded functions from clashing</para>
183          <indexterm zone="ch-cross-tools-binutils c-filt">
184            <primary sortas="b-c++filt">c++filt</primary>
185          </indexterm>
186        </listitem>
187      </varlistentry>
188
189      <varlistentry id="elfedit">
190        <term><command>elfedit</command></term>
191        <listitem>
192          <para>Examine and modify ELF metadata within an ELF object</para>
193          <indexterm zone="ch-cross-tools-binutils elfedit">
194            <primary sortas="b-elfedit">elfedit</primary>
195          </indexterm>
196        </listitem>
197      </varlistentry>
198
199      <varlistentry id="gprof">
200        <term><command>gprof</command></term>
201        <listitem>
202          <para>Displays call graph profile data</para>
203          <indexterm zone="ch-cross-tools-binutils gprof">
204            <primary sortas="b-gprof">gprof</primary>
205          </indexterm>
206        </listitem>
207      </varlistentry>
208
209      <varlistentry id="ld">
210        <term><command>ld</command></term>
211        <listitem>
212          <para>A linker that combines a number of object and archive files
213          into a single file, relocating their data and tying up symbol
214          references</para>
215          <indexterm zone="ch-cross-tools-binutils ld">
216            <primary sortas="b-ld">ld</primary>
217          </indexterm>
218        </listitem>
219      </varlistentry>
220
221      <varlistentry id="nm">
222        <term><command>nm</command></term>
223        <listitem>
224          <para>Lists the symbols occurring in a given object file</para>
225          <indexterm zone="ch-cross-tools-binutils nm">
226            <primary sortas="b-nm">nm</primary>
227          </indexterm>
228        </listitem>
229      </varlistentry>
230
231      <varlistentry id="objcopy">
232        <term><command>objcopy</command></term>
233        <listitem>
234          <para>Copy the contents of one object file to another</para>
235          <indexterm zone="ch-cross-tools-binutils objcopy">
236            <primary sortas="b-objcopy">objcopy</primary>
237          </indexterm>
238        </listitem>
239      </varlistentry>
240
241      <varlistentry id="objdump">
242        <term><command>objdump</command></term>
243        <listitem>
244          <para>Displays information about the given object file, with options
245          controlling the particular information to display; the information
246          shown is useful to programmers who are working on the compilation
247          tools</para>
248          <indexterm zone="ch-cross-tools-binutils objdump">
249            <primary sortas="b-objdump">objdump</primary>
250          </indexterm>
251        </listitem>
252      </varlistentry>
253
254      <varlistentry id="ranlib">
255        <term><command>ranlib</command></term>
256        <listitem>
257          <para>Generates an index of the contents of an archive and stores it
258          in the archive; the index lists all of the symbols defined by archive
259          members that are relocatable object files</para>
260          <indexterm zone="ch-cross-tools-binutils ranlib">
261            <primary sortas="b-ranlib">ranlib</primary>
262          </indexterm>
263        </listitem>
264      </varlistentry>
265
266      <varlistentry id="readelf">
267        <term><command>readelf</command></term>
268        <listitem>
269          <para>Displays information about ELF type binaries</para>
270          <indexterm zone="ch-cross-tools-binutils readelf">
271            <primary sortas="b-readelf">readelf</primary>
272          </indexterm>
273        </listitem>
274      </varlistentry>
275
276      <varlistentry id="size">
277        <term><command>size</command></term>
278        <listitem>
279          <para>Lists the section sizes and the total size for the given
280          object files</para>
281          <indexterm zone="ch-cross-tools-binutils size">
282            <primary sortas="b-size">size</primary>
283          </indexterm>
284        </listitem>
285      </varlistentry>
286
287      <varlistentry id="strings">
288        <term><command>strings</command></term>
289        <listitem>
290          <para>Outputs, for each given file, the sequences of printable
291          characters that are of at least the specified length (defaulting to
292          four); for object files, it prints, by default, only the strings from
293          the initializing and loading sections while for other types of files,
294          it scans the entire file</para>
295          <indexterm zone="ch-cross-tools-binutils strings">
296            <primary sortas="b-strings">strings</primary>
297          </indexterm>
298        </listitem>
299      </varlistentry>
300
301      <varlistentry id="strip">
302        <term><command>strip</command></term>
303        <listitem>
304          <para>Discards symbols from object files</para>
305          <indexterm zone="ch-cross-tools-binutils strip">
306            <primary sortas="b-strip">strip</primary>
307          </indexterm>
308        </listitem>
309      </varlistentry>
310
311      <varlistentry id="libiberty">
312        <term><filename class="libraryfile">libiberty</filename></term>
313        <listitem>
314          <para>Contains routines used by various GNU programs, including
315          <command>getopt</command>, <command>obstack</command>,
316          <command>strerror</command>, <command>strtol</command>, and
317          <command>strtoul</command></para>
318          <indexterm zone="ch-cross-tools-binutils libiberty">
319            <primary sortas="c-libiberty">libiberty</primary>
320          </indexterm>
321        </listitem>
322      </varlistentry>
323
324      <varlistentry id="libbfd">
325        <term><filename class="libraryfile">libbfd</filename></term>
326        <listitem>
327          <para>The Binary File Descriptor library</para>
328          <indexterm zone="ch-cross-tools-binutils libbfd">
329            <primary sortas="c-libbfd">libbfd</primary>
330          </indexterm>
331        </listitem>
332      </varlistentry>
333
334      <varlistentry id="libopcodes">
335        <term><filename class="libraryfile">libopcodes</filename></term>
336        <listitem>
337          <para>A library for dealing with opcodes&mdash;the <quote>readable
338          text</quote> versions of instructions for the processor;
339          it is used for building utilities like
340          <command>objdump</command>.</para>
341          <indexterm zone="ch-cross-tools-binutils libopcodes">
342            <primary sortas="c-libopcodes">libopcodes</primary>
343          </indexterm>
344        </listitem>
345      </varlistentry>
346
347    </variablelist>
348
349  </sect2>
350
351</sect1>
Note: See TracBrowser for help on using the repository browser.