Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 427052 - linux-mod.eclass needs a fix for ABI x32
Summary: linux-mod.eclass needs a fix for ABI x32
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
: 508502 (view as bug list)
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2012-07-18 06:20 UTC by devsk
Modified: 2022-05-02 02:03 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description devsk 2012-07-18 06:20:24 UTC
LDFLAGS=\"$(get_abi_LDFLAGS)\" linux-mod_src_compile is wrong for x32 ABI. It forces the final link to be an x32 link while the objects are pure 64-bit. We should always create 64-bit kernel modules for x32 ABI because only the 64-bit kernel will run x32 ABI. So, LDFLAGS should be passed in this case.

I don't know how to properly fix it though. I did not dig deep. But I have a feeling that just removing the LDFLAGS altogether should do the right thing for all ARCHs. But as I said, I don't know....:)

Reproducible: Always
Comment 1 devsk 2012-07-18 06:21:41 UTC
Just wanted to mention that the final link fails because 64-bit objects are not compatible with elf32_x86_64.
Comment 2 Ambroz Bizjak 2012-08-08 11:04:58 UTC
Doesn't the kernel Makefile handle using the right flags based on config options? What is the reason linux-mod passes any LDFLAGS?
Comment 3 devsk 2012-08-08 15:24:14 UTC
linux-mod is doing the wrong thing with crosscompile as well, when there is no need to pass any of those args to the make. There is very good support for crosscompile built into the kernel.

Last time I tried, you couldn't have a 64-bit kernel and pure 32-bit userspace on gentoo because of this CROSS_COMPILE=${CHOST}- thingy. All of the packages which needed to build kernel modules failed to build. I needed this patch to move fwd:

# diff -u linux-mod.eclass.org linux-mod.eclass
--- linux-mod.eclass.org        2012-08-08 08:23:52.666304793 -0700
+++ linux-mod.eclass    2012-08-08 08:23:47.699366891 -0700
@@ -667,9 +667,7 @@
                        # 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)\" \
+                       eval "emake  \
                                                ${BUILD_FIXES} \
                                                ${BUILD_PARAMS} \
                                                ${BUILD_TARGETS} " \
Comment 4 Nick Bowler 2017-03-28 15:55:02 UTC
Pretty sure the only thing needed to fix this is to add KERNEL_ABI=amd64 into the x32 profiles.  No changes to the eclass are required.

Adding this locally fixes out of tree module ebuilds on my x32 systems.
Comment 5 Mike Gilbert gentoo-dev 2021-09-06 23:23:33 UTC
(In reply to Ambroz Bizjak from comment #2)
> Doesn't the kernel Makefile handle using the right flags based on config
> options? What is the reason linux-mod passes any LDFLAGS?

That originates from bug 133382.
Comment 6 Mike Gilbert gentoo-dev 2021-09-06 23:24:38 UTC
(In reply to Nick Bowler from comment #4)
> Pretty sure the only thing needed to fix this is to add KERNEL_ABI=amd64
> into the x32 profiles.  No changes to the eclass are required.

Yeah, this is probably the safest approach. Patch sent to gentoo-dev for review.

https://archives.gentoo.org/gentoo-dev/message/cb1a75cf9274ffda23cbac51cfba1486
Comment 7 Larry the Git Cow gentoo-dev 2021-09-08 14:49:10 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b01f5d7f4de20063d5949b3bd8a4ed12ebf99621

commit b01f5d7f4de20063d5949b3bd8a4ed12ebf99621
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2021-09-06 23:17:24 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-09-08 14:48:49 +0000

    profiles/arch/amd64/x32: set KERNEL_ABI="amd64"
    
    Closes: https://bugs.gentoo.org/427052
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 profiles/arch/amd64/x32/make.defaults | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-05-02 02:03:43 UTC
*** Bug 508502 has been marked as a duplicate of this bug. ***