On 03/01/2020 12:52, Jason A. Donenfeld wrote:
A user reported that when compiling modules for a system with a 64-bit
kernel and a 32-bit userland, there were linker errors. This patch here
is an attempt to fix that by making sure that we always use the kernel
ABI when giving target build parameters.

Signed-off-by: Jason A. Donenfeld <zx...@gentoo.org>
Fixes: https://bugs.gentoo.org/704468
Cc: joakim.tjernl...@infinera.com
Cc: ker...@gentoo.org
---
  eclass/linux-mod.eclass | 11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index b6dc2c84d09..60b0d88e9b9 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -671,13 +671,16 @@ linux-mod_src_compile() {
                        # spaces that must be preserved. If don't do this, then 
the stuff
                        # inside the variables gets used as targets for Make, 
which then
                        # fails.
-                       eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
-                                               CROSS_COMPILE=${CHOST}- \
-                                               LDFLAGS=\"$(get_abi_LDFLAGS)\" \
+                       local KERNEL_CHOST="$(ABI=${KERNEL_ABI} get_abi_CHOST)"
+                       local KERNEL_LDFLAGS="$(ABI=${KERNEL_ABI} 
get_abi_LDFLAGS)"
+                       local HOST_CC="$(tc-getBUILD_CC)"
+                       eval "emake HOSTCC=\"${HOST_CC}\" \
+                                               CROSS_COMPILE=${KERNEL_CHOST}- \
+                                               LDFLAGS=\"${KERNEL_LDFLAGS}\" \
                                                ${BUILD_FIXES} \
                                                ${BUILD_PARAMS} \
                                                ${BUILD_TARGETS} " \
-                               || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" 
CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} 
${BUILD_TARGETS}"
+                               || die "Unable to emake HOSTCC="${HOST_CC}" 
CROSS_COMPILE=${KERNEL_CHOST}- LDFLAGS="${KERNEL_LDFLAGS}" ${BUILD_FIXES} ${BUILD_PARAMS} 
${BUILD_TARGETS}"
                        cd "${OLDPWD}"
                        touch "${srcdir}"/.built
                fi


It seems doing what it is supposed to do. what is the testing condition?

lu


Reply via email to