mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Simplify and clean up MC symbol lookup for ARM constant pool values. This fixes
double quoting of ObjC symbol names in constant pool entries. rdar://8652107 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118688 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
432d08cbdb
commit
7c7ddb21c3
@ -622,40 +622,40 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) {
|
|||||||
int Size = TM.getTargetData()->getTypeAllocSize(MCPV->getType());
|
int Size = TM.getTargetData()->getTypeAllocSize(MCPV->getType());
|
||||||
|
|
||||||
ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>(MCPV);
|
ARMConstantPoolValue *ACPV = static_cast<ARMConstantPoolValue*>(MCPV);
|
||||||
SmallString<128> Str;
|
|
||||||
raw_svector_ostream OS(Str);
|
|
||||||
|
|
||||||
|
MCSymbol *MCSym;
|
||||||
if (ACPV->isLSDA()) {
|
if (ACPV->isLSDA()) {
|
||||||
|
SmallString<128> Str;
|
||||||
|
raw_svector_ostream OS(Str);
|
||||||
OS << MAI->getPrivateGlobalPrefix() << "_LSDA_" << getFunctionNumber();
|
OS << MAI->getPrivateGlobalPrefix() << "_LSDA_" << getFunctionNumber();
|
||||||
|
MCSym = OutContext.GetOrCreateSymbol(OS.str());
|
||||||
} else if (ACPV->isBlockAddress()) {
|
} else if (ACPV->isBlockAddress()) {
|
||||||
OS << *GetBlockAddressSymbol(ACPV->getBlockAddress());
|
MCSym = GetBlockAddressSymbol(ACPV->getBlockAddress());
|
||||||
} else if (ACPV->isGlobalValue()) {
|
} else if (ACPV->isGlobalValue()) {
|
||||||
const GlobalValue *GV = ACPV->getGV();
|
const GlobalValue *GV = ACPV->getGV();
|
||||||
bool isIndirect = Subtarget->isTargetDarwin() &&
|
bool isIndirect = Subtarget->isTargetDarwin() &&
|
||||||
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
||||||
if (!isIndirect)
|
if (!isIndirect)
|
||||||
OS << *Mang->getSymbol(GV);
|
MCSym = Mang->getSymbol(GV);
|
||||||
else {
|
else {
|
||||||
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
||||||
MCSymbol *Sym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
MCSym = GetSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||||
OS << *Sym;
|
|
||||||
|
|
||||||
MachineModuleInfoMachO &MMIMachO =
|
MachineModuleInfoMachO &MMIMachO =
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||||
GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(Sym) :
|
GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym) :
|
||||||
MMIMachO.getGVStubEntry(Sym);
|
MMIMachO.getGVStubEntry(MCSym);
|
||||||
if (StubSym.getPointer() == 0)
|
if (StubSym.getPointer() == 0)
|
||||||
StubSym = MachineModuleInfoImpl::
|
StubSym = MachineModuleInfoImpl::
|
||||||
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
StubValueTy(Mang->getSymbol(GV), !GV->hasInternalLinkage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
|
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
|
||||||
OS << *GetExternalSymbolSymbol(ACPV->getSymbol());
|
MCSym = GetExternalSymbolSymbol(ACPV->getSymbol());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an MCSymbol for the reference.
|
// Create an MCSymbol for the reference.
|
||||||
MCSymbol *MCSym = OutContext.GetOrCreateSymbol(OS.str());
|
|
||||||
const MCExpr *Expr =
|
const MCExpr *Expr =
|
||||||
MCSymbolRefExpr::Create(MCSym, getModifierVariantKind(ACPV->getModifier()),
|
MCSymbolRefExpr::Create(MCSym, getModifierVariantKind(ACPV->getModifier()),
|
||||||
OutContext);
|
OutContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user