aboutsummaryrefslogtreecommitdiff
path: root/gold/arm.cc
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-05-13 02:41:15 +0000
committerDoug Kwan <dougkwan@google.com>2010-05-13 02:41:15 +0000
commitda59ad79a2bab290cca29440b8b1d7981aa2b983 (patch)
tree69474e22226b02e09ee1e7fbb6bb4a7ff3227ac5 /gold/arm.cc
parent235f101c07d43aac6a5fcc167680ea691c9ee92a (diff)
downloadgdb-da59ad79a2bab290cca29440b8b1d7981aa2b983.zip
gdb-da59ad79a2bab290cca29440b8b1d7981aa2b983.tar.gz
gdb-da59ad79a2bab290cca29440b8b1d7981aa2b983.tar.bz2
2010-05-12 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog * arm.h (Tag_FP_arch, Tag_ABI_align_needed, Tag_ABI_align_preserved, Tag_FP_HP_extension, Tag_MPextension_use_legacy): Rename from existing tags. (Tag_undefined40, Tag_undefined41, Tag_MPextension_use, Tag_undefined43): New tags. (Targ_VFP_arch, Tag_ABI_align8_needed, TAG_ABI_align8_preserved, Tag_VFP_HP_extension): Define aliases for backward compatiblity. gold/ChangeLog * arm.cc (Target_arm::do_finalize_sections): Create an empty attributes section only if there no attributes section after merging. (Target_arm::merge_object_attributes): Move value of Tag_MPextension_use_legacy to that of Tag_MPextension_use. Handle Tag_DIV_use and Tag_MPextension_use_legacy. * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout and arm_attr_merge_7.stdout. (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r, arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o, arm_attr_merge_7b.o): New rules. (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and arm_attr_merge_7 * testsuite/Makefile.in: Regenerate. * testsuite/arm_attr_merge.sh: New file. * testsuite/arm_attr_merge_[67][ab].s: Same.
Diffstat (limited to 'gold/arm.cc')
-rw-r--r--gold/arm.cc80
1 files changed, 74 insertions, 6 deletions
diff --git a/gold/arm.cc b/gold/arm.cc
index 11a0734..c304d2a 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -7998,11 +7998,6 @@ Target_arm<big_endian>::do_finalize_sections(
const Input_objects* input_objects,
Symbol_table* symtab)
{
- // Create an empty uninitialized attribute section if we still don't have it
- // at this moment.
- if (this->attributes_section_data_ == NULL)
- this->attributes_section_data_ = new Attributes_section_data(NULL, 0);
-
// Merge processor-specific flags.
for (Input_objects::Relobj_iterator p = input_objects->relobj_begin();
p != input_objects->relobj_end();
@@ -8033,6 +8028,12 @@ Target_arm<big_endian>::do_finalize_sections(
arm_dynobj->attributes_section_data());
}
+ // Create an empty uninitialized attribute section if we still don't have it
+ // at this moment. This happens if there is no attributes sections in all
+ // inputs.
+ if (this->attributes_section_data_ == NULL)
+ this->attributes_section_data_ = new Attributes_section_data(NULL, 0);
+
// Check BLX use.
const Object_attribute* cpu_arch_attr =
this->get_aeabi_object_attribute(elfcpp::Tag_CPU_arch);
@@ -9427,13 +9428,35 @@ Target_arm<big_endian>::merge_object_attributes(
return;
// If output has no object attributes, just copy.
+ const int vendor = Object_attribute::OBJ_ATTR_PROC;
if (this->attributes_section_data_ == NULL)
{
this->attributes_section_data_ = new Attributes_section_data(*pasd);
+ Object_attribute* out_attr =
+ this->attributes_section_data_->known_attributes(vendor);
+
+ // We do not output objects with Tag_MPextension_use_legacy - we move
+ // the attribute's value to Tag_MPextension_use. */
+ if (out_attr[elfcpp::Tag_MPextension_use_legacy].int_value() != 0)
+ {
+ if (out_attr[elfcpp::Tag_MPextension_use].int_value() != 0
+ && out_attr[elfcpp::Tag_MPextension_use_legacy].int_value()
+ != out_attr[elfcpp::Tag_MPextension_use].int_value())
+ {
+ gold_error(_("%s has both the current and legacy "
+ "Tag_MPextension_use attributes"),
+ name);
+ }
+
+ out_attr[elfcpp::Tag_MPextension_use] =
+ out_attr[elfcpp::Tag_MPextension_use_legacy];
+ out_attr[elfcpp::Tag_MPextension_use_legacy].set_type(0);
+ out_attr[elfcpp::Tag_MPextension_use_legacy].set_int_value(0);
+ }
+
return;
}
- const int vendor = Object_attribute::OBJ_ATTR_PROC;
const Object_attribute* in_attr = pasd->known_attributes(vendor);
Object_attribute* out_attr =
this->attributes_section_data_->known_attributes(vendor);
@@ -9759,6 +9782,51 @@ Target_arm<big_endian>::merge_object_attributes(
out_attr[i].set_int_value(in_attr[i].int_value());
break;
+ case elfcpp::Tag_DIV_use:
+ // This tag is set to zero if we can use UDIV and SDIV in Thumb
+ // mode on a v7-M or v7-R CPU; to one if we can not use UDIV or
+ // SDIV at all; and to two if we can use UDIV or SDIV on a v7-A
+ // CPU. We will merge as follows: If the input attribute's value
+ // is one then the output attribute's value remains unchanged. If
+ // the input attribute's value is zero or two then if the output
+ // attribute's value is one the output value is set to the input
+ // value, otherwise the output value must be the same as the
+ // inputs. */
+ if (in_attr[i].int_value() != 1 && out_attr[i].int_value() != 1)
+ {
+ if (in_attr[i].int_value() != out_attr[i].int_value())
+ {
+ gold_error(_("DIV usage mismatch between %s and output"),
+ name);
+ }
+ }
+
+ if (in_attr[i].int_value() != 1)
+ out_attr[i].set_int_value(in_attr[i].int_value());
+
+ break;
+
+ case elfcpp::Tag_MPextension_use_legacy:
+ // We don't output objects with Tag_MPextension_use_legacy - we
+ // move the value to Tag_MPextension_use.
+ if (in_attr[i].int_value() != 0
+ && in_attr[elfcpp::Tag_MPextension_use].int_value() != 0)
+ {
+ if (in_attr[elfcpp::Tag_MPextension_use].int_value()
+ != in_attr[i].int_value())
+ {
+ gold_error(_("%s has has both the current and legacy "
+ "Tag_MPextension_use attributes"),
+ name);
+ }
+ }
+
+ if (in_attr[i].int_value()
+ > out_attr[elfcpp::Tag_MPextension_use].int_value())
+ out_attr[elfcpp::Tag_MPextension_use] = in_attr[i];
+
+ break;
+
case elfcpp::Tag_nodefaults:
// 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 -