[LLVMdev] RFC: Mangling Unnamed Global Values

Bill Wendling isanbard at gmail.com
Sun Nov 23 02:15:36 PST 2008


Hi all,

Right now the Mangler::getValueName() method will produce something  
like "__unnamed_1_37" for a global value that doesn't have a name.  
This is wrong for Objective-C where CFStrings will get these labels,  
thus preventing the linker from coalescing them.

[/tmp]> nm -s __DATA __cfstring -m foo.o
00000000000244d0 (__DATA,__cfstring) non-external __unnamed_1_0
00000000000244b0 (__DATA,__cfstring) non-external __unnamed_1_1
...

I think that prepending the PrivateGlobalPrefix to these names would  
be the way to go. My question is whether getValueName() should do the  
prepending or should the individual back-end do it? I think that  
getValueName() should do it so that it's consistent, but then the  
prefix needs to be passed in (as the mangler doesn't know about the  
TargetAsmInfo object).

What do you think?

-bw



More information about the llvm-dev mailing list