[LLVMdev] A question about 'llc -march=c'

lpeng pengliang at ict.ac.cn
Tue Dec 8 01:00:21 PST 2009

Hello friends working on LLVM,
I am a beginner to LLVM. I tried to get C code from LLVM bitcode using
'llc -march=c'. But it seems to me that it doesn't work if the source
program is a C++ program. Am I right? I have attatched the source
program and the result of compiling the C code of it with GCC4.3.3. 
By the way, has LLVM's C code backend been tested on benchmarks like
spec?  Sorry if I missed the answers on websites.

Best regards,
Liang Peng
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cc
Type: text/x-c++src
Size: 157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091208/c97861e2/attachment.cc>
-------------- next part --------------
$gcc testcc.cbe.c
testcc.cbe.c:323: warning: conflicting types for built-in function ‘malloc’
testcc.cbe.c: In function ‘main’:
testcc.cbe.c:356: warning: return type of ‘main’ is not ‘int’
/tmp/ccDcoA7R.o: In function `main':
testcc.cbe.c:(.text+0x33): undefined reference to `std::cout'
testcc.cbe.c:(.text+0x38): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
testcc.cbe.c:(.text+0x42): undefined reference to `std::cout'
testcc.cbe.c:(.text+0x47): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
/tmp/ccDcoA7R.o: In function `global constructors keyed to main':
testcc.cbe.c:(.text+0x6a): undefined reference to `std::ios_base::Init::Init()'
/tmp/ccDcoA7R.o: In function `__tcf_0':
testcc.cbe.c:(.text+0x9e): undefined reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status

More information about the llvm-dev mailing list