Are you sure that this 'ld' wasn't configured using
'--with-sysroot=$sysroot' or something special?
Yes I'm sure.
Anyway I try to summarize what I did until now.
I'm using a Gentoo Linux system for building my own GNU/Linux system,
but I'm not following the Linux From Scratch book at the letter.
First of all I set the following environment variables:
export LFS=/home/booleandomain/tmp/lfs
export LFS_BUILD=x86_64-pc-linux-gnu
export LFS_HOST=x86_64-pc-linux-gnu
export LFS_TARGET=x86_64-pc-linux-gnu
export CFLAGS="-O2 -march=core2"
I then created a directory $LFS/static and a symlink /static pointing to
$LFS/static.
I statically compiled and installed in /static the following packages
(in this order): bash, coreutils, tar, gzip, bzip2, sed, gcc, binutils,
make, gawk, m4, grep, diffutils, glibc.
I then chrooted in $LFS using the following command:
chroot ${LFS} /static/bin/env -i
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/static/bin
LFS_BUILD=x86_64-pc-linux-gnu LFS_HOST=x86_64-pc-linux-gnu
LFS_TARGET=x86_64-pc-linux-gnu CFLAGS="-O2 -march=core2" /static/bin/bash
I then compiled and installed from inside the chroot the following
packages (in this order): glibc, binutils, gmp, mpfr.
The next one should be gcc. But I can't compile it for the reason
explained before.