[llvm] [llvm][SystemZ] Recognize `@GOTENT` modifier in assembler. (PR #107038)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 18:44:44 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-systemz
Author: Alex Rønne Petersen (alexrp)
<details>
<summary>Changes</summary>
Closes #<!-- -->105918.
I'm unsure if there are other places that need to be updated for this.
---
Full diff: https://github.com/llvm/llvm-project/pull/107038.diff
4 Files Affected:
- (modified) llvm/include/llvm/MC/MCExpr.h (+1)
- (modified) llvm/lib/MC/MCExpr.cpp (+2)
- (modified) llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp (+1)
- (modified) llvm/test/MC/SystemZ/fixups.s (+6)
``````````diff
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 118b1dd88525ab..10bc6ebd6fe506 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -192,6 +192,7 @@ class MCSymbolRefExpr : public MCExpr {
VK_Invalid,
VK_GOT,
+ VK_GOTENT,
VK_GOTOFF,
VK_GOTREL,
VK_PCREL,
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index e4ca431c3d25f9..f04f6e8533a31b 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -226,6 +226,7 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
case VK_DTPOFF: return "DTPOFF";
case VK_DTPREL: return "DTPREL";
case VK_GOT: return "GOT";
+ case VK_GOTENT: return "GOTENT";
case VK_GOTOFF: return "GOTOFF";
case VK_GOTREL: return "GOTREL";
case VK_PCREL: return "PCREL";
@@ -407,6 +408,7 @@ MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
.Case("dtprel", VK_DTPREL)
.Case("dtpoff", VK_DTPOFF)
.Case("got", VK_GOT)
+ .Case("gotent", VK_GOTENT)
.Case("gotoff", VK_GOTOFF)
.Case("gotrel", VK_GOTREL)
.Case("pcrel", VK_PCREL)
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
index de1eedb8daff62..e44b4a52369153 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp
@@ -185,6 +185,7 @@ unsigned SystemZELFObjectWriter::getRelocType(MCContext &Ctx,
return getTLSGDReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_GOT:
+ case MCSymbolRefExpr::VK_GOTENT:
if (IsPCRel && Kind == SystemZ::FK_390_PC32DBL)
return ELF::R_390_GOTENT;
Ctx.reportError(Loc, "Only PC-relative GOT accesses are supported for now");
diff --git a/llvm/test/MC/SystemZ/fixups.s b/llvm/test/MC/SystemZ/fixups.s
index ad0b1f18cdcfd4..0d59e60fc59579 100644
--- a/llvm/test/MC/SystemZ/fixups.s
+++ b/llvm/test/MC/SystemZ/fixups.s
@@ -19,6 +19,12 @@
.align 16
larl %r14, target at got
+# CHECK: larl %r14, target at GOTENT # encoding: [0xc0,0xe0,A,A,A,A]
+# CHECK-NEXT: # fixup A - offset: 2, value: target at GOTENT+2, kind: FK_390_PC32DBL
+# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_GOTENT target 0x2
+ .align 16
+ larl %r14, target at gotent
+
# CHECK: larl %r14, target at INDNTPOFF # encoding: [0xc0,0xe0,A,A,A,A]
# CHECK-NEXT: # fixup A - offset: 2, value: target at INDNTPOFF+2, kind: FK_390_PC32DBL
# CHECK-REL: 0x{{[0-9A-F]*2}} R_390_TLS_IEENT target 0x2
``````````
</details>
https://github.com/llvm/llvm-project/pull/107038
More information about the llvm-commits
mailing list