[llvm-dev] Linking Linux kernel with LLD

Dmitry Golovin via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 24 04:08:25 PST 2017


Thanks for merging the patches into upstream. Now there are only two left: D28094 and D28612.

> just as a guess: you probably can try to add -N option for that place

The "-N" option (whatever it is) doesn't help. I can compare the object files produced by bfd, gold and lld.

I have attached my kernel config and kernel patch for upstream version. You can also examine my vmlinux and run it with

    qemu-system-x86_64 -kernel linux -append 'console=ttyS0' -serial stdio

Regards,
Dmitry

24.01.2017, 10:47, "George Rimar" <grimar at accesssoftek.com>:
>>>>   - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
>>>  Do you remember where it was used ?
>>
>> setup.elf:
>>       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.
>
> George.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vmlinux
Type: application/x-executable
Size: 3307704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170124/98a05249/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lld-support.patch
Type: text/x-diff
Size: 2538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170124/98a05249/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-config
Type: application/octet-stream
Size: 24036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170124/98a05249/attachment-0001.obj>


More information about the llvm-dev mailing list