[RFC,v2,3/6] Document --unique-dso in the man page and ld help output

Message ID 20200617135945.12716-4-vivek@collabora.com
State New
Headers show
Series
  • binutils patches to add DT_GNU_UNIQUE
Related show

Commit Message

Alan Modra via Binutils June 17, 2020, 1:59 p.m.
---
 ld/ld.texi  | 8 ++++++++
 ld/lexsup.c | 2 ++
 2 files changed, 10 insertions(+)

-- 
2.11.0

Patch

diff --git a/ld/ld.texi b/ld/ld.texi
index bf474d4c62..a176cfa4a1 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1144,6 +1144,14 @@  multiple times on the command line;  It prevents the normal merging of
 input sections with the same name, overriding output section assignments
 in a linker script.
 
+@kindex --unique-dso
+@item --unique-dso
+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.
+
 @kindex -v
 @kindex -V
 @kindex --version
diff --git a/ld/lexsup.c b/ld/lexsup.c
index d84b334b34..73a4c9fce0 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1908,6 +1908,8 @@  elf_shlib_list_options (FILE *file)
   -P AUDITLIB, --depaudit=AUDITLIB\n" "\
                               Specify a library to use for auditing dependencies\n"));
   fprintf (file, _("\
+  --unique-dso                Mark DSO to be loaded at most once, and only in the main namespace\n"));
+  fprintf (file, _("\
   -z combreloc                Merge dynamic relocs into one section and sort\n"));
   fprintf (file, _("\
   -z nocombreloc              Don't merge dynamic relocs into one section\n"));