source: chapter08/binutils.xml@ 5096a20

xry111/loongarch xry111/loongarch-12.2
Last change on this file since 5096a20 was 479d3bc, checked in by Xi Ruoyao <xry111@…>, 7 weeks ago

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

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