diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 14 | ||||
-rw-r--r-- | binutils/readelf.c | 20 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 4 |
3 files changed, 35 insertions, 3 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ac2f1c5..9b720d9 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,17 @@ +2016-11-01 Palmer Dabbelt <palmer@dabbelt.com> + Andrew Waterman <andrew@sifive.com> + + Add support for RISC-V architecture. + * readelf.c (guess_is_rela): Add EM_RISCV. + (get_machine_name): Likewise. + (dump_relocations): Add support for riscv relocations. + (get_machine_flags): Add support for riscv flags. + (is_32bit_abs_reloc): Add R_RISCV_32. + (is_64bit_abs_reloc): Add R_RISCV_64. + (is_none_reloc): Add R_RISCV_NONE. + * testsuite/binutils-all/objdump.exp (cpus_expected): Add riscv. + Expect the debug_ranges test to fail. + 2016-10-17 Nick Clifton <nickc@redhat.com> * readelf.c (apply_relocations): Fail if the symbol table section diff --git a/binutils/readelf.c b/binutils/readelf.c index 69942cf..114486c 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -124,6 +124,7 @@ #include "elf/metag.h" #include "elf/microblaze.h" #include "elf/mips.h" +#include "elf/riscv.h" #include "elf/mmix.h" #include "elf/mn10200.h" #include "elf/mn10300.h" @@ -775,6 +776,7 @@ guess_is_rela (unsigned int e_machine) case EM_OR1K: case EM_PPC64: case EM_PPC: + case EM_RISCV: case EM_RL78: case EM_RX: case EM_S390: @@ -1314,6 +1316,10 @@ dump_relocations (FILE * file, rtype = elf_mips_reloc_type (type); break; + case EM_RISCV: + rtype = elf_riscv_reloc_type (type); + break; + case EM_ALPHA: rtype = elf_alpha_reloc_type (type); break; @@ -2327,6 +2333,7 @@ get_machine_name (unsigned e_machine) case EM_CR16: case EM_MICROBLAZE: case EM_MICROBLAZE_OLD: return "Xilinx MicroBlaze"; + case EM_RISCV: return "RISC-V"; case EM_RL78: return "Renesas RL78"; case EM_RX: return "Renesas RX"; case EM_METAG: return "Imagination Technologies Meta processor architecture"; @@ -2363,7 +2370,6 @@ get_machine_name (unsigned e_machine) case EM_CSR_KALIMBA: return "CSR Kalimba architecture family"; case EM_Z80: return "Zilog Z80"; case EM_AMDGPU: return "AMD GPU architecture"; - case EM_RISCV: return "RISC-V"; default: snprintf (buff, sizeof (buff), _("<unknown>: 0x%x"), e_machine); return buff; @@ -3308,6 +3314,13 @@ get_machine_flags (unsigned e_flags, unsigned e_machine) decode_NDS32_machine_flags (e_flags, buf, sizeof buf); break; + case EM_RISCV: + if (e_flags & EF_RISCV_RVC) + strcat (buf, ", RVC"); + if (e_flags & EF_RISCV_SOFT_FLOAT) + strcat (buf, ", soft-float ABI"); + break; + case EM_SH: switch ((e_flags & EF_SH_MACH_MASK)) { @@ -11788,6 +11801,8 @@ is_32bit_abs_reloc (unsigned int reloc_type) return reloc_type == 1; /* R_PPC64_ADDR32. */ case EM_PPC: return reloc_type == 1; /* R_PPC_ADDR32. */ + case EM_RISCV: + return reloc_type == 1; /* R_RISCV_32. */ case EM_RL78: return reloc_type == 1; /* R_RL78_DIR32. */ case EM_RX: @@ -11941,6 +11956,8 @@ is_64bit_abs_reloc (unsigned int reloc_type) return reloc_type == 80; /* R_PARISC_DIR64. */ case EM_PPC64: return reloc_type == 38; /* R_PPC64_ADDR64. */ + case EM_RISCV: + return reloc_type == 2; /* R_RISCV_64. */ case EM_SPARC32PLUS: case EM_SPARCV9: case EM_SPARC: @@ -12112,6 +12129,7 @@ is_none_reloc (unsigned int reloc_type) case EM_PARISC: /* R_PARISC_NONE. */ case EM_PPC64: /* R_PPC64_NONE. */ case EM_PPC: /* R_PPC_NONE. */ + case EM_RISCV: /* R_RISCV_NONE. */ case EM_S390: /* R_390_NONE. */ case EM_S390_OLD: case EM_SH: /* R_SH_NONE. */ diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index f097a7e..377c5b1 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -38,7 +38,7 @@ lappend cpus_expected aarch64 alpha arc ARC700 ARCv2 arm cris lappend cpus_expected d10v d30v fr30 fr500 fr550 h8 hppa i386 i860 i960 iamcu ip2022 lappend cpus_expected m16c m32c m32r m68hc11 m68hc12 m68k m88k MCore mep c5 h1 MicroBlaze lappend cpus_expected mips mn10200 mn10300 ms1 msp MSP430 nds32 n1h_v3 ns32k -lappend cpus_expected or1k or1knd pj powerpc pyramid romp rs6000 s390 sh sparc +lappend cpus_expected or1k or1knd pj powerpc pyramid riscv romp rs6000 s390 sh sparc lappend cpus_expected tahoe tic54x tic80 tilegx tms320c30 tms320c4x tms320c54x lappend cpus_expected v850 vax we32k x86-64 xscale xtensa z8k z8001 z8002 @@ -265,7 +265,7 @@ if { ![is_elf_format] } then { send_log "\n" } - setup_xfail "msp430-*-*" "nds32*-*-*" + setup_xfail "msp430-*-*" "nds32*-*-*" "riscv*-*-*" if { [regexp_diff objdump.out $srcdir/$subdir/dw2-ranges.W] } then { fail "objdump -W for debug_ranges" } else { |