source: chapter08/binutils.xml@ 6e6641f

12.2 12.2-rc1 multilib trunk xry111/arm64 xry111/clfs-ng xry111/loongarch xry111/loongarch-12.2 xry111/multilib
Last change on this file since 6e6641f was 6e6641f, checked in by Xi Ruoyao <xry111@…>, 2 months ago

binutils: Add --enable-new-dtags

This option makes ld use DT_RUNPATH instead of DT_RPATH. DT_RPATH is
generally considered bad because it takes precedence over
LD_LIBRARY_PATH. For example, eog is linked with -rpath /usr/lib/eog,
and with DT_RPATH if an old eog is already installed we are basically
impossible to debug a new eog build w/o overwriting the system
installation first or explicitly using "ld.so --inhibit-rpath" to
invoke it.

This "new" actually means "new in 2000," it's 24 years ago and all other
distros has enabled it. Thus I guess some unexplainable "test suite
uses installed library instead of the just built one" issues in BLFS are
actually caused by this difference: the package author just assumes
everyone is using DT_RUNPATH thus they just set LD_LIBRARY_PATH and
consider it enough to test with the just built libraries, but DT_RPATH
breaks this expectation.

Let's eliminate the difference as it seems not doing anything good and
doing so just takes one switch.

  • Property mode set to 100644
File size: 15.6 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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>The Binutils documentation recommends building Binutils
45 in a dedicated build directory:</para>
46
47<screen><userinput remap="pre">mkdir -v build
48cd build</userinput></screen>
49
50 <para>Prepare Binutils for compilation:</para>
51
52<screen><userinput remap="configure">../configure --prefix=/usr \
53 --sysconfdir=/etc \
54 --enable-gold \
55 --enable-ld=default \
56 --enable-plugins \
57 --enable-shared \
58 --disable-werror \
59 --enable-64-bit-bfd \
60 --enable-new-dtags \
61 --with-system-zlib \
62 --enable-default-hash-style=gnu</userinput></screen>
63
64 <variablelist>
65 <title>The meaning of the new configure parameters:</title>
66
67 <varlistentry>
68 <term><parameter>--enable-gold</parameter></term>
69 <listitem>
70 <para>Build the gold linker and install it as ld.gold (alongside the
71 default linker).</para>
72 </listitem>
73 </varlistentry>
74
75 <varlistentry>
76 <term><parameter>--enable-ld=default</parameter></term>
77 <listitem>
78 <para>Build the original bfd linker and install it as both ld (the
79 default linker) and ld.bfd.</para>
80 </listitem>
81 </varlistentry>
82
83 <varlistentry>
84 <term><parameter>--enable-plugins</parameter></term>
85 <listitem>
86 <para>Enables plugin support for the linker.</para>
87 </listitem>
88 </varlistentry>
89
90 <varlistentry>
91 <term><parameter>--with-system-zlib</parameter></term>
92 <listitem>
93 <para>Use the installed zlib library instead of building the
94 included version.</para>
95 </listitem>
96 </varlistentry>
97
98 </variablelist>
99
100 <para>Compile the package:</para>
101
102<screen><userinput remap="make">make tooldir=/usr</userinput></screen>
103
104 <variablelist>
105 <title>The meaning of the make parameter:</title>
106
107 <varlistentry>
108 <term><parameter>tooldir=/usr</parameter></term>
109 <listitem>
110 <para>Normally, the tooldir (the directory where the executables will
111 ultimately be located) is set to <filename
112 class="directory">$(exec_prefix)/$(target_alias)</filename>. For
113 example, x86_64 machines would expand that to <filename
114 class="directory">/usr/x86_64-pc-linux-gnu</filename>. Because this is
115 a custom system, this target-specific directory in <filename
116 class="directory">/usr</filename> is not required. <filename
117 class="directory">$(exec_prefix)/$(target_alias)</filename> would be
118 used if the system were used to cross-compile (for example, compiling a
119 package on an Intel machine that generates code that can be executed
120 on PowerPC machines).</para>
121 </listitem>
122 </varlistentry>
123
124 </variablelist>
125
126 <important>
127 <para>The test suite for Binutils in this section is considered critical.
128 Do not skip it under any circumstances.</para>
129 </important>
130
131 <para>Test the results:</para>
132
133<screen><userinput remap="test">make -k check</userinput></screen>
134
135 <para>For a list of failed tests, run:</para>
136
137<screen><userinput remap="test">grep '^FAIL:' $(find -name '*.log')</userinput></screen>
138
139 <para>Twelve tests fail in the gold test suite when the
140 <option>--enable-default-pie</option> and
141 <option>--enable-default-ssp</option> options are passed to GCC.</para>
142
143 <!-- <para>Three tests in the gprofng suite are also known to fail.</para>-->
144
145 <para>Install the package:</para>
146
147<screen><userinput remap="install">make tooldir=/usr install</userinput></screen>
148
149 <para>Remove useless static libraries:</para>
150
151<screen><userinput remap="install">rm -fv /usr/lib/lib{bfd,ctf,ctf-nobfd,gprofng,opcodes,sframe}.a</userinput></screen>
152
153 </sect2>
154
155 <sect2 id="contents-binutils" role="content">
156 <title>Contents of Binutils</title>
157
158 <segmentedlist>
159 <segtitle>Installed programs</segtitle>
160 <segtitle>Installed libraries</segtitle>
161 <segtitle>Installed directory</segtitle>
162
163 <seglistitem>
164 <seg>addr2line, ar, as, c++filt, dwp, elfedit, gprof, gprofng, ld, ld.bfd, ld.gold, nm,
165 objcopy, objdump, ranlib, readelf, size, strings, and strip</seg>
166 <seg>libbfd.so, libctf.so, libctf-nobfd.so, libgprofng.so,
167 libopcodes.so, and libsframe.so</seg>
168 <seg>/usr/lib/ldscripts</seg>
169 </seglistitem>
170 </segmentedlist>
171
172 <variablelist>
173 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
174 <?dbfo list-presentation="list"?>
175 <?dbhtml list-presentation="table"?>
176
177 <varlistentry id="addr2line">
178 <term><command>addr2line</command></term>
179 <listitem>
180 <para>Translates program addresses to file names and line numbers;
181 given an address and the name of an executable, it uses the debugging
182 information in the executable to determine which source file and line
183 number are associated with the address</para>
184 <indexterm zone="ch-system-binutils addr2line">
185 <primary sortas="b-addr2line">addr2line</primary>
186 </indexterm>
187 </listitem>
188 </varlistentry>
189
190 <varlistentry id="ar">
191 <term><command>ar</command></term>
192 <listitem>
193 <para>Creates, modifies, and extracts from archives</para>
194 <indexterm zone="ch-system-binutils ar">
195 <primary sortas="b-ar">ar</primary>
196 </indexterm>
197 </listitem>
198 </varlistentry>
199
200 <varlistentry id="as">
201 <term><command>as</command></term>
202 <listitem>
203 <para>An assembler that assembles the output of <command>gcc</command>
204 into object files</para>
205 <indexterm zone="ch-system-binutils as">
206 <primary sortas="b-as">as</primary>
207 </indexterm>
208 </listitem>
209 </varlistentry>
210
211 <varlistentry id="c-filt">
212 <term><command>c++filt</command></term>
213 <listitem>
214 <para>Used by the linker to de-mangle C++ and Java symbols and to keep
215 overloaded functions from clashing</para>
216 <indexterm zone="ch-system-binutils c-filt">
217 <primary sortas="b-c++filt">c++filt</primary>
218 </indexterm>
219 </listitem>
220 </varlistentry>
221
222 <varlistentry id="dwp">
223 <term><command>dwp</command></term>
224 <listitem>
225 <para>The DWARF packaging utility</para>
226 <indexterm zone="ch-system-binutils dwp">
227 <primary sortas="dwp">dwp</primary>
228 </indexterm>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry id="elfedit">
233 <term><command>elfedit</command></term>
234 <listitem>
235 <para>Updates the ELF headers of ELF files</para>
236 <indexterm zone="ch-system-binutils elfedit">
237 <primary sortas="b-elfedit">elfedit</primary>
238 </indexterm>
239 </listitem>
240 </varlistentry>
241
242 <varlistentry id="gprof">
243 <term><command>gprof</command></term>
244 <listitem>
245 <para>Displays call graph profile data</para>
246 <indexterm zone="ch-system-binutils gprof">
247 <primary sortas="b-gprof">gprof</primary>
248 </indexterm>
249 </listitem>
250 </varlistentry>
251
252 <varlistentry id="gprofng">
253 <term><command>gprofng</command></term>
254 <listitem>
255 <para>Gathers and analyzes performance data</para>
256 <indexterm zone="ch-system-binutils gprofng">
257 <primary sortas="b-gprofng">gprofng</primary>
258 </indexterm>
259 </listitem>
260 </varlistentry>
261
262 <varlistentry id="ld">
263 <term><command>ld</command></term>
264 <listitem>
265 <para>A linker that combines a number of object and archive files
266 into a single file, relocating their data and tying up symbol
267 references</para>
268 <indexterm zone="ch-system-binutils ld">
269 <primary sortas="b-ld">ld</primary>
270 </indexterm>
271 </listitem>
272 </varlistentry>
273
274 <varlistentry id="ld.gold">
275 <term><command>ld.gold</command></term>
276 <listitem>
277 <para>A cut down version of ld that only supports the
278 elf object file format</para>
279 <indexterm zone="ch-system-binutils ld.gold">
280 <primary sortas="b-ld.gold">ld.gold</primary>
281 </indexterm>
282 </listitem>
283 </varlistentry>
284
285 <varlistentry id="ld.bfd">
286 <term><command>ld.bfd</command></term>
287 <listitem>
288 <para>A hard link to <command>ld</command></para>
289 <indexterm zone="ch-system-binutils ld.bfd">
290 <primary sortas="b-ld.bfd">ld.bfd</primary>
291 </indexterm>
292 </listitem>
293 </varlistentry>
294
295 <varlistentry id="nm">
296 <term><command>nm</command></term>
297 <listitem>
298 <para>Lists the symbols occurring in a given object file</para>
299 <indexterm zone="ch-system-binutils nm">
300 <primary sortas="b-nm">nm</primary>
301 </indexterm>
302 </listitem>
303 </varlistentry>
304
305 <varlistentry id="objcopy">
306 <term><command>objcopy</command></term>
307 <listitem>
308 <para>Translates one type of object file into another</para>
309 <indexterm zone="ch-system-binutils objcopy">
310 <primary sortas="b-objcopy">objcopy</primary>
311 </indexterm>
312 </listitem>
313 </varlistentry>
314
315 <varlistentry id="objdump">
316 <term><command>objdump</command></term>
317 <listitem>
318 <para>Displays information about the given object file, with options
319 controlling the particular information to display; the information
320 shown is useful to programmers who are working on the compilation
321 tools</para>
322 <indexterm zone="ch-system-binutils objdump">
323 <primary sortas="b-objdump">objdump</primary>
324 </indexterm>
325 </listitem>
326 </varlistentry>
327
328 <varlistentry id="ranlib">
329 <term><command>ranlib</command></term>
330 <listitem>
331 <para>Generates an index of the contents of an archive and stores it
332 in the archive; the index lists all of the symbols defined by archive
333 members that are relocatable object files</para>
334 <indexterm zone="ch-system-binutils ranlib">
335 <primary sortas="b-ranlib">ranlib</primary>
336 </indexterm>
337 </listitem>
338 </varlistentry>
339
340 <varlistentry id="readelf">
341 <term><command>readelf</command></term>
342 <listitem>
343 <para>Displays information about ELF type binaries</para>
344 <indexterm zone="ch-system-binutils readelf">
345 <primary sortas="b-readelf">readelf</primary>
346 </indexterm>
347 </listitem>
348 </varlistentry>
349
350 <varlistentry id="size">
351 <term><command>size</command></term>
352 <listitem>
353 <para>Lists the section sizes and the total size for the given
354 object files</para>
355 <indexterm zone="ch-system-binutils size">
356 <primary sortas="b-size">size</primary>
357 </indexterm>
358 </listitem>
359 </varlistentry>
360
361 <varlistentry id="strings">
362 <term><command>strings</command></term>
363 <listitem>
364 <para>Outputs, for each given file, the sequences of printable
365 characters that are of at least the specified length (defaulting to
366 four); for object files, it prints, by default, only the strings from
367 the initializing and loading sections while for other types of files, it
368 scans the entire file</para>
369 <indexterm zone="ch-system-binutils strings">
370 <primary sortas="b-strings">strings</primary>
371 </indexterm>
372 </listitem>
373 </varlistentry>
374
375 <varlistentry id="strip">
376 <term><command>strip</command></term>
377 <listitem>
378 <para>Discards symbols from object files</para>
379 <indexterm zone="ch-system-binutils strip">
380 <primary sortas="b-strip">strip</primary>
381 </indexterm>
382 </listitem>
383 </varlistentry>
384
385 <varlistentry id="libbfd">
386 <term><filename class="libraryfile">libbfd</filename></term>
387 <listitem>
388 <para>The Binary File Descriptor library</para>
389 <indexterm zone="ch-system-binutils libbfd">
390 <primary sortas="c-libbfd">libbfd</primary>
391 </indexterm>
392 </listitem>
393 </varlistentry>
394
395 <varlistentry id="libctf">
396 <term><filename class="libraryfile">libctf</filename></term>
397 <listitem>
398 <para>The Compat ANSI-C Type Format debugging support library</para>
399 <indexterm zone="ch-system-binutils libctf">
400 <primary sortas="c-libctf">libctf</primary>
401 </indexterm>
402 </listitem>
403 </varlistentry>
404
405 <varlistentry id="libctf-nobfd">
406 <term><filename class="libraryfile">libctf-nobfd</filename></term>
407 <listitem>
408 <para>A libctf variant which does not use libbfd functionality</para>
409 <indexterm zone="ch-system-binutils libctf-nobfd">
410 <primary sortas="c-libctf-nobfd">libctf-nobfd</primary>
411 </indexterm>
412 </listitem>
413 </varlistentry>
414
415 <varlistentry id="libgprofng">
416 <term><filename class="libraryfile">libgprofng</filename></term>
417 <listitem>
418 <para>A library containing most routines used by
419 <command>gprofng</command></para>
420 <indexterm zone="ch-system-binutils libgprofng">
421 <primary sortas="c-libgprofng">libgprofng</primary>
422 </indexterm>
423 </listitem>
424 </varlistentry>
425
426 <varlistentry id="libopcodes">
427 <term><filename class="libraryfile">libopcodes</filename></term>
428 <listitem>
429 <para>A library for dealing with opcodes&mdash;the <quote>readable
430 text</quote> versions of instructions for the processor;
431 it is used for building utilities like
432 <command>objdump</command></para>
433 <indexterm zone="ch-system-binutils libopcodes">
434 <primary sortas="c-libopcodes">libopcodes</primary>
435 </indexterm>
436 </listitem>
437 </varlistentry>
438
439 <varlistentry id="libsframe">
440 <term><filename class="libraryfile">libsframe</filename></term>
441 <listitem>
442 <para>A library to support online backtracing using a
443 simple unwinder</para>
444 <indexterm zone="ch-system-binutils libsframe">
445 <primary sortas="c-libsframe">libsframe</primary>
446 </indexterm>
447 </listitem>
448 </varlistentry>
449
450 </variablelist>
451
452 </sect2>
453
454</sect1>
Note: See TracBrowser for help on using the repository browser.