Implement and document -z unique / -z nounique handling in gold
authorVivek Das Mohapatra <vivek@collabora.com>
Mon, 14 Dec 2020 17:25:55 +0000 (17:25 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 15 Dec 2020 08:15:24 +0000 (18:45 +1030)
* layout.cc (Layout::finish_dynamic_section): Set DF_GNU_1_UNIQUE.
* options.h (class General_options): Handle -z unique, -z nounique.

gold/ChangeLog
gold/layout.cc
gold/options.h

index 533736b95595c454cc5514afdd57c93a65de472a..d1c0ca713ee21be8b3d3e0a8a60b2f8dc666185f 100644 (file)
@@ -1,3 +1,9 @@
+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
index dc88a9d8ae605cee44e904c4ba0559b35448c53d..44664e2943e42b4fa6eea42bdc613309b1a89b70 100644 (file)
@@ -5371,6 +5371,12 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
     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
index 51d3614e6b672d23e3db31ca3f6aecd3bf9badd8..111453b95eeb8b88c37bddd8ded0c337a2376e71 100644 (file)
@@ -1469,6 +1469,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"),
+             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);
This page took 0.033467 seconds and 4 git commands to generate.