binutils: configure the sysroot relative to the prefix, like gcc
toolchain/gcc/Makefile passes --with-sysroot='$${prefix}/${STAGING_HOST2TARGET}',
binutils passed the absolute $(STAGING_TARGET_DIR). Both compile the value in, but
only the relative form lets the tool recompute it at run time: ld/configure.ac
matches the literal '${prefix}/'* case and defines TARGET_SYSTEM_ROOT_RELOCATABLE,
and get_relative_sysroot() in ld/ldmain.c then derives the sysroot from argv[0]
(relative to BINDIR and TOOLBINDIR) and uses it if it exists -- the same mechanism
gcc has in gcc.cc.
Without it a packed toolchain's ld keeps pointing at the build directory whenever
it is called directly rather than through gcc, which gcc's link spec overrides
with an explicit --sysroot. ld-elf2flt on the FLAT targets is such a direct
caller. In the build tree the value resolves to exactly the same directory as
before, so nothing changes there.
Verified by reading the binutils 2.46 sources, not by a toolchain rebuild; effective
only for newly built toolchains.
Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>