aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2009-01-19 11:50:31 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2009-01-19 11:50:31 +0000
commit2d0bb7614be1a94ab9051c35fe95514b05fc0823 (patch)
tree248548d3974efc4e89823e0ca4dcde4967e8d2cb
parenta77e83b76e29dd542c48e2edb3c3980a6c790262 (diff)
downloadgdb-2d0bb7614be1a94ab9051c35fe95514b05fc0823.zip
gdb-2d0bb7614be1a94ab9051c35fe95514b05fc0823.tar.gz
gdb-2d0bb7614be1a94ab9051c35fe95514b05fc0823.tar.bz2
2009-01-19 Andrew Stubbs <ams@codesourcery.com>
bfd/ * elf-attrs.c (is_default_attr): Support defaultless attributes. (bfd_elf_add_obj_attr_int): Get type from _bfd_elf_obj_attrs_arg_type. (bfd_elf_add_obj_attr_string): Likewise. (bfd_elf_add_obj_attr_int_string): Likewise. (_bfd_elf_parse_attributes): Allow for unknown flag bits in type. * elf-bfd.h (struct obj_attribute): Document new flag bit. * elf32-arm.c (elf32_arm_obj_attrs_arg_type): Specify that Tag_nodefaults has no default value. (elf32_arm_merge_eabi_attributes): Modify the Tag_nodefaults comment to reflect the new state. gas/ * read.c (s_vendor_attribute): Allow for unknown flag bits in type.
-rw-r--r--bfd/ChangeLog13
-rw-r--r--bfd/elf-attrs.c10
-rw-r--r--bfd/elf-bfd.h3
-rw-r--r--bfd/elf32-arm.c11
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/read.c4
6 files changed, 33 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a65ee31..683540b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-19 Andrew Stubbs <ams@codesourcery.com>
+
+ * elf-attrs.c (is_default_attr): Support defaultless attributes.
+ (bfd_elf_add_obj_attr_int): Get type from _bfd_elf_obj_attrs_arg_type.
+ (bfd_elf_add_obj_attr_string): Likewise.
+ (bfd_elf_add_obj_attr_int_string): Likewise.
+ (_bfd_elf_parse_attributes): Allow for unknown flag bits in type.
+ * elf-bfd.h (struct obj_attribute): Document new flag bit.
+ * elf32-arm.c (elf32_arm_obj_attrs_arg_type): Specify that
+ Tag_nodefaults has no default value.
+ (elf32_arm_merge_eabi_attributes): Modify the Tag_nodefaults
+ comment to reflect the new state.
+
2009-01-19 Alan Modra <amodra@bigpond.net.au>
PR 9695
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index 4019535..dc26056 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -47,6 +47,8 @@ is_default_attr (obj_attribute *attr)
return FALSE;
if ((attr->type & 2) && attr->s && *attr->s)
return FALSE;
+ if (attr->type & 4)
+ return FALSE;
return TRUE;
}
@@ -290,7 +292,7 @@ bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i)
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = 1;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->i = i;
}
@@ -313,7 +315,7 @@ bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s)
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = 2;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->s = _bfd_elf_attr_strdup (abfd, s);
}
@@ -325,7 +327,7 @@ bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, int tag,
obj_attribute *attr;
attr = elf_new_obj_attr (abfd, vendor, tag);
- attr->type = 3;
+ attr->type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
attr->i = i;
attr->s = _bfd_elf_attr_strdup (abfd, s);
}
@@ -487,7 +489,7 @@ _bfd_elf_parse_attributes (bfd *abfd, Elf_Internal_Shdr * hdr)
tag = read_unsigned_leb128 (abfd, p, &n);
p += n;
type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
- switch (type)
+ switch (type & 3)
{
case 3:
val = read_unsigned_leb128 (abfd, p, &n);
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 14825a4..267b4b4 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1373,7 +1373,8 @@ struct elf_find_verdep_info
/* The value of an object attribute. type & 1 indicates whether there
is an integer value; type & 2 indicates whether there is a string
- value. */
+ value; type & 4 indicates whether the type has a default value
+ (i.e. is there a value that need not be written to file). */
typedef struct obj_attribute
{
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index ece1a56..a047c5f 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -8139,6 +8139,8 @@ elf32_arm_obj_attrs_arg_type (int tag)
{
if (tag == Tag_compatibility)
return 3;
+ else if (tag == Tag_nodefaults)
+ return 5;
else if (tag == 4 || tag == 5)
return 2;
else if (tag < 32)
@@ -8675,11 +8677,10 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, bfd *obfd)
break;
case Tag_nodefaults:
- /* This tag is set if it exists, but the value is unused.
- Unfortunately, we don't record whether each attribute is zero
- initialized, or read from the file, so the information has been
- lost. In any case, we don't write attributes with zero values.
- Do nothing. */
+ /* This tag is set if it exists, but the value is unused (and is
+ typically zero). We don't actually need to do anything here -
+ the merge happens automatically when the type flags are merged
+ below. */
break;
case Tag_also_compatible_with:
/* Already done in Tag_CPU_arch. */
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 715614e..d1b9399 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-19 Andrew Stubbs <ams@codesourcery.com>
+
+ * read.c (s_vendor_attribute): Allow for unknown flag bits in type.
+
2009-01-16 Mark Shinwell <shinwell@codesourcery.com>
* config/te-armeabi.h (EABI_DEFAULT): Use EF_ARM_EABI_VER5.
diff --git a/gas/read.c b/gas/read.c
index 502e258..db0cc87 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -2123,7 +2123,7 @@ s_vendor_attribute (int vendor)
}
i = exp.X_add_number;
}
- if (type == 3
+ if ((type & 3) == 3
&& skip_past_comma (&input_line_pointer) == -1)
{
as_bad (_("expected comma"));
@@ -2140,7 +2140,7 @@ s_vendor_attribute (int vendor)
s = demand_copy_C_string (&len);
}
- switch (type)
+ switch (type & 3)
{
case 3:
bfd_elf_add_obj_attr_int_string (stdoutput, vendor, tag, i, s);