diff options
author | br <br@FreeBSD.org> | 2016-05-25 11:58:55 +0000 |
---|---|---|
committer | br <br@FreeBSD.org> | 2016-05-25 11:58:55 +0000 |
commit | 738d07cfc5e98f5ee607466cbbff2ccf43f911b0 (patch) | |
tree | 6a661c70434865cf9964ac9323fa7c62e6a820b4 /contrib/elftoolchain | |
parent | 8c49ce7aa04fd90d2822f5e57e7a85b62e8cc430 (diff) | |
download | FreeBSD-src-738d07cfc5e98f5ee607466cbbff2ccf43f911b0.zip FreeBSD-src-738d07cfc5e98f5ee607466cbbff2ccf43f911b0.tar.gz |
Add relocation support for RISC-V.
Reviewed by: emaste
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D6559
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r-- | contrib/elftoolchain/libdwarf/libdwarf.h | 1 | ||||
-rw-r--r-- | contrib/elftoolchain/libdwarf/libdwarf_reloc.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/contrib/elftoolchain/libdwarf/libdwarf.h b/contrib/elftoolchain/libdwarf/libdwarf.h index 02f0ce5..c18bf20 100644 --- a/contrib/elftoolchain/libdwarf/libdwarf.h +++ b/contrib/elftoolchain/libdwarf/libdwarf.h @@ -440,6 +440,7 @@ enum Dwarf_ISA { DW_ISA_X86, DW_ISA_X86_64, DW_ISA_AARCH64, + DW_ISA_RISCV, DW_ISA_MAX }; diff --git a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c index 9b28f11..19325c1 100644 --- a/contrib/elftoolchain/libdwarf/libdwarf_reloc.c +++ b/contrib/elftoolchain/libdwarf/libdwarf_reloc.c @@ -54,6 +54,8 @@ _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) return (R_ARM_ABS32); case DW_ISA_MIPS: return (is64 ? R_MIPS_64 : R_MIPS_32); + case DW_ISA_RISCV: + return (is64 ? R_RISCV_64 : R_RISCV_32); case DW_ISA_IA64: return (is64 ? R_IA_64_DIR64LSB : R_IA_64_DIR32LSB); default: @@ -106,6 +108,12 @@ _dwarf_get_reloc_size(Dwarf_Debug dbg, Dwarf_Unsigned rel_type) else if (rel_type == R_MIPS_64) return (8); break; + case EM_RISCV: + if (rel_type == R_RISCV_32) + return (4); + else if (rel_type == R_RISCV_64) + return (8); + break; case EM_IA_64: if (rel_type == R_IA_64_SECREL32LSB) return (4); |