[RFC][PATCH 3/6] Document DF_1_UNIQUE in the man page and ld help output

Vivek Das Mohapatra vivek@collabora.com
Mon Mar 30 17:42:04 GMT 2020


---
 ld/ld.texi  | 7 +++++++
 ld/lexsup.c | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/ld/ld.texi b/ld/ld.texi
index 9f562935be..af7dfcbb41 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1271,6 +1271,13 @@ 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
+When generating a shared library or other dynamically loadable ELF object
+mark it as one that should 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 cannot function
+correctly unless they are the sole instances of themselves.
+
 @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 2597e2d630..3876b922f4 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1806,6 +1806,8 @@ 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, and only in the main namespace\n"));
+  fprintf (file, _("\
   -z lazy                     Mark object lazy runtime binding (default)\n"));
   fprintf (file, _("\
   -z loadfltr                 Mark object requiring immediate process\n"));
-- 
2.11.0



More information about the Libc-alpha mailing list