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

Last change on this file since 841271e was 841271e, checked in by Jim Gifford <clfs@…>, 17 years ago

uClibc updates

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