aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2012-08-07 13:24:47 +0000
committerIan Lance Taylor <ian@airs.com>2012-08-07 13:24:47 +0000
commit82435b3b3da1b288ca2d2596a9de40e6bc734773 (patch)
tree38449a6c75e0ad6674007a0663754275e1ff116c /gold
parente2de53900e9726ff35583c281de80048d538c35c (diff)
downloadgdb-82435b3b3da1b288ca2d2596a9de40e6bc734773.zip
gdb-82435b3b3da1b288ca2d2596a9de40e6bc734773.tar.gz
gdb-82435b3b3da1b288ca2d2596a9de40e6bc734773.tar.bz2
* layout.cc (Layout::add_target_dynamic_tags): If
dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for plt_rel.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/layout.cc25
2 files changed, 22 insertions, 9 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 8386048..ee05f80 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-07 Ian Lance Taylor <iant@google.com>
+
+ * layout.cc (Layout::add_target_dynamic_tags): If
+ dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
+ plt_rel.
+
2012-07-30 Nick Clifton <nickc@redhat.com>
* po/gold.pot: Updated template.
diff --git a/gold/layout.cc b/gold/layout.cc
index ad667ab..d597fa6 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -4341,19 +4341,26 @@ Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got,
use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA);
}
- if (dyn_rel != NULL && dyn_rel->output_section() != NULL)
+ if ((dyn_rel != NULL && dyn_rel->output_section() != NULL)
+ || (dynrel_includes_plt
+ && plt_rel != NULL
+ && plt_rel->output_section() != NULL))
{
+ bool have_dyn_rel = dyn_rel != NULL && dyn_rel->output_section() != NULL;
+ bool have_plt_rel = plt_rel != NULL && plt_rel->output_section() != NULL;
odyn->add_section_address(use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA,
- dyn_rel->output_section());
- if (plt_rel != NULL
- && plt_rel->output_section() != NULL
- && dynrel_includes_plt)
- odyn->add_section_size(use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ,
+ (have_dyn_rel
+ ? dyn_rel->output_section()
+ : plt_rel->output_section()));
+ elfcpp::DT size_tag = use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ;
+ if (have_dyn_rel && have_plt_rel && dynrel_includes_plt)
+ odyn->add_section_size(size_tag,
dyn_rel->output_section(),
plt_rel->output_section());
+ else if (have_dyn_rel)
+ odyn->add_section_size(size_tag, dyn_rel->output_section());
else
- odyn->add_section_size(use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ,
- dyn_rel->output_section());
+ odyn->add_section_size(size_tag, plt_rel->output_section());
const int size = parameters->target().get_size();
elfcpp::DT rel_tag;
int rel_size;
@@ -4379,7 +4386,7 @@ Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got,
}
odyn->add_constant(rel_tag, rel_size);
- if (parameters->options().combreloc())
+ if (parameters->options().combreloc() && have_dyn_rel)
{
size_t c = dyn_rel->relative_reloc_count();
if (c > 0)