X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Freadelf.c;h=8335538e0334572d164e4fd50f292ea25ac42bbb;hb=7f99954970001cfc1b155d877ac2966d77e2c647;hp=b85db9f97cef6893376effd33514c96dd53bf2ac;hpb=6d4f21f6eee9933a2883f2a214953432c13ee1c2;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/readelf.c b/binutils/readelf.c index b85db9f97c..8335538e03 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -119,6 +119,7 @@ #include "elf/m32r.h" #include "elf/m68k.h" #include "elf/m68hc11.h" +#include "elf/s12z.h" #include "elf/mcore.h" #include "elf/mep.h" #include "elf/metag.h" @@ -131,6 +132,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" @@ -515,7 +517,8 @@ print_symbol (signed int width, const char *symbol) width = - width; extra_padding = TRUE; } - assert (width != 0); + else if (width == 0) + return 0; if (do_wide) /* Set the remaining width to a very large value. @@ -775,6 +778,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. */ @@ -1271,6 +1275,10 @@ dump_relocations (Filedata * filedata, rtype = elf_m68hc11_reloc_type (type); break; + case EM_S12Z: + rtype = elf_s12z_reloc_type (type); + break; + case EM_68K: rtype = elf_m68k_reloc_type (type); break; @@ -1559,6 +1567,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) @@ -2273,7 +2288,7 @@ get_machine_name (unsigned e_machine) case EM_PARISC: return "HPPA"; case EM_VPP550: return "Fujitsu VPP500"; case EM_SPARC32PLUS: return "Sparc v8+" ; - case EM_960: return "Intel 90860"; + case EM_960: return "Intel 80960"; case EM_PPC: return "PowerPC"; /* 20 */ case EM_PPC64: return "PowerPC64"; @@ -2471,6 +2486,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"; @@ -2484,6 +2500,7 @@ get_machine_name (unsigned e_machine) case EM_CYGNUS_MEP: return "Toshiba MeP Media Engine"; case EM_ADAPTEVA_EPIPHANY: return "Adapteva EPIPHANY"; case EM_CYGNUS_FRV: return "Fujitsu FR-V"; + case EM_S12Z: return "Freescale S12Z"; default: snprintf (buff, sizeof (buff), _(": 0x%x"), e_machine); @@ -2577,6 +2594,12 @@ decode_ARM_machine_flags (unsigned e_flags, char buf[]) e_flags &= ~ EF_ARM_RELEXEC; } + if (e_flags & EF_ARM_PIC) + { + strcat (buf, ", position independent"); + e_flags &= ~ EF_ARM_PIC; + } + /* Now handle EABI specific flags. */ switch (eabi) { @@ -3433,10 +3456,25 @@ 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"); + if (e_flags & EF_RISCV_RVE) + strcat (buf, ", RVE"); + switch (e_flags & EF_RISCV_FLOAT_ABI) { case EF_RISCV_FLOAT_ABI_SOFT: @@ -3717,6 +3755,7 @@ get_osabi_name (Filedata * filedata, unsigned int osabi) switch (osabi) { case ELFOSABI_ARM: return "ARM"; + case ELFOSABI_ARM_FDPIC: return "ARM FDPIC"; default: break; } @@ -4127,6 +4166,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) { @@ -4213,6 +4264,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: @@ -9653,7 +9707,7 @@ process_dynamic_section (Filedata * filedata) if (archive_file_offset != 0) str_tab_len = archive_file_size - offset; else - str_tab_len = filedata->file_size; + str_tab_len = filedata->file_size - offset; if (str_tab_len < 1) { @@ -10009,6 +10063,21 @@ process_dynamic_section (Filedata * filedata) printf (" PIE"); val ^= DF_1_PIE; } + if (val & DF_1_KMOD) + { + printf (" KMOD"); + val ^= DF_1_KMOD; + } + if (val & DF_1_WEAKFILTER) + { + printf (" WEAKFILTER"); + val ^= DF_1_WEAKFILTER; + } + if (val & DF_1_NOCOMMON) + { + printf (" NOCOMMON"); + val ^= DF_1_NOCOMMON; + } if (val != 0) printf (" %lx", val); puts (""); @@ -12248,6 +12317,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) case EM_68HC11: case EM_68HC12: return reloc_type == 6; /* R_M68HC11_32. */ + case EM_S12Z: + return reloc_type == 6; /* R_S12Z_EXT32. */ case EM_MCORE: return reloc_type == 1; /* R_MCORE_ADDR32. */ case EM_CYGNUS_MEP: @@ -12282,7 +12353,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) case EM_OR1K: return reloc_type == 1; /* R_OR1K_32. */ case EM_PARISC: - return (reloc_type == 1 /* R_PARISC_DIR32. */ + return (reloc_type == 1 /* R_PARISC_DIR32. */ + || reloc_type == 2 /* R_PARISC_DIR21L. */ || reloc_type == 41); /* R_PARISC_SECREL32. */ case EM_PJ: case EM_PJ_OLD: @@ -17487,6 +17559,13 @@ get_symbol_for_build_attribute (Filedata * filedata, if (strtab[sym->st_name] == 0) continue; + /* The AArch64 and ARM architectures define mapping symbols + (eg $d, $x, $t) which we want to ignore. */ + if (strtab[sym->st_name] == '$' + && strtab[sym->st_name + 1] != 0 + && strtab[sym->st_name + 2] == 0) + continue; + if (is_open_attr) { /* For OPEN attributes we prefer GLOBAL over LOCAL symbols @@ -17615,6 +17694,12 @@ print_gnu_build_attribute_description (Elf_Internal_Note * pnote, name = NULL; sym = get_symbol_for_build_attribute (filedata, start, is_open_attr, & name); + /* As of version 5 of the annobin plugin, filename symbols are biased by 2 + in order to avoid them being confused with the start address of the + first function in the file... */ + if (sym == NULL && is_open_attr) + sym = get_symbol_for_build_attribute (filedata, start + 2, is_open_attr, + & name); if (end == 0 && sym != NULL && sym->st_size > 0) end = start + sym->st_size;