mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
[AsmPrinter][TLOF] ARM64 MachO support for replacing GOT equivalents
Follow up r230264 and add ARM64 support for replacing global GOT equivalent symbol accesses by references to the GOT entry for the final symbol instead, example: -- before .globl _foo _foo: .long 42 .globl _gotequivalent _gotequivalent: .quad _foo .globl _delta _delta: .long _gotequivalent-_delta -- after .globl _foo _foo: .long 42 .globl _delta Ltmp3: .long _foo@GOT-Ltmp3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2084,9 +2084,13 @@ static void handleIndirectSymViaGOTPCRel(AsmPrinter &AP, const MCExpr **ME,
|
||||
//
|
||||
// gotpcrelcst := <offset from @foo base> + <cst>
|
||||
//
|
||||
// Only encode <cst> if the target supports it.
|
||||
//
|
||||
int64_t GOTPCRelCst = Offset + MV.getConstant();
|
||||
if (GOTPCRelCst < 0)
|
||||
return;
|
||||
if (!AP.getObjFileLowering().supportGOTPCRelWithOffset() && GOTPCRelCst != 0)
|
||||
return;
|
||||
|
||||
// Emit the GOT PC relative to replace the got equivalent global, i.e.:
|
||||
//
|
||||
@@ -2110,7 +2114,8 @@ static void handleIndirectSymViaGOTPCRel(AsmPrinter &AP, const MCExpr **ME,
|
||||
const GlobalValue *FinalGV = dyn_cast<GlobalValue>(GV->getOperand(0));
|
||||
const MCSymbol *FinalSym = AP.getSymbol(FinalGV);
|
||||
*ME = AP.getObjFileLowering().getIndirectSymViaGOTPCRel(FinalSym,
|
||||
GOTPCRelCst);
|
||||
GOTPCRelCst,
|
||||
AP.OutStreamer);
|
||||
|
||||
// Update GOT equivalent usage information
|
||||
--NumUses;
|
||||
|
Reference in New Issue
Block a user