[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
This commit is contained in:
Kazushi (Jam) Marukawa 2021-12-11 03:06:02 +09:00
parent d1057f9604
commit cffce86a1c
2 changed files with 12 additions and 0 deletions

View File

@ -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:

11
llvm/test/MC/VE/sym-lea.s Normal file
View File

@ -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