forked from OSchip/llvm-project
[RelocationResolver] Add R_RISCV_SET{16,32}
Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D134408
This commit is contained in:
parent
8b8e18e11f
commit
fcfa9c7fcd
|
@ -437,8 +437,10 @@ static bool supportsRISCV(uint64_t Type) {
|
||||||
case ELF::R_RISCV_SUB6:
|
case ELF::R_RISCV_SUB6:
|
||||||
case ELF::R_RISCV_ADD8:
|
case ELF::R_RISCV_ADD8:
|
||||||
case ELF::R_RISCV_SUB8:
|
case ELF::R_RISCV_SUB8:
|
||||||
|
case ELF::R_RISCV_SET16:
|
||||||
case ELF::R_RISCV_ADD16:
|
case ELF::R_RISCV_ADD16:
|
||||||
case ELF::R_RISCV_SUB16:
|
case ELF::R_RISCV_SUB16:
|
||||||
|
case ELF::R_RISCV_SET32:
|
||||||
case ELF::R_RISCV_ADD32:
|
case ELF::R_RISCV_ADD32:
|
||||||
case ELF::R_RISCV_SUB32:
|
case ELF::R_RISCV_SUB32:
|
||||||
case ELF::R_RISCV_ADD64:
|
case ELF::R_RISCV_ADD64:
|
||||||
|
@ -472,10 +474,14 @@ static uint64_t resolveRISCV(uint64_t Type, uint64_t Offset, uint64_t S,
|
||||||
return (A + (S + RA)) & 0xFF;
|
return (A + (S + RA)) & 0xFF;
|
||||||
case ELF::R_RISCV_SUB8:
|
case ELF::R_RISCV_SUB8:
|
||||||
return (A - (S + RA)) & 0xFF;
|
return (A - (S + RA)) & 0xFF;
|
||||||
|
case ELF::R_RISCV_SET16:
|
||||||
|
return (S + RA) & 0xFFFF;
|
||||||
case ELF::R_RISCV_ADD16:
|
case ELF::R_RISCV_ADD16:
|
||||||
return (A + (S + RA)) & 0xFFFF;
|
return (A + (S + RA)) & 0xFFFF;
|
||||||
case ELF::R_RISCV_SUB16:
|
case ELF::R_RISCV_SUB16:
|
||||||
return (A - (S + RA)) & 0xFFFF;
|
return (A - (S + RA)) & 0xFFFF;
|
||||||
|
case ELF::R_RISCV_SET32:
|
||||||
|
return (S + RA) & 0xFFFFFFFF;
|
||||||
case ELF::R_RISCV_ADD32:
|
case ELF::R_RISCV_ADD32:
|
||||||
return (A + (S + RA)) & 0xFFFFFFFF;
|
return (A + (S + RA)) & 0xFFFFFFFF;
|
||||||
case ELF::R_RISCV_SUB32:
|
case ELF::R_RISCV_SUB32:
|
||||||
|
|
|
@ -4,8 +4,16 @@
|
||||||
# RUN: | FileCheck -check-prefix=CHECK-DWARFDUMP %s
|
# RUN: | FileCheck -check-prefix=CHECK-DWARFDUMP %s
|
||||||
|
|
||||||
# CHECK: 0x26 R_RISCV_SET8 - 0x0
|
# CHECK: 0x26 R_RISCV_SET8 - 0x0
|
||||||
# CHECK-DWARFDUMP: DW_CFA_advance_loc1
|
# CHECK-NEXT: 0x26 R_RISCV_SUB8 - 0x0
|
||||||
# CHECK-DWARFDUMP-NEXT: DW_CFA_def_cfa_offset
|
# 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
|
.text
|
||||||
.globl test # -- Begin function test
|
.globl test # -- Begin function test
|
||||||
.p2align 1
|
.p2align 1
|
||||||
|
@ -16,4 +24,10 @@ test:
|
||||||
.zero 100, 0x90
|
.zero 100, 0x90
|
||||||
.cfi_def_cfa_offset 8
|
.cfi_def_cfa_offset 8
|
||||||
nop
|
nop
|
||||||
|
.zero 255, 0x90
|
||||||
|
.cfi_def_cfa_offset 8
|
||||||
|
nop
|
||||||
|
.zero 65535, 0x90
|
||||||
|
.cfi_def_cfa_offset 8
|
||||||
|
nop
|
||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
|
|
Loading…
Reference in New Issue