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:50:45
Message-Id: 20200103115027.1062743-1-zx2c4@gentoo.org
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 This is untested on the bug reporter's system, and I'd appreciate some
12 review from an author of this eclass.
13
14 eclass/linux-mod.eclass | 11 +++++++----
15 1 file changed, 7 insertions(+), 4 deletions(-)
16
17 diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
18 index b6dc2c84d09..ecfce72a142 100644
19 --- a/eclass/linux-mod.eclass
20 +++ b/eclass/linux-mod.eclass
21 @@ -671,13 +671,16 @@ linux-mod_src_compile() {
22 # spaces that must be preserved. If don't do this, then the stuff
23 # inside the variables gets used as targets for Make, which then
24 # fails.
25 - eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
26 - CROSS_COMPILE=${CHOST}- \
27 - LDFLAGS=\"$(get_abi_LDFLAGS)\" \
28 + local KERNEL_CHOST="$(ABI=${KERNEL_ABI} get_abi_CHOST)"
29 + local KERNEL_LDFLAGS="$(ABI=${KERNEL_ABI} get_abi_LDFLAGS)"
30 + local HOST_CC="$(tc-getHOST_CC)"
31 + eval "emake HOSTCC=\"${HOST_CC}\" \
32 + CROSS_COMPILE=${KERNEL_CHOST}- \
33 + LDFLAGS=\"${KERNEL_LDFLAGS}\" \
34 ${BUILD_FIXES} \
35 ${BUILD_PARAMS} \
36 ${BUILD_TARGETS} " \
37 - || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
38 + || die "Unable to emake HOSTCC="${HOST_CC}" CROSS_COMPILE=${KERNEL_CHOST}- LDFLAGS="${KERNEL_LDFLAGS}" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
39 cd "${OLDPWD}"
40 touch "${srcdir}"/.built
41 fi
42 --
43 2.24.1

Replies