[RFC,v4,3/6] Document -z unique/-z nounique in the ld man page and help output

Message ID 5027dd42e084d9e291349374c51291c563fc00f8.1594308457.git.vivek@collabora.com
State New
Headers show
  • binutils patches for DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE
Related show

Commit Message

Libor Bukata via Binutils July 9, 2020, 3:29 p.m.
 ld/ld.texi  | 10 ++++++++++
 ld/lexsup.c |  4 ++++
 2 files changed, 14 insertions(+)



diff --git a/ld/ld.texi b/ld/ld.texi
index 40b042de9b..e578da920a 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1305,6 +1305,16 @@  Specify that the dynamic loader should modify its symbol search order
 so that symbols in this shared library interpose all other shared
 libraries not so marked.
+@item unique
+@itemx nounique
+When generating a shared library or other dynamically loadable ELF
+object mark it as one that should (by default) only ever be loaded once,
+and only in the main namespace (when using @code{dlmopen}). This is
+primarily used to mark fundamental libraries such as libc, libpthread et
+al which do not usually function correctly unless they are the sole instances
+of themselves. This behaviour can be overridden by the @code{dlmopen} caller
+and does not apply to certain loading mechanisms (such as audit libraries).
 @item lazy
 When generating an executable or shared library, mark it to tell the
 dynamic linker to defer function call resolution to the point when
diff --git a/ld/lexsup.c b/ld/lexsup.c
index a79bec0b45..1f12ccb4c0 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1925,6 +1925,10 @@  elf_shlib_list_options (FILE *file)
   fprintf (file, _("\
   -z interpose                Mark object to interpose all DSOs but executable\n"));
   fprintf (file, _("\
+  -z unique                   Mark DSO to be loaded at most once by default, and only in the main namespace\n"));
+  fprintf (file, _("\
+  -z nounique                 Don't mark DSO as a loadable at most once\n"));
+  fprintf (file, _("\
   -z lazy                     Mark object lazy runtime binding (default)\n"));
   fprintf (file, _("\
   -z loadfltr                 Mark object requiring immediate process\n"));