The SkyVision Book · Part II · Chapter 5 · 5.2 Binutils-2.43.1 — Pass 1
5.2 Binutils-2.43.1 — Pass 1
The Binutils package contains the linker, the assembler, and other tools for handling object files. We build it first because both GCC and Glibc perform tests on the linker and assembler at configure time to decide which of their own features to enable — the toolchain we are about to grow is shaped by this very first package.
This is the package you time to define one SBU on your machine:
time { ../configure ... && make && make install; }5.2.1 Installation of cross-Binutils
The Binutils documentation recommends building in a dedicated directory:
$ mkdir -v build $ cd build
Now prepare Binutils for compilation:
$ ../configure --prefix=$SV/tools \ --with-sysroot=$SV \ --target=$SV_TGT \ --disable-nls \ --enable-gprofng=no \ --disable-werror \ --enable-new-dtags \ --enable-default-hash-style=gnu
The meaning of the configure options:
--prefix=$SV/tools — installs the cross
tools into the throwaway tools directory;
nothing built in this chapter survives into the final system, so we keep
it strictly separated.
--with-sysroot=$SV — tells the build system
to look in $SV for the target system
libraries, keeping the host system's libraries strictly out of our new
toolchain. Cross-contamination from the host is the single most common
cause of a broken build, and this flag is our first line of defense.
--target=$SV_TGT — because
$SV_TGT (x86_64-sv-linux-gnu) differs from the host triplet, this activates Binutils'
cross-compilation mode: tools are built that run on the host but produce
binaries for SkyVision.
--disable-nls — no translations in temporary
tools; less to build, nothing of value lost at this stage.
--enable-default-hash-style=gnu — emits only
GNU-style symbol hash tables, which are faster to look up than the
classic ELF tables and the only style our Glibc will read.
Continue with compiling and installing the package:
$ make $ make install
ld,
as, objdump and
friends — are collected in
Appendix A.2, “Contents of Binutils.”