From 8274239589cb7d560af55e3565ad7e6829b1edfe Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 13 Jul 2010 12:04:03 +0000 Subject: [PATCH] * output.h (Output_section_lookup_maps::add_merge_section): Correct check of whether value was inserted. (Output_section_lookup_maps::add_merge_input_section): Likewise. (Output_section_lookup_maps::add_relaxed_input_section): Likewise. * arm.cc (Target_arm::got_section): Remove used local os. * i386.cc (Target_i386::got_section): Likewise. * x86_64.cc (Target_x86_64::got_section): Likewise. * sparc.cc (Target_sparc::got_section): Likewise. (Target_sparc::relocate): Remove unused local have_got_offset. * powerpc.cc (Target_powerpc::relocate): Likewise. --- gold/ChangeLog | 15 +++++++++++++++ gold/arm.cc | 20 +++++++++----------- gold/i386.cc | 20 +++++++++----------- gold/output.h | 6 +++--- gold/powerpc.cc | 3 --- gold/sparc.cc | 12 ++++-------- gold/x86_64.cc | 20 +++++++++----------- 7 files changed, 49 insertions(+), 47 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 1c5b157..8d75269 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,18 @@ +2010-07-13 Philip Herron + Ian Lance Taylor + + * output.h (Output_section_lookup_maps::add_merge_section): + Correct check of whether value was inserted. + (Output_section_lookup_maps::add_merge_input_section): Likewise. + (Output_section_lookup_maps::add_relaxed_input_section): + Likewise. + * arm.cc (Target_arm::got_section): Remove used local os. + * i386.cc (Target_i386::got_section): Likewise. + * x86_64.cc (Target_x86_64::got_section): Likewise. + * sparc.cc (Target_sparc::got_section): Likewise. + (Target_sparc::relocate): Remove unused local have_got_offset. + * powerpc.cc (Target_powerpc::relocate): Likewise. + 2010-07-13 Ian Lance Taylor * compressed_output.cc (zlib_decompress): Fix signature in diff --git a/gold/arm.cc b/gold/arm.cc index 76d466b..ddfe543 100644 --- a/gold/arm.cc +++ b/gold/arm.cc @@ -4116,22 +4116,20 @@ Target_arm::got_section(Symbol_table* symtab, Layout* layout) this->got_ = new Arm_output_data_got(symtab, layout); - Output_section* os; - os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_, false, false, false, - true); + layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_, false, false, false, true); // The old GNU linker creates a .got.plt section. We just // create another set of data in the .got section. Note that we // always create a PLT if we create a GOT, although the PLT // might be empty. this->got_plt_ = new Output_data_space(4, "** GOT PLT"); - os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_plt_, false, false, - false, false); + layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_plt_, false, false, false, + false); // The first three entries are reserved. this->got_plt_->set_current_data_size(3 * 4); diff --git a/gold/i386.cc b/gold/i386.cc index 1776383..e49207a 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -494,19 +494,17 @@ Target_i386::got_section(Symbol_table* symtab, Layout* layout) this->got_ = new Output_data_got<32, false>(); - Output_section* os; - os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_, false, true, true, - false); + layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_, false, true, true, false); this->got_plt_ = new Output_data_space(4, "** GOT PLT"); - os = layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_plt_, false, false, false, - true); + layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_plt_, false, false, false, + true); // The first three entries are reserved. this->got_plt_->set_current_data_size(3 * 4); diff --git a/gold/output.h b/gold/output.h index 1a0a8da..7355718 100644 --- a/gold/output.h +++ b/gold/output.h @@ -2432,7 +2432,7 @@ class Output_section_lookup_maps std::pair value(msp, pomb); std::pair result = this->merge_sections_by_properties_.insert(value); - gold_assert(value.second); + gold_assert(result.second); } // Add a mapping from a merged input section in OBJECT with index SHNDX @@ -2445,7 +2445,7 @@ class Output_section_lookup_maps std::pair value(csid, pomb); std::pair result = this->merge_sections_by_id_.insert(value); - gold_assert(value.second); + gold_assert(result.second); } // Find a relaxed input section of OBJECT with index SHNDX. @@ -2469,7 +2469,7 @@ class Output_section_lookup_maps value(csid, poris); std::pair result = this->relaxed_input_sections_by_id_.insert(value); - gold_assert(value.second); + gold_assert(result.second); } private: diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 0eda0a9..627911c 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -1636,7 +1636,6 @@ Target_powerpc::Relocate::relocate( // Get the GOT offset if needed. Unlike i386 and x86_64, our GOT // pointer points to the beginning, not the end, of the table. // So we just use the plain offset. - bool have_got_offset = false; unsigned int got_offset = 0; unsigned int got2_offset = 0; switch (r_type) @@ -1668,7 +1667,6 @@ Target_powerpc::Relocate::relocate( gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_STANDARD)); got_offset = object->local_got_offset(r_sym, GOT_TYPE_STANDARD); } - have_got_offset = true; break; // R_PPC_PLTREL24 is rather special. If non-zero, @@ -1681,7 +1679,6 @@ Target_powerpc::Relocate::relocate( got2_offset = got2->offset(); addend += got2_offset; } - have_got_offset = true; break; default: diff --git a/gold/sparc.cc b/gold/sparc.cc index e2d59b9..90e5ae3 100644 --- a/gold/sparc.cc +++ b/gold/sparc.cc @@ -1045,12 +1045,10 @@ Target_sparc::got_section(Symbol_table* symtab, this->got_ = new Output_data_got(); - Output_section* os; - os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_, false, true, false, - false); + layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_, false, true, false, false); // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section. symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL, @@ -2474,7 +2472,6 @@ Target_sparc::Relocate::relocate( // Get the GOT offset if needed. Unlike i386 and x86_64, our GOT // pointer points to the beginning, not the end, of the table. // So we just use the plain offset. - bool have_got_offset = false; unsigned int got_offset = 0; switch (r_type) { @@ -2495,7 +2492,6 @@ Target_sparc::Relocate::relocate( gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_STANDARD)); got_offset = object->local_got_offset(r_sym, GOT_TYPE_STANDARD); } - have_got_offset = true; break; default: diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 9110278..1dba535 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -547,19 +547,17 @@ Target_x86_64::got_section(Symbol_table* symtab, Layout* layout) this->got_ = new Output_data_got<64, false>(); - Output_section* os; - os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_, false, true, true, - false); + layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_, false, true, true, false); this->got_plt_ = new Output_data_space(8, "** GOT PLT"); - os = layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS, - (elfcpp::SHF_ALLOC - | elfcpp::SHF_WRITE), - this->got_plt_, false, false, - false, true); + layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS, + (elfcpp::SHF_ALLOC + | elfcpp::SHF_WRITE), + this->got_plt_, false, false, false, + true); // The first three entries are reserved. this->got_plt_->set_current_data_size(3 * 8); -- 2.7.4