forked from OSchip/llvm-project
Simplify handling of hidden stubs on PowerPC.
We now handle them just like non hidden ones. This was already the case on x86 (r207518) and arm (r207517). llvm-svn: 270205
This commit is contained in:
parent
ed28d41b1a
commit
8571aa3d5d
|
@ -32,12 +32,6 @@ class MachineModuleInfoMachO : public MachineModuleInfoImpl {
|
|||
/// is true if this GV is external.
|
||||
DenseMap<MCSymbol *, StubValueTy> GVStubs;
|
||||
|
||||
/// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
|
||||
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
|
||||
/// these are for things with hidden visibility. The extra bit is true if
|
||||
/// this GV is external.
|
||||
DenseMap<MCSymbol *, StubValueTy> HiddenGVStubs;
|
||||
|
||||
/// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
|
||||
/// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
|
||||
/// bit is true if this GV is external.
|
||||
|
@ -57,11 +51,6 @@ public:
|
|||
return GVStubs[Sym];
|
||||
}
|
||||
|
||||
StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return HiddenGVStubs[Sym];
|
||||
}
|
||||
|
||||
StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return ThreadLocalGVStubs[Sym];
|
||||
|
@ -70,7 +59,6 @@ public:
|
|||
/// Accessor methods to return the set of stubs in sorted order.
|
||||
SymbolListTy GetFnStubList() { return getSortedStubs(FnStubs); }
|
||||
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
|
||||
SymbolListTy GetHiddenGVStubList() { return getSortedStubs(HiddenGVStubs); }
|
||||
SymbolListTy GetThreadLocalGVStubList() {
|
||||
return getSortedStubs(ThreadLocalGVStubs);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ void PPCAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
|||
SymToPrint = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>().getGVStubEntry(
|
||||
SymToPrint);
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::
|
||||
|
@ -1574,25 +1574,6 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
|
|||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
Stubs = MMIMacho.GetHiddenGVStubList();
|
||||
if (!Stubs.empty()) {
|
||||
OutStreamer->SwitchSection(getObjFileLowering().getDataSection());
|
||||
EmitAlignment(isPPC64 ? 3 : 2);
|
||||
|
||||
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
||||
// L_foo$stub:
|
||||
OutStreamer->EmitLabel(Stubs[i].first);
|
||||
// .long _foo
|
||||
OutStreamer->EmitValue(MCSymbolRefExpr::
|
||||
create(Stubs[i].second.getPointer(),
|
||||
OutContext),
|
||||
isPPC64 ? 8 : 4/*size*/);
|
||||
}
|
||||
|
||||
Stubs.clear();
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
// Funny Darwin hack: This flag tells the linker that no global symbols
|
||||
// contain code that falls through to other global symbols (e.g. the obvious
|
||||
// implementation of multiple entry points). If this doesn't occur, the
|
||||
|
|
|
@ -94,11 +94,9 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
|
|||
// then add the suffix.
|
||||
if (MO.getTargetFlags() & PPCII::MO_NLP_FLAG) {
|
||||
MachineModuleInfoMachO &MachO = getMachOMMI(AP);
|
||||
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
(MO.getTargetFlags() & PPCII::MO_NLP_HIDDEN_FLAG) ?
|
||||
MachO.getHiddenGVStubEntry(Sym) : MachO.getGVStubEntry(Sym);
|
||||
|
||||
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym = MachO.getGVStubEntry(Sym);
|
||||
|
||||
if (!StubSym.getPointer()) {
|
||||
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
||||
StubSym = MachineModuleInfoImpl::
|
||||
|
|
|
@ -13,11 +13,9 @@ define i32* @get_b() {
|
|||
|
||||
; CHECK: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
|
||||
; CHECK-NEXT: .p2align 2
|
||||
; CHECK-NEXT: L_a$non_lazy_ptr:
|
||||
; CHECK-NEXT: .indirect_symbol _a
|
||||
; CHECK-NEXT: .long 0
|
||||
; CHECK-NEXT: L_b$non_lazy_ptr:
|
||||
; CHECK-NEXT: .indirect_symbol _b
|
||||
; CHECK-NEXT: .long 0
|
||||
|
||||
; CHECK: .section __DATA,__data
|
||||
; CHECK-NEXT: .p2align 2
|
||||
; CHECK-NEXT: L_a$non_lazy_ptr:
|
||||
; CHECK-NEXT: .long _a
|
||||
|
|
Loading…
Reference in New Issue