[llvm-dev] Linking Linux kernel with LLD

Dmitry Golovin via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 20 12:49:11 PST 2017


>> - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
> Do you remember where it was used ?
I can undo the patch (but I can access the build machine only on Monday) and see what breaks.

> CONSTRUCTORS can be just removed, they do nothing for ELF.
Okay, this is what I did (I thought it will break things, but it is okay). I will apply the patch.

> LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently. Not sure what is easy fix here.
Just ignore it for now, it's not really a big deal.

> I updated patch for --emit-relocs, now they do not fail: https://reviews.llvm.org/D28612
Thank you, I will apply the updated patch and hope that it will boot.

Regards,
Dmitry

20.01.2017, 18:36, "George Rimar" <grimar at accesssoftek.com>:
> Hi Dmitry,
>
> thanls for sharing. Few comments/questions below:
>
>> Here is the list of modifications I had to do in order to link the kernel (I have used llvmlinux with clang and mainline with gcc, the >results are similar):
>>
>> 1. LLD patches:
>
>  > - D28094 (Implemented support for R_386_PC8/R_386_8 relocations)
>
> Do you remember where it was used ?
>
>> 5. In arch/x86/kernel/vmlinux.lds.S commented out the "CONSTRUCTORS", because LLD doesn't support it.
>
> It is https://reviews.llvm.org/D28951. CONSTRUCTORS can be just removed, they do nothing for ELF.
>
>> 6. In arch/x86/boot/setup.ld replaced 5*512 with precalculated value of 2560 because it doesn't seem that LLD supports math inside >ASSERT in linker scripts.
>
> It is actually not relative with ASSERT. LLD does not support "symbol = 5*6", but accepts "symbol = 5 * 6" currently.
> Not sure what is easy fix here.
>
>> Finally the kernel was built and it obviously didn't run (only printed out "No setup signature found..." but this is some result as well). >Probably, the result could be better if the --emit-relocs option didn't fail and CONSTRUCTORS were supported. I really don't know what >to do about the assertion that I have commented out.
>
> I updated patch for --emit-relocs, now they do not fail: https://reviews.llvm.org/D28612
> It looks to be important feature for self relocations, so it is not surprising it did not run without :)
>
> George.


More information about the llvm-dev mailing list