[LLVMdev] compile linux kernel

Daniel Berlin dberlin at dberlin.org
Sat Sep 27 23:20:31 PDT 2008


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
>



More information about the llvm-dev mailing list