On Sun, Sep 28, 2008 at 1:57 PM, Ashish Bijlani
<ashish.bijlani at gmail.com> wrote:> Hi,
>
> I'm trying to compile linux kernel with llvm to generate llvm ir
> (bitcode). It seems like llvm-ld doesn't accept any linker scripts.
> How do I deal with vmlinux.lds in such a case? How did people who have
> compiled linux kernel with llvm deal with this in the past?
You need to add a bytecode linker stage before that. You still need
the linker script for correctness, but you must use it in the final
link stage after you have generated a native .o file from the bitcode.
By the way, it you are still planning on jitting the kernel, you
should be warned that the linker script creates globals and arrays
that are referenced by the kernel code but otherwise will appear
nowhere in your bitcode... You will have to rewrite the kernel's
initialization infastructure or write a pass to fix up the bitcode or
both.
Andrew