aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorFrancois H. Theron <francois.theron@netronome.com>2018-04-30 17:02:59 +0100
committerNick Clifton <nickc@redhat.com>2018-04-30 17:02:59 +0100
commitfe944acf8f858cfe6bcfd00670a88847a464717c (patch)
tree63cfbbb8631a3c6624f1263aa0608ea6c796c5c4 /binutils/readelf.c
parentd33bc52e51fdb6c464c1c8e8fdf9b2007b522b57 (diff)
downloadgdb-fe944acf8f858cfe6bcfd00670a88847a464717c.zip
gdb-fe944acf8f858cfe6bcfd00670a88847a464717c.tar.gz
gdb-fe944acf8f858cfe6bcfd00670a88847a464717c.tar.bz2
This patch adds support to objdump for disassembly of NFP (Netronome Flow Processor) ELF files (.nffw) as well as some basic readelf support.
bfd * Makefile.am: Added NFP files to build. * archures.c: Added bfd_arch_nfp * config.bfd: Added NFP support. * configure.ac: Added NFP support. * cpu-nfp.c: New, for NFP support. * elf-bfd.h: Added elf_section_info() * elf64-nfp.c: New, for NFP support. * po/SRC-POTFILES.in: Added NFP source files. * targets.c: Added nfp_elf64_vec * bfd-in2.h: Regenerate. * Makefile.in: Regenerate. * configure: Regenerate. binutils* readelf.c: Very basic support for EM_NFP and its section types. * testsuite/binutils-all/nfp: New directory. * testsuite/binutils-all/nfp/objdump.exp: New file. Run new tests. * testsuite/binutils-all/nfp/test2_ctx8.d: New file. * testsuite/binutils-all/nfp/test2_no-pc_ctx4.d: New file. * testsuite/binutils-all/nfp/test1.d: New file. * testsuite/binutils-all/nfp/nfp6000.nffw: New file. * testsuite/binutils-all/nfp/test2_nfp6000.nffw: New file. * NEWS: Mention the new support. include * dis-asm.h: Added print_nfp_disassembler_options prototype. * elf/common.h: Added EM_NFP, officially assigned. See Google Group Generic System V Application Binary Interface. * elf/nfp.h: New, for NFP support. * opcode/nfp.h: New, for NFP support. opcodes Makefile.am: Added nfp-dis.c. configure.ac: Added bfd_nfp_arch. disassemble.h: Added print_insn_nfp prototype. disassemble.c: Added ARCH_nfp and call to print_insn_nfp nfp-dis.c: New, for NFP support. po/POTFILES.in: Added nfp-dis.c to the list. Makefile.in: Regenerate. configure: Regenerate.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index eecc05b..0c676f2 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -131,6 +131,7 @@
#include "elf/mt.h"
#include "elf/msp430.h"
#include "elf/nds32.h"
+#include "elf/nfp.h"
#include "elf/nios2.h"
#include "elf/or1k.h"
#include "elf/pj.h"
@@ -776,6 +777,7 @@ guess_is_rela (unsigned int e_machine)
case EM_CYGNUS_M32R:
case EM_SCORE:
case EM_XGATE:
+ case EM_NFP:
return FALSE;
/* Targets that use RELA relocations. */
@@ -1560,6 +1562,13 @@ dump_relocations (Filedata * filedata,
case EM_TI_PRU:
rtype = elf_pru_reloc_type (type);
break;
+
+ case EM_NFP:
+ if (EF_NFP_MACH (filedata->file_header.e_flags) == E_NFP_MACH_3200)
+ rtype = elf_nfp3200_reloc_type (type);
+ else
+ rtype = elf_nfp_reloc_type (type);
+ break;
}
if (rtype == NULL)
@@ -2472,6 +2481,7 @@ get_machine_name (unsigned e_machine)
case EM_RISCV: return "RISC-V";
case EM_LANAI: return "Lanai 32-bit processor";
case EM_BPF: return "Linux BPF";
+ case EM_NFP: return "Netronome Flow Processor";
/* Large numbers... */
case EM_MT: return "Morpho Techologies MT processor";
@@ -3440,6 +3450,18 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine)
decode_NDS32_machine_flags (e_flags, buf, sizeof buf);
break;
+ case EM_NFP:
+ switch (EF_NFP_MACH (e_flags))
+ {
+ case E_NFP_MACH_3200:
+ strcat (buf, ", NFP-32xx");
+ break;
+ case E_NFP_MACH_6000:
+ strcat (buf, ", NFP-6xxx");
+ break;
+ }
+ break;
+
case EM_RISCV:
if (e_flags & EF_RISCV_RVC)
strcat (buf, ", RVC");
@@ -4136,6 +4158,18 @@ get_msp430x_section_type_name (unsigned int sh_type)
}
static const char *
+get_nfp_section_type_name (unsigned int sh_type)
+{
+ switch (sh_type)
+ {
+ case SHT_NFP_MECONFIG: return "NFP_MECONFIG";
+ case SHT_NFP_INITREG: return "NFP_INITREG";
+ case SHT_NFP_UDEBUG: return "NFP_UDEBUG";
+ default: return NULL;
+ }
+}
+
+static const char *
get_v850_section_type_name (unsigned int sh_type)
{
switch (sh_type)
@@ -4221,6 +4255,9 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
case EM_MSP430:
result = get_msp430x_section_type_name (sh_type);
break;
+ case EM_NFP:
+ result = get_nfp_section_type_name (sh_type);
+ break;
case EM_V800:
case EM_V850:
case EM_CYGNUS_V850: