Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.58 KB

File metadata and controls

52 lines (40 loc) · 1.58 KB

Binutils 2.46.0 — Pass 1

Binutils provides the assembler (as) and linker (ld) that GCC depends on. It must be built before GCC — GCC's configure script probes the linker to determine its capabilities.

Run as the lfs user with $LFS and $LFS_TGT set.

Build steps

cd $LFS/sources
tar xf binutils-2.46.0.tar.xz
cd binutils-2.46.0
mkdir -v build
cd build

../configure \
    --prefix=$LFS/tools \
    --with-sysroot=$LFS \
    --target=$LFS_TGT \
    --disable-nls \
    --enable-gprofng=no \
    --disable-werror \
    --enable-new-dtags \
    --enable-default-hash-style=gnu

make -j$(nproc)
make install

Remove the source directory:

cd $LFS/sources && rm -rf binutils-2.46.0

Flag reference

Flag Purpose
--prefix=$LFS/tools Install to /mnt/lfs/tools, not the host system
--with-sysroot=$LFS Tell the tools to look for libraries inside $LFS, not on the host
--target=$LFS_TGT Produce tools that generate code for aarch64-lfs-linux-gnu
--disable-nls No internationalisation — reduces build time and host dependencies
--enable-gprofng=no Skip the gprofng profiling tool which has host library dependencies
--enable-default-hash-style=gnu Use the GNU hash format (faster at runtime)

Checkpoint

Verify before moving on
ls $LFS/tools/bin/ | grep aarch64 shows aarch64-lfs-linux-gnu-ar, aarch64-lfs-linux-gnu-as, aarch64-lfs-linux-gnu-ld, aarch64-lfs-linux-gnu-nm
$LFS/tools/bin/aarch64-lfs-linux-gnu-ld --version prints Binutils 2.46.0