[PATCH] D70204: [Object][RISCV] Resolve R_RISCV_32_PCREL
Luís Marques via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 15:33:58 PST 2019
luismarques updated this revision to Diff 230549.
luismarques retitled this revision from "[DWARF][RISCV] Resolve R_RISCV_32_PCREL" to "[Object][RISCV] Resolve R_RISCV_32_PCREL".
luismarques added a comment.
Rebase patch; Tweak enumeration order. Change title [DWARF] to [Object].
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70204/new/
https://reviews.llvm.org/D70204
Files:
llvm/lib/Object/RelocationResolver.cpp
llvm/test/DebugInfo/RISCV/relax-debug-frame.ll
Index: llvm/test/DebugInfo/RISCV/relax-debug-frame.ll
===================================================================
--- llvm/test/DebugInfo/RISCV/relax-debug-frame.ll
+++ llvm/test/DebugInfo/RISCV/relax-debug-frame.ll
@@ -1,7 +1,7 @@
; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o - \
; RUN: | llvm-readobj -r | FileCheck -check-prefix=RELAX %s
; RUN: llc -filetype=obj -mtriple=riscv32 -mattr=+relax %s -o - \
-; RUN: | llvm-dwarfdump --debug-frame - \
+; RUN: | llvm-dwarfdump --debug-frame - 2>&1 \
; RUN: | FileCheck -check-prefix=RELAX-DWARFDUMP %s
;
; RELAX: Section{{.*}}.rela.{{eh|debug}}_frame {
@@ -15,6 +15,7 @@
; RELAX: 0x39 R_RISCV_SET6
; RELAX: 0x39 R_RISCV_SUB6
;
+; RELAX-DWARFDUMP-NOT: error: failed to compute relocation
; RELAX-DWARFDUMP: CIE
; RELAX-DWARFDUMP: DW_CFA_advance_loc
; RELAX-DWARFDUMP: DW_CFA_def_cfa_offset
Index: llvm/lib/Object/RelocationResolver.cpp
===================================================================
--- llvm/lib/Object/RelocationResolver.cpp
+++ llvm/lib/Object/RelocationResolver.cpp
@@ -336,6 +336,7 @@
switch (Type) {
case ELF::R_RISCV_NONE:
case ELF::R_RISCV_32:
+ case ELF::R_RISCV_32_PCREL:
case ELF::R_RISCV_64:
case ELF::R_RISCV_SET6:
case ELF::R_RISCV_SUB6:
@@ -360,6 +361,8 @@
return A;
case ELF::R_RISCV_32:
return (S + RA) & 0xFFFFFFFF;
+ case ELF::R_RISCV_32_PCREL:
+ return (S + RA - R.getOffset()) & 0xFFFFFFFF;
case ELF::R_RISCV_64:
return S + RA;
case ELF::R_RISCV_SET6:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70204.230549.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191121/391f9ec3/attachment-0001.bin>
More information about the llvm-commits
mailing list