[llvm] cffce86 - [VE] Support srel32 in symbol reference
Kazushi Marukawa via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 13 03:29:23 PST 2021
Author: Kazushi (Jam) Marukawa
Date: 2021-12-13T20:29:17+09:00
New Revision: cffce86a1cb2d76b9296c1d3c6a06f9f6f9182f0
URL: https://github.com/llvm/llvm-project/commit/cffce86a1cb2d76b9296c1d3c6a06f9f6f9182f0
DIFF: https://github.com/llvm/llvm-project/commit/cffce86a1cb2d76b9296c1d3c6a06f9f6f9182f0.diff
LOG: [VE] Support srel32 in symbol reference
Support R_VE_SREL32 in symbol references in MC layer.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D115591
Added:
llvm/test/MC/VE/sym-lea.s
Modified:
llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
index 3b0a469441091..ae065407409a7 100644
--- a/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
+++ b/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp
@@ -67,6 +67,7 @@ unsigned VEELFObjectWriter::getRelocType(MCContext &Ctx, const MCValue &Target,
Ctx.reportError(Fixup.getLoc(),
"8-byte pc-relative data relocation is not supported");
return ELF::R_VE_NONE;
+ case VE::fixup_ve_reflong:
case VE::fixup_ve_srel32:
return ELF::R_VE_SREL32;
case VE::fixup_ve_pc_hi32:
diff --git a/llvm/test/MC/VE/sym-lea.s b/llvm/test/MC/VE/sym-lea.s
new file mode 100644
index 0000000000000..904485a179465
--- /dev/null
+++ b/llvm/test/MC/VE/sym-lea.s
@@ -0,0 +1,11 @@
+# RUN: llvm-mc -triple=ve %s -o - | FileCheck %s
+# RUN: llvm-mc -triple=ve -filetype=obj %s -o - | llvm-objdump -r - | FileCheck %s --check-prefix=CHECK-OBJ
+
+ lea %s0, tgt
+ lea %s0, tgt2-.
+# CHECK: lea %s0, tgt
+# CHECK-NEXT: [[LABEL:.*]]:
+# CHECK-NEXT: lea %s0, tgt2-[[LABEL]]
+
+# CHECK-OBJ: 0 R_VE_REFLONG tgt
+# CHECK-OBJ: 8 R_VE_SREL32 tgt2
More information about the llvm-commits
mailing list