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