Просмотр исходного кода

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>
ramin 1 неделя назад
Родитель
Сommit
aa9a517381
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      toolchain/binutils/Makefile

+ 1 - 1
toolchain/binutils/Makefile

@@ -48,7 +48,7 @@ endif
 		$(WRKBUILD)/configure \
 		--prefix=$(TOOLCHAIN_DIR)/usr \
 		--target=$(GNU_TARGET_NAME) \
-		--with-sysroot=$(STAGING_TARGET_DIR) \
+		--with-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \
 		--disable-dependency-tracking \
 		--disable-libtool-lock \
 		--disable-nls \