summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-11-04 16:35:51 +0000
committerIan Lance Taylor <ian@airs.com>2009-11-04 16:35:51 +0000
commit58391c9ab0d8419f3eb613d77eb44136425f2be6 (patch)
tree4e0fda513878edd09312bf80cf3abcfccb0d6349 /gold
parent3811ab81c5a07c2cd257c7b4006c64be010907d5 (diff)
downloadbinutils-redhat-58391c9ab0d8419f3eb613d77eb44136425f2be6.tar.gz
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.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/arm.cc9
-rw-r--r--gold/i386.cc9
-rw-r--r--gold/powerpc.cc6
-rw-r--r--gold/sparc.cc6
-rw-r--r--gold/x86_64.cc9
6 files changed, 36 insertions, 13 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 7cb8619cc4..bd91f6754f 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,15 @@
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
is_dynamic_linker_section parameters. Change all callers.
(Layout::choose_output_section): Likewise.
diff --git a/gold/arm.cc b/gold/arm.cc
index 89980327b3..e0c4a9a524 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -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);
diff --git a/gold/i386.cc b/gold/i386.cc
index d0ed561b23..c48a019ab6 100644
--- a/gold/i386.cc
+++ b/gold/i386.cc
@@ -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);
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 0475f8ee7b..8fe8877300 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -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);
diff --git a/gold/sparc.cc b/gold/sparc.cc
index 25f03d1962..d344af2309 100644
--- a/gold/sparc.cc
+++ b/gold/sparc.cc
@@ -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);
diff --git a/gold/x86_64.cc b/gold/x86_64.cc
index c325fc00da..cbc45beda1 100644
--- a/gold/x86_64.cc
+++ b/gold/x86_64.cc
@@ -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);