[LLVMdev] compile linux kernel

René Rebe
Mon, 29 Sep 2008 09:44:16 -0000

And the code of the Linux kernel compiled by LLVM is also very arch
depended,
despite any loader and hw access will not work inside the standard LLVM JIT,
all the MMU and low-level access stuff will make no sense on a machine other
than what was enabled while compiling the kernel. E.g. you would need a
whole
virtualized HW architecture ala Qemu (et al.) along the JIT.

Of course in theory one could setup such an infrastructure to JIT low level,
kernel and driver code, just throwing the i386 linux kernel source on LLVM
will not bring you there.

Yours,

Daniel Berlin wrote:
> No, this is not the case.
>
> Just because you compile something to LLVM IR does not make the thing
> you compiled work on every architecture.
> You may even be able to retarget it to any architecture (it depends),
> but this in no way means the result will *actually work*.
> The LLVM IR generated by llvm-gcc is very architecture dependent.
> Theoretically you could make a C compiler that was mostly C compliant
> and produced architecture independent LLVM IR.
> llvm-gcc is not this compiler, however.
>
> On Sun, Sep 28, 2008 at 1:07 AM, Ashish Bijlani
> <ashish.bijlani at gmail.com> wrote:
>
>> does that mean .o generated with  gcc (.c -> .s and .s -> .o)
will not
>> contain llvm ir?
>>
>> i meant, final kernel bitcode ir arch independent and can be JIT with
>> any arch-specific backend. Is it not the case?
>>
>> thanks,
>> ashish
>>
>> On Sat, Sep 27, 2008 at 10:43 PM, Andrew Lenharth <andrewl at
lenharth.org> wrote:
>>
>>> On Sat, Sep 27, 2008 at 8:08 PM, Ashish Bijlani
>>> <ashish.bijlani at gmail.com> wrote:
>>>
>>>> If I use GCC to generate asm-offsets.s file, then the build
system go
>>>> ahead but fails when it generates .so files as Andrew pointed
out.
>>>>
>>> You have to generate this with gcc.  .c -> .s and .s -> .o
need gcc,
>>> .c -> .o can use llvm-gcc.  The combination has to be fixed up
in
>>> final linking.
>>>
>>>
>>>> Now, If the build systems generates .so files, then it will be
>>>> difficult o actually generate fully arch-independent kernel
code,
>>>> isn't it?
>>>>
>>> A llvm compiled kernel is in no way arch-independent.  It is very
very
>>> arch dependent.
>>>
>>> Andrew
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>


--
  René Rebe - ExactCODE GmbH - Europe, Germany, Berlin
  http://exactcode.de | http://t2-project.org | http://rene.rebe.name