#define UNKNOWN -1
-#define SECTION_NAME(X) ((X) == NULL ? "<none>" : \
- ((X)->sh_name >= string_table_length \
- ? "<corrupt>" : string_table + (X)->sh_name))
+#define SECTION_NAME(X) \
+ ((X) == NULL ? "<none>" \
+ : string_table == NULL ? "<no-name>" \
+ : ((X)->sh_name >= string_table_length ? "<corrupt>" \
+ : string_table + (X)->sh_name))
/* Given st_shndx I, map to section_headers index. */
#define SECTION_HEADER_INDEX(I) \
case EM_BLACKFIN: return "Analog Devices Blackfin";
case EM_NIOS32: return "Altera Nios";
case EM_ALTERA_NIOS2: return "Altera Nios II";
+ case EM_XC16X: return "Infineon Technologies xc16x";
default:
snprintf (buff, sizeof (buff), _("<unknown>: %x"), e_machine);
return buff;
case EF_ARM_EABI_VER4:
strcat (buf, ", Version4 EABI");
+ goto eabi;
+
+ case EF_ARM_EABI_VER5:
+ strcat (buf, ", Version5 EABI");
+ eabi:
while (e_flags)
{
unsigned flag;
break;
case EM_68K:
- if (e_flags & EF_CPU32)
+ if (e_flags & EF_M68K_CPU32)
strcat (buf, ", cpu32");
- if (e_flags & EF_M68000)
+ if (e_flags & EF_M68K_M68000)
strcat (buf, ", m68000");
+ if (e_flags & EF_M68K_ISA_MASK)
+ {
+ char const *isa = _("unknown");
+ char const *mac = _("unknown mac");
+ char const *additional = NULL;
+
+ switch (e_flags & EF_M68K_ISA_MASK)
+ {
+ case EF_M68K_ISA_A_NODIV:
+ isa = "A";
+ additional = ", nodiv";
+ break;
+ case EF_M68K_ISA_A:
+ isa = "A";
+ break;
+ case EF_M68K_ISA_A_PLUS:
+ isa = "A+";
+ break;
+ case EF_M68K_ISA_B_NOUSP:
+ isa = "B";
+ additional = ", nousp";
+ break;
+ case EF_M68K_ISA_B:
+ isa = "B";
+ break;
+ }
+ strcat (buf, ", cf, isa ");
+ strcat (buf, isa);
+ if (additional)
+ strcat (buf, additional);
+ if (e_flags & EF_M68K_FLOAT)
+ strcat (buf, ", float");
+ switch (e_flags & EF_M68K_MAC_MASK)
+ {
+ case 0:
+ mac = NULL;
+ break;
+ case EF_M68K_MAC:
+ mac = "mac";
+ break;
+ case EF_M68K_EMAC:
+ mac = "emac";
+ break;
+ }
+ if (mac)
+ {
+ strcat (buf, ", ");
+ strcat (buf, mac);
+ }
+ }
break;
case EM_PPC:
case EF_SH4_NOFPU: strcat (buf, ", sh4-nofpu"); break;
case EF_SH4A_NOFPU: strcat (buf, ", sh4a-nofpu"); break;
case EF_SH2A_NOFPU: strcat (buf, ", sh2a-nofpu"); break;
+ case EF_SH3_NOMMU: strcat (buf, ", sh3-nommu"); break;
+ case EF_SH4_NOMMU_NOFPU: strcat (buf, ", sh4-nommu-nofpu"); break;
+ case EF_SH2A_SH4_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh4-nommu-nofpu"); break;
+ case EF_SH2A_SH3_NOFPU: strcat (buf, ", sh2a-nofpu-or-sh3-nommu"); break;
+ case EF_SH2A_SH4: strcat (buf, ", sh2a-or-sh4"); break;
+ case EF_SH2A_SH3E: strcat (buf, ", sh2a-or-sh3e"); break;
default: strcat (buf, ", unknown ISA"); break;
}
(long) elf_header.e_shstrndx);
if (section_headers != NULL && elf_header.e_shstrndx == SHN_XINDEX)
printf (" (%ld)", (long) section_headers[0].sh_link);
+ else if (elf_header.e_shstrndx != SHN_UNDEF
+ && (elf_header.e_shstrndx >= elf_header.e_shnum
+ || (elf_header.e_shstrndx >= SHN_LORESERVE
+ && elf_header.e_shstrndx <= SHN_HIRESERVE)))
+ printf (" <corrupt: out of range>");
putc ('\n', stdout);
}
elf_header.e_shnum = section_headers[0].sh_size;
if (elf_header.e_shstrndx == SHN_XINDEX)
elf_header.e_shstrndx = section_headers[0].sh_link;
+ else if (elf_header.e_shstrndx != SHN_UNDEF
+ && (elf_header.e_shstrndx >= elf_header.e_shnum
+ || (elf_header.e_shstrndx >= SHN_LORESERVE
+ && elf_header.e_shstrndx <= SHN_HIRESERVE)))
+ elf_header.e_shstrndx = SHN_UNDEF;
free (section_headers);
section_headers = NULL;
}
for (j = 1; j < elf_header.e_shnum; j++, section++)
{
- if (section->sh_size > 0
- /* PT_DYNAMIC segment contains only SHT_DYNAMIC
- sections. */
- && (segment->p_type != PT_DYNAMIC
- || section->sh_type == SHT_DYNAMIC)
- /* Compare allocated sections by VMA, unallocated
- sections by file offset. */
- && (section->sh_flags & SHF_ALLOC
- ? (section->sh_addr >= segment->p_vaddr
- && section->sh_addr + section->sh_size
- <= segment->p_vaddr + segment->p_memsz)
- : ((bfd_vma) section->sh_offset >= segment->p_offset
- && (section->sh_offset + section->sh_size
- <= segment->p_offset + segment->p_filesz))))
+ if (ELF_IS_SECTION_IN_SEGMENT_MEMORY(section, segment))
printf ("%s ", SECTION_NAME (section));
}
return 0;
/* Read in the string table, so that we have names to display. */
- if (SECTION_HEADER_INDEX (elf_header.e_shstrndx) < elf_header.e_shnum)
+ if (elf_header.e_shstrndx != SHN_UNDEF
+ && SECTION_HEADER_INDEX (elf_header.e_shstrndx) < elf_header.e_shnum)
{
section = SECTION_HEADER (elf_header.e_shstrndx);
&& find_section (".gcc_compiled_long32") == NULL)
eh_addr_size = 8;
break;
+
+ case EM_H8_300:
+ case EM_H8_300H:
+ switch (elf_header.e_flags & EF_H8_MACH)
+ {
+ case E_H8_MACH_H8300:
+ case E_H8_MACH_H8300HN:
+ case E_H8_MACH_H8300SN:
+ case E_H8_MACH_H8300SXN:
+ eh_addr_size = 2;
+ break;
+ case E_H8_MACH_H8300H:
+ case E_H8_MACH_H8300S:
+ case E_H8_MACH_H8300SX:
+ eh_addr_size = 4;
+ break;
+ }
}
#define CHECK_ENTSIZE_VALUES(section, i, size32, size64) \
static const char *arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"};
static const char *arm_attr_tag_THUMB_ISA_use[] =
{"No", "Thumb-1", "Thumb-2"};
-static const char *arm_attr_tag_VFP_arch[] = {"No", "VFPv1", "VFPv2"};
+/* FIXME: VFPv3 encoding was extrapolated! */
+static const char *arm_attr_tag_VFP_arch[] = {"No", "VFPv1", "VFPv2", "VFPv3"};
static const char *arm_attr_tag_WMMX_arch[] = {"No", "WMMXv1"};
static const char *arm_attr_tag_NEON_arch[] = {"No", "NEONv1"};
static const char *arm_attr_tag_ABI_PCS_config[] =
#define LOOKUP(id, name) \
{id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}
-static arm_attr_public_tag arm_attr_public_tags[] =
+static arm_attr_public_tag arm_attr_public_tags[] =
{
{4, "CPU_raw_name", 1, NULL},
{5, "CPU_name", 1, NULL},
contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size,
_("attributes"));
-
+
if (!contents)
continue;
p = contents;
{
printf (_("Unknown format '%c'\n"), *p);
}
-
+
free(contents);
}
return 1;
assert (num_dump_sects >= num_cmdline_dump_sects);
memcpy (dump_sects, cmdline_dump_sects, num_cmdline_dump_sects);
}
-
+
if (! process_file_header ())
return 1;
archive_file_offset = ftell (file);
archive_file_size = strtoul (arhdr.ar_size, NULL, 10);
-
+
ret |= process_object (namealc, file);
free (namealc);