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: Don't create DT_FLAGS if not needed


Originally gold would always create a DT_FLAGS entry, so that it was
possible for a tool to set flags for an existing executable without
great difficulty.  However, now that gold supports --spare-dynamic-tags,
this is no longer necessary.  This patch removes it.  Committed to
mainline.

Ian


2011-06-18  Ian Lance Taylor  <iant@google.com>

	* layout.cc (Layout::finish_dynamic_section): Don't create
	DT_FLAGS entry if not needed.


Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.201
diff -u -p -r1.201 layout.cc
--- layout.cc	18 Jun 2011 22:29:14 -0000	1.201
+++ layout.cc	18 Jun 2011 22:33:11 -0000
@@ -4162,7 +4162,8 @@ Layout::finish_dynamic_section(const Inp
     }
   if (parameters->options().now())
     flags |= elfcpp::DF_BIND_NOW;
-  odyn->add_constant(elfcpp::DT_FLAGS, flags);
+  if (flags != 0)
+    odyn->add_constant(elfcpp::DT_FLAGS, flags);
 
   flags = 0;
   if (parameters->options().initfirst())
@@ -4187,7 +4188,7 @@ Layout::finish_dynamic_section(const Inp
     flags |= elfcpp::DF_1_ORIGIN;
   if (parameters->options().now())
     flags |= elfcpp::DF_1_NOW;
-  if (flags)
+  if (flags != 0)
     odyn->add_constant(elfcpp::DT_FLAGS_1, flags);
 }
 

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