mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 10:17:36 +00:00
Simplify handling of hidden stub.
Since r207518 they are printed exactly like non-hidden stubs on x86 and since r207517 on ARM. This means we can use a single set for all stubs in those platforms. llvm-svn: 269776
This commit is contained in:
parent
95ad7eab26
commit
3a373d5446
@ -686,9 +686,7 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
|
||||
|
||||
// Add information about the stub reference to MachOMMI so that the stub
|
||||
// gets emitted by the asmprinter.
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
|
||||
MachOMMI.getGVStubEntry(SSym);
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
|
||||
if (!StubSym.getPointer()) {
|
||||
MCSymbol *Sym = TM.getSymbol(GV, Mang);
|
||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||
|
@ -515,18 +515,6 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
Stubs = MMIMacho.GetHiddenGVStubList();
|
||||
if (!Stubs.empty()) {
|
||||
OutStreamer->SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
|
||||
EmitAlignment(2);
|
||||
|
||||
for (auto &Stub : Stubs)
|
||||
emitNonLazySymbolPointer(*OutStreamer, Stub.first, Stub.second);
|
||||
|
||||
Stubs.clear();
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
Stubs = MMIMacho.GetThreadLocalGVStubList();
|
||||
if (!Stubs.empty()) {
|
||||
// Switch with ".non_lazy_symbol_pointer" directive.
|
||||
@ -927,10 +915,8 @@ MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV,
|
||||
MachineModuleInfoMachO &MMIMachO =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
GV->isThreadLocal()
|
||||
? MMIMachO.getThreadLocalGVStubEntry(MCSym)
|
||||
: (GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym)
|
||||
: MMIMachO.getGVStubEntry(MCSym));
|
||||
GV->isThreadLocal() ? MMIMachO.getThreadLocalGVStubEntry(MCSym)
|
||||
: MMIMachO.getGVStubEntry(MCSym);
|
||||
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::StubValueTy(getSymbol(GV),
|
||||
|
@ -201,12 +201,6 @@ namespace X86II {
|
||||
/// a PIC-base-relative reference to a non-hidden dyld lazy pointer stub.
|
||||
MO_DARWIN_NONLAZY_PIC_BASE,
|
||||
|
||||
/// MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this
|
||||
/// indicates that the reference is actually to "FOO$non_lazy_ptr -PICBASE",
|
||||
/// which is a PIC-base-relative reference to a hidden dyld lazy pointer
|
||||
/// stub.
|
||||
MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE,
|
||||
|
||||
/// MO_TLVP - On a symbol operand this indicates that the immediate is
|
||||
/// some TLS offset.
|
||||
///
|
||||
|
@ -91,8 +91,7 @@ static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO,
|
||||
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB)
|
||||
GVSym = P.getSymbolWithGlobalValueBase(GV, "$stub");
|
||||
else if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
|
||||
MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE ||
|
||||
MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE)
|
||||
MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE)
|
||||
GVSym = P.getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||
else
|
||||
GVSym = P.getSymbol(GV);
|
||||
@ -110,14 +109,6 @@ static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO,
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::
|
||||
StubValueTy(P.getSymbol(GV), !GV->hasInternalLinkage());
|
||||
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE){
|
||||
MCSymbol *Sym = P.getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
P.MMI->getObjFileInfo<MachineModuleInfoMachO>().getHiddenGVStubEntry(
|
||||
Sym);
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::
|
||||
StubValueTy(P.getSymbol(GV), !GV->hasInternalLinkage());
|
||||
} else if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
||||
MCSymbol *Sym = P.getSymbolWithGlobalValueBase(GV, "$stub");
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
@ -158,7 +149,6 @@ static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO,
|
||||
break;
|
||||
case X86II::MO_PIC_BASE_OFFSET:
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
|
||||
O << '-';
|
||||
P.MF->getPICBaseSymbol()->print(O, P.MAI);
|
||||
break;
|
||||
@ -642,20 +632,6 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
Stubs = MMIMacho.GetHiddenGVStubList();
|
||||
if (!Stubs.empty()) {
|
||||
MCSection *TheSection = OutContext.getMachOSection(
|
||||
"__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||
SectionKind::getMetadata());
|
||||
OutStreamer->SwitchSection(TheSection);
|
||||
|
||||
for (auto &Stub : Stubs)
|
||||
emitNonLazySymbolPointer(*OutStreamer, Stub.first, Stub.second);
|
||||
|
||||
Stubs.clear();
|
||||
OutStreamer->AddBlankLine();
|
||||
}
|
||||
|
||||
SM.serializeToStackMapSection();
|
||||
FM.serializeToFaultMapSection();
|
||||
|
||||
|
@ -7333,7 +7333,6 @@ X86InstrInfo::getSerializableDirectMachineOperandTargetFlags() const {
|
||||
{MO_DARWIN_STUB, "x86-darwin-stub"},
|
||||
{MO_DARWIN_NONLAZY, "x86-darwin-nonlazy"},
|
||||
{MO_DARWIN_NONLAZY_PIC_BASE, "x86-darwin-nonlazy-pic-base"},
|
||||
{MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE, "x86-darwin-hidden-nonlazy-pic-base"},
|
||||
{MO_TLVP, "x86-tlvp"},
|
||||
{MO_TLVP_PIC_BASE, "x86-tlvp-pic-base"},
|
||||
{MO_SECREL, "x86-secrel"}};
|
||||
|
@ -90,7 +90,6 @@ inline static bool isGlobalStubReference(unsigned char TargetFlag) {
|
||||
case X86II::MO_GOT: // normal GOT reference.
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Normal $non_lazy_ptr ref.
|
||||
case X86II::MO_DARWIN_NONLAZY: // Normal $non_lazy_ptr ref.
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: // Hidden $non_lazy_ptr ref.
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -106,7 +105,6 @@ inline static bool isGlobalRelativeToPICBase(unsigned char TargetFlag) {
|
||||
case X86II::MO_GOT: // isPICStyleGOT: other global.
|
||||
case X86II::MO_PIC_BASE_OFFSET: // Darwin local global.
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Darwin/32 external global.
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: // Darwin/32 hidden global.
|
||||
case X86II::MO_TLVP: // ??? Pretty sure..
|
||||
return true;
|
||||
default:
|
||||
|
@ -132,7 +132,6 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
break;
|
||||
case X86II::MO_DARWIN_NONLAZY:
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
|
||||
Suffix = "$non_lazy_ptr";
|
||||
break;
|
||||
}
|
||||
@ -176,18 +175,6 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE: {
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
getMachOMMI().getHiddenGVStubEntry(Sym);
|
||||
if (!StubSym.getPointer()) {
|
||||
assert(MO.isGlobal() && "Extern symbol not handled yet");
|
||||
StubSym =
|
||||
MachineModuleInfoImpl::
|
||||
StubValueTy(AsmPrinter.getSymbol(MO.getGlobal()),
|
||||
!MO.getGlobal()->hasInternalLinkage());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case X86II::MO_DARWIN_STUB: {
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
getMachOMMI().getFnStubEntry(Sym);
|
||||
@ -252,7 +239,6 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
case X86II::MO_PLT: RefKind = MCSymbolRefExpr::VK_PLT; break;
|
||||
case X86II::MO_PIC_BASE_OFFSET:
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
|
||||
Expr = MCSymbolRefExpr::create(Sym, Ctx);
|
||||
// Subtract the pic base.
|
||||
Expr = MCBinaryExpr::createSub(Expr,
|
||||
|
@ -116,14 +116,14 @@ ClassifyGlobalReference(const GlobalValue *GV, const TargetMachine &TM) const {
|
||||
|
||||
// Unless we have a symbol with hidden visibility, we have to go through a
|
||||
// normal $non_lazy_ptr stub because this symbol might be resolved late.
|
||||
if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
|
||||
if (!GV->hasHiddenVisibility()) // $non_lazy_ptr reference.
|
||||
return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
|
||||
|
||||
// If symbol visibility is hidden, we have a stub for common symbol
|
||||
// references and external declarations.
|
||||
if (GV->isDeclarationForLinker() || GV->hasCommonLinkage()) {
|
||||
// Hidden $non_lazy_ptr reference.
|
||||
return X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE;
|
||||
// $non_lazy_ptr reference.
|
||||
return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
|
||||
}
|
||||
|
||||
// Otherwise, no stub.
|
||||
|
@ -35,9 +35,9 @@ declare i32 @__gxx_personality_v0(...)
|
||||
; CHECK: .section __IMPORT,__pointers,non_lazy_symbol_pointers
|
||||
|
||||
; CHECK-NOT: __DATA,__data
|
||||
; CHECK: .indirect_symbol _normal_typeid
|
||||
; CHECK: .indirect_symbol _hidden_typeid
|
||||
; CHECK-NEXT: .long 0
|
||||
|
||||
; CHECK-NOT: __DATA,__data
|
||||
; CHECK: .indirect_symbol _hidden_typeid
|
||||
; CHECK: .indirect_symbol _normal_typeid
|
||||
; CHECK-NEXT: .long 0
|
||||
|
Loading…
Reference in New Issue
Block a user