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 -f and -F options


This patch to gold adds the -f and -F options, just as they are
implemented in GNU ld.  Committed to mainline.

Ian


2011-07-02  Ian Lance Taylor  <iant@google.com>

	PR gold/12957
	* options.h (class General_options): Add -f and -F.
	* options.cc (General_options::finalize): Fatal error if -f/-F
	are used without -shared.
	* layout.cc (Layout::finish_dynamic_section): Implement -f/-F.


? autom4te.cache
? testsuite/Makefile.am-hold
? testsuite/ver_test_12.cc
? testsuite/ver_test_12a.cc
? testsuite/ver_test_12b.cc
? testsuite/ver_test_12b.script
? testsuite/ver_test_13.cc
Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.210
diff -u -p -r1.210 layout.cc
--- layout.cc	1 Jul 2011 22:05:01 -0000	1.210
+++ layout.cc	3 Jul 2011 04:45:18 -0000
@@ -4218,8 +4218,18 @@ Layout::finish_dynamic_section(const Inp
         }
     }
 
-  // Add a DT_FLAGS entry. We add it even if no flags are set so that
-  // post-link tools can easily modify these flags if desired.
+  if (parameters->options().filter() != NULL)
+    odyn->add_string(elfcpp::DT_FILTER, parameters->options().filter());
+  if (parameters->options().any_auxiliary())
+    {
+      for (options::String_set::const_iterator p =
+	     parameters->options().auxiliary_begin();
+	   p != parameters->options().auxiliary_end();
+	   ++p)
+	odyn->add_string(elfcpp::DT_AUXILIARY, *p);
+    }
+
+  // Add a DT_FLAGS entry if necessary.
   unsigned int flags = 0;
   if (have_textrel)
     {
Index: options.cc
===================================================================
RCS file: /cvs/src/src/gold/options.cc,v
retrieving revision 1.110
diff -u -p -r1.110 options.cc
--- options.cc	28 Jun 2011 23:12:31 -0000	1.110
+++ options.cc	3 Jul 2011 04:45:18 -0000
@@ -1166,6 +1166,14 @@ General_options::finalize()
   if (this->pie() && this->relocatable())
     gold_fatal(_("-pie and -r are incompatible"));
 
+  if (!this->shared())
+    {
+      if (this->filter() != NULL)
+	gold_fatal(_("-F/--filter may not used without -shared"));
+      if (this->any_auxiliary())
+	gold_fatal(_("-f/--auxiliary may not be used without -shared"));
+    }
+
   // TODO: implement support for -retain-symbols-file with -r, if needed.
   if (this->relocatable() && this->retain_symbols_file())
     gold_fatal(_("-retain-symbols-file does not yet work with -r"));
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.163
diff -u -p -r1.163 options.h
--- options.h	2 Jul 2011 00:39:13 -0000	1.163
+++ options.h	3 Jul 2011 04:45:18 -0000
@@ -735,6 +735,14 @@ class General_options
 	      N_("(ARM only) Do not warn about objects with incompatible "
 		 "enum sizes"));
 
+  DEFINE_set(auxiliary, options::TWO_DASHES, 'f',
+	     N_("Auxiliary filter for shared object symbol table"),
+	     N_("SHLIB"));
+
+  DEFINE_string(filter, options::TWO_DASHES, 'F', NULL,
+		N_("Filter for shared object symbol table"),
+		N_("SHLIB"));
+
   DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
 	      N_("Treat warnings as errors"),
 	      N_("Do not treat warnings as errors"));

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