[llvm] r180657 - Make all darwin ppc stubs local.
Rafael Espindola
rafael.espindola at gmail.com
Fri Apr 26 17:43:16 PDT 2013
Author: rafael
Date: Fri Apr 26 19:43:16 2013
New Revision: 180657
URL: http://llvm.org/viewvc/llvm-project?rev=180657&view=rev
Log:
Make all darwin ppc stubs local.
This fixes pr15763.
Patch by David Fang.
Modified:
llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
llvm/trunk/test/CodeGen/PowerPC/stubs.ll
Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=180657&r1=180656&r2=180657&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Fri Apr 26 19:43:16 2013
@@ -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(co
// 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())
Modified: llvm/trunk/test/CodeGen/PowerPC/stubs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/stubs.ll?rev=180657&r1=180656&r2=180657&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/stubs.ll (original)
+++ llvm/trunk/test/CodeGen/PowerPC/stubs.ll Fri Apr 26 19:43:16 2013
@@ -6,16 +6,16 @@ entry:
}
; CHECK: _test1:
-; CHECK: bl ___floatditf$stub
+; CHECK: bl L___floatditf$stub
; CHECK: .section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16
-; CHECK: ___floatditf$stub:
+; CHECK: L___floatditf$stub:
; CHECK: .indirect_symbol ___floatditf
-; CHECK: lis r11, ha16(___floatditf$lazy_ptr)
-; CHECK: lwzu r12, lo16(___floatditf$lazy_ptr)(r11)
+; CHECK: lis r11, ha16(L___floatditf$lazy_ptr)
+; CHECK: lwzu r12, lo16(L___floatditf$lazy_ptr)(r11)
; CHECK: mtctr r12
; CHECK: bctr
; CHECK: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
-; CHECK: ___floatditf$lazy_ptr:
+; CHECK: L___floatditf$lazy_ptr:
; CHECK: .indirect_symbol ___floatditf
; CHECK: .long dyld_stub_binding_helper
More information about the llvm-commits
mailing list