diff options
author | herman ten brugge <hermantenbrugge@home.nl> | 2024-01-07 07:45:31 +0100 |
---|---|---|
committer | herman ten brugge <hermantenbrugge@home.nl> | 2024-01-07 07:45:31 +0100 |
commit | 2701dcfb0673d910014c120c4bbca56417714984 (patch) | |
tree | 67f1a7e6355cd6d6f714e6551500255f11390895 | |
parent | c13bbb5cb584b136195a3be2ae6a8aee649ffe7b (diff) |
Add some relocations to riscv64-link.c
dlltest failed on a riscv machine.
-rw-r--r-- | riscv64-link.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/riscv64-link.c b/riscv64-link.c index 34bfeb0..39c0c5d 100644 --- a/riscv64-link.c +++ b/riscv64-link.c @@ -39,10 +39,13 @@ int code_reloc (int reloc_type) case R_RISCV_PCREL_LO12_S: case R_RISCV_32_PCREL: case R_RISCV_SET6: + case R_RISCV_SET8: + case R_RISCV_SET16: case R_RISCV_SUB6: case R_RISCV_ADD16: case R_RISCV_ADD32: case R_RISCV_ADD64: + case R_RISCV_SUB8: case R_RISCV_SUB16: case R_RISCV_SUB32: case R_RISCV_SUB64: @@ -68,8 +71,11 @@ int gotplt_entry_type (int reloc_type) case R_RISCV_RVC_JUMP: case R_RISCV_JUMP_SLOT: case R_RISCV_SET6: + case R_RISCV_SET8: + case R_RISCV_SET16: case R_RISCV_SUB6: case R_RISCV_ADD16: + case R_RISCV_SUB8: case R_RISCV_SUB16: return NO_GOTPLT_ENTRY; @@ -328,12 +334,21 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, case R_RISCV_ADD16: write16le(ptr, read16le(ptr) + val); return; + case R_RISCV_SUB8: + *ptr -= val; + return; case R_RISCV_SUB16: write16le(ptr, read16le(ptr) - val); return; case R_RISCV_SET6: *ptr = (*ptr & ~0x3f) | (val & 0x3f); return; + case R_RISCV_SET8: + *ptr = (*ptr & ~0xff) | (val & 0xff); + return; + case R_RISCV_SET16: + *ptr = (*ptr & ~0xffff) | (val & 0xffff); + return; case R_RISCV_SUB6: *ptr = (*ptr & ~0x3f) | ((*ptr - val) & 0x3f); return; |