From cffce86a1cb2d76b9296c1d3c6a06f9f6f9182f0 Mon Sep 17 00:00:00 2001 From: "Kazushi (Jam) Marukawa" Date: Sat, 11 Dec 2021 03:06:02 +0900 Subject: [PATCH] [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 --- llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp | 1 + llvm/test/MC/VE/sym-lea.s | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 llvm/test/MC/VE/sym-lea.s diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEELFObjectWriter.cpp index 3b0a469..ae06540 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 0000000..904485a --- /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 -- 2.7.4