|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
gold patch committed: PR 10887: Discarded dynamic reloc sectionPR 10887 is about a crash in gold when the dynamic reloc section is
discarded by a linker script. This patch fixes the problem by not emitting dynamic tags for a discarded section. Committed to mainline and 2.20 branch. Ian 2009-11-04 Ian Lance Taylor <iant@...> PR 10887 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic tags if data is discarded by linker script. * i386.cc (Target_i386::do_finalize_sections): Likewise. * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. * sparc.cc (Target_sparc::do_finalize_sections): Likewise. * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. Index: arm.cc =================================================================== RCS file: /cvs/src/src/gold/arm.cc,v retrieving revision 1.28 diff -p -u -r1.28 arm.cc --- arm.cc 4 Nov 2009 15:56:03 -0000 1.28 +++ arm.cc 4 Nov 2009 16:32:14 -0000 @@ -4252,10 +4252,12 @@ Target_arm<big_endian>::do_finalize_sect Output_data_dynamic* const odyn = layout->dynamic_data(); if (odyn != NULL) { - if (this->got_plt_ != NULL) + if (this->got_plt_ != NULL + && this->got_plt_->output_section() != NULL) odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); - if (this->plt_ != NULL) + if (this->plt_ != NULL + && this->plt_->output_section() != NULL) { const Output_data* od = this->plt_->rel_plt(); odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); @@ -4263,7 +4265,8 @@ Target_arm<big_endian>::do_finalize_sect odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL); } - if (this->rel_dyn_ != NULL) + if (this->rel_dyn_ != NULL + && this->rel_dyn_->output_section() != NULL) { const Output_data* od = this->rel_dyn_; odyn->add_section_address(elfcpp::DT_REL, od); Index: i386.cc =================================================================== RCS file: /cvs/src/src/gold/i386.cc,v retrieving revision 1.98 diff -p -u -r1.98 i386.cc --- i386.cc 4 Nov 2009 15:56:03 -0000 1.98 +++ i386.cc 4 Nov 2009 16:32:14 -0000 @@ -1558,10 +1558,12 @@ Target_i386::do_finalize_sections(Layout Output_data_dynamic* const odyn = layout->dynamic_data(); if (odyn != NULL) { - if (this->got_plt_ != NULL) + if (this->got_plt_ != NULL + && this->got_plt_->output_section() != NULL) odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); - if (this->plt_ != NULL) + if (this->plt_ != NULL + && this->plt_->output_section() != NULL) { const Output_data* od = this->plt_->rel_plt(); odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); @@ -1569,7 +1571,8 @@ Target_i386::do_finalize_sections(Layout odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL); } - if (this->rel_dyn_ != NULL) + if (this->rel_dyn_ != NULL + && this->rel_dyn_->output_section() != NULL) { const Output_data* od = this->rel_dyn_; odyn->add_section_address(elfcpp::DT_REL, od); Index: powerpc.cc =================================================================== RCS file: /cvs/src/src/gold/powerpc.cc,v retrieving revision 1.19 diff -p -u -r1.19 powerpc.cc --- powerpc.cc 4 Nov 2009 15:56:03 -0000 1.19 +++ powerpc.cc 4 Nov 2009 16:32:14 -0000 @@ -1538,7 +1538,8 @@ Target_powerpc<size, big_endian>::do_fin Output_data_dynamic* const odyn = layout->dynamic_data(); if (odyn != NULL) { - if (this->plt_ != NULL) + if (this->plt_ != NULL + && this->plt_->output_section() != NULL) { const Output_data* od = this->plt_->rel_plt(); odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); @@ -1548,7 +1549,8 @@ Target_powerpc<size, big_endian>::do_fin odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_); } - if (this->rela_dyn_ != NULL) + if (this->rela_dyn_ != NULL + && this->rela_dyn_->output_section() != NULL) { const Output_data* od = this->rela_dyn_; odyn->add_section_address(elfcpp::DT_RELA, od); Index: sparc.cc =================================================================== RCS file: /cvs/src/src/gold/sparc.cc,v retrieving revision 1.23 diff -p -u -r1.23 sparc.cc --- sparc.cc 4 Nov 2009 15:56:03 -0000 1.23 +++ sparc.cc 4 Nov 2009 16:32:14 -0000 @@ -2325,7 +2325,8 @@ Target_sparc<size, big_endian>::do_final Output_data_dynamic* const odyn = layout->dynamic_data(); if (odyn != NULL) { - if (this->plt_ != NULL) + if (this->plt_ != NULL + && this->plt_->output_section() != NULL) { const Output_data* od = this->plt_->rel_plt(); odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); @@ -2335,7 +2336,8 @@ Target_sparc<size, big_endian>::do_final odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_); } - if (this->rela_dyn_ != NULL) + if (this->rela_dyn_ != NULL + && this->rela_dyn_->output_section() != NULL) { const Output_data* od = this->rela_dyn_; odyn->add_section_address(elfcpp::DT_RELA, od); Index: x86_64.cc =================================================================== RCS file: /cvs/src/src/gold/x86_64.cc,v retrieving revision 1.91 diff -p -u -r1.91 x86_64.cc --- x86_64.cc 4 Nov 2009 15:56:03 -0000 1.91 +++ x86_64.cc 4 Nov 2009 16:32:14 -0000 @@ -1648,10 +1648,12 @@ Target_x86_64::do_finalize_sections(Layo Output_data_dynamic* const odyn = layout->dynamic_data(); if (odyn != NULL) { - if (this->got_plt_ != NULL) + if (this->got_plt_ != NULL + && this->got_plt_->output_section() != NULL) odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); - if (this->plt_ != NULL) + if (this->plt_ != NULL + && this->plt_->output_section() != NULL) { const Output_data* od = this->plt_->rel_plt(); odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); @@ -1669,7 +1671,8 @@ Target_x86_64::do_finalize_sections(Layo } } - if (this->rela_dyn_ != NULL) + if (this->rela_dyn_ != NULL + && this->rela_dyn_->output_section() != NULL) { const Output_data* od = this->rela_dyn_; odyn->add_section_address(elfcpp::DT_RELA, od); |
| Free embeddable forum powered by Nabble | Forum Help |