[LLVMdev] Why are functions renamed for .cpp files with llvm-gcc?

Pertti Kellomäki pertti.kellomaki at tut.fi
Wed Jun 17 02:01:02 PDT 2009


A. Vuori kirjoitti:
> I wonder why there is a difference in how 
> llvm-gcc compiles .c and .cpp files.
[...]
> Above, function 'bar' has been renamed to '_Z3barv'.
> 
> If, however, 'bar.cpp' is renamed 'bar.c',
> we get 'define i32 @bar()' as expected.

Look at what c++filt says about _Z3barv:

$ c++filt _Z3barv
bar()

The reason is that .cpp is taken to be a C++ file, and
names are mangled accordingly.
-- 
Pertti



More information about the llvm-dev mailing list