Created attachment 254251 [details] patch Hello, 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: https://github.com/torvalds/linux/blob/master/arch/x86/Makefile#L173 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: https://github.com/torvalds/linux/blob/master/arch/x86/realmode/rm/Makefile#L50 https://github.com/torvalds/linux/blob/master/arch/x86/boot/Makefile#L102 This resolves the issue for us. Suggested patch attached.
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.
We have sent the attached patch upstream to the kernel (trying to find a link...), will update this bug once we get feedback.
https://lkml.org/lkml/2018/12/12/784