diff options
authorJames Le Cuirot <>2022-12-26 22:17:40 +0000
committerJames Le Cuirot <>2023-01-28 22:11:13 +0000
commitd26d425af9aa825c94532589f2ca6d0cdb7f3d01 (patch)
tree7d7a191d1d2a2ac2026b89d2f3a2a46fe35ae7ca /eclass/usr-ldscript.eclass
parentsys-libs/glibc: Strip prefix from ld scripts for better cross-compiling (diff)
usr-ldscript.eclass: Don't add prefix to ld script paths when standalone
The toolchain's sysroot is automatically prepended to these paths. Gentoo Prefix used to prevent this, but now we're changing that. prefix-guest systems do not have a sysroot applied, as they use the host's libc, so the prefix is still needed in this case. This is actually all moot because the gen_usr_ldscript function is a noop on prefix anyway, but I'm still adding this in case that changes. Signed-off-by: James Le Cuirot <>
Diffstat (limited to 'eclass/usr-ldscript.eclass')
1 files changed, 8 insertions, 1 deletions
diff --git a/eclass/usr-ldscript.eclass b/eclass/usr-ldscript.eclass
index b73d538ae5bb..6dbce59c6400 100644
--- a/eclass/usr-ldscript.eclass
+++ b/eclass/usr-ldscript.eclass
@@ -39,6 +39,13 @@ gen_usr_ldscript() {
tc-is-static-only && return
use prefix && return
+ # The toolchain's sysroot is automatically prepended to paths in this
+ # script. We therefore need to omit EPREFIX on standalone prefix (RAP)
+ # systems. prefix-guest (non-RAP) systems don't apply a sysroot so EPREFIX
+ # is still needed in that case. This is moot because the above line makes
+ # the function a noop on prefix, but we keep this in case that changes.
+ local prefix=$(usex prefix-guest "${EPREFIX}" "")
# We only care about stuffing / for the native ABI. #479448
if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
multilib_is_native_abi || return 0
@@ -154,7 +161,7 @@ gen_usr_ldscript() {
See bug for more info.
- GROUP ( ${EPREFIX}/${libdir}/${tlib} )
+ GROUP ( ${prefix}/${libdir}/${tlib} )