* options.h (class General_options): Add --spare-dynamic-tags.
authorIan Lance Taylor <ian@airs.com>
Sat, 6 Mar 2010 02:34:13 +0000 (02:34 +0000)
committerIan Lance Taylor <ian@airs.com>
Sat, 6 Mar 2010 02:34:13 +0000 (02:34 +0000)
* output.cc (Output_data_dynamic::set_final_data_size): Implement
--spare-dynamic-tags.

gold/ChangeLog
gold/options.h
gold/output.cc

index b6320963ea9593989dac52698d7f4e3cfd657227..1ae668b59bc154f08e95c8e9b015e4c8b62817fa 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-05  Ian Lance Taylor  <iant@google.com>
+
+       * options.h (class General_options): Add --spare-dynamic-tags.
+       * output.cc (Output_data_dynamic::set_final_data_size): Implement
+       --spare-dynamic-tags.
+
 2010-03-05  Ian Lance Taylor  <iant@google.com>
 
        * incremental.cc: Include "libiberty.h".
index fee76dc853d8f9e384c0596e7e32a523a55f713d..7f35bd21db5214059f824a50e3a4fc938f29df57 100644 (file)
@@ -875,6 +875,10 @@ class General_options
                         N_("Sort common symbols by alignment"),
                         N_("[={ascending,descending}]"));
 
+  DEFINE_uint(spare_dynamic_tags, options::TWO_DASHES, '\0', 5,
+             N_("Dynamic tag slots to reserve (default 5)"),
+             N_("COUNT"));
+
   DEFINE_bool(strip_all, options::TWO_DASHES, 's', false,
               N_("Strip all symbols"), NULL);
   DEFINE_bool(strip_debug, options::TWO_DASHES, 'S', false,
index d49f08b605c715a10dde25d9703aee206f869c5b..0627cbe698fa64c87bd61fe2b4afb83275689398 100644 (file)
@@ -1622,9 +1622,13 @@ Output_data_dynamic::set_final_data_size()
 {
   // Add the terminating entry if it hasn't been added.
   // Because of relaxation, we can run this multiple times.
-  if (this->entries_.empty()
-      || this->entries_.rbegin()->tag() != elfcpp::DT_NULL)
-    this->add_constant(elfcpp::DT_NULL, 0);
+  if (this->entries_.empty() || this->entries_.back().tag() != elfcpp::DT_NULL)
+    {
+      int extra = parameters->options().spare_dynamic_tags();
+      for (int i = 0; i < extra; ++i)
+       this->add_constant(elfcpp::DT_NULL, 0);
+      this->add_constant(elfcpp::DT_NULL, 0);
+    }
 
   int dyn_size;
   if (parameters->target().get_size() == 32)