diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-27 00:43:16 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-04-27 00:43:16 +0000 |
commit | 5b0ce3570c03919f71cab6ef8ed2312d2b707ca2 (patch) | |
tree | 968e406c6880f817a9a241e1690254cca8b9c453 /lib/Target/PowerPC/PPCMCInstLower.cpp | |
parent | a5b314c27a585b979ac9c9da944aa3cec27d22a6 (diff) | |
download | external_llvm-5b0ce3570c03919f71cab6ef8ed2312d2b707ca2.zip external_llvm-5b0ce3570c03919f71cab6ef8ed2312d2b707ca2.tar.gz external_llvm-5b0ce3570c03919f71cab6ef8ed2312d2b707ca2.tar.bz2 |
Make all darwin ppc stubs local.
This fixes pr15763.
Patch by David Fang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCMCInstLower.cpp')
-rw-r--r-- | lib/Target/PowerPC/PPCMCInstLower.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp index 9b0df3e..f8cf3a5 100644 --- a/lib/Target/PowerPC/PPCMCInstLower.cpp +++ b/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -14,6 +14,7 @@ #include "PPC.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Twine.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfoImpls.h" @@ -51,7 +52,14 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){ // before we return the symbol. if (MO.getTargetFlags() == PPCII::MO_DARWIN_STUB) { Name += "$stub"; - MCSymbol *Sym = Ctx.GetOrCreateSymbol(Name.str()); + const char *PGP = AP.MAI->getPrivateGlobalPrefix(); + const char *Prefix = ""; + if (!Name.startswith(PGP)) { + // http://llvm.org/bugs/show_bug.cgi?id=15763 + // all stubs and lazy_ptrs should be local symbols, which need leading 'L' + Prefix = PGP; + } + MCSymbol *Sym = Ctx.GetOrCreateSymbol(Twine(Prefix) + Twine(Name)); MachineModuleInfoImpl::StubValueTy &StubSym = getMachOMMI(AP).getFnStubEntry(Sym); if (StubSym.getPointer()) |