[RFC,6/6] Implement and document DF_1_UNIQUE handling in gold

Message ID b61b4c068b86edca0e9f1055dd85249b88897ea7.1585587351.git.vivek@collabora.com
State Not applicable
Headers
Series binutils patches to add DT_FLAGS_1 / DF_1_UNIQUE |

Commit Message

Vivek Dasmohapatra March 30, 2020, 5:42 p.m. UTC
  ---
 gold/layout.cc | 2 ++
 gold/options.h | 3 +++
 2 files changed, 5 insertions(+)
  

Patch

diff --git a/gold/layout.cc b/gold/layout.cc
index be437f3900..d97ac57afc 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -5351,6 +5351,8 @@  Layout::finish_dynamic_section(const Input_objects* input_objects,
     flags |= elfcpp::DF_1_NOW;
   if (parameters->options().Bgroup())
     flags |= elfcpp::DF_1_GROUP;
+  if (parameters->options().unique())
+    flags |= elfcpp::DF_1_UNIQUE;
   if (flags != 0)
     odyn->add_constant(elfcpp::DT_FLAGS_1, flags);
 }
diff --git a/gold/options.h b/gold/options.h
index b2059d984c..de151642c7 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1459,6 +1459,9 @@  class General_options
   DEFINE_bool(interpose, options::DASH_Z, '\0', false,
 	      N_("Mark object to interpose all DSOs but executable"),
 	      NULL);
+  DEFINE_bool(unique, options::DASH_Z, '\0', false,
+              N_("Mark DSO to be loaded at most once, and only in the main namespace"),
+              NULL);
   DEFINE_bool_alias(lazy, now, options::DASH_Z, '\0',
 		    N_("Mark object for lazy runtime binding"),
 		    NULL, true);