commit:     d26d425af9aa825c94532589f2ca6d0cdb7f3d01
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 22:17:40 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jan 28 22:11:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d26d425a

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 <chewi <AT> gentoo.org>

 eclass/usr-ldscript.eclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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 https://bugs.gentoo.org/4411 for more info.
                         */
                        ${output_format}
-                       GROUP ( ${EPREFIX}/${libdir}/${tlib} )
+                       GROUP ( ${prefix}/${libdir}/${tlib} )
                        END_LDSCRIPT
                        ;;
                esac

Reply via email to