5.9. Cross Binutils-2.19.1

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

5.9.1. Installation of Cross Binutils

It is important that Binutils be the first package compiled because both EGLIBC and GCC perform various tests on the available linker and assembler to determine which of their own features to enable.

The following patch contains a number of updates to the 2.19.1 branch by the Binutils developers:

patch -Np1 -i ../binutils-2.19.1-branch_update-5.patch

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

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

Prepare Binutils for compilation:

AR=ar AS=as ../binutils-2.19.1/configure --prefix=${CLFS}/cross-tools \
   --host=${CLFS_HOST} --target=${CLFS_TARGET} --with-sysroot=${CLFS} \
   --disable-nls --enable-shared --disable-multilib

The meaning of the configure options:

--prefix=${CLFS}/cross-tools

This tells the configure script to prepare to install the package in the ${CLFS}/cross-tools directory.

--host=${CLFS_HOST}

When used with --target, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.

--target=${CLFS_TARGET}

When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.

--with-sysroot=${CLFS}

This tells configure that ${CLFS} is going to be the root of our system. It will now use the specified sysroot, ${CLFS}, as a prefix of the default search paths.

--disable-nls

This disables internationalization as i18n is not needed for the cross-compile tools.

--enable-shared

Enable the creation of the shared libraries.

--disable-multilib

This option disables the building of a multilib capable Binutils.

Compile the package:

make configure-host
make

The meaning of the make options:

configure-host

This checks the host environment and makes sure all the necessary tools are available to compile Binutils.

Install the package:

make install

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

cp -v ../binutils-2.19.1/include/libiberty.h ${CLFS}/usr/include

Details on this package are located in Section 6.10.3, “Contents of Binutils.”