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

Message ID 736af5b6e404f4b65c00a6f4914c8f2830bb81af.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
  ---
 ld/ld.texi  | 7 +++++++
 ld/lexsup.c | 2 ++
 2 files changed, 9 insertions(+)
  

Patch

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"));