[llvm-dev] Linking Linux kernel with LLD
Sean Silva via llvm-dev
llvm-dev at lists.llvm.org
Fri Jan 20 12:44:00 PST 2017
On Fri, Jan 20, 2017 at 8:35 AM, George Rimar via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> 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
> >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.
I'm not sure if it is easy, but I think that it's clear that the
linkerscript lexer needs to be improved. I think that is the source of the
problems with `*(.apicdrivers);` as well. This is not the first bug related
to lexing that we have run into (e.g. lexing `.=` as a single token is the
cause of https://llvm.org/bugs/show_bug.cgi?id=31128 ).
-- Sean Silva
> >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:
> It looks to be important feature for self relocations, so it is not
> surprising it did not run without :)
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev