[PATCH] D134164: [RelocationResolver] Add R_RISCV_SET8

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 21 19:30:33 PDT 2022


liaolucy updated this revision to Diff 462069.
liaolucy added a comment.

address comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134164/new/

https://reviews.llvm.org/D134164

Files:
  llvm/lib/Object/RelocationResolver.cpp
  llvm/test/MC/RISCV/cfi-advance.s


Index: llvm/test/MC/RISCV/cfi-advance.s
===================================================================
--- /dev/null
+++ llvm/test/MC/RISCV/cfi-advance.s
@@ -0,0 +1,19 @@
+# RUN: llvm-mc -filetype=obj -triple riscv32 %s -o %t.o  
+# RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=CHECK %s
+# RUN: llvm-dwarfdump --debug-frame %t.o 2>&1 \
+# 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
+        .text
+        .globl  test                            # -- Begin function test
+        .p2align        1
+        .type   test, at function
+test:
+        .cfi_startproc
+        nop
+        .zero 100, 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
@@ -433,6 +433,7 @@
   case ELF::R_RISCV_32_PCREL:
   case ELF::R_RISCV_64:
   case ELF::R_RISCV_SET6:
+  case ELF::R_RISCV_SET8:
   case ELF::R_RISCV_SUB6:
   case ELF::R_RISCV_ADD8:
   case ELF::R_RISCV_SUB8:
@@ -463,6 +464,8 @@
     return S + RA;
   case ELF::R_RISCV_SET6:
     return (A & 0xC0) | ((S + RA) & 0x3F);
+  case ELF::R_RISCV_SET8:
+    return (S + RA) & 0xFF;
   case ELF::R_RISCV_SUB6:
     return (A & 0xC0) | (((A & 0x3F) - (S + RA)) & 0x3F);
   case ELF::R_RISCV_ADD8:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134164.462069.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220922/b2a9b357/attachment.bin>


More information about the llvm-commits mailing list