Compile, Assemble and Disassemble Using the LLVM Tool Chain

后端 未结 1 927
独厮守ぢ
独厮守ぢ 2021-01-05 07:02

I\'m trying to run the following example to Compile, Assemble and Disassemble an small program using the LLVM tool chain.

My intention is to learn how it works so in

相关标签:
1条回答
  • 2021-01-05 07:40

    Make sure your llvm-gcc's version match the version of LLVM you installed - the binary IR format changes quite fast and is not backward compatible across several version.

    Alternatively, you might try to emit text representation of LLVM IR out of llvm-gcc and assemble it through llvm-as.

    Something like this:

    llvm-gcc -emit-llvm -S foo.c -o foo.ll
    llvm-as foo.ll -o foo.bc
    llc foo.ll -o foo.S
    

    etc.

    0 讨论(0)
提交回复
热议问题