[LLVMdev] clang change function name

Haopeng Liu hyliuhp at gmail.com
Sun Mar 1 21:07:41 PST 2015


Got it, thanks. But in my pass, I use function name to locate. Can I 
disable mangling in clang?

Best,
Haopeng

On 3/1/15 10:44 PM, John Criswell wrote:
> On 3/1/15 11:38 PM, Haopeng Liu wrote:
>> 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?
>
> 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/mailman/listinfo/llvmdev
>
>




More information about the llvm-dev mailing list