[LLVMdev] "Can I use LLVM to convert C++ code to C code?"FAQ doesn't work

Eli Friedman eli.friedman at gmail.com
Tue Jul 12 21:58:40 PDT 2011


On Tue, Jul 12, 2011 at 8:38 PM, pp <tdihp at hotmail.com> wrote:
> hi, I'm new to llvm and trying to convert some c files to bitcode and
> convert them back to c code.
> my command line is pretty simple and verymuch like commands in "Can I use
> LLVM to convert C++ code to C code?"
> dragonegg_disable_version_check=1 llvm-gcc -emit-llvm test.c -o test -c
> llc -march=c test -o testout.c
>
> so I meant to compile test.c, which can be compiled and run by normal gcc,
> to bitcode, and use lcc -march=c to convert it back to c code.
>
> but I recieve this:
> llc: test:1:1: error: expected top-level entity
> ELF X 4(
>              U����0��E��M��U��M��E��U�� �E��M� ȋU� �ƒ� ��
> �U��M��E��E��M��U�=��M��E��U�
>
> so please could someone tell me how can I get the correct result?

dragonegg doesn't support -emit-llvm; try -flto.

-Eli




More information about the llvm-dev mailing list