mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-24 08:18:33 +00:00
[AsmPrinter][TLOF] 32-bit MachO support for replacing GOT equivalents
Add MachO 32-bit (i.e. arm and x86) support for replacing global GOT equivalent
symbol accesses. Unlike 64-bit targets, there's no GOTPCREL relocation, and
access through a non_lazy_symbol_pointers section is used instead.
-- before
_extgotequiv:
.long _extfoo
_delta:
.long _extgotequiv-_delta
-- after
_delta:
.long L_extfoo$non_lazy_ptr-_delta
.section __IMPORT,__pointers,non_lazy_symbol_pointers
L_extfoo$non_lazy_ptr:
.indirect_symbol _extfoo
.long 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231475 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -88,6 +88,7 @@ public:
|
||||
class TargetLoweringObjectFileMachO : public TargetLoweringObjectFile {
|
||||
public:
|
||||
virtual ~TargetLoweringObjectFileMachO() {}
|
||||
TargetLoweringObjectFileMachO();
|
||||
|
||||
/// Extract the dependent library name from a linker option string. Returns
|
||||
/// StringRef() if the option does not specify a library.
|
||||
@@ -122,6 +123,12 @@ public:
|
||||
MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
|
||||
const TargetMachine &TM,
|
||||
MachineModuleInfo *MMI) const override;
|
||||
|
||||
/// Get MachO PC relative GOT entry relocation
|
||||
const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
|
||||
const MCValue &MV, int64_t Offset,
|
||||
MachineModuleInfo *MMI,
|
||||
MCStreamer &Streamer) const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,19 +29,20 @@ namespace llvm {
|
||||
class MCSymbol;
|
||||
class MCSymbolRefExpr;
|
||||
class MCStreamer;
|
||||
class MCValue;
|
||||
class ConstantExpr;
|
||||
class GlobalValue;
|
||||
class TargetMachine;
|
||||
|
||||
class TargetLoweringObjectFile : public MCObjectFileInfo {
|
||||
MCContext *Ctx;
|
||||
const DataLayout *DL;
|
||||
|
||||
TargetLoweringObjectFile(
|
||||
const TargetLoweringObjectFile&) = delete;
|
||||
void operator=(const TargetLoweringObjectFile&) = delete;
|
||||
|
||||
protected:
|
||||
const DataLayout *DL;
|
||||
bool SupportIndirectSymViaGOTPCRel;
|
||||
bool SupportGOTPCRelWithOffset;
|
||||
|
||||
@@ -178,7 +179,9 @@ public:
|
||||
|
||||
/// \brief Get the target specific PC relative GOT entry relocation
|
||||
virtual const MCExpr *getIndirectSymViaGOTPCRel(const MCSymbol *Sym,
|
||||
const MCValue &MV,
|
||||
int64_t Offset,
|
||||
MachineModuleInfo *MMI,
|
||||
MCStreamer &Streamer) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user