-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm][SystemZ] Recognize @GOTENT
modifier in assembler.
#107038
Conversation
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-systemz Author: Alex Rønne Petersen (alexrp) ChangesCloses #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:
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
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
5379a26
to
65e1543
Compare
There was a problem hiding this 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!
Just noting that I don't have commit access - forgot to mention in the PR description. |
Closes llvm#105918. I'm unsure if there are other places that need to be updated for this.
Closes #105918.
I'm unsure if there are other places that need to be updated for this.