Skip to content

Conversation

@alexrp
Copy link
Member

@alexrp alexrp commented Sep 3, 2024

Closes #105918.

I'm unsure if there are other places that need to be updated for this.

@llvmbot llvmbot added backend:SystemZ llvm:mc Machine (object) code labels Sep 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 3, 2024

@llvm/pr-subscribers-mc

@llvm/pr-subscribers-backend-systemz

Author: Alex Rønne Petersen (alexrp)

Changes

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 --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@got
 
+# CHECK: larl %r14, target@GOTENT               # encoding: [0xc0,0xe0,A,A,A,A]
+# CHECK-NEXT:                                   # fixup A - offset: 2, value: target@GOTENT+2, kind: FK_390_PC32DBL
+# CHECK-REL:                                    0x{{[0-9A-F]*2}} R_390_GOTENT target 0x2
+	.align 16
+	larl %r14, target@gotent
+
 # CHECK: larl %r14, target@INDNTPOFF            # encoding: [0xc0,0xe0,A,A,A,A]
 # CHECK-NEXT:                                   # fixup A - offset: 2, value: target@INDNTPOFF+2, kind: FK_390_PC32DBL
 # CHECK-REL:                                    0x{{[0-9A-F]*2}} R_390_TLS_IEENT target 0x2

@github-actions
Copy link

github-actions bot commented Sep 3, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if there are other places that need to be updated for this.

No, this should be the only place. Patch LGTM, thanks!

@alexrp
Copy link
Member Author

alexrp commented Sep 3, 2024

Just noting that I don't have commit access - forgot to mention in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:SystemZ llvm:mc Machine (object) code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SystemZ] Assembler does not recognize symbol@GOTENT syntax

3 participants