Binutils-2.14

The Binutils package contains a linker, an assembler, and other tools for handling object files.

Approximate build time:  1.4 SBU
Required disk space:     167 MB

Binutils installation depends on: Bash, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, Sed, Texinfo.

Installation of Binutils

Now is an appropriate time to verify that your pseudo terminals (PTYs) are working properly inside the chroot environment. We will again quickly check that everything is set up correctly by performing a simple test:

expect -c "spawn ls"

If you receive the message:

The system has no more ptys.  Ask your system administrator to create more.

Your chroot environment is not set up for proper PTY operation. In this case there is no point in running the test suites for Binutils and GCC until you are able to resolve the issue. Please refer back to the section called “Mounting the proc and devpts file systems” and the Make_devices section and perform the recommended steps to fix the problem.

This package is known to behave badly when you have changed its default optimization flags (including the -march and -mcpu options). Therefore, if you have defined any environment variables that override default optimizations, such as CFLAGS and CXXFLAGS, we recommend un-setting or modifying them when building Binutils.

The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:

mkdir ../binutils-build
cd ../binutils-build

Now prepare Binutils for compilation:

../binutils-2.14/configure --prefix=/usr --enable-shared

Compile the package:

make tooldir=/usr

Normally, the tooldir (the directory where the executables end up) is set to $(exec_prefix)/$(target_alias), which expands into, for example, /usr/i686-pc-linux-gnu. Since we only build for our own system, we don't need this target specific directory in /usr. That setup would be used if the system was used to cross-compile (for example compiling a package on an Intel machine that generates code that can be executed on PowerPC machines).

[Important] Important

The test suite for Binutils in this section is considered critical. Our advice is to not skip it under any circumstances.

Test the results:

make check

The test suite notes from the section called “Binutils-2.14 - Pass 2” are still very much appropriate here. Be sure to refer back there should you have any doubts.

Install the package:

make tooldir=/usr install

Install the libiberty header file that is needed by some packages:

cp ../binutils-2.14/include/libiberty.h /usr/include

Contents of Binutils

Installed programs: addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump, ranlib, readelf, size, strings and strip

Installed libraries: libiberty.a, libbfd.[a,so] and libopcodes.[a,so]

Short descriptions

addr2line translates program addresses to file names and line numbers. Given an address and the name of an executable, it uses the debugging information in the executable to figure out which source file and line number are associated with the address.

ar creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).

as is an assembler. It assembles the output of gcc into object files.

c++filt is used by the linker to de-mangle C++ and Java symbols, to keep overloaded functions from clashing.

gprof displays call graph profile data.

ld is a linker. It combines a number of object and archive files into a single file, relocating their data and tying up symbol references.

nm lists the symbols occurring in a given object file.

objcopy is used to translate one type of object file into another.

objdump displays information about the given object file, with options controlling what particular information to display. The information shown is mostly only useful to programmers who are working on the compilation tools.

ranlib generates an index of the contents of an archive, and stores it in the archive. The index lists all the symbols defined by archive members that are relocatable object files.

readelf displays information about elf type binaries.

size lists the section sizes -- and the grand total -- for the given object files.

strings outputs, for each given file, the sequences of printable characters that are of at least the specified length (defaulting to 4). For object files it prints, by default, only the strings from the initializing and loading sections. For other types of files it scans the whole file.

strip discards symbols from object files.

libiberty contains routines used by various GNU programs, including getopt, obstack, strerror, strtol and strtoul.

libbfd is the Binary File Descriptor library.

libopcodes is a library for dealing with opcodes. It is used for building utilities like objdump. Opcodes are the “readable text” versions of instructions for the processor.