mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-26 10:29:36 +00:00
It turned out that we failed to emit proper symbol stubs on non-x86/darwin for ages (we emitted a reference to a stub, but no stub was emitted). The code inside x86-32/macho target objfile lowering should actually be the generic one - move it there.
This (I really, really hope) should fix EH issues on ppc/darwin and arm/darwin. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
be94ffcf12
commit
293d592bf9
@ -171,6 +171,11 @@ public:
|
|||||||
virtual const MCExpr *
|
virtual const MCExpr *
|
||||||
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding) const;
|
MachineModuleInfo *MMI, unsigned Encoding) const;
|
||||||
|
|
||||||
|
virtual unsigned getPersonalityEncoding() const;
|
||||||
|
virtual unsigned getLSDAEncoding() const;
|
||||||
|
virtual unsigned getFDEEncoding() const;
|
||||||
|
virtual unsigned getTTypeEncoding() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "llvm/ADT/SmallString.h"
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
using namespace dwarf;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// ELF
|
// ELF
|
||||||
@ -738,11 +739,23 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|||||||
MachineModuleInfo *MMI, unsigned Encoding) const {
|
MachineModuleInfo *MMI, unsigned Encoding) const {
|
||||||
// The mach-o version of this method defaults to returning a stub reference.
|
// The mach-o version of this method defaults to returning a stub reference.
|
||||||
|
|
||||||
if (Encoding & dwarf::DW_EH_PE_indirect) {
|
if (Encoding & DW_EH_PE_indirect) {
|
||||||
|
MachineModuleInfoMachO &MachOMMI =
|
||||||
|
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||||
|
|
||||||
SmallString<128> Name;
|
SmallString<128> Name;
|
||||||
Mang->getNameWithPrefix(Name, GV, true);
|
Mang->getNameWithPrefix(Name, GV, true);
|
||||||
Name += "$non_lazy_ptr";
|
Name += "$non_lazy_ptr";
|
||||||
|
|
||||||
|
// Add information about the stub reference to MachOMMI so that the stub
|
||||||
|
// gets emitted by the asmprinter.
|
||||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
|
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
|
||||||
|
MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
|
||||||
|
if (StubSym == 0) {
|
||||||
|
Name.clear();
|
||||||
|
Mang->getNameWithPrefix(Name, GV, false);
|
||||||
|
StubSym = getContext().GetOrCreateSymbol(Name.str());
|
||||||
|
}
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
return TargetLoweringObjectFile::
|
||||||
getSymbolForDwarfReference(Sym, MMI,
|
getSymbolForDwarfReference(Sym, MMI,
|
||||||
@ -753,6 +766,21 @@ getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|||||||
getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
|
getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned TargetLoweringObjectFileMachO::getPersonalityEncoding() const {
|
||||||
|
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned TargetLoweringObjectFileMachO::getLSDAEncoding() const {
|
||||||
|
return DW_EH_PE_pcrel;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned TargetLoweringObjectFileMachO::getFDEEncoding() const {
|
||||||
|
return DW_EH_PE_pcrel;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned TargetLoweringObjectFileMachO::getTTypeEncoding() const {
|
||||||
|
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// COFF
|
// COFF
|
||||||
|
@ -73,7 +73,7 @@ static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
|
|||||||
case X86Subtarget::isDarwin:
|
case X86Subtarget::isDarwin:
|
||||||
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
||||||
return new X8664_MachoTargetObjectFile();
|
return new X8664_MachoTargetObjectFile();
|
||||||
return new X8632_MachoTargetObjectFile();
|
return new TargetLoweringObjectFileMachO();
|
||||||
case X86Subtarget::isELF:
|
case X86Subtarget::isELF:
|
||||||
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
||||||
return new X8664_ELFTargetObjectFile(TM);
|
return new X8664_ELFTargetObjectFile(TM);
|
||||||
|
@ -18,38 +18,6 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace dwarf;
|
using namespace dwarf;
|
||||||
|
|
||||||
const MCExpr *X8632_MachoTargetObjectFile::
|
|
||||||
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|
||||||
MachineModuleInfo *MMI, unsigned Encoding) const {
|
|
||||||
// The mach-o version of this method defaults to returning a stub reference.
|
|
||||||
|
|
||||||
if (Encoding & DW_EH_PE_indirect) {
|
|
||||||
MachineModuleInfoMachO &MachOMMI =
|
|
||||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
|
||||||
|
|
||||||
SmallString<128> Name;
|
|
||||||
Mang->getNameWithPrefix(Name, GV, true);
|
|
||||||
Name += "$non_lazy_ptr";
|
|
||||||
|
|
||||||
// Add information about the stub reference to MachOMMI so that the stub
|
|
||||||
// gets emitted by the asmprinter.
|
|
||||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Name.str());
|
|
||||||
MCSymbol *&StubSym = MachOMMI.getGVStubEntry(Sym);
|
|
||||||
if (StubSym == 0) {
|
|
||||||
Name.clear();
|
|
||||||
Mang->getNameWithPrefix(Name, GV, false);
|
|
||||||
StubSym = getContext().GetOrCreateSymbol(Name.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
return TargetLoweringObjectFile::
|
|
||||||
getSymbolForDwarfReference(Sym, MMI,
|
|
||||||
Encoding & ~dwarf::DW_EH_PE_indirect);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TargetLoweringObjectFileMachO::
|
|
||||||
getSymbolForDwarfGlobalReference(GV, Mang, MMI, Encoding);
|
|
||||||
}
|
|
||||||
|
|
||||||
const MCExpr *X8664_MachoTargetObjectFile::
|
const MCExpr *X8664_MachoTargetObjectFile::
|
||||||
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding) const {
|
MachineModuleInfo *MMI, unsigned Encoding) const {
|
||||||
@ -148,35 +116,3 @@ unsigned X8664_ELFTargetObjectFile::getTTypeEncoding() const {
|
|||||||
|
|
||||||
return DW_EH_PE_absptr;
|
return DW_EH_PE_absptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned X8632_MachoTargetObjectFile::getPersonalityEncoding() const {
|
|
||||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8632_MachoTargetObjectFile::getLSDAEncoding() const {
|
|
||||||
return DW_EH_PE_pcrel;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8632_MachoTargetObjectFile::getFDEEncoding() const {
|
|
||||||
return DW_EH_PE_pcrel;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8632_MachoTargetObjectFile::getTTypeEncoding() const {
|
|
||||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8664_MachoTargetObjectFile::getPersonalityEncoding() const {
|
|
||||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8664_MachoTargetObjectFile::getLSDAEncoding() const {
|
|
||||||
return DW_EH_PE_pcrel;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8664_MachoTargetObjectFile::getFDEEncoding() const {
|
|
||||||
return DW_EH_PE_pcrel;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned X8664_MachoTargetObjectFile::getTTypeEncoding() const {
|
|
||||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
|
||||||
}
|
|
||||||
|
@ -17,20 +17,6 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class X86TargetMachine;
|
class X86TargetMachine;
|
||||||
|
|
||||||
/// X8632_MachoTargetObjectFile - This TLOF implementation is used for
|
|
||||||
/// Darwin/x86-32.
|
|
||||||
class X8632_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
|
||||||
public:
|
|
||||||
|
|
||||||
virtual const MCExpr *
|
|
||||||
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
|
||||||
MachineModuleInfo *MMI, unsigned Encoding) const;
|
|
||||||
virtual unsigned getPersonalityEncoding() const;
|
|
||||||
virtual unsigned getLSDAEncoding() const;
|
|
||||||
virtual unsigned getFDEEncoding() const;
|
|
||||||
virtual unsigned getTTypeEncoding() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// X8664_MachoTargetObjectFile - This TLOF implementation is used for
|
/// X8664_MachoTargetObjectFile - This TLOF implementation is used for
|
||||||
/// Darwin/x86-64.
|
/// Darwin/x86-64.
|
||||||
class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
||||||
@ -39,10 +25,6 @@ namespace llvm {
|
|||||||
virtual const MCExpr *
|
virtual const MCExpr *
|
||||||
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
|
||||||
MachineModuleInfo *MMI, unsigned Encoding) const;
|
MachineModuleInfo *MMI, unsigned Encoding) const;
|
||||||
virtual unsigned getPersonalityEncoding() const;
|
|
||||||
virtual unsigned getLSDAEncoding() const;
|
|
||||||
virtual unsigned getFDEEncoding() const;
|
|
||||||
virtual unsigned getTTypeEncoding() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
|
class X8632_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user