]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* layout.cc (Layout::add_target_dynamic_tags): If
authorIan Lance Taylor <ian@airs.com>
Tue, 7 Aug 2012 13:24:47 +0000 (13:24 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 7 Aug 2012 13:24:47 +0000 (13:24 +0000)
dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
plt_rel.

gold/ChangeLog
gold/layout.cc

index 8386048bf5f6fb221df3f5df23b0a8da9a074441..ee05f80c7861ccc61a708586dcd50701dc439788 100644 (file)
@@ -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.
index ad667ab875b8ecb2f12079044eecd88f2f6017fb..d597fa6f61fe830feb3625cef93781439b920280 100644 (file)
@@ -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)