| [3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 
|---|
| [aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | 
|---|
|  | 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ | 
|---|
| [3f8be484] | 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 | <title>Binutils-&binutils-version;</title> | 
|---|
|  | 12 |  | 
|---|
|  | 13 | <indexterm zone="ch-system-binutils"> | 
|---|
|  | 14 | <primary sortas="a-Binutils">Binutils</primary> | 
|---|
|  | 15 | </indexterm> | 
|---|
|  | 16 |  | 
|---|
|  | 17 | <sect2 role="package"> | 
|---|
|  | 18 | <title/> | 
|---|
|  | 19 |  | 
|---|
|  | 20 | <para>The Binutils package contains a linker, an assembler, and other | 
|---|
|  | 21 | tools for handling object files.</para> | 
|---|
|  | 22 |  | 
|---|
|  | 23 | </sect2> | 
|---|
|  | 24 |  | 
|---|
|  | 25 | <sect2 role="installation"> | 
|---|
|  | 26 | <title>Installation of Binutils</title> | 
|---|
|  | 27 |  | 
|---|
|  | 28 | <para os="b">Verify that the PTYs are working properly inside the build | 
|---|
|  | 29 | environment. Check that everything is set up correctly by performing a | 
|---|
|  | 30 | simple test:</para> | 
|---|
|  | 31 |  | 
|---|
| [0f3854e] | 32 | <screen os="c" role="nodump"><userinput>expect -c "spawn ls"</userinput></screen> | 
|---|
| [3f8be484] | 33 |  | 
|---|
| [9ecbe5a] | 34 | <para os="d">This command should give the following output:</para> | 
|---|
| [3f8be484] | 35 |  | 
|---|
| [9ecbe5a] | 36 | <screen os="e"><computeroutput>spawn ls</computeroutput></screen> | 
|---|
| [3f8be484] | 37 |  | 
|---|
| [9ecbe5a] | 38 | <para os="f">If, instead, it gives a message saying to create more ptys, | 
|---|
|  | 39 | then the environment is not set up for proper PTY operation. This issue | 
|---|
|  | 40 | needs to be resolved before running the test suites for Binutils and GCC.</para> | 
|---|
| [3f8be484] | 41 |  | 
|---|
| [e61fedb] | 42 | <!-- Branch update patch area | 
|---|
| [3e0fdeb] | 43 | <para os="p1">The following patch contains a number of updates to the | 
|---|
|  | 44 | &binutils-version; branch by the Binutils developers:</para> | 
|---|
|  | 45 |  | 
|---|
|  | 46 | <screen os="p2"><userinput>patch -Np1 -i ../&binutils-branch_update-patch;</userinput></screen> | 
|---|
| [e61fedb] | 47 | --> | 
|---|
| [3e0fdeb] | 48 |  | 
|---|
| [3f8be484] | 49 | <para os="g">The Binutils documentation recommends building Binutils outside of the | 
|---|
|  | 50 | source directory in a dedicated build directory:</para> | 
|---|
|  | 51 |  | 
|---|
| [94e6142] | 52 | <screen os="h"><userinput>mkdir -v ../binutils-build | 
|---|
| [3f8be484] | 53 | cd ../binutils-build</userinput></screen> | 
|---|
|  | 54 |  | 
|---|
|  | 55 | <para os="i">Prepare Binutils for compilation:</para> | 
|---|
|  | 56 |  | 
|---|
| [4173cd9] | 57 | <screen os="ca"><userinput>CC="gcc -isystem /usr/include" \ | 
|---|
| [b6831b6] | 58 | LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ | 
|---|
| [b27081c4] | 59 | ../binutils-&binutils-dir;/configure \ | 
|---|
|  | 60 | --prefix=/usr \ | 
|---|
|  | 61 | --enable-shared \ | 
|---|
|  | 62 | --enable-gold=yes \ | 
|---|
|  | 63 | --enable-plugins \ | 
|---|
| [44d4b28] | 64 | --with-system-zlib \ | 
|---|
| [b27081c4] | 65 | --enable-threads</userinput></screen> | 
|---|
| [3f8be484] | 66 |  | 
|---|
|  | 67 | <para os="j">Compile the package:</para> | 
|---|
|  | 68 |  | 
|---|
| [e1bee3d4] | 69 | <screen os="k"><userinput>make tooldir=/usr</userinput></screen> | 
|---|
| [3f8be484] | 70 |  | 
|---|
| [51adad9] | 71 | <!--    <important os="l"> | 
|---|
| [e1bee3d4] | 72 | <para>During <command>make tooldir=/usr</command> you may receive the | 
|---|
| [3f8be484] | 73 | following error message. It is safe to ignore.</para> | 
|---|
|  | 74 |  | 
|---|
|  | 75 | <screen><computeroutput>WARNING: `flex' is missing on your system. You should only | 
|---|
|  | 76 | need it if you modified a `.l' file. You may need the `Flex' | 
|---|
|  | 77 | package in order for those modifications to take effect. You | 
|---|
|  | 78 | can get `Flex' from any GNU archive site.</computeroutput></screen> | 
|---|
| [51adad9] | 79 | </important> --> | 
|---|
| [3f8be484] | 80 |  | 
|---|
| [44d357b] | 81 | <variablelist os="n"> | 
|---|
|  | 82 | <title>The meaning of the make parameter:</title> | 
|---|
|  | 83 |  | 
|---|
|  | 84 | <varlistentry> | 
|---|
|  | 85 | <term><parameter>tooldir=/usr</parameter></term> | 
|---|
|  | 86 | <listitem> | 
|---|
|  | 87 | <para>Normally, the tooldir (the directory where the executables | 
|---|
|  | 88 | will ultimately be located) is set to <filename | 
|---|
|  | 89 | class="directory">$(exec_prefix)/$(target_alias)</filename>. Because this | 
|---|
|  | 90 | is a custom system, this target-specific directory in <filename | 
|---|
|  | 91 | class="directory">/usr</filename> is not required.</para> | 
|---|
|  | 92 | </listitem> | 
|---|
|  | 93 | </varlistentry> | 
|---|
|  | 94 | </variablelist> | 
|---|
| [3f8be484] | 95 |  | 
|---|
|  | 96 | <important os="o"> | 
|---|
| [eb21c92] | 97 | <para>Due to Binutils' critical role in a properly functioning system, | 
|---|
|  | 98 | the CLFS developers strongly recommend running the testsuite.</para> | 
|---|
| [3f8be484] | 99 | </important> | 
|---|
|  | 100 |  | 
|---|
| [936dcb48] | 101 | <para os="p">Test the results:</para> | 
|---|
| [f54319a] | 102 |  | 
|---|
| [686839b] | 103 | <screen os="q"><userinput remap="test">make check</userinput></screen> | 
|---|
| [f54319a] | 104 |  | 
|---|
| [3f8be484] | 105 | <para os="r">Install the package:</para> | 
|---|
|  | 106 |  | 
|---|
|  | 107 | <screen os="s"><userinput>make tooldir=/usr install</userinput></screen> | 
|---|
|  | 108 |  | 
|---|
|  | 109 | </sect2> | 
|---|
|  | 110 |  | 
|---|
|  | 111 | <sect2 id="contents-binutils" role="content"> | 
|---|
|  | 112 | <title>Contents of Binutils</title> | 
|---|
|  | 113 |  | 
|---|
|  | 114 | <segmentedlist> | 
|---|
|  | 115 | <segtitle>Installed programs</segtitle> | 
|---|
|  | 116 | <segtitle>Installed libraries</segtitle> | 
|---|
| [61ad0b7f] | 117 | <segtitle>Installed directory</segtitle> | 
|---|
| [3f8be484] | 118 |  | 
|---|
|  | 119 | <seglistitem> | 
|---|
| [bcda234] | 120 | <seg>addr2line, ar, as, c++filt, elfedit, gprof, ld, ld.bfd, ld.gold, | 
|---|
|  | 121 | nm, objcopy, objdump, ranlib, readelf, size, strings, strip</seg> | 
|---|
| [c2102b28] | 122 | <seg>libbfd.[a,so], libopcodes.[a,so]</seg> | 
|---|
| [61ad0b7f] | 123 | <seg>/usr/lib/ldscripts</seg> | 
|---|
| [3f8be484] | 124 | </seglistitem> | 
|---|
|  | 125 | </segmentedlist> | 
|---|
|  | 126 |  | 
|---|
|  | 127 | <variablelist> | 
|---|
|  | 128 | <bridgehead renderas="sect3">Short Descriptions</bridgehead> | 
|---|
|  | 129 | <?dbfo list-presentation="list"?> | 
|---|
|  | 130 | <?dbhtml list-presentation="table"?> | 
|---|
|  | 131 |  | 
|---|
|  | 132 | <varlistentry id="addr2line"> | 
|---|
|  | 133 | <term><command>addr2line</command></term> | 
|---|
|  | 134 | <listitem> | 
|---|
|  | 135 | <para>Translates program addresses to file names and line numbers; | 
|---|
|  | 136 | given an address and the name of an executable, it uses the debugging | 
|---|
|  | 137 | information in the executable to determine which source file and line | 
|---|
|  | 138 | number are associated with the address</para> | 
|---|
|  | 139 | <indexterm zone="ch-system-binutils addr2line"> | 
|---|
|  | 140 | <primary sortas="b-addr2line">addr2line</primary> | 
|---|
|  | 141 | </indexterm> | 
|---|
|  | 142 | </listitem> | 
|---|
|  | 143 | </varlistentry> | 
|---|
|  | 144 |  | 
|---|
|  | 145 | <varlistentry id="ar"> | 
|---|
|  | 146 | <term><command>ar</command></term> | 
|---|
|  | 147 | <listitem> | 
|---|
|  | 148 | <para>Creates, modifies, and extracts from archives</para> | 
|---|
|  | 149 | <indexterm zone="ch-system-binutils ar"> | 
|---|
|  | 150 | <primary sortas="b-ar">ar</primary> | 
|---|
|  | 151 | </indexterm> | 
|---|
|  | 152 | </listitem> | 
|---|
|  | 153 | </varlistentry> | 
|---|
|  | 154 |  | 
|---|
|  | 155 | <varlistentry id="as"> | 
|---|
|  | 156 | <term><command>as</command></term> | 
|---|
|  | 157 | <listitem> | 
|---|
|  | 158 | <para>An assembler that assembles the output of <command>gcc</command> | 
|---|
|  | 159 | into object files</para> | 
|---|
|  | 160 | <indexterm zone="ch-system-binutils as"> | 
|---|
|  | 161 | <primary sortas="b-as">as</primary> | 
|---|
|  | 162 | </indexterm> | 
|---|
|  | 163 | </listitem> | 
|---|
|  | 164 | </varlistentry> | 
|---|
|  | 165 |  | 
|---|
|  | 166 | <varlistentry id="c-filt"> | 
|---|
|  | 167 | <term><command>c++filt</command></term> | 
|---|
|  | 168 | <listitem> | 
|---|
|  | 169 | <para>Used by the linker to de-mangle C++ and Java symbols and to keep | 
|---|
|  | 170 | overloaded functions from clashing</para> | 
|---|
|  | 171 | <indexterm zone="ch-system-binutils c-filt"> | 
|---|
|  | 172 | <primary sortas="b-c++filt">c++filt</primary> | 
|---|
|  | 173 | </indexterm> | 
|---|
|  | 174 | </listitem> | 
|---|
|  | 175 | </varlistentry> | 
|---|
|  | 176 |  | 
|---|
| [2b220db9] | 177 | <varlistentry id="elfedit"> | 
|---|
|  | 178 | <term><command>elfedit</command></term> | 
|---|
|  | 179 | <listitem> | 
|---|
|  | 180 | <para>Updates the ELF header of ELF files</para> | 
|---|
|  | 181 | <indexterm zone="ch-system-binutils elfedit"> | 
|---|
|  | 182 | <primary sortas="b-elfedit">elfedit</primary> | 
|---|
|  | 183 | </indexterm> | 
|---|
|  | 184 | </listitem> | 
|---|
|  | 185 | </varlistentry> | 
|---|
|  | 186 |  | 
|---|
| [3f8be484] | 187 | <varlistentry id="gprof"> | 
|---|
|  | 188 | <term><command>gprof</command></term> | 
|---|
|  | 189 | <listitem> | 
|---|
|  | 190 | <para>Displays call graph profile data</para> | 
|---|
|  | 191 | <indexterm zone="ch-system-binutils gprof"> | 
|---|
|  | 192 | <primary sortas="b-gprof">gprof</primary> | 
|---|
|  | 193 | </indexterm> | 
|---|
|  | 194 | </listitem> | 
|---|
|  | 195 | </varlistentry> | 
|---|
|  | 196 |  | 
|---|
|  | 197 | <varlistentry id="ld"> | 
|---|
|  | 198 | <term><command>ld</command></term> | 
|---|
|  | 199 | <listitem> | 
|---|
|  | 200 | <para>A linker that combines a number of object and archive files | 
|---|
|  | 201 | into a single file, relocating their data and tying up symbol | 
|---|
|  | 202 | references</para> | 
|---|
|  | 203 | <indexterm zone="ch-system-binutils ld"> | 
|---|
|  | 204 | <primary sortas="b-ld">ld</primary> | 
|---|
|  | 205 | </indexterm> | 
|---|
|  | 206 | </listitem> | 
|---|
|  | 207 | </varlistentry> | 
|---|
|  | 208 |  | 
|---|
| [2b220db9] | 209 | <varlistentry id="ld.bfd"> | 
|---|
|  | 210 | <term><command>ld.bfd</command></term> | 
|---|
|  | 211 | <listitem> | 
|---|
|  | 212 | <para>Hard link to <command>ld</command></para> | 
|---|
|  | 213 | <indexterm zone="ch-system-binutils ld.bfd"> | 
|---|
|  | 214 | <primary sortas="b-ld.bfd">ld.bfd</primary> | 
|---|
|  | 215 | </indexterm> | 
|---|
|  | 216 | </listitem> | 
|---|
|  | 217 | </varlistentry> | 
|---|
|  | 218 |  | 
|---|
| [bcda234] | 219 | <varlistentry id="ld.gold"> | 
|---|
|  | 220 | <term><command>ld.gold</command></term> | 
|---|
|  | 221 | <listitem> | 
|---|
|  | 222 | <para>A linker designed to be faster than <command>ld</command>, | 
|---|
|  | 223 | especially for large C++ applications.</para> | 
|---|
|  | 224 | <indexterm zone="ch-system-binutils ld.gold"> | 
|---|
|  | 225 | <primary sortas="b-ld.gold">ld.gold</primary> | 
|---|
|  | 226 | </indexterm> | 
|---|
|  | 227 | </listitem> | 
|---|
|  | 228 | </varlistentry> | 
|---|
|  | 229 |  | 
|---|
| [3f8be484] | 230 | <varlistentry id="nm"> | 
|---|
|  | 231 | <term><command>nm</command></term> | 
|---|
|  | 232 | <listitem> | 
|---|
|  | 233 | <para>Lists the symbols occurring in a given object file</para> | 
|---|
|  | 234 | <indexterm zone="ch-system-binutils nm"> | 
|---|
|  | 235 | <primary sortas="b-nm">nm</primary> | 
|---|
|  | 236 | </indexterm> | 
|---|
|  | 237 | </listitem> | 
|---|
|  | 238 | </varlistentry> | 
|---|
|  | 239 |  | 
|---|
|  | 240 | <varlistentry id="objcopy"> | 
|---|
|  | 241 | <term><command>objcopy</command></term> | 
|---|
|  | 242 | <listitem> | 
|---|
|  | 243 | <para>Translates one type of object file into another</para> | 
|---|
|  | 244 | <indexterm zone="ch-system-binutils objcopy"> | 
|---|
|  | 245 | <primary sortas="b-objcopy">objcopy</primary> | 
|---|
|  | 246 | </indexterm> | 
|---|
|  | 247 | </listitem> | 
|---|
|  | 248 | </varlistentry> | 
|---|
|  | 249 |  | 
|---|
|  | 250 | <varlistentry id="objdump"> | 
|---|
|  | 251 | <term><command>objdump</command></term> | 
|---|
|  | 252 | <listitem> | 
|---|
|  | 253 | <para>Displays information about the given object file, with options | 
|---|
|  | 254 | controlling the particular information to display; the information | 
|---|
|  | 255 | shown is useful to programmers who are working on the compilation | 
|---|
|  | 256 | tools</para> | 
|---|
|  | 257 | <indexterm zone="ch-system-binutils objdump"> | 
|---|
|  | 258 | <primary sortas="b-objdump">objdump</primary> | 
|---|
|  | 259 | </indexterm> | 
|---|
|  | 260 | </listitem> | 
|---|
|  | 261 | </varlistentry> | 
|---|
|  | 262 |  | 
|---|
|  | 263 | <varlistentry id="ranlib"> | 
|---|
|  | 264 | <term><command>ranlib</command></term> | 
|---|
|  | 265 | <listitem> | 
|---|
|  | 266 | <para>Generates an index of the contents of an archive and stores it | 
|---|
|  | 267 | in the archive; the index lists all of the symbols defined by archive | 
|---|
|  | 268 | members that are relocatable object files</para> | 
|---|
|  | 269 | <indexterm zone="ch-system-binutils ranlib"> | 
|---|
|  | 270 | <primary sortas="b-ranlib">ranlib</primary> | 
|---|
|  | 271 | </indexterm> | 
|---|
|  | 272 | </listitem> | 
|---|
|  | 273 | </varlistentry> | 
|---|
|  | 274 |  | 
|---|
|  | 275 | <varlistentry id="readelf"> | 
|---|
|  | 276 | <term><command>readelf</command></term> | 
|---|
|  | 277 | <listitem> | 
|---|
|  | 278 | <para>Displays information about ELF type binaries</para> | 
|---|
|  | 279 | <indexterm zone="ch-system-binutils readelf"> | 
|---|
|  | 280 | <primary sortas="b-readelf">readelf</primary> | 
|---|
|  | 281 | </indexterm> | 
|---|
|  | 282 | </listitem> | 
|---|
|  | 283 | </varlistentry> | 
|---|
|  | 284 |  | 
|---|
|  | 285 | <varlistentry id="size"> | 
|---|
|  | 286 | <term><command>size</command></term> | 
|---|
|  | 287 | <listitem> | 
|---|
|  | 288 | <para>Lists the section sizes and the total size for the given | 
|---|
|  | 289 | object files</para> | 
|---|
|  | 290 | <indexterm zone="ch-system-binutils size"> | 
|---|
|  | 291 | <primary sortas="b-size">size</primary> | 
|---|
|  | 292 | </indexterm> | 
|---|
|  | 293 | </listitem> | 
|---|
|  | 294 | </varlistentry> | 
|---|
|  | 295 |  | 
|---|
|  | 296 | <varlistentry id="strings"> | 
|---|
|  | 297 | <term><command>strings</command></term> | 
|---|
|  | 298 | <listitem> | 
|---|
|  | 299 | <para>Outputs, for each given file, the sequences of printable | 
|---|
|  | 300 | characters that are of at least the specified length (defaulting to | 
|---|
|  | 301 | four); for object files, it prints, by default, only the strings from | 
|---|
|  | 302 | the initializing and loading sections while for other types of files, | 
|---|
|  | 303 | it scans the entire file</para> | 
|---|
|  | 304 | <indexterm zone="ch-system-binutils strings"> | 
|---|
|  | 305 | <primary sortas="b-strings">strings</primary> | 
|---|
|  | 306 | </indexterm> | 
|---|
|  | 307 | </listitem> | 
|---|
|  | 308 | </varlistentry> | 
|---|
|  | 309 |  | 
|---|
|  | 310 | <varlistentry id="strip"> | 
|---|
|  | 311 | <term><command>strip</command></term> | 
|---|
|  | 312 | <listitem> | 
|---|
|  | 313 | <para>Discards symbols from object files</para> | 
|---|
|  | 314 | <indexterm zone="ch-system-binutils strip"> | 
|---|
|  | 315 | <primary sortas="b-strip">strip</primary> | 
|---|
|  | 316 | </indexterm> | 
|---|
|  | 317 | </listitem> | 
|---|
|  | 318 | </varlistentry> | 
|---|
|  | 319 |  | 
|---|
|  | 320 | <varlistentry id="libbfd"> | 
|---|
|  | 321 | <term><filename class="libraryfile">libbfd</filename></term> | 
|---|
|  | 322 | <listitem> | 
|---|
|  | 323 | <para>The Binary File Descriptor library</para> | 
|---|
|  | 324 | <indexterm zone="ch-system-binutils libbfd"> | 
|---|
|  | 325 | <primary sortas="c-libbfd">libbfd</primary> | 
|---|
|  | 326 | </indexterm> | 
|---|
|  | 327 | </listitem> | 
|---|
|  | 328 | </varlistentry> | 
|---|
|  | 329 |  | 
|---|
|  | 330 | <varlistentry id="libopcodes"> | 
|---|
|  | 331 | <term><filename class="libraryfile">libopcodes</filename></term> | 
|---|
|  | 332 | <listitem> | 
|---|
|  | 333 | <para>A library for dealing with opcodes—the <quote>readable | 
|---|
|  | 334 | text</quote> versions of instructions for the processor; | 
|---|
|  | 335 | it is used for building utilities like | 
|---|
|  | 336 | <command>objdump</command>.</para> | 
|---|
|  | 337 | <indexterm zone="ch-system-binutils libopcodes"> | 
|---|
|  | 338 | <primary sortas="c-libopcodes">libopcodes</primary> | 
|---|
|  | 339 | </indexterm> | 
|---|
|  | 340 | </listitem> | 
|---|
|  | 341 | </varlistentry> | 
|---|
|  | 342 |  | 
|---|
|  | 343 | </variablelist> | 
|---|
|  | 344 |  | 
|---|
|  | 345 | </sect2> | 
|---|
|  | 346 |  | 
|---|
|  | 347 | </sect1> | 
|---|