source: chapter08/binutils.xml@ 2a71a83

xry111/loongarch xry111/loongarch-12.1 xry111/loongarch-12.2
Last change on this file since 2a71a83 was 8b8b87b, checked in by Xi Ruoyao <xry111@…>, 8 months ago

loongarch: Binutils: Apply an upstream fix for LTO

This issue is known to cause Mozilla packages fail to build. So fix it
just like what we did for Binutils-2.38 on x86_64.

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