Reads at or beyond END will not be made. */
static unsigned char *
-display_tag_value (int tag,
+display_tag_value (signed int tag,
unsigned char * p,
const unsigned char * const end)
{
static unsigned char *
display_gnu_attribute (unsigned char * p,
- unsigned char * (* display_proc_gnu_attribute) (unsigned char *, int, const unsigned char * const),
+ unsigned char * (* display_proc_gnu_attribute) (unsigned char *, unsigned int, const unsigned char * const),
const unsigned char * const end)
{
int tag;
unsigned int len;
- int val;
+ unsigned int val;
tag = read_uleb128 (p, &len, end);
p += len;
static unsigned char *
display_power_gnu_attribute (unsigned char * p,
- int tag,
+ unsigned int tag,
const unsigned char * const end)
{
unsigned int len;
static unsigned char *
display_s390_gnu_attribute (unsigned char * p,
- int tag,
+ unsigned int tag,
const unsigned char * const end)
{
unsigned int len;
}
static void
-display_sparc_hwcaps (int mask)
+display_sparc_hwcaps (unsigned int mask)
{
if (mask)
{
}
static void
-display_sparc_hwcaps2 (int mask)
+display_sparc_hwcaps2 (unsigned int mask)
{
if (mask)
{
static unsigned char *
display_sparc_gnu_attribute (unsigned char * p,
- int tag,
+ unsigned int tag,
const unsigned char * const end)
{
unsigned int len;
static unsigned char *
display_mips_gnu_attribute (unsigned char * p,
- int tag,
+ unsigned int tag,
const unsigned char * const end)
{
if (tag == Tag_GNU_MIPS_ABI_FP)
display_tic6x_attribute (unsigned char * p,
const unsigned char * const end)
{
- int tag;
+ unsigned int tag;
unsigned int len;
int val;
}
static void
-display_raw_attribute (unsigned char * p, unsigned char * end)
+display_raw_attribute (unsigned char * p, unsigned char const * const end)
{
unsigned long addr = 0;
size_t bytes = end - p;
const unsigned char * const end)
{
unsigned int len;
- int val;
- int tag;
+ unsigned int val;
+ unsigned int tag;
tag = read_uleb128 (p, & len, end);
p += len;
const char * public_name,
unsigned int proc_type,
unsigned char * (* display_pub_attribute) (unsigned char *, const unsigned char * const),
- unsigned char * (* display_proc_gnu_attribute) (unsigned char *, int, const unsigned char * const))
+ unsigned char * (* display_proc_gnu_attribute) (unsigned char *, unsigned int, const unsigned char * const))
{
Elf_Internal_Shdr * sect;
unsigned i;
continue;
p = contents;
- if (*p == 'A')
+ /* The first character is the version of the attributes.
+ Currently only version 1, (aka 'A') is recognised here. */
+ if (*p != 'A')
+ printf (_("Unknown attributes version '%c'(%d) - expecting 'A'\n"), *p, *p);
+ else
{
bfd_vma section_len;
{
while (p < end)
p = display_pub_attribute (p, end);
- assert (p <= end);
+ assert (p == end);
}
else if (gnu_section && display_proc_gnu_attribute != NULL)
{
p = display_gnu_attribute (p,
display_proc_gnu_attribute,
end);
- assert (p <= end);
+ assert (p == end);
}
else if (p < end)
{
}
}
}
- else
- printf (_("Unknown format '%c' (%d)\n"), *p, *p);
free (contents);
}
return 1;
}
-static int
-process_arm_specific (FILE * file)
-{
- return process_attributes (file, "aeabi", SHT_ARM_ATTRIBUTES,
- display_arm_attribute, NULL);
-}
-
-static int
-process_power_specific (FILE * file)
-{
- return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
- display_power_gnu_attribute);
-}
-
-static int
-process_s390_specific (FILE * file)
-{
- return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
- display_s390_gnu_attribute);
-}
-
-static int
-process_sparc_specific (FILE * file)
-{
- return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
- display_sparc_gnu_attribute);
-}
-
-static int
-process_tic6x_specific (FILE * file)
-{
- return process_attributes (file, "c6xabi", SHT_C6000_ATTRIBUTES,
- display_tic6x_attribute, NULL);
-}
-
-static int
-process_msp430x_specific (FILE * file)
-{
- return process_attributes (file, "mspabi", SHT_MSP430_ATTRIBUTES,
- display_msp430x_attribute, NULL);
-}
-
/* DATA points to the contents of a MIPS GOT that starts at VMA PLTGOT.
Print the Address, Access and Initial fields of an entry at VMA ADDR
and return the VMA of the next entry, or -1 if there was a problem.
return 1;
}
+static unsigned char *
+display_public_gnu_attributes (unsigned char * start,
+ const unsigned char * const end)
+{
+ printf (_(" Unknown GNU attribute: %s\n"), start);
+
+ start += strnlen ((char *) start, end - start);
+ display_raw_attribute (start, end);
+
+ return (unsigned char *) end;
+}
+
+static unsigned char *
+display_generic_attribute (unsigned char * start,
+ unsigned int tag,
+ const unsigned char * const end)
+{
+ if (tag == 0)
+ return (unsigned char *) end;
+
+ return display_tag_value (tag, start, end);
+}
+
static int
process_arch_specific (FILE * file)
{
switch (elf_header.e_machine)
{
case EM_ARM:
- return process_arm_specific (file);
+ return process_attributes (file, "aeabi", SHT_ARM_ATTRIBUTES,
+ display_arm_attribute,
+ display_generic_attribute);
+
case EM_MIPS:
case EM_MIPS_RS3_LE:
return process_mips_specific (file);
- break;
+
+ case EM_MSP430:
+ return process_attributes (file, "mspabi", SHT_MSP430_ATTRIBUTES,
+ display_msp430x_attribute,
+ display_generic_attribute);
+
case EM_NDS32:
return process_nds32_specific (file);
- break;
+
case EM_PPC:
case EM_PPC64:
- return process_power_specific (file);
- break;
+ return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
+ display_power_gnu_attribute);
+
case EM_S390:
case EM_S390_OLD:
- return process_s390_specific (file);
- break;
+ return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
+ display_s390_gnu_attribute);
+
case EM_SPARC:
case EM_SPARC32PLUS:
case EM_SPARCV9:
- return process_sparc_specific (file);
- break;
+ return process_attributes (file, NULL, SHT_GNU_ATTRIBUTES, NULL,
+ display_sparc_gnu_attribute);
+
case EM_TI_C6000:
- return process_tic6x_specific (file);
- break;
- case EM_MSP430:
- return process_msp430x_specific (file);
+ return process_attributes (file, "c6xabi", SHT_C6000_ATTRIBUTES,
+ display_tic6x_attribute,
+ display_generic_attribute);
+
default:
- break;
+ return process_attributes (file, "gnu", SHT_GNU_ATTRIBUTES,
+ display_public_gnu_attributes,
+ display_generic_attribute);
}
- return 1;
}
static int