aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2007-06-29 16:29:17 +0000
committerJoseph Myers <joseph@codesourcery.com>2007-06-29 16:29:17 +0000
commit104d59d19c416dcbf54fb387970b27178feb17d5 (patch)
tree90921bc1aa5b7bca865fdf8645f7b47502946c2f /binutils
parent5ab79981933708d465b91676baf6994996979da8 (diff)
downloadgdb-104d59d19c416dcbf54fb387970b27178feb17d5.zip
gdb-104d59d19c416dcbf54fb387970b27178feb17d5.tar.gz
gdb-104d59d19c416dcbf54fb387970b27178feb17d5.tar.bz2
bfd:
* elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/readelf.c79
2 files changed, 81 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 715b058..2dfb51e 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2007-06-29 Joseph Myers <joseph@codesourcery.com>
+
+ * readelf.c (display_gnu_attribute): New.
+ (process_arm_specific): Rearrange as process_attributes.
+ (process_arm_specific): Replace by wrapper of process_attributes.
+
2007-06-28 Roland McGrath <roland@frob.com>
* objcopy.c (setup_section): Don't reset ELF section type to
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 165aa61..1c4c715 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -8297,8 +8297,61 @@ display_arm_attribute (unsigned char *p)
return p;
}
+
+static unsigned char *
+display_gnu_attribute (unsigned char *p,
+ unsigned char *(*display_proc_gnu_attribute)
+ (unsigned char *, int))
+{
+ int tag;
+ unsigned int len;
+ int val;
+ int type;
+
+ tag = read_uleb128 (p, &len);
+ p += len;
+
+ /* Tag_compatibility is the only generic GNU attribute defined at
+ present. */
+ if (tag == 32)
+ {
+ val = read_uleb128 (p, &len);
+ p += len;
+ printf ("flag = %d, vendor = %s\n", val, p);
+ p += strlen((char *)p) + 1;
+ return p;
+ }
+
+ if ((tag & 2) == 0 && display_proc_gnu_attribute)
+ return display_proc_gnu_attribute (p, tag);
+
+ if (tag & 1)
+ type = 1; /* String. */
+ else
+ type = 2; /* uleb128. */
+ printf (" Tag_unknown_%d: ", tag);
+
+ if (type == 1)
+ {
+ printf ("\"%s\"\n", p);
+ p += strlen ((char *)p) + 1;
+ }
+ else
+ {
+ val = read_uleb128 (p, &len);
+ p += len;
+ printf ("%d (0x%x)\n", val, val);
+ }
+
+ return p;
+}
+
static int
-process_arm_specific (FILE *file)
+process_attributes (FILE *file, const char *public_name,
+ unsigned int proc_type,
+ unsigned char *(*display_pub_attribute) (unsigned char *),
+ unsigned char *(*display_proc_gnu_attribute)
+ (unsigned char *, int))
{
Elf_Internal_Shdr *sect;
unsigned char *contents;
@@ -8313,7 +8366,7 @@ process_arm_specific (FILE *file)
i < elf_header.e_shnum;
i++, sect++)
{
- if (sect->sh_type != SHT_ARM_ATTRIBUTES)
+ if (sect->sh_type != proc_type && sect->sh_type != SHT_GNU_ATTRIBUTES)
continue;
contents = get_data (NULL, file, sect->sh_offset, 1, sect->sh_size,
@@ -8330,6 +8383,7 @@ process_arm_specific (FILE *file)
{
int namelen;
bfd_boolean public_section;
+ bfd_boolean gnu_section;
section_len = byte_get (p, 4);
p += 4;
@@ -8341,10 +8395,14 @@ process_arm_specific (FILE *file)
}
len -= section_len;
printf ("Attribute Section: %s\n", p);
- if (strcmp ((char *)p, "aeabi") == 0)
+ if (public_name && strcmp ((char *)p, public_name) == 0)
public_section = TRUE;
else
public_section = FALSE;
+ if (strcmp ((char *)p, "gnu") == 0)
+ gnu_section = TRUE;
+ else
+ gnu_section = FALSE;
namelen = strlen ((char *)p) + 1;
p += namelen;
section_len -= namelen + 4;
@@ -8393,7 +8451,13 @@ process_arm_specific (FILE *file)
if (public_section)
{
while (p < end)
- p = display_arm_attribute(p);
+ p = display_pub_attribute (p);
+ }
+ else if (gnu_section)
+ {
+ while (p < end)
+ p = display_gnu_attribute (p,
+ display_proc_gnu_attribute);
}
else
{
@@ -8415,6 +8479,13 @@ process_arm_specific (FILE *file)
}
static int
+process_arm_specific (FILE *file)
+{
+ return process_attributes (file, "aeabi", SHT_ARM_ATTRIBUTES,
+ display_arm_attribute, NULL);
+}
+
+static int
process_mips_specific (FILE *file)
{
Elf_Internal_Dyn *entry;