5.15. Cross Binutils-2.23.2

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

5.15.1. Installation of Cross Binutils

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

Apply the following sed for hosts using Texinfo-5.x:

sed -i -e 's/@colophon/@@colophon/' \
       -e 's/doc@cygnus.com/doc@@cygnus.com/' bfd/doc/bfd.texinfo

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.23.2/configure \
  --prefix=/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} \
  --with-sysroot=${CLFS} --with-lib-path=/tools/lib --disable-nls \
  --disable-static --enable-64-bit-bfd --disable-multilib

The meaning of the new configure options:

AR=ar AS=as

This prevents Binutils from compiling with ${CLFS_HOST}-ar and ${CLFS_HOST}-as as they are provided by this package and therefore not installed yet.

--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-lib-path=/tools/lib

This tells the configure script to specify the library search path during the compilation of Binutils, resulting in /tools/lib being passed to the linker. This prevents the linker from searching through library directories on the host.

--disable-nls

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

--disable-multilib

This option disables the building of a multilib capable Binutils.

--enable-64-bit-bfd

This adds 64 bit support to 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

Copy libiberty.h to /tools/include directory:

cp -v ../binutils-2.23.2/include/libiberty.h /tools/include

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