diff --git a/llvm/lib/Object/RelocationResolver.cpp b/llvm/lib/Object/RelocationResolver.cpp --- a/llvm/lib/Object/RelocationResolver.cpp +++ b/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: diff --git a/llvm/test/MC/RISCV/cfi-advance.s b/llvm/test/MC/RISCV/cfi-advance.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/RISCV/cfi-advance.s @@ -0,0 +1,18 @@ +# RUN: llvm-mc -filetype=obj -triple riscv32 %s -o %t.o +# RUN: llvm-readobj -r %t.o | FileCheck -check-prefix=RELAX %s +# RUN: llvm-dwarfdump --debug-info --debug-line %t.o 2>&1 \ +# RUN: | FileCheck -check-prefix=RELAX-DWARFDUMP %s + +#RELAX: 0x26 R_RISCV_SET8 - 0x0 +#RELAX-DWARFDUMP-NOT: error: failed to compute relocation + .text + .globl test # -- Begin function test + .p2align 1 + .type test,@function +test: + .cfi_startproc + nop + .zero 100, 0x90 + .cfi_def_cfa_offset 8 + nop + .cfi_endproc