diff options
| author | Andreas Schwab <[email protected]> | 2018-10-02 14:46:51 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2018-10-13 22:54:51 +0200 |
| commit | 2876b3b648f665736ac9c879d34de5e3866ba8f9 (patch) | |
| tree | be631dee293e01847e3eea43343b0d249a7532c6 /backends/riscv_symbol.c | |
| parent | 69d6e67eee30c483ba53a8e1da1b3568033e3dde (diff) | |
Handle ADD/SUB relocations
This adds support for ADD and SUB relocations as seen on RISC-V.
Signed-off-by: Andreas Schwab <[email protected]>
Diffstat (limited to 'backends/riscv_symbol.c')
| -rw-r--r-- | backends/riscv_symbol.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/backends/riscv_symbol.c b/backends/riscv_symbol.c index 866a2d7a..c34b7702 100644 --- a/backends/riscv_symbol.c +++ b/backends/riscv_symbol.c @@ -40,14 +40,38 @@ /* Check for the simple reloc types. */ Elf_Type -riscv_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) +riscv_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type, + int *addsub) { switch (type) { + case R_RISCV_SET8: + return ELF_T_BYTE; + case R_RISCV_SET16: + return ELF_T_HALF; case R_RISCV_32: + case R_RISCV_SET32: return ELF_T_WORD; case R_RISCV_64: return ELF_T_XWORD; + case R_RISCV_ADD16: + *addsub = 1; + return ELF_T_HALF; + case R_RISCV_SUB16: + *addsub = -1; + return ELF_T_HALF; + case R_RISCV_ADD32: + *addsub = 1; + return ELF_T_WORD; + case R_RISCV_SUB32: + *addsub = -1; + return ELF_T_WORD; + case R_RISCV_ADD64: + *addsub = 1; + return ELF_T_XWORD; + case R_RISCV_SUB64: + *addsub = -1; + return ELF_T_XWORD; default: return ELF_T_NUM; } |
