public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
@ 2020-01-03 11:50 Jason A. Donenfeld
  2020-01-03 11:52 ` Jason A. Donenfeld
  0 siblings, 1 reply; 6+ messages in thread
From: Jason A. Donenfeld @ 2020-01-03 11:50 UTC (permalink / raw
  To: gentoo-dev; +Cc: Jason A. Donenfeld, joakim.tjernlund, kernel

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 <zx2c4@gentoo.org>
Fixes: https://bugs.gentoo.org/704468
Cc: joakim.tjernlund@infinera.com
Cc: kernel@gentoo.org
---
This is untested on the bug reporter's system, and I'd appreciate some
review from an author of this eclass.

 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..ecfce72a142 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-getHOST_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
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
  2020-01-03 11:50 [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system Jason A. Donenfeld
@ 2020-01-03 11:52 ` Jason A. Donenfeld
  2020-01-05  2:11   ` [gentoo-dev] " Jason A. Donenfeld
  2020-01-05  8:20   ` Luca Barbato
  0 siblings, 2 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2020-01-03 11:52 UTC (permalink / raw
  To: gentoo-dev; +Cc: Jason A. Donenfeld, joakim.tjernlund, kernel

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 <zx2c4@gentoo.org>
Fixes: https://bugs.gentoo.org/704468
Cc: joakim.tjernlund@infinera.com
Cc: kernel@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
-- 
2.24.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] Re: [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
  2020-01-03 11:52 ` Jason A. Donenfeld
@ 2020-01-05  2:11   ` Jason A. Donenfeld
  2020-01-05  2:33     ` Aaron Bauman
  2020-01-05  8:20   ` Luca Barbato
  1 sibling, 1 reply; 6+ messages in thread
From: Jason A. Donenfeld @ 2020-01-05  2:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: joakim.tjernlund, kernel

Hi,

I'd appreciate some code review of this before I commit.

Thanks,
Jason


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] Re: [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
  2020-01-05  2:11   ` [gentoo-dev] " Jason A. Donenfeld
@ 2020-01-05  2:33     ` Aaron Bauman
  2020-01-05  3:11       ` Jason A. Donenfeld
  0 siblings, 1 reply; 6+ messages in thread
From: Aaron Bauman @ 2020-01-05  2:33 UTC (permalink / raw
  To: gentoo-dev; +Cc: joakim.tjernlund, kernel

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]

On Sat, Jan 04, 2020 at 09:11:01PM -0500, Jason A. Donenfeld wrote:
> Hi,
> 
> I'd appreciate some code review of this before I commit.
> 
> Thanks,
> Jason
> 

Silence is consent. I also don't know the original authors are even Gentoo devs
anymore...

-- 
Cheers,
Aaron

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] Re: [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
  2020-01-05  2:33     ` Aaron Bauman
@ 2020-01-05  3:11       ` Jason A. Donenfeld
  0 siblings, 0 replies; 6+ messages in thread
From: Jason A. Donenfeld @ 2020-01-05  3:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: joakim.tjernlund, kernel

On Sat, Jan 4, 2020 at 9:33 PM Aaron Bauman <bman@gentoo.org> wrote:
>
> On Sat, Jan 04, 2020 at 09:11:01PM -0500, Jason A. Donenfeld wrote:
> > Hi,
> >
> > I'd appreciate some code review of this before I commit.
> >
> > Thanks,
> > Jason
> >
>
> Silence is consent.

Maybe. But there's quite a bit of this that I look at and think,
"that's not necessary, let me just trim this all down to something
much smaller..." And then I start to wonder whether the original
authors have already been through several bug-fixing cycles when they
added all that. So I'd like to avoid repeating that exercise if
possible.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gentoo-dev] Re: [PATCH] linux-mod.eclass: pass proper arch to kernel's build system
  2020-01-03 11:52 ` Jason A. Donenfeld
  2020-01-05  2:11   ` [gentoo-dev] " Jason A. Donenfeld
@ 2020-01-05  8:20   ` Luca Barbato
  1 sibling, 0 replies; 6+ messages in thread
From: Luca Barbato @ 2020-01-05  8:20 UTC (permalink / raw
  To: Jason A. Donenfeld, gentoo-dev; +Cc: joakim.tjernlund, kernel

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 <zx2c4@gentoo.org>
> Fixes: https://bugs.gentoo.org/704468
> Cc: joakim.tjernlund@infinera.com
> Cc: kernel@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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-05  8:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-03 11:50 [gentoo-dev] [PATCH] linux-mod.eclass: pass proper arch to kernel's build system Jason A. Donenfeld
2020-01-03 11:52 ` Jason A. Donenfeld
2020-01-05  2:11   ` [gentoo-dev] " Jason A. Donenfeld
2020-01-05  2:33     ` Aaron Bauman
2020-01-05  3:11       ` Jason A. Donenfeld
2020-01-05  8:20   ` Luca Barbato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox