From ca419a6f33e27d59324ba74c4655e551a381aad5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Feb 2010 17:45:38 +0000 Subject: [PATCH] * arm.cc (Target_arm::do_finalize_sections): Create attribute section if it does not already exist. * attributes.cc (Attributes_section_data::Attributes_section_data): Don't crash if size is zero. --- gold/ChangeLog | 7 +++++++ gold/arm.cc | 5 +++++ gold/attributes.cc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 45017f229bc..6259834dd94 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2010-02-23 Viktor Kutuzov + + * arm.cc (Target_arm::do_finalize_sections): Create attribute + section if it does not already exist. + * attributes.cc (Attributes_section_data::Attributes_section_data): + Don't crash if size is zero. + 2010-02-23 Viktor Kutuzov Ian Lance Taylor diff --git a/gold/arm.cc b/gold/arm.cc index bc5557a7e44..b8141e0a7c1 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -7554,6 +7554,11 @@ Target_arm::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(); diff --git a/gold/attributes.cc b/gold/attributes.cc index 2024fda6296..b9b36089e36 100644 --- a/gold/attributes.cc +++ b/gold/attributes.cc @@ -278,7 +278,7 @@ Attributes_section_data::Attributes_section_data( const unsigned char *p = view; p = view; - if (*(p++) == 'A') + if (size > 0 && p != NULL && *(p++) == 'A') { size--; while (size > 0) -- 2.30.2