+2020-12-15  Vivek Das Mohapatra  <vivek@collabora.com>
+
+       Implement -z unique / -z nounique options.
+       * layout.cc (Layout::finish_dynamic_section): Set DF_GNU_1_UNIQUE.
+       * options.h (class General_options): Handle -z unique, -z nounique.
+
 2020-12-13  Cary Coutant  <ccoutant@gmail.com>
 
        PR gold/23539
 
     flags |= elfcpp::DF_1_PIE;
   if (flags != 0)
     odyn->add_constant(elfcpp::DT_FLAGS_1, flags);
+
+  flags = 0;
+  if (parameters->options().unique())
+    flags |= elfcpp::DF_GNU_1_UNIQUE;
+  if (flags != 0)
+    odyn->add_constant(elfcpp::DT_GNU_FLAGS_1, flags);
 }
 
 // Set the size of the _DYNAMIC symbol table to be the size of the
 
   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"),
+             N_("Do not mark the DSO as one to be loaded only in the main namespace"));
   DEFINE_bool_alias(lazy, now, options::DASH_Z, '\0',
                    N_("Mark object for lazy runtime binding"),
                    NULL, true);