[PATCH] Add support for '-z global'

Dmitriy Ivanov dimitry@google.com
Thu Nov 20 00:18:00 GMT 2014


 Sets DF_1_GLOBAL flags for DT_FLAGS_1 dynamic section
---
 gold/ChangeLog | 6 ++++++
 gold/layout.cc | 2 ++
 gold/options.h | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index ec76ab9..6617a91 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-19  Dimitry Ivanov <dimitry@google.com>
+
+	* layout.cc (Layout::finish_dynamic_section): When '-z global'
+	is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
+	* options.h (General_options): New -z option (global).
+
 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
diff --git a/gold/layout.cc b/gold/layout.cc
index 7cbbe39..dbcf0a5 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -4869,6 +4869,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
     odyn->add_constant(elfcpp::DT_FLAGS, flags);
 
   flags = 0;
+  if (parameters->options().global())
+    flags |= elfcpp::DF_1_GLOBAL;
   if (parameters->options().initfirst())
     flags |= elfcpp::DF_1_INITFIRST;
   if (parameters->options().interpose())
diff --git a/gold/options.h b/gold/options.h
index cf3b705..00c15b6 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1272,6 +1272,8 @@ class General_options
 	      NULL);
   DEFINE_bool(execstack, options::DASH_Z, '\0', false,
 	      N_("Mark output as requiring executable stack"), NULL);
+  DEFINE_bool(global, options::DASH_Z, '\0', false,
+	      N_("Make symbols in DSO available for subsequently loaded objects"), NULL);
   DEFINE_bool(initfirst, options::DASH_Z, '\0', false,
 	      N_("Mark DSO to be initialized first at runtime"),
 	      NULL);
-- 
2.1.0.rc2.206.gedb03e5



More information about the Binutils mailing list