[PowerPC CodeGen] patch for bug 15763

David Fang fang at csl.cornell.edu
Fri Apr 26 15:51:41 PDT 2013


Hi Rafael,

>> Attached is a patch that fixes PIC codegen for PPC on darwin, by privatizing
>> all function stubs and lazy pointer symbols in emitted assembly.
>> http://llvm.org/bugs/show_bug.cgi?id=15763
>> Could PPC maintainers kindly review/apply?  Thanks.
>
> getPrivateGlobalPrefix can take a twine, so it is probably better to do
>
> const char* Prefix;
> if (...)
>  Prefix =  = AP.MAI->getPrivateGlobalPrefix();
> else
>  Prefix = "";
> MCSymbol Sym = Ctx.GetOrCreateSymbol(Twine(Prefix) + Twine(Name));

 	Sure, I can rewrite it with Twine.

> Btw, is there a case where the prefix was already added? I.e., is
> Name.startswith(plp) ever true? It would be nice if the prefix could
> be added in one central location.

Yes, I found that most C++ symbols (__ZN...) already had their stubs
and lazy-pointer labels prefixed with 'L'.
The ones that were missing the prefix were some C-library symbols like 
_memcpy, _strlen, _snprintf$LDBL128.

Here is the asm that was produced, pre-patch:
http://llvm.org/bugs/attachment.cgi?id=10358

If you can think of a better place to 'fix' the problem I'm seeing, I'll 
defer to your suggestion.

Fang

-- 
David Fang
http://www.csl.cornell.edu/~fang/




More information about the llvm-commits mailing list