mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-13 05:10:07 +08:00
Add some relocations to riscv64-link.c
dlltest failed on a riscv machine.
This commit is contained in:
parent
c13bbb5cb5
commit
2701dcfb06
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user