Skip to content

Commit 26578a1

Browse files
author
Sergei Trofimovich
committed
multilib.eclass: multilib_env(): set LIBDIR=lib for *-musl*
In contrast to glibc musl profiles use 'lib' layour for 32-bit and 64-bit targets. multilib_env() did not take it into account and assumed glibc's lib64 layout. That breaks crossdev as it uses multilib_env to extract target definition. Native builds are unaffected by this change. Bug: https://bugs.gentoo.org/675954 Bug: https://gcc.gnu.org/PR90077 Bug: gentoo/musl#245 Signed-off-by: Sergei Trofimovich <[email protected]>
1 parent ba0d4bc commit 26578a1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

eclass/multilib.eclass

+12-1
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,22 @@ get_modname() {
294294
}
295295

296296
# This is for the toolchain to setup profile variables when pulling in
297-
# a crosscompiler (and thus they aren't set in the profile)
297+
# a crosscompiler (and thus they aren't set in the profile).
298298
multilib_env() {
299299
local CTARGET=${1:-${CTARGET}}
300300
local cpu=${CTARGET%%*-}
301301

302+
if [[ ${CTARGET} = *-musl* ]]; then
303+
# musl has no multilib support and can run only in 'lib':
304+
# - https://bugs.gentoo.org/675954
305+
# - https://gcc.gnu.org/PR90077
306+
# - https://github.com/gentoo/musl/issues/245
307+
: ${MULTILIB_ABIS=default}
308+
: ${DEFAULT_ABI=default}
309+
export MULTILIB_ABIS DEFAULT_ABI
310+
return
311+
fi
312+
302313
case ${cpu} in
303314
aarch64*)
304315
# Not possible to do multilib with aarch64 and a single toolchain.

eclass/tests/multilib.sh

+4
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,9 @@ test-multilib_env \
5757
"x86_64-pc-linux-gnux32" \
5858
"x32:x32 amd64 x86" \
5959
"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= )"
60+
test-multilib_env \
61+
"x86_64-gentoo-linux-musl" \
62+
"default:default" \
63+
"default? ( CHOST=x86_64-gentoo-linux-musl LIBDIR=lib CFLAGS= LDFLAGS= )"
6064

6165
texit

0 commit comments

Comments
 (0)