Gentoo Archives: gentoo-dev

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-dev@l.g.o
Cc: Sergei Trofimovich <slyfox@g.o>
Subject: [gentoo-dev] [PATCH 2/2] multilib.eclass: multilib_env(): set LIBDIR=lib for *-musl*
Date: Sat, 28 Mar 2020 09:41:10
Message-Id: 20200328094043.648161-2-slyfox@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/2] eclass/tests: add basic tests for multilib_env() expansion by Sergei Trofimovich
1 In contrast to glibc musl profiles use 'lib' layour for 32-bit
2 and 64-bit targets. multilib_env() did not take it into account
3 and assumed glibc's lib64 layout.
4
5 That breaks crossdev as it uses multilib_env to extract target
6 definition. Native builds are unaffected by this change.
7
8 Bug: https://bugs.gentoo.org/675954
9 Bug: https://gcc.gnu.org/PR90077
10 Bug: https://github.com/gentoo/musl/issues/245
11 Signed-off-by: Sergei Trofimovich <slyfox@g.o>
12 ---
13 eclass/multilib.eclass | 13 ++++++++++++-
14 eclass/tests/multilib.sh | 4 ++++
15 2 files changed, 16 insertions(+), 1 deletion(-)
16
17 diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
18 index 63bde5cbb60..8b4a7dacaa3 100644
19 --- a/eclass/multilib.eclass
20 +++ b/eclass/multilib.eclass
21 @@ -294,11 +294,22 @@ get_modname() {
22 }
23
24 # This is for the toolchain to setup profile variables when pulling in
25 -# a crosscompiler (and thus they aren't set in the profile)
26 +# a crosscompiler (and thus they aren't set in the profile).
27 multilib_env() {
28 local CTARGET=${1:-${CTARGET}}
29 local cpu=${CTARGET%%*-}
30
31 + if [[ ${CTARGET} = *-musl* ]]; then
32 + # musl has no multilib support and can run only in 'lib':
33 + # - https://bugs.gentoo.org/675954
34 + # - https://gcc.gnu.org/PR90077
35 + # - https://github.com/gentoo/musl/issues/245
36 + : ${MULTILIB_ABIS=default}
37 + : ${DEFAULT_ABI=default}
38 + export MULTILIB_ABIS DEFAULT_ABI
39 + return
40 + fi
41 +
42 case ${cpu} in
43 aarch64*)
44 # Not possible to do multilib with aarch64 and a single toolchain.
45 diff --git a/eclass/tests/multilib.sh b/eclass/tests/multilib.sh
46 index 308c456b98d..68c0dd6e142 100755
47 --- a/eclass/tests/multilib.sh
48 +++ b/eclass/tests/multilib.sh
49 @@ -57,5 +57,9 @@ test-multilib_env \
50 "x86_64-pc-linux-gnux32" \
51 "x32:x32 amd64 x86" \
52 "x32? ( CHOST=x86_64-pc-linux-gnux32 LIBDIR=libx32 CFLAGS=-mx32 LDFLAGS= ) amd64? ( CHOST=x86_64-pc-linux-gnu LIBDIR=lib64 CFLAGS=-m64 LDFLAGS= ) x86? ( CHOST=i686-pc-linux-gnu LIBDIR=lib CFLAGS=-m32 LDFLAGS= )"
53 +test-multilib_env \
54 + "x86_64-gentoo-linux-musl" \
55 + "default:default" \
56 + "default? ( CHOST=x86_64-gentoo-linux-musl LIBDIR=lib CFLAGS= LDFLAGS= )"
57
58 texit
59 --
60 2.26.0

Replies