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
Can symbols with external linkage but no name be converted to have internal linkage? Would that solve the problem? Dan On Nov 23, 2008, at 2:15 AM, Bill Wendling wrote:> 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 > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
The symbols I'm interested in already have internal linkage (as you would expect). But because the mangler is in charge of assigning them names, they never seem to be decorated with the 'L' in front. . . . -bw On Mon, Nov 24, 2008 at 10:48 AM, Dan Gohman <gohman at apple.com> wrote:> Can symbols with external linkage but no name be converted > to have internal linkage? Would that solve the problem? > > Dan > > On Nov 23, 2008, at 2:15 AM, Bill Wendling wrote: > >> 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 >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >