This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: Add --spare-dynamic-tags


I committed this patch to gold to add the --spare-dynamic-tags option.
The default of 5 matches GNU ld's default behaviour.  This permits the
GNU/Linux prelinker to work.

Ian


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.


Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.140
diff -p -u -r1.140 options.h
--- options.h	13 Feb 2010 02:04:20 -0000	1.140
+++ options.h	6 Mar 2010 02:32:35 -0000
@@ -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: output.cc
===================================================================
RCS file: /cvs/src/src/gold/output.cc,v
retrieving revision 1.121
diff -p -u -r1.121 output.cc
--- output.cc	1 Mar 2010 21:43:49 -0000	1.121
+++ output.cc	6 Mar 2010 02:32:36 -0000
@@ -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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]