[PATCH] D134408: [RelocationResolver] Add R_RISCV_SET{16,32}
Liao Chunyu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 20:53:57 PDT 2022
liaolucy created this revision.
liaolucy added reviewers: MaskRay, StephenFan, HsiangKai, luismarques, asb.
Herald added subscribers: sunshaoce, VincentWu, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
liaolucy requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134408
Files:
llvm/lib/Object/RelocationResolver.cpp
llvm/test/MC/RISCV/cfi-advance.s
Index: llvm/test/MC/RISCV/cfi-advance.s
===================================================================
--- llvm/test/MC/RISCV/cfi-advance.s
+++ llvm/test/MC/RISCV/cfi-advance.s
@@ -4,8 +4,16 @@
# RUN: | FileCheck -check-prefix=CHECK-DWARFDUMP %s
# CHECK: 0x26 R_RISCV_SET8 - 0x0
-# CHECK-DWARFDUMP: DW_CFA_advance_loc1
-# CHECK-DWARFDUMP-NEXT: DW_CFA_def_cfa_offset
+# CHECK-NEXT: 0x26 R_RISCV_SUB8 - 0x0
+# CHECK-NEXT: 0x2A R_RISCV_SET16 - 0x0
+# CHECK-NEXT: 0x2A R_RISCV_SUB16 - 0x0
+# CHECK-NEXT: 0x2F R_RISCV_SET32 - 0x0
+# CHECK-DWARFDUMP: DW_CFA_advance_loc1
+# CHECK-DWARFDUMP-NEXT: DW_CFA_def_cfa_offset
+# CHECK-DWARFDUMP-NEXT: DW_CFA_advance_loc2
+# CHECK-DWARFDUMP-NEXT: DW_CFA_def_cfa_offset
+# CHECK-DWARFDUMP-NEXT: DW_CFA_advance_loc4
+# CHECK-DWARFDUMP-NEXT: DW_CFA_def_cfa_offset
.text
.globl test # -- Begin function test
.p2align 1
@@ -16,4 +24,10 @@
.zero 100, 0x90
.cfi_def_cfa_offset 8
nop
+ .zero 255, 0x90
+ .cfi_def_cfa_offset 8
+ nop
+ .zero 65535, 0x90
+ .cfi_def_cfa_offset 8
+ nop
.cfi_endproc
Index: llvm/lib/Object/RelocationResolver.cpp
===================================================================
--- llvm/lib/Object/RelocationResolver.cpp
+++ llvm/lib/Object/RelocationResolver.cpp
@@ -437,8 +437,10 @@
case ELF::R_RISCV_SUB6:
case ELF::R_RISCV_ADD8:
case ELF::R_RISCV_SUB8:
+ case ELF::R_RISCV_SET16:
case ELF::R_RISCV_ADD16:
case ELF::R_RISCV_SUB16:
+ case ELF::R_RISCV_SET32:
case ELF::R_RISCV_ADD32:
case ELF::R_RISCV_SUB32:
case ELF::R_RISCV_ADD64:
@@ -472,10 +474,14 @@
return (A + (S + RA)) & 0xFF;
case ELF::R_RISCV_SUB8:
return (A - (S + RA)) & 0xFF;
+ case ELF::R_RISCV_SET16:
+ return (S + RA) & 0xFFFF;
case ELF::R_RISCV_ADD16:
return (A + (S + RA)) & 0xFFFF;
case ELF::R_RISCV_SUB16:
return (A - (S + RA)) & 0xFFFF;
+ case ELF::R_RISCV_SET32:
+ return (S + RA) & 0xFFFFFFFF;
case ELF::R_RISCV_ADD32:
return (A + (S + RA)) & 0xFFFFFFFF;
case ELF::R_RISCV_SUB32:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134408.462076.patch
Type: text/x-patch
Size: 2144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220922/45627bd6/attachment.bin>
More information about the llvm-commits
mailing list