Gentoo Archives: gentoo-dev

From: "Jason A. Donenfeld" <zx2c4@g.o>
To: gentoo-dev@l.g.o
Cc: "Jason A. Donenfeld" <zx2c4@g.o>, joakim.tjernlund@××××××××.com, kernel@g.o
Subject: [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
Date: Fri, 03 Jan 2020 11:52:59
Message-Id: 20200103115251.1063012-1-zx2c4@gentoo.org
In Reply to: [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system by "Jason A. Donenfeld"
1 A user reported that when compiling modules for a system with a 64-bit
2 kernel and a 32-bit userland, there were linker errors. This patch here
3 is an attempt to fix that by making sure that we always use the kernel
4 ABI when giving target build parameters.
5
6 Signed-off-by: Jason A. Donenfeld <zx2c4@g.o>
7 Fixes: https://bugs.gentoo.org/704468
8 Cc: joakim.tjernlund@××××××××.com
9 Cc: kernel@g.o
10 ---
11 eclass/linux-mod.eclass | 11 +++++++----
12 1 file changed, 7 insertions(+), 4 deletions(-)
13
14 diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
15 index b6dc2c84d09..60b0d88e9b9 100644
16 --- a/eclass/linux-mod.eclass
17 +++ b/eclass/linux-mod.eclass
18 @@ -671,13 +671,16 @@ linux-mod_src_compile() {
19 # spaces that must be preserved. If don't do this, then the stuff
20 # inside the variables gets used as targets for Make, which then
21 # fails.
22 - eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
23 - CROSS_COMPILE=${CHOST}- \
24 - LDFLAGS=\"$(get_abi_LDFLAGS)\" \
25 + local KERNEL_CHOST="$(ABI=${KERNEL_ABI} get_abi_CHOST)"
26 + local KERNEL_LDFLAGS="$(ABI=${KERNEL_ABI} get_abi_LDFLAGS)"
27 + local HOST_CC="$(tc-getBUILD_CC)"
28 + eval "emake HOSTCC=\"${HOST_CC}\" \
29 + CROSS_COMPILE=${KERNEL_CHOST}- \
30 + LDFLAGS=\"${KERNEL_LDFLAGS}\" \
31 ${BUILD_FIXES} \
32 ${BUILD_PARAMS} \
33 ${BUILD_TARGETS} " \
34 - || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
35 + || die "Unable to emake HOSTCC="${HOST_CC}" CROSS_COMPILE=${KERNEL_CHOST}- LDFLAGS="${KERNEL_LDFLAGS}" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
36 cd "${OLDPWD}"
37 touch "${srcdir}"/.built
38 fi
39 --
40 2.24.1

Replies