Bug 194091 - Some modules are linked with wrong emulation (-m) type
Summary: Some modules are linked with wrong emulation (-m) type
Status: NEW
Alias: None
Product: Other
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: other_other
Depends on:
Reported: 2017-02-06 14:23 UTC by georgerim
Modified: 2018-12-18 18:20 UTC (History)
2 users (show)

See Also:
Kernel Version: All
Tree: Mainline
Regression: No

patch (960 bytes, application/octet-stream)
2017-02-06 14:23 UTC, georgerim

Description georgerim 2017-02-06 14:23:59 UTC
Created attachment 254251 [details]


I am one of LLD linkers developer and we faced with a little issue while tried to link the kernel with our linker.

Next line specifies general -m option:

Problem we are observing that arch/x86/boot and arch/x86/realmode/rm modules
has i386 object files, but linked with -m elf_x86_64 linker flag.

GNU linkers accepts that. Though out linker errors out when mets inconsistency of emulation and input files. And we think it is correct and probably do not want to relax this behavior without reasons.

So, I suggest to add -m elf_i386 option to the next lines:


This resolves the issue for us. Suggested patch attached.
Comment 1 Nick Desaulniers 2018-12-07 18:12:27 UTC
Thanks for the recommendation and patch.  That matches up with what other developers have suggested in https://github.com/ClangBuiltLinux/linux/issues/30.  I will send that patch upstream, as per discussions in https://bugs.llvm.org/show_bug.cgi?id=37432.  Thank you for taking the time to write it, and attach it here.
Comment 2 Nick Desaulniers 2018-12-11 21:01:20 UTC
We have sent the attached patch upstream to the kernel (trying to find a link...), will update this bug once we get feedback.
Comment 3 Nick Desaulniers 2018-12-18 18:20:18 UTC

Note You need to log in before you can comment on or make changes to this bug.