[llvm-dev] Linking Linux kernel with LLD

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Sun Jan 29 00:18:13 PST 2017

>At this point I'm able to link Linux kernel with LLD and objcopy doen't give me any errors.

>The versions are:
>Linux 4.10.0-rc5 (+ applied the patch from my previous message)
>LLD 5.0.0 (https://github.com/llvm-mirror/lld db83a5cc3968b3aac1dbe3270190bd3282862e74) (+ applied D28612)
>GNU objcopy (GNU Binutils) 2.27
>The problem is that the resulting kernel doesn't boot. Does anybody have any suggestions on how to debug it or any guesses what did go wrong while linking?

It should not boot atm, I believe.
I mentioned earlier, LLD currently generates wrong output for scripts like:

.rodata : {
 . = ALIGN(16);
 video_cards = .;
 video_cards_end = .;?

That is sample from kernel realmode script. We produce wrong values for video_cards/video_cards_end.
Reduced sample is D29217, and thread with possible patch for that is D27415 which is under discussions now.
(Though there are also probably can be other issues, but that one is obvious atm).

I have a question also. You added -m elf_i386 to workaround emulation conflict issue in LLD, do you know
does output produced by BFD boot fine after that change ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170129/2ea02ee0/attachment.html>

More information about the llvm-dev mailing list