source: chapter08/binutils.xml@ 04ca2a7

xry111/arm64 xry111/arm64-12.0
Last change on this file since 04ca2a7 was 04ca2a7, checked in by Xi Ruoyao <xry111@…>, 19 months ago

Merge remote-tracking branch 'origin/trunk' into xry111/arm64

  • Property mode set to 100644
File size: 16.5 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-system-binutils" role="wrap">
9 <?dbhtml filename="binutils.html"?>
10
11 <sect1info condition="script">
12 <productname>binutils</productname>
13 <productnumber>&binutils-version;</productnumber>
14 <address>&binutils-url;</address>
15 </sect1info>
16
17 <title>Binutils-&binutils-version;</title>
18
19 <indexterm zone="ch-system-binutils">
20 <primary sortas="a-Binutils">Binutils</primary>
21 </indexterm>
22
23 <sect2 role="package">
24 <title/>
25
26 <para>The Binutils package contains a linker, an assembler, and other
27 tools for handling object files.</para>
28
29 <segmentedlist>
30 <segtitle>&buildtime;</segtitle>
31 <segtitle>&diskspace;</segtitle>
32
33 <seglistitem>
34 <seg>&binutils-fin-sbu;</seg>
35 <seg>&binutils-fin-du;</seg>
36 </seglistitem>
37 </segmentedlist>
38
39 </sect2>
40
41 <sect2 role="installation">
42 <title>Installation of Binutils</title>
43
44 <para>Verify that the PTYs are working properly inside the chroot
45 environment by performing a simple test:</para>
46
47<screen><userinput remap="test">expect -c "spawn ls"</userinput></screen>
48
49 <para>This command should output the following:</para>
50
51<screen><computeroutput>spawn ls</computeroutput></screen>
52
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>
56
57<screen><computeroutput>The system has no more ptys.
58Ask your system administrator to create more.</computeroutput></screen>
59<!-- Fixed in binutils-2.39
60 <para>
61 Now make a fix identified upstream that affects building some packages:
62 </para>
63
64<screen><userinput remap="pre">sed -e '/R_386_TLS_LE /i \ || (TYPE) == R_386_TLS_IE \\' \
65 -i ./bfd/elfxx-x86.h</userinput></screen>
66-->
67 <para>The Binutils documentation recommends building Binutils
68 in a dedicated build directory:</para>
69
70<screen><userinput remap="pre">mkdir -v build
71cd build</userinput></screen>
72
73 <para>Prepare Binutils for compilation:</para>
74
75<screen><userinput remap="configure">../configure --prefix=/usr \
76 --sysconfdir=/etc \
77 --enable-gold \
78 --enable-ld=default \
79 --enable-plugins \
80 --enable-shared \
81 --disable-werror \
82 --enable-64-bit-bfd \
83 --with-system-zlib</userinput></screen>
84 <variablelist>
85 <title>The meaning of the configure parameters:</title>
86
87 <varlistentry>
88 <term><parameter>--enable-gold</parameter></term>
89 <listitem>
90 <para>Build the gold linker and install it as ld.gold (along side the
91 default linker).</para>
92 </listitem>
93 </varlistentry>
94
95 <varlistentry>
96 <term><parameter>--enable-ld=default</parameter></term>
97 <listitem>
98 <para>Build the original bfd linker and install it as both ld (the
99 default linker) and ld.bfd.</para>
100 </listitem>
101 </varlistentry>
102
103 <varlistentry>
104 <term><parameter>--enable-plugins</parameter></term>
105 <listitem>
106 <para>Enables plugin support for the linker.</para>
107 </listitem>
108 </varlistentry>
109
110 <varlistentry>
111 <term><parameter>--enable-64-bit-bfd</parameter></term>
112 <listitem>
113 <para>Enables 64-bit support (on hosts with narrower word sizes).
114 May not be needed on 64-bit systems, but does no harm.</para>
115 </listitem>
116 </varlistentry>
117
118 <varlistentry>
119 <term><parameter>--with-system-zlib</parameter></term>
120 <listitem>
121 <para>Use the installed zlib library rather than building the
122 included version.</para>
123 </listitem>
124 </varlistentry>
125
126 </variablelist>
127
128 <para>Compile the package:</para>
129
130<screen><userinput remap="make">make tooldir=/usr</userinput></screen>
131
132 <variablelist>
133 <title>The meaning of the make parameter:</title>
134
135 <varlistentry>
136 <term><parameter>tooldir=/usr</parameter></term>
137 <listitem>
138 <para>Normally, the tooldir (the directory where the executables will
139 ultimately be located) is set to <filename
140 class="directory">$(exec_prefix)/$(target_alias)</filename>. For
141 example, ARM64 machines would expand that to <filename
142 class="directory">/usr/aarch64-unknown-linux-gnu</filename>. Because this is
143 a custom system, this target-specific directory in <filename
144 class="directory">/usr</filename> is not required. <filename
145 class="directory">$(exec_prefix)/$(target_alias)</filename> would be
146 used if the system was used to cross-compile (for example, compiling a
147 package on an Intel machine that generates code that can be executed
148 on PowerPC machines).</para>
149 </listitem>
150 </varlistentry>
151
152 </variablelist>
153
154 <important>
155 <para>The test suite for Binutils in this section is considered critical.
156 Do not skip it under any circumstances.</para>
157 </important>
158
159 <para>Test the results:</para>
160
161<screen><userinput remap="test">make -k check</userinput></screen>
162
163 <para>For a list of failed tests, run:</para>
164
165<screen><userinput remap="test">grep '^FAIL:' $(find -name '*.log')</userinput></screen>
166
167 <para>
168 <!-- Caused by egrep deprecation. Note that we don't "patch" temp grep.
169 And it seems unworthy to add a sed into temp grep just for one test
170 failure. (I don't really agree to "patch" grep in the first place,
171 anyway.)
172 Will be fixed in 2.40 (upstream commit 67d1991). -->
173 The test named <filename>ar with versioned solib</filename> is
174 known to fail.
175 <!-- https://sourceware.org/bugzilla/show_bug.cgi?id=29107 -->
176 Because of a race between the gas testsuite and the gprofng testsuite,
177 some gas tests may fail if parallel jobs are used. If you are not
178 assured of the correctness of gas, invoke
179 <command>make check-gas</command> to run gas testsuite separately and
180 all tests should pass. Three gprofng tests result
181 <literal>ERROR</literal> and they are counted as
182 <literal>UNRESOLVED</literal> in the summary.</para>
183
184 <para>Install the package:</para>
185
186<screen><userinput remap="install">make tooldir=/usr install</userinput></screen>
187
188 <para>Remove useless static libraries and an empty man page:</para>
189
190<screen><userinput remap="install">rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.a
191rm -fv /usr/share/man/man1/gprofng.1</userinput></screen>
192
193 </sect2>
194
195 <sect2 id="contents-binutils" role="content">
196 <title>Contents of Binutils</title>
197
198 <segmentedlist>
199 <segtitle>Installed programs</segtitle>
200 <segtitle>Installed libraries</segtitle>
201 <segtitle>Installed directory</segtitle>
202
203 <seglistitem>
204 <seg>addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, ld.gold, nm,
205 objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
206 <seg>libbfd.so, libctf.so, libctf-nobfd.so, and libopcodes.so</seg>
207 <seg>/usr/lib/ldscripts</seg>
208 </seglistitem>
209 </segmentedlist>
210
211 <variablelist>
212 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
213 <?dbfo list-presentation="list"?>
214 <?dbhtml list-presentation="table"?>
215
216 <varlistentry id="addr2line">
217 <term><command>addr2line</command></term>
218 <listitem>
219 <para>Translates program addresses to file names and line numbers;
220 given an address and the name of an executable, it uses the debugging
221 information in the executable to determine which source file and line
222 number are associated with the address</para>
223 <indexterm zone="ch-system-binutils addr2line">
224 <primary sortas="b-addr2line">addr2line</primary>
225 </indexterm>
226 </listitem>
227 </varlistentry>
228
229 <varlistentry id="ar">
230 <term><command>ar</command></term>
231 <listitem>
232 <para>Creates, modifies, and extracts from archives</para>
233 <indexterm zone="ch-system-binutils ar">
234 <primary sortas="b-ar">ar</primary>
235 </indexterm>
236 </listitem>
237 </varlistentry>
238
239 <varlistentry id="as">
240 <term><command>as</command></term>
241 <listitem>
242 <para>An assembler that assembles the output of <command>gcc</command>
243 into object files</para>
244 <indexterm zone="ch-system-binutils as">
245 <primary sortas="b-as">as</primary>
246 </indexterm>
247 </listitem>
248 </varlistentry>
249
250 <varlistentry id="c-filt">
251 <term><command>c++filt</command></term>
252 <listitem>
253 <para>Used by the linker to de-mangle C++ and Java symbols and to keep
254 overloaded functions from clashing</para>
255 <indexterm zone="ch-system-binutils c-filt">
256 <primary sortas="b-c++filt">c++filt</primary>
257 </indexterm>
258 </listitem>
259 </varlistentry>
260
261 <varlistentry id="dwp">
262 <term><command>dwp</command></term>
263 <listitem>
264 <para>The DWARF packaging utility</para>
265 <indexterm zone="ch-system-binutils dwp">
266 <primary sortas="dwp">dwp</primary>
267 </indexterm>
268 </listitem>
269 </varlistentry>
270
271 <varlistentry id="elfedit">
272 <term><command>elfedit</command></term>
273 <listitem>
274 <para>Updates the ELF header of ELF files</para>
275 <indexterm zone="ch-system-binutils elfedit">
276 <primary sortas="b-elfedit">elfedit</primary>
277 </indexterm>
278 </listitem>
279 </varlistentry>
280
281 <varlistentry id="gprof">
282 <term><command>gprof</command></term>
283 <listitem>
284 <para>Displays call graph profile data</para>
285 <indexterm zone="ch-system-binutils gprof">
286 <primary sortas="b-gprof">gprof</primary>
287 </indexterm>
288 </listitem>
289 </varlistentry>
290
291 <varlistentry id="gprofng">
292 <term><command>gprofng</command></term>
293 <listitem>
294 <para>Gather and analyze performance data</para>
295 <indexterm zone="ch-system-binutils gprofng">
296 <primary sortas="b-gprofng">gprofng</primary>
297 </indexterm>
298 </listitem>
299 </varlistentry>
300
301 <varlistentry id="ld">
302 <term><command>ld</command></term>
303 <listitem>
304 <para>A linker that combines a number of object and archive files
305 into a single file, relocating their data and tying up symbol
306 references</para>
307 <indexterm zone="ch-system-binutils ld">
308 <primary sortas="b-ld">ld</primary>
309 </indexterm>
310 </listitem>
311 </varlistentry>
312
313 <varlistentry id="ld.gold">
314 <term><command>ld.gold</command></term>
315 <listitem>
316 <para>A cut down version of ld that only supports the
317 elf object file format</para>
318 <indexterm zone="ch-system-binutils ld.gold">
319 <primary sortas="b-ld.gold">ld.gold</primary>
320 </indexterm>
321 </listitem>
322 </varlistentry>
323
324 <varlistentry id="ld.bfd">
325 <term><command>ld.bfd</command></term>
326 <listitem>
327 <para>Hard link to <command>ld</command></para>
328 <indexterm zone="ch-system-binutils ld.bfd">
329 <primary sortas="b-ld.bfd">ld.bfd</primary>
330 </indexterm>
331 </listitem>
332 </varlistentry>
333
334 <varlistentry id="nm">
335 <term><command>nm</command></term>
336 <listitem>
337 <para>Lists the symbols occurring in a given object file</para>
338 <indexterm zone="ch-system-binutils nm">
339 <primary sortas="b-nm">nm</primary>
340 </indexterm>
341 </listitem>
342 </varlistentry>
343
344 <varlistentry id="objcopy">
345 <term><command>objcopy</command></term>
346 <listitem>
347 <para>Translates one type of object file into another</para>
348 <indexterm zone="ch-system-binutils objcopy">
349 <primary sortas="b-objcopy">objcopy</primary>
350 </indexterm>
351 </listitem>
352 </varlistentry>
353
354 <varlistentry id="objdump">
355 <term><command>objdump</command></term>
356 <listitem>
357 <para>Displays information about the given object file, with options
358 controlling the particular information to display; the information
359 shown is useful to programmers who are working on the compilation
360 tools</para>
361 <indexterm zone="ch-system-binutils objdump">
362 <primary sortas="b-objdump">objdump</primary>
363 </indexterm>
364 </listitem>
365 </varlistentry>
366
367 <varlistentry id="ranlib">
368 <term><command>ranlib</command></term>
369 <listitem>
370 <para>Generates an index of the contents of an archive and stores it
371 in the archive; the index lists all of the symbols defined by archive
372 members that are relocatable object files</para>
373 <indexterm zone="ch-system-binutils ranlib">
374 <primary sortas="b-ranlib">ranlib</primary>
375 </indexterm>
376 </listitem>
377 </varlistentry>
378
379 <varlistentry id="readelf">
380 <term><command>readelf</command></term>
381 <listitem>
382 <para>Displays information about ELF type binaries</para>
383 <indexterm zone="ch-system-binutils readelf">
384 <primary sortas="b-readelf">readelf</primary>
385 </indexterm>
386 </listitem>
387 </varlistentry>
388
389 <varlistentry id="size">
390 <term><command>size</command></term>
391 <listitem>
392 <para>Lists the section sizes and the total size for the given
393 object files</para>
394 <indexterm zone="ch-system-binutils size">
395 <primary sortas="b-size">size</primary>
396 </indexterm>
397 </listitem>
398 </varlistentry>
399
400 <varlistentry id="strings">
401 <term><command>strings</command></term>
402 <listitem>
403 <para>Outputs, for each given file, the sequences of printable
404 characters that are of at least the specified length (defaulting to
405 four); for object files, it prints, by default, only the strings from
406 the initializing and loading sections while for other types of files, it
407 scans the entire file</para>
408 <indexterm zone="ch-system-binutils strings">
409 <primary sortas="b-strings">strings</primary>
410 </indexterm>
411 </listitem>
412 </varlistentry>
413
414 <varlistentry id="strip">
415 <term><command>strip</command></term>
416 <listitem>
417 <para>Discards symbols from object files</para>
418 <indexterm zone="ch-system-binutils strip">
419 <primary sortas="b-strip">strip</primary>
420 </indexterm>
421 </listitem>
422 </varlistentry>
423
424 <varlistentry id="libbfd">
425 <term><filename class="libraryfile">libbfd</filename></term>
426 <listitem>
427 <para>The Binary File Descriptor library</para>
428 <indexterm zone="ch-system-binutils libbfd">
429 <primary sortas="c-libbfd">libbfd</primary>
430 </indexterm>
431 </listitem>
432 </varlistentry>
433
434 <varlistentry id="libctf">
435 <term><filename class="libraryfile">libctf</filename></term>
436 <listitem>
437 <para>The Compat ANSI-C Type Format debugging support library</para>
438 <indexterm zone="ch-system-binutils libctf">
439 <primary sortas="c-libctf">libctf</primary>
440 </indexterm>
441 </listitem>
442 </varlistentry>
443
444 <varlistentry id="libctf-nobfd">
445 <term><filename class="libraryfile">libctf-nobfd</filename></term>
446 <listitem>
447 <para>A libctf variant which does not use libbfd functionality</para>
448 <indexterm zone="ch-system-binutils libctf-nobfd">
449 <primary sortas="c-libctf-nobfd">libctf-nobfd</primary>
450 </indexterm>
451 </listitem>
452 </varlistentry>
453
454 <varlistentry id="libopcodes">
455 <term><filename class="libraryfile">libopcodes</filename></term>
456 <listitem>
457 <para>A library for dealing with opcodes&mdash;the <quote>readable
458 text</quote> versions of instructions for the processor;
459 it is used for building utilities like
460 <command>objdump</command></para>
461 <indexterm zone="ch-system-binutils libopcodes">
462 <primary sortas="c-libopcodes">libopcodes</primary>
463 </indexterm>
464 </listitem>
465 </varlistentry>
466
467 </variablelist>
468
469 </sect2>
470
471</sect1>
Note: See TracBrowser for help on using the repository browser.