summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2022-12-26 22:32:02 +0000
committerJames Le Cuirot <chewi@gentoo.org>2023-01-28 22:11:16 +0000
commit72925b1dccebbf082c31a2be89c7693d966ecd54 (patch)
treeb0e5259d4817880913a47e7b86e86d0c09874a7c /eclass/toolchain.eclass
parentusr-ldscript.eclass: Don't add prefix to ld script paths when standalone (diff)
downloadgentoo-72925b1dccebbf082c31a2be89c7693d966ecd54.tar.gz
gentoo-72925b1dccebbf082c31a2be89c7693d966ecd54.tar.bz2
gentoo-72925b1dccebbf082c31a2be89c7693d966ecd54.zip
toolchain.eclass: Fix cross-compiling gcc for standalone prefix
Standalone prefix has always configured gcc with a sysroot, but the location of this sysroot is different at build time when cross-compiling. gcc has a separate configure option for that. prefix-guest systems do not have a sysroot applied, as they use the host's libc. Move this code from the prefix profile into the eclass so that it's less of a special case. We can avoid relying on the `BOOTSTRAP_RAP_STAGE2` variable by checking for the `prefix-guest` USE flag instead, as a prefix-guest profile is now used for RAP stage 2. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass15
1 files changed, 15 insertions, 0 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 0dd23d93e383..479814f0df3e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1200,6 +1200,21 @@ toolchain_src_configure() {
confgcc+=( --enable-threads=posix )
;;
esac
+
+ if ! use prefix-guest ; then
+ # GNU ld scripts, such as those in glibc, reference unprefixed paths
+ # as the sysroot given here is automatically prepended. For
+ # prefix-guest, we use the host's libc instead.
+ if [[ -n ${EPREFIX} ]] ; then
+ confgcc+=( --with-sysroot="${EPREFIX}" )
+ fi
+
+ # We need to build against the right headers and libraries. Again,
+ # for prefix-guest, this is the host's.
+ if [[ -n ${ESYSROOT} ]] ; then
+ confgcc+=( --with-build-sysroot="${ESYSROOT}" )
+ fi
+ fi
fi
# __cxa_atexit is "essential for fully standards-compliant handling of