}
}
+static const char *
+get_solaris_section_type (unsigned long type)
+{
+ switch (type)
+ {
+ case 0x6fffffee: return "SUNW_ancillary";
+ case 0x6fffffef: return "SUNW_capchain";
+ case 0x6ffffff0: return "SUNW_capinfo";
+ case 0x6ffffff1: return "SUNW_symsort";
+ case 0x6ffffff2: return "SUNW_tlssort";
+ case 0x6ffffff3: return "SUNW_LDYNSYM";
+ case 0x6ffffff4: return "SUNW_dof";
+ case 0x6ffffff5: return "SUNW_cap";
+ case 0x6ffffff6: return "SUNW_SIGNATURE";
+ case 0x6ffffff7: return "SUNW_ANNOTATE";
+ case 0x6ffffff8: return "SUNW_DEBUGSTR";
+ case 0x6ffffff9: return "SUNW_DEBUG";
+ case 0x6ffffffa: return "SUNW_move";
+ case 0x6ffffffb: return "SUNW_COMDAT";
+ case 0x6ffffffc: return "SUNW_syminfo";
+ case 0x6ffffffd: return "SUNW_verdef";
+ case 0x6ffffffe: return "SUNW_verneed";
+ case 0x6fffffff: return "SUNW_versym";
+ case 0x70000000: return "SPARC_GOTDATA";
+ default: return NULL;
+ }
+}
+
static const char *
get_alpha_dynamic_type (unsigned long type)
{
}
}
+static const char *
+get_solaris_dynamic_type (unsigned long type)
+{
+ switch (type)
+ {
+ case 0x6000000d: return "SUNW_AUXILIARY";
+ case 0x6000000e: return "SUNW_RTLDINF";
+ case 0x6000000f: return "SUNW_FILTER";
+ case 0x60000010: return "SUNW_CAP";
+ case 0x60000011: return "SUNW_SYMTAB";
+ case 0x60000012: return "SUNW_SYMSZ";
+ case 0x60000013: return "SUNW_SORTENT";
+ case 0x60000014: return "SUNW_SYMSORT";
+ case 0x60000015: return "SUNW_SYMSORTSZ";
+ case 0x60000016: return "SUNW_TLSSORT";
+ case 0x60000017: return "SUNW_TLSSORTSZ";
+ case 0x60000018: return "SUNW_CAPINFO";
+ case 0x60000019: return "SUNW_STRPAD";
+ case 0x6000001a: return "SUNW_CAPCHAIN";
+ case 0x6000001b: return "SUNW_LDMACH";
+ case 0x6000001d: return "SUNW_CAPCHAINENT";
+ case 0x6000001f: return "SUNW_CAPCHAINSZ";
+ case 0x60000021: return "SUNW_PARENT";
+ case 0x60000023: return "SUNW_ASLR";
+ case 0x60000025: return "SUNW_RELAX";
+ case 0x60000029: return "SUNW_NXHEAP";
+ case 0x6000002b: return "SUNW_NXSTACK";
+
+ case 0x70000001: return "SPARC_REGISTER";
+ case 0x7ffffffd: return "AUXILIARY";
+ case 0x7ffffffe: return "USED";
+ case 0x7fffffff: return "FILTER";
+
+ default: return NULL;
+ }
+}
+
static const char *
get_dynamic_type (unsigned long type)
{
result = get_nios2_dynamic_type (type);
break;
default:
- result = NULL;
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ result = get_solaris_dynamic_type (type);
+ else
+ result = NULL;
break;
}
result = get_ia64_dynamic_type (type);
break;
default:
- result = NULL;
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ result = get_solaris_dynamic_type (type);
+ else
+ result = NULL;
break;
}
case E_ARC_MACH_ARC700:
strcat (buf, ", ARC700");
break;
- case E_ARC_MACH_NPS400:
- strcat (buf, ", NPS400");
- break;
/* The only times we should end up here are (a) A corrupt ELF, (b) A
new ELF with new architecture being read by an old version of
return NULL;
}
+static const char *
+get_solaris_segment_type (unsigned long type)
+{
+ switch (type)
+ {
+ case 0x6464e550: return "PT_SUNW_UNWIND";
+ case 0x6474e550: return "PT_SUNW_EH_FRAME";
+ case 0x6ffffff7: return "PT_LOSUNW";
+ case 0x6ffffffa: return "PT_SUNWBSS";
+ case 0x6ffffffb: return "PT_SUNWSTACK";
+ case 0x6ffffffc: return "PT_SUNWDTRACE";
+ case 0x6ffffffd: return "PT_SUNWCAP";
+ case 0x6fffffff: return "PT_HISUNW";
+ default: return NULL;
+ }
+}
+
static const char *
get_segment_type (unsigned long p_type)
{
result = get_ia64_segment_type (p_type);
break;
default:
- result = NULL;
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ result = get_solaris_segment_type (p_type);
+ else
+ result = NULL;
break;
}
result = get_ia64_section_type_name (sh_type);
break;
default:
- result = NULL;
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ result = get_solaris_section_type (sh_type);
+ else
+ result = NULL;
break;
}
error (_("Out of memory allocating dump request table.\n"));
else
{
- /* Copy current flag settings. */
- memcpy (new_dump_sects, dump_sects, num_dump_sects * sizeof (* dump_sects));
+ if (dump_sects)
+ {
+ /* Copy current flag settings. */
+ memcpy (new_dump_sects, dump_sects, num_dump_sects * sizeof (* dump_sects));
- free (dump_sects);
+ free (dump_sects);
+ }
dump_sects = new_dump_sects;
num_dump_sects = section + 1;
internal->sh_info = BYTE_GET (shdrs[i].sh_info);
internal->sh_addralign = BYTE_GET (shdrs[i].sh_addralign);
internal->sh_entsize = BYTE_GET (shdrs[i].sh_entsize);
+ if (!probe && internal->sh_link > num)
+ warn (_("Section %u has an out of range sh_link value of %u\n"), i, internal->sh_link);
+ if (!probe && internal->sh_flags & SHF_INFO_LINK && internal->sh_info > num)
+ warn (_("Section %u has an out of range sh_info value of %u\n"), i, internal->sh_info);
}
free (shdrs);
internal->sh_info = BYTE_GET (shdrs[i].sh_info);
internal->sh_offset = BYTE_GET (shdrs[i].sh_offset);
internal->sh_addralign = BYTE_GET (shdrs[i].sh_addralign);
+ if (!probe && internal->sh_link > num)
+ warn (_("Section %u has an out of range sh_link value of %u\n"), i, internal->sh_link);
+ if (!probe && internal->sh_flags & SHF_INFO_LINK && internal->sh_info > num)
+ warn (_("Section %u has an out of range sh_info value of %u\n"), i, internal->sh_info);
}
free (shdrs);
/* 20 */ { STRING_COMMA_LEN ("COMPRESSED") },
/* ARM specific. */
/* 21 */ { STRING_COMMA_LEN ("ENTRYSECT") },
- /* 22 */ { STRING_COMMA_LEN ("ARM_NOREAD") },
+ /* 22 */ { STRING_COMMA_LEN ("ARM_PURECODE") },
/* 23 */ { STRING_COMMA_LEN ("COMDEF") }
};
switch (flag)
{
case SHF_ENTRYSECT: sindex = 21; break;
- case SHF_ARM_NOREAD: sindex = 22; break;
+ case SHF_ARM_PURECODE: sindex = 22; break;
case SHF_COMDEF: sindex = 23; break;
default: break;
}
&& flag == SHF_X86_64_LARGE)
*p = 'l';
else if (elf_header.e_machine == EM_ARM
- && flag == SHF_ARM_NOREAD)
+ && flag == SHF_ARM_PURECODE)
*p = 'y';
else if (flag & SHF_MASKOS)
{
if (is_32bit_elf)
{
Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) buf;
+
chdr->ch_type = BYTE_GET (echdr->ch_type);
chdr->ch_size = BYTE_GET (echdr->ch_size);
chdr->ch_addralign = BYTE_GET (echdr->ch_addralign);
else
{
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) buf;
+
chdr->ch_type = BYTE_GET (echdr->ch_type);
chdr->ch_size = BYTE_GET (echdr->ch_size);
chdr->ch_addralign = BYTE_GET (echdr->ch_addralign);
i < elf_header.e_shnum;
i++, section++)
{
+ /* Run some sanity checks on the section header. */
+
+ /* Check the sh_link field. */
+ switch (section->sh_type)
+ {
+ case SHT_SYMTAB_SHNDX:
+ case SHT_GROUP:
+ case SHT_HASH:
+ case SHT_GNU_HASH:
+ case SHT_GNU_versym:
+ case SHT_REL:
+ case SHT_RELA:
+ if (section->sh_link < 1
+ || section->sh_link > elf_header.e_shnum
+ || (section_headers[section->sh_link].sh_type != SHT_SYMTAB
+ && section_headers[section->sh_link].sh_type != SHT_DYNSYM))
+ warn (_("[%2u]: Link field (%u) should index a symtab section.\n"),
+ i, section->sh_link);
+ break;
+
+ case SHT_DYNAMIC:
+ case SHT_SYMTAB:
+ case SHT_DYNSYM:
+ case SHT_GNU_verneed:
+ case SHT_GNU_verdef:
+ case SHT_GNU_LIBLIST:
+ if (section->sh_link < 1
+ || section->sh_link > elf_header.e_shnum
+ || section_headers[section->sh_link].sh_type != SHT_STRTAB)
+ warn (_("[%2u]: Link field (%u) should index a string section.\n"),
+ i, section->sh_link);
+ break;
+
+ case SHT_INIT_ARRAY:
+ case SHT_FINI_ARRAY:
+ case SHT_PREINIT_ARRAY:
+ if (section->sh_type < SHT_LOOS && section->sh_link != 0)
+ warn (_("[%2u]: Unexpected value (%u) in link field.\n"),
+ i, section->sh_link);
+ break;
+
+ default:
+ /* FIXME: Add support for target specific section types. */
+#if 0 /* Currently we do not check other section types as there are too
+ many special cases. Stab sections for example have a type
+ of SHT_PROGBITS but an sh_link field that links to the .stabstr
+ section. */
+ if (section->sh_type < SHT_LOOS && section->sh_link != 0)
+ warn (_("[%2u]: Unexpected value (%u) in link field.\n"),
+ i, section->sh_link);
+#endif
+ break;
+ }
+
+ /* Check the sh_info field. */
+ switch (section->sh_type)
+ {
+ case SHT_REL:
+ case SHT_RELA:
+ if (section->sh_info < 1
+ || section->sh_info > elf_header.e_shnum
+ || (section_headers[section->sh_info].sh_type != SHT_PROGBITS
+ && section_headers[section->sh_info].sh_type != SHT_NOBITS
+ && section_headers[section->sh_info].sh_type != SHT_NOTE
+ && section_headers[section->sh_info].sh_type != SHT_INIT_ARRAY
+ /* FIXME: Are other section types valid ? */
+ && section_headers[section->sh_info].sh_type < SHT_LOOS))
+ {
+ if (section->sh_info == 0
+ && (streq (SECTION_NAME (section), ".rel.dyn")
+ || streq (SECTION_NAME (section), ".rela.dyn")))
+ /* The .rel.dyn and .rela.dyn sections have an sh_info field
+ of zero. No idea why. I would have expected the index
+ of the .plt section. */
+ ;
+ else
+ warn (_("[%2u]: Info field (%u) should index a relocatable section.\n"),
+ i, section->sh_info);
+ }
+ break;
+
+ case SHT_DYNAMIC:
+ case SHT_HASH:
+ case SHT_SYMTAB_SHNDX:
+ case SHT_INIT_ARRAY:
+ case SHT_FINI_ARRAY:
+ case SHT_PREINIT_ARRAY:
+ if (section->sh_info != 0)
+ warn (_("[%2u]: Unexpected value (%u) in info field.\n"),
+ i, section->sh_info);
+ break;
+
+ case SHT_GROUP:
+ case SHT_SYMTAB:
+ case SHT_DYNSYM:
+ /* A symbol index - we assume that it is valid. */
+ break;
+
+ default:
+ /* FIXME: Add support for target specific section types. */
+ if (section->sh_type == SHT_NOBITS)
+ /* NOBITS section headers with non-zero sh_info fields can be
+ created when a binary is stripped of everything but its debug
+ information. The stripped sections have their headers preserved but their types set to SHT_NOBITS. so do not check this type of section. */
+ ;
+ else if (section->sh_flags & SHF_INFO_LINK)
+ {
+ if (section->sh_info < 1 || section->sh_info > elf_header.e_shnum)
+ warn (_("[%2u]: Expected link to another section in info field"), i);
+ }
+ else if (section->sh_type < SHT_LOOS && section->sh_info != 0)
+ warn (_("[%2u]: Unexpected value (%u) in info field.\n"),
+ i, section->sh_info);
+ break;
+ }
+
printf (" [%2u] ", i);
if (do_section_details)
printf ("%s\n ", printable_section_name (section));
/* Minimum section size is 12 bytes for 32-bit compression
header + 12 bytes for compressed data header. */
unsigned char buf[24];
+
assert (sizeof (buf) >= sizeof (Elf64_External_Chdr));
if (get_data (&buf, (FILE *) file, section->sh_offset, 1,
sizeof (buf), _("compression header")))
{
Elf_Internal_Chdr chdr;
- get_compression_header (&chdr, buf);
+
+ (void) get_compression_header (&chdr, buf);
+
if (chdr.ch_type == ELFCOMPRESS_ZLIB)
printf (" ZLIB, ");
else
printf (_("Key to Flags:\n\
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),\n\
L (link order), O (extra OS processing required), G (group), T (TLS),\n\
- C (compressed), x (unknown), o (OS specific), E (exclude),\n"));
+ C (compressed), x (unknown), o (OS specific), E (exclude),\n "));
if (elf_header.e_machine == EM_X86_64
|| elf_header.e_machine == EM_L1OM
|| elf_header.e_machine == EM_K1OM)
printf (_("l (large), "));
else if (elf_header.e_machine == EM_ARM)
- printf (_("y (noread), "));
+ printf (_("y (purecode), "));
printf ("p (processor specific)\n");
}
case DT_MIPS_TIME_STAMP:
{
- char timebuf[20];
+ char timebuf[128];
struct tm * tmp;
time_t atime = entry->d_un.d_val;
case DT_MIPS_DELTA_SYM_NO:
case DT_MIPS_DELTA_CLASSSYM_NO:
case DT_MIPS_COMPACT_SIZE:
- print_vma (entry->d_un.d_ptr, DEC);
+ print_vma (entry->d_un.d_val, DEC);
break;
default:
}
}
+static const char *
+get_solaris_symbol_visibility (unsigned int visibility)
+{
+ switch (visibility)
+ {
+ case 4: return "EXPORTED";
+ case 5: return "SINGLETON";
+ case 6: return "ELIMINATE";
+ default: return get_symbol_visibility (visibility);
+ }
+}
+
static const char *
get_mips_symbol_other (unsigned int other)
{
result = get_ppc64_symbol_other (other);
break;
default:
+ result = NULL;
break;
}
printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
- printf (" %-7s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
- /* Check to see if any other bits in the st_other field are set.
- Note - displaying this information disrupts the layout of the
- table being generated, but for the moment this case is very
- rare. */
- if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))
- printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)));
+
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ printf (" %-7s", get_solaris_symbol_visibility (psym->st_other));
+ else
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+
+ printf (" %-7s", get_symbol_visibility (vis));
+ /* Check to see if any other bits in the st_other field are set.
+ Note - displaying this information disrupts the layout of the
+ table being generated, but for the moment this case is very
+ rare. */
+ if (psym->st_other ^ vis)
+ printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
+ }
+
printf (" %3.3s ", get_symbol_index_type (psym->st_shndx));
if (VALID_DYNAMIC_NAME (psym->st_name))
print_symbol (25, GET_DYNAMIC_NAME (psym->st_name));
print_vma (psym->st_size, DEC_5);
printf (" %-7s", get_symbol_type (ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (ELF_ST_BIND (psym->st_info)));
- printf (" %-7s", get_symbol_visibility (ELF_ST_VISIBILITY (psym->st_other)));
- /* Check to see if any other bits in the st_other field are set.
- Note - displaying this information disrupts the layout of the
- table being generated, but for the moment this case is very rare. */
- if (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other))
- printf (" [%s] ", get_symbol_other (psym->st_other ^ ELF_ST_VISIBILITY (psym->st_other)));
+ if (elf_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
+ printf (" %-7s", get_solaris_symbol_visibility (psym->st_other));
+ else
+ {
+ unsigned int vis = ELF_ST_VISIBILITY (psym->st_other);
+
+ printf (" %-7s", get_symbol_visibility (vis));
+ /* Check to see if any other bits in the st_other field are set.
+ Note - displaying this information disrupts the layout of the
+ table being generated, but for the moment this case is very rare. */
+ if (psym->st_other ^ vis)
+ printf (" [%s] ", get_symbol_other (psym->st_other ^ vis));
+ }
printf (" %4s ", get_symbol_index_type (psym->st_shndx));
print_symbol (25, psym->st_name < strtab_size
? strtab + psym->st_name : _("<corrupt>"));
}
putchar ('\n');
+
+ if (ELF_ST_BIND (psym->st_info) == STB_LOCAL
+ && si >= section->sh_info
+ /* Irix 5 and 6 MIPS binaries are known to ignore this requirement. */
+ && elf_header.e_machine != EM_MIPS
+ /* Solaris binaries have been found to violate this requirement as
+ well. Not sure if this is a bug or an ABI requirement. */
+ && elf_header.e_ident[EI_OSABI] != ELFOSABI_SOLARIS)
+ warn (_("local symbol %u found at index >= %s's sh_info value of %u\n"),
+ si, printable_section_name (section), section->sh_info);
}
free (symtab);
static bfd_boolean
is_32bit_abs_reloc (unsigned int reloc_type)
{
+ /* Please keep this table alpha-sorted for ease of visual lookup. */
switch (elf_header.e_machine)
{
case EM_386:
return reloc_type == 2; /* R_960_32. */
case EM_AARCH64:
return reloc_type == 258; /* R_AARCH64_ABS32 */
+ case EM_ADAPTEVA_EPIPHANY:
+ return reloc_type == 3;
case EM_ALPHA:
return reloc_type == 1; /* R_ALPHA_REFLONG. */
case EM_ARC:
case EM_AVR_OLD:
case EM_AVR:
return reloc_type == 1;
- case EM_ADAPTEVA_EPIPHANY:
- return reloc_type == 3;
case EM_BLACKFIN:
return reloc_type == 0x12; /* R_byte4_data. */
case EM_CRIS:
is_32bit_pcrel_reloc (unsigned int reloc_type)
{
switch (elf_header.e_machine)
+ /* Please keep this table alpha-sorted for ease of visual lookup. */
{
case EM_386:
case EM_IAMCU:
return reloc_type == 49; /* R_ARC_32_PCREL. */
case EM_ARM:
return reloc_type == 3; /* R_ARM_REL32 */
+ case EM_AVR_OLD:
+ case EM_AVR:
+ return reloc_type == 36; /* R_AVR_32_PCREL. */
case EM_MICROBLAZE:
return reloc_type == 2; /* R_MICROBLAZE_32_PCREL. */
case EM_OR1K:
case EM_CYGNUS_MN10200:
case EM_MN10200:
return reloc_type == 4; /* R_MN10200_24. */
+ case EM_FT32:
+ return reloc_type == 5; /* R_FT32_20. */
default:
return FALSE;
}
static bfd_boolean
is_16bit_abs_reloc (unsigned int reloc_type)
{
+ /* Please keep this table alpha-sorted for ease of visual lookup. */
switch (elf_header.e_machine)
{
case EM_ARC:
case EM_ARC_COMPACT:
case EM_ARC_COMPACT2:
return reloc_type == 2; /* R_ARC_16. */
+ case EM_ADAPTEVA_EPIPHANY:
+ return reloc_type == 5;
case EM_AVR_OLD:
case EM_AVR:
return reloc_type == 4; /* R_AVR_16. */
- case EM_ADAPTEVA_EPIPHANY:
- return reloc_type == 5;
case EM_CYGNUS_D10V:
case EM_D10V:
return reloc_type == 3; /* R_D10V_16. */
case EM_M32C_OLD:
case EM_M32C:
return reloc_type == 1; /* R_M32C_16 */
+ case EM_CYGNUS_MN10200:
+ case EM_MN10200:
+ return reloc_type == 2; /* R_MN10200_16. */
+ case EM_CYGNUS_MN10300:
+ case EM_MN10300:
+ return reloc_type == 2; /* R_MN10300_16. */
case EM_MSP430:
if (uses_msp430x_relocs ())
return reloc_type == 2; /* R_MSP430_ABS16. */
return reloc_type == 2; /* R_OR1K_16. */
case EM_TI_C6000:
return reloc_type == 2; /* R_C6000_ABS16. */
+ case EM_VISIUM:
+ return reloc_type == 2; /* R_VISIUM_16. */
case EM_XC16X:
case EM_C166:
return reloc_type == 2; /* R_XC16C_ABS_16. */
- case EM_CYGNUS_MN10200:
- case EM_MN10200:
- return reloc_type == 2; /* R_MN10200_16. */
- case EM_CYGNUS_MN10300:
- case EM_MN10300:
- return reloc_type == 2; /* R_MN10300_16. */
- case EM_VISIUM:
- return reloc_type == 2; /* R_VISIUM_16. */
case EM_XGATE:
return reloc_type == 3; /* R_XGATE_16. */
default:
{
switch (elf_header.e_machine)
{
- case EM_68K: /* R_68K_NONE. */
case EM_386: /* R_386_NONE. */
- case EM_SPARC32PLUS:
- case EM_SPARCV9:
- case EM_SPARC: /* R_SPARC_NONE. */
- case EM_MIPS: /* R_MIPS_NONE. */
- case EM_PARISC: /* R_PARISC_NONE. */
- case EM_ALPHA: /* R_ALPHA_NONE. */
+ case EM_68K: /* R_68K_NONE. */
case EM_ADAPTEVA_EPIPHANY:
- case EM_PPC: /* R_PPC_NONE. */
- case EM_PPC64: /* R_PPC64_NONE. */
+ case EM_ALPHA: /* R_ALPHA_NONE. */
+ case EM_ALTERA_NIOS2: /* R_NIOS2_NONE. */
case EM_ARC: /* R_ARC_NONE. */
- case EM_ARC_COMPACT: /* R_ARC_NONE. */
case EM_ARC_COMPACT2: /* R_ARC_NONE. */
+ case EM_ARC_COMPACT: /* R_ARC_NONE. */
case EM_ARM: /* R_ARM_NONE. */
- case EM_IA_64: /* R_IA64_NONE. */
- case EM_SH: /* R_SH_NONE. */
- case EM_S390_OLD:
- case EM_S390: /* R_390_NONE. */
+ case EM_C166: /* R_XC16X_NONE. */
case EM_CRIS: /* R_CRIS_NONE. */
- case EM_X86_64: /* R_X86_64_NONE. */
- case EM_L1OM: /* R_X86_64_NONE. */
+ case EM_FT32: /* R_FT32_NONE. */
+ case EM_IA_64: /* R_IA64_NONE. */
case EM_K1OM: /* R_X86_64_NONE. */
+ case EM_L1OM: /* R_X86_64_NONE. */
+ case EM_M32R: /* R_M32R_NONE. */
+ case EM_MIPS: /* R_MIPS_NONE. */
case EM_MN10300: /* R_MN10300_NONE. */
- case EM_FT32: /* R_FT32_NONE. */
case EM_MOXIE: /* R_MOXIE_NONE. */
- case EM_M32R: /* R_M32R_NONE. */
- case EM_TI_C6000:/* R_C6000_NONE. */
+ case EM_NIOS32: /* R_NIOS_NONE. */
+ case EM_OR1K: /* R_OR1K_NONE. */
+ case EM_PARISC: /* R_PARISC_NONE. */
+ case EM_PPC64: /* R_PPC64_NONE. */
+ case EM_PPC: /* R_PPC_NONE. */
+ case EM_S390: /* R_390_NONE. */
+ case EM_S390_OLD:
+ case EM_SH: /* R_SH_NONE. */
+ case EM_SPARC32PLUS:
+ case EM_SPARC: /* R_SPARC_NONE. */
+ case EM_SPARCV9:
case EM_TILEGX: /* R_TILEGX_NONE. */
case EM_TILEPRO: /* R_TILEPRO_NONE. */
+ case EM_TI_C6000:/* R_C6000_NONE. */
+ case EM_X86_64: /* R_X86_64_NONE. */
case EM_XC16X:
- case EM_C166: /* R_XC16X_NONE. */
- case EM_ALTERA_NIOS2: /* R_NIOS2_NONE. */
- case EM_NIOS32: /* R_NIOS_NONE. */
- case EM_OR1K: /* R_OR1K_NONE. */
return reloc_type == 0;
+
case EM_AARCH64:
return reloc_type == 0 || reloc_type == 256;
+ case EM_AVR_OLD:
+ case EM_AVR:
+ return (reloc_type == 0 /* R_AVR_NONE. */
+ || reloc_type == 30 /* R_AVR_DIFF8. */
+ || reloc_type == 31 /* R_AVR_DIFF16. */
+ || reloc_type == 32 /* R_AVR_DIFF32. */);
+ case EM_METAG:
+ return reloc_type == 3; /* R_METAG_NONE. */
case EM_NDS32:
return (reloc_type == 0 /* R_XTENSA_NONE. */
|| reloc_type == 204 /* R_NDS32_DIFF8. */
|| reloc_type == 17 /* R_XTENSA_DIFF8. */
|| reloc_type == 18 /* R_XTENSA_DIFF16. */
|| reloc_type == 19 /* R_XTENSA_DIFF32. */);
- case EM_METAG:
- return reloc_type == 3; /* R_METAG_NONE. */
}
return FALSE;
}
if ((sec->sh_flags & SHF_COMPRESSED) != 0)
{
Elf_Internal_Chdr chdr;
- unsigned int compression_header_size
- = get_compression_header (&chdr, start);
+ unsigned int compression_header_size;
+
+ if (size < (is_32bit_elf
+ ? sizeof (Elf32_External_Chdr)
+ : sizeof (Elf64_External_Chdr)))
+ {
+ warn (_("compressed section %s is too small to contain a compression header"),
+ section->name);
+ return 0;
+ }
+
+ compression_header_size = get_compression_header (&chdr, start);
+
if (chdr.ch_type != ELFCOMPRESS_ZLIB)
{
warn (_("section '%s' has unsupported compress type: %d\n"),
{"Not Allowed", "Allowed"};
static const char * arm_attr_tag_ABI_FP_16bit_format[] =
{"None", "IEEE 754", "Alternative Format"};
+static const char * arm_attr_tag_DSP_extension[] =
+ {"Follow architecture", "Allowed"};
static const char * arm_attr_tag_MPextension_use[] =
{"Not Allowed", "Allowed"};
static const char * arm_attr_tag_DIV_use[] =
LOOKUP(38, ABI_FP_16bit_format),
LOOKUP(42, MPextension_use),
LOOKUP(44, DIV_use),
+ LOOKUP(46, DSP_extension),
{64, "nodefaults", 0, NULL},
{65, "also_compatible_with", 0, NULL},
LOOKUP(66, T2EE_use),
const unsigned char * const end)
{
unsigned int len;
- int val;
+ unsigned int val;
if (tag == Tag_GNU_Power_ABI_FP)
{
val = read_uleb128 (p, &len, end);
p += len;
printf (" Tag_GNU_Power_ABI_FP: ");
+ if (len == 0)
+ {
+ printf (_("<corrupt>\n"));
+ return p;
+ }
- switch (val)
+ if (val > 15)
+ printf ("(%#x), ", val);
+
+ switch (val & 3)
{
case 0:
- printf (_("Hard or soft float\n"));
+ printf (_("unspecified hard/soft float, "));
break;
case 1:
- printf (_("Hard float\n"));
+ printf (_("hard float, "));
break;
case 2:
- printf (_("Soft float\n"));
+ printf (_("soft float, "));
break;
case 3:
- printf (_("Single-precision hard float\n"));
+ printf (_("single-precision hard float, "));
break;
- default:
- printf ("??? (%d)\n", val);
+ }
+
+ switch (val & 0xC)
+ {
+ case 0:
+ printf (_("unspecified long double\n"));
+ break;
+ case 4:
+ printf (_("128-bit IBM long double\n"));
+ break;
+ case 8:
+ printf (_("64-bit long double\n"));
+ break;
+ case 12:
+ printf (_("128-bit IEEE long double\n"));
break;
}
return p;
- }
+ }
if (tag == Tag_GNU_Power_ABI_Vector)
{
val = read_uleb128 (p, &len, end);
p += len;
printf (" Tag_GNU_Power_ABI_Vector: ");
- switch (val)
+ if (len == 0)
+ {
+ printf (_("<corrupt>\n"));
+ return p;
+ }
+
+ if (val > 3)
+ printf ("(%#x), ", val);
+
+ switch (val & 3)
{
case 0:
- printf (_("Any\n"));
+ printf (_("unspecified\n"));
break;
case 1:
- printf (_("Generic\n"));
+ printf (_("generic\n"));
break;
case 2:
printf ("AltiVec\n");
case 3:
printf ("SPE\n");
break;
- default:
- printf ("??? (%d)\n", val);
- break;
}
return p;
- }
+ }
if (tag == Tag_GNU_Power_ABI_Struct_Return)
{
- if (p == end)
+ val = read_uleb128 (p, &len, end);
+ p += len;
+ printf (" Tag_GNU_Power_ABI_Struct_Return: ");
+ if (len == 0)
{
- warn (_("corrupt Tag_GNU_Power_ABI_Struct_Return\n"));
+ printf (_("<corrupt>\n"));
return p;
}
- val = read_uleb128 (p, &len, end);
- p += len;
- printf (" Tag_GNU_Power_ABI_Struct_Return: ");
- switch (val)
- {
- case 0:
- printf (_("Any\n"));
- break;
- case 1:
- printf ("r3/r4\n");
- break;
- case 2:
- printf (_("Memory\n"));
- break;
- default:
- printf ("??? (%d)\n", val);
- break;
- }
+ if (val > 2)
+ printf ("(%#x), ", val);
+
+ switch (val & 3)
+ {
+ case 0:
+ printf (_("unspecified\n"));
+ break;
+ case 1:
+ printf ("r3/r4\n");
+ break;
+ case 2:
+ printf (_("memory\n"));
+ break;
+ case 3:
+ printf ("???\n");
+ break;
+ }
return p;
}
fputs ("\n\tDSP ASE", stdout);
if (mask & AFL_ASE_DSPR2)
fputs ("\n\tDSP R2 ASE", stdout);
+ if (mask & AFL_ASE_DSPR3)
+ fputs ("\n\tDSP R3 ASE", stdout);
if (mask & AFL_ASE_EVA)
fputs ("\n\tEnhanced VA Scheme", stdout);
if (mask & AFL_ASE_MCU)
{
Elf32_Lib liblist;
time_t atime;
- char timebuf[20];
+ char timebuf[128];
struct tm * tmp;
liblist.l_name = BYTE_GET (elib[cnt].l_name);
cmalloc ((sect->sh_size / sizeof (eopt)), sizeof (* iopt));
if (iopt == NULL)
{
- error (_("Out of memory allocatinf space for MIPS options\n"));
+ error (_("Out of memory allocating space for MIPS options\n"));
return 0;
}
{
Elf32_Lib liblist;
time_t atime;
- char timebuf[20];
+ char timebuf[128];
struct tm * tmp;
liblist.l_name = BYTE_GET (elib[cnt].l_name);
return process_nds32_specific (file);
break;
case EM_PPC:
+ case EM_PPC64:
return process_power_specific (file);
break;
case EM_S390: