I compiled .S file using command:
clang-8 -c funcs.s -o funcs.o -emit-llvm
I found, that .o file was generated in ELF format. I was expected to see llvm-ir format (with "BC" characters at the beginning of resulting file).
Seems, Clang ignores "-emit-llvm" flag.
Your question isn't fundamentally different from Is it possible to translate an assembly language to LLVM IR, optimize it and then recompile it to a different architecture? .
asm source and binary executables / object files are basically equivalent for this problem. You're still trying to decompile to LLVM-IR. This is hard, and I don't know if a decompiler exists.
Seems, Clang ignores "-emit-llvm" flag.
No, it just didn't affect any of the steps involved in the operation you asked it to do.
You asked your compiler to compile to a .o
, so it did so.
If the input had been .c
and the output a .s
, it would have been able to emit LLVM-IR, but in this case LLVM-IR wasn't part of the process of assembling a .s
to a .o
.
So no LLVM-IR representation of the program ever existed while clang
was running, so there was nothing to emit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.