Displaying 5 results from an estimated 5 matches for "name_mangling_in_c".
2015 Mar 02
2
[LLVMdev] clang change function name
Hi,
I compile a .cpp with cmd:
clang++ -emit-llvm -c -g -O0 -w pbzip2.cpp -o pbzip2.bc -lbz2
llvm-dis pbzip2.bc
One function in .cpp is consumer_decompress. However, I look inside
pbzip2.ll. The function name is changed to "define i8*
@_Z19consumer_decompressPv(i8* %q) #0 {"
Why clang adds a "_Z19" prefix and "Pv" suffix?
Thanks,
2015 Mar 02
2
[LLVMdev] clang change function name
...adds a "_Z19" prefix and "Pv" suffix?
>
> Clang mangles the name so that the function's name encodes the name
> and the function's type; this helps the linker link C++ object files
> together correctly. See
> http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_C.2B.2B
> for more details.
>
> Regards,
>
> John Criswell
>
>>
>> Thanks,
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/ma...
2014 Jun 11
3
[LLVMdev] How do clang & clang++ choose function names for LLVM IR?
Hello all,
I'm getting started on a project using LLVM's opt tool to do static
analysis, printing call graphs and such. When compiling C programs to IR
(and eventually to call graphs), function names remain the same (main,
function1, function2 etc.), but when compiling the same program as C++, the
function names often have cruft added to them (_Z9function1v, _Z9function2v
etc.) which
2009 Jun 17
0
[LLVMdev] Why are functions renamed for .cpp files with llvm-gcc?
...ferent parameters,
(which C++ supports but C does not). _Z3barv just means "bar()", i.e. a function
named 'bar' with no parameters (there's a program called c++filt to demangle
these names).
This is called name mangling. See also
http://en.wikipedia.org/wiki/Name_mangling#Name_mangling_in_C.2B.2B
2009 Jun 17
8
[LLVMdev] Why are functions renamed for .cpp files with llvm-gcc?
Hello,
I wonder why there is a difference in how
llvm-gcc compiles .c and .cpp files.
Example:
---bar.cpp----
int bar() {
return 42;
}
--------------
$ llvm-gcc -emit-llvm -c bar.cpp
Now running bar.o through llvm-dis gives:
--------------------------------
define i32 @_Z3barv() nounwind {
< clip >
}
--------------------------------
Above, function 'bar' has been renamed