mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Use TARGET2 relocation for TType references on ARM.
Do some cleanup of the code while here. Inspired by patch by Logan Chien! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -88,6 +88,36 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
|
||||
Streamer.EmitSymbolValue(Sym, Size);
|
||||
}
|
||||
|
||||
const MCExpr *TargetLoweringObjectFileELF::
|
||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
MachineModuleInfo *MMI, unsigned Encoding,
|
||||
MCStreamer &Streamer) const {
|
||||
|
||||
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
||||
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
||||
|
||||
SmallString<128> Name;
|
||||
Mang->getNameWithPrefix(Name, GV, true);
|
||||
Name += ".DW.stub";
|
||||
|
||||
// Add information about the stub reference to ELFMMI so that the stub
|
||||
// gets emitted by the asmprinter.
|
||||
MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str());
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
||||
if (StubSym.getPointer() == 0) {
|
||||
MCSymbol *Sym = Mang->getSymbol(GV);
|
||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getTTypeReference(MCSymbolRefExpr::Create(SSym, getContext()),
|
||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
||||
}
|
||||
|
||||
static SectionKind
|
||||
getELFKindForNamedSection(StringRef Name, SectionKind K) {
|
||||
// N.B.: The defaults used in here are no the same ones used in MC.
|
||||
@ -314,35 +344,6 @@ getSectionForConstant(SectionKind Kind) const {
|
||||
return DataRelROSection;
|
||||
}
|
||||
|
||||
const MCExpr *TargetLoweringObjectFileELF::
|
||||
getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
MachineModuleInfo *MMI,
|
||||
unsigned Encoding, MCStreamer &Streamer) const {
|
||||
|
||||
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
||||
MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
|
||||
|
||||
SmallString<128> Name;
|
||||
Mang->getNameWithPrefix(Name, GV, true);
|
||||
Name += ".DW.stub";
|
||||
|
||||
// Add information about the stub reference to ELFMMI so that the stub
|
||||
// gets emitted by the asmprinter.
|
||||
MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str());
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
|
||||
if (StubSym.getPointer() == 0) {
|
||||
MCSymbol *Sym = Mang->getSymbol(GV);
|
||||
StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getExprForDwarfReference(SSym, Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
||||
}
|
||||
|
||||
const MCSection *
|
||||
TargetLoweringObjectFileELF::getStaticCtorSection(unsigned Priority) const {
|
||||
// The default scheme is .ctor / .dtor, so we have to invert the priority
|
||||
@ -604,9 +605,9 @@ shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler *Mang) const {
|
||||
}
|
||||
|
||||
const MCExpr *TargetLoweringObjectFileMachO::
|
||||
getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
MachineModuleInfo *MMI, unsigned Encoding,
|
||||
MCStreamer &Streamer) const {
|
||||
getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
MachineModuleInfo *MMI, unsigned Encoding,
|
||||
MCStreamer &Streamer) const {
|
||||
// The mach-o version of this method defaults to returning a stub reference.
|
||||
|
||||
if (Encoding & DW_EH_PE_indirect) {
|
||||
@ -629,11 +630,12 @@ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getExprForDwarfReference(SSym, Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
getTTypeReference(MCSymbolRefExpr::Create(SSym, getContext()),
|
||||
Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
|
||||
}
|
||||
|
||||
return TargetLoweringObjectFile::
|
||||
getExprForDwarfGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
||||
getTTypeGlobalReference(GV, Mang, MMI, Encoding, Streamer);
|
||||
}
|
||||
|
||||
MCSymbol *TargetLoweringObjectFileMachO::
|
||||
|
Reference in New Issue
Block a user