[llvm-dev] Linking Linux kernel with LLD

George Rimar via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 24 00:46:24 PST 2017

>>>  - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
>> Do you remember where it was used ?
>      ld.lld -m elf_i386 -T arch/x86/boot/setup.ld arch/x86/boot/a20.o arch/x86/boot/bioscall.o arch/x86/boot/cmdline.o arch/x86/boot/copy.o arch/x86/boot/cpu.o >arch/x86/boot/cpuflags.o arch/x86/boot/cpucheck.o arch/x86/boot/early_serial_console.o arch/x86/boot/edd.o arch/x86/boot/header.o arch/x86/boot/main.o >arch/x86/boot/mca.o arch/x86/boot/memory.o arch/x86/boot/pm.o arch/x86/boot/pmjump.o arch/x86/boot/printf.o arch/x86/boot/regs.o arch/x86/boot/string.o >arch/x86/boot/tty.o arch/x86/boot/video.o arch/x86/boot/video-mode.o arch/x86/boot/version.o arch/x86/boot/video-vga.o arch/x86/boot/video-vesa.o arch/x86/boot/video->bios.o -o arch/x86/boot/setup.elf
>    ld.lld: error: do not know how to handle relocation 'R_386_PC8' (23)

Thanks, I'll take a look and probably resurrect that abandoned patch then.

>I still didn't do anything with "Setup too big!" problem, just commented out the assert. 

I did not get to that step yet, but just as a guess: you probably can try to add -N option for that place.

>Tried booting the resulting bzImage and vmlinux with qemu. The bzImage only did reboot over and over, but the vmlinux did show an adorable picture (attached).

That is interesting information, thanks. 
I am not familar with linux kernel, but testing with qemu helped a lot when we worked on booting freebsd loaders.
I hope to get to that step soon, after finishing with other already known issues.


More information about the llvm-dev mailing list