[RFC][PATCH v5 15/16] Add a DT_GNU_UNIQUE dynamic section to the glibc cluster DSOs

Vivek Das Mohapatra vivek@collabora.com
Wed Jun 17 14:00:23 GMT 2020


---
 Makeconfig         | 1 +
 Makerules          | 2 +-
 iconvdata/Makefile | 1 +
 nptl/Makefile      | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makeconfig b/Makeconfig
index f252842979..ac38994c52 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -398,6 +398,7 @@ LDFLAGS-lib.so += -Wl,-z,now
 # Extra flags for dynamically linked non-test main programs.
 link-extra-flags += -Wl,-z,now
 endif
+LDFLAGS-lib.so += -Wl,--unique-dso
 
 # Command to run after every final link (executable or shared object).
 # This is invoked with $(call after-link,...), so it should operate on
diff --git a/Makerules b/Makerules
index 1e9c18f0d8..c98db0556b 100644
--- a/Makerules
+++ b/Makerules
@@ -635,7 +635,7 @@ build-shlib-objlist = $(build-module-helper-objlist) \
 # Don't try to use -lc when making libc.so itself.
 # Also omits crti.o and crtn.o, which we do not want
 # since we define our own `.init' section specially.
-LDFLAGS-c.so = -nostdlib -nostartfiles
+LDFLAGS-c.so = -nostdlib -nostartfiles -Wl,--unique-dso
 # But we still want to link libc.so against $(libc.so-gnulib).
 LDLIBS-c.so += $(libc.so-gnulib)
 # Give libc.so an entry point and make it directly runnable itself.
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index c83962f351..aa5f47532e 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -67,6 +67,7 @@ modules	:= ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5		 \
 ifeq ($(bind-now),yes)
 LDFLAGS.so += -Wl,-z,now
 endif
+LDFLAGS.so += -Wl,--unique-dso
 
 modules.so := $(addsuffix .so, $(modules))
 
diff --git a/nptl/Makefile b/nptl/Makefile
index 584e0ffd96..92c30f7260 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -380,7 +380,7 @@ else
 tests-printers-libs := $(static-thread-library)
 endif
 
-LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
+LDFLAGS-pthread.so = -Wl,--enable-new-dtags,--unique-dso,-z,nodelete,-z,initfirst
 
 # GCC-4.9 compiles 'sprintf(NULL, ...)' into UD2 on x86_64 without -fno-builtin
 CFLAGS-tst-cleanup2.c += -fno-builtin
-- 
2.11.0



More information about the Libc-alpha mailing list