Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 2/7] usr-ldscript.eclass: Don't add prefix to ld script paths when standalone
Date: Sat, 21 Jan 2023 22:21:54
Message-Id: 20230121222037.29094-3-chewi@gentoo.org
In Reply to: [gentoo-dev] Allow prefixed systems to be cross-compiled by James Le Cuirot
1 The toolchain's sysroot is automatically prepended to these paths.
2 Gentoo Prefix used to prevent this, but now we're changing that.
3
4 prefix-guest systems do not have a sysroot applied, as they use the
5 host's libc, so the prefix is still needed in this case.
6
7 This is actually all moot because the gen_usr_ldscript function is a
8 noop on prefix anyway, but I'm still adding this in case that changes.
9
10 Signed-off-by: James Le Cuirot <chewi@g.o>
11 ---
12 eclass/usr-ldscript.eclass | 9 ++++++++-
13 1 file changed, 8 insertions(+), 1 deletion(-)
14
15 diff --git a/eclass/usr-ldscript.eclass b/eclass/usr-ldscript.eclass
16 index b73d538ae5bb..6dbce59c6400 100644
17 --- a/eclass/usr-ldscript.eclass
18 +++ b/eclass/usr-ldscript.eclass
19 @@ -39,6 +39,13 @@ gen_usr_ldscript() {
20 tc-is-static-only && return
21 use prefix && return
22
23 + # The toolchain's sysroot is automatically prepended to paths in this
24 + # script. We therefore need to omit EPREFIX on standalone prefix (RAP)
25 + # systems. prefix-guest (non-RAP) systems don't apply a sysroot so EPREFIX
26 + # is still needed in that case. This is moot because the above line makes
27 + # the function a noop on prefix, but we keep this in case that changes.
28 + local prefix=$(usex prefix-guest "${EPREFIX}" "")
29 +
30 # We only care about stuffing / for the native ABI. #479448
31 if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
32 multilib_is_native_abi || return 0
33 @@ -154,7 +161,7 @@ gen_usr_ldscript() {
34 See bug https://bugs.gentoo.org/4411 for more info.
35 */
36 ${output_format}
37 - GROUP ( ${EPREFIX}/${libdir}/${tlib} )
38 + GROUP ( ${prefix}/${libdir}/${tlib} )
39 END_LDSCRIPT
40 ;;
41 esac
42 --
43 2.39.1