PR 10887
authorIan Lance Taylor <ian@airs.com>
Wed, 4 Nov 2009 16:35:51 +0000 (16:35 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 4 Nov 2009 16:35:51 +0000 (16:35 +0000)
* 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.

gold/ChangeLog
gold/arm.cc
gold/i386.cc
gold/powerpc.cc
gold/sparc.cc
gold/x86_64.cc

index 7cb8619cc495fff4e5915954a58f72d683279ad7..bd91f6754fe89d823cb6e61d7a7199440ac31110 100644 (file)
@@ -1,3 +1,13 @@
+2009-11-04  Ian Lance Taylor  <iant@google.com>
+
+       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.
+
 2009-11-04  Ian Lance Taylor  <iant@google.com>
 
        * layout.cc (Layout::get_output_section): Add is_interp and
index 89980327b3c2e6a481862eff2e1fb5e60fcbdd50..e0c4a9a524968c23be09b062585eb514ad5d1d6e 100644 (file)
@@ -4252,10 +4252,12 @@ Target_arm<big_endian>::do_finalize_sections(
   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_sections(
          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 d0ed561b2394d9fc2b5234eaddc8db592cbc43d5..c48a019ab68e59b50336492e3f4b55a7e9424902 100644 (file)
@@ -1558,10 +1558,12 @@ Target_i386::do_finalize_sections(Layout* layout, const Input_objects*)
   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* layout, const Input_objects*)
          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 0475f8ee7b4922f131e528788a884966e11f658d..8fe8877300bf7687ac3d33f748fe506b5c5cb201 100644 (file)
@@ -1538,7 +1538,8 @@ Target_powerpc<size, big_endian>::do_finalize_sections(
   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_finalize_sections(
          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 25f03d196256cbea8370730eb5fde0e60654b321..d344af230916bb46fddb27eace0cb88353867ccc 100644 (file)
@@ -2325,7 +2325,8 @@ Target_sparc<size, big_endian>::do_finalize_sections(
   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_finalize_sections(
          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 c325fc00daa5f0232108e40c51edad1574580288..cbc45beda15eae87d85970bb140e2f154e34893d 100644 (file)
@@ -1648,10 +1648,12 @@ Target_x86_64::do_finalize_sections(Layout* layout, const Input_objects*)
   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(Layout* layout, const Input_objects*)
            }
        }
 
-      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);