diff options
author | Nick Clifton <nickc@redhat.com> | 2016-11-01 16:45:57 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-11-01 16:45:57 +0000 |
commit | e23eba971dd409b999dd83d8df0f842680c1c642 (patch) | |
tree | 0002ef536e33bff13648ee1f2c419349f4f91d75 /binutils/readelf.c | |
parent | 4e56efac8b4d5e251e8edc13febec93992bd6eb4 (diff) | |
download | gdb-e23eba971dd409b999dd83d8df0f842680c1c642.zip gdb-e23eba971dd409b999dd83d8df0f842680c1c642.tar.gz gdb-e23eba971dd409b999dd83d8df0f842680c1c642.tar.bz2 |
Add support for RISC-V architecture.
bfd * Makefile.am: Add entries for riscv32-elf and riscv64-elf.
* config.bdf: Likewise.
* configure.ac: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* archures.c: Add bfd_riscv_arch.
* reloc.c: Add riscv relocs.
* targets.c: Add riscv_elf32_vec and riscv_elf64_vec.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id.
* elfnn-riscv.c: New file.
* elfxx-riscv.c: New file.
* elfxx-riscv.h: New file.
binutils* 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.
gas * Makefile.am: Add riscv files.
* Makefile.in: Regenerate.
* NEWS: Mention the support for this architecture.
* configure.in: Define a default architecture.
* configure: Regenerate.
* configure.tgt: Add entries for riscv.
* doc/as.texinfo: Likewise.
* testsuite/gas/all/gas.exp: Expect the redef tests to fail.
* testsuite/gas/elf/elf.exp: Expect the groupauto tests to fail.
* config/tc-riscv.c: New file.
* config/tc-riscv.h: New file.
* doc/c-riscv.texi: New file.
* testsuite/gas/riscv: New directory.
* testsuite/gas/riscv/riscv.exp: New file.
* testsuite/gas/riscv/t_insns.d: New file.
* testsuite/gas/riscv/t_insns.s: New file.
ld * Makefile.am: Add riscv files.
* Makefile.in: Regenerate.
* NEWS: Mention the support for this target.
* configure.tgt: Add riscv entries.
* emulparams/elf32lriscv-defs.sh: New file.
* emulparams/elf32lriscv.sh: New file.
* emulparams/elf64lriscv-defs.sh: New file.
* emulparams/elf64lriscv.sh: New file.
* emultempl/riscvelf.em: New file.
opcodes * configure.ac: Add entry for bfd_riscv_arch.
* configure: Regenerate.
* disassemble.c (disassembler): Add support for riscv.
(disassembler_usage): Likewise.
* riscv-dis.c: New file.
* riscv-opc.c: New file.
include * dis-asm.h: Add prototypes for print_insn_riscv and
print_riscv_disassembler_options.
* elf/riscv.h: New file.
* opcode/riscv-opc.h: New file.
* opcode/riscv.h: New file.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 20 |
1 files changed, 19 insertions, 1 deletions
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. */ |