diff mbox series

[RFC,v7,18/20] Add DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE dynamic section+flag to glibc DSOs

Message ID 20201216132650.22949-19-vivek@collabora.com
State New
Headers show
Series Implementation of RTLD_SHARED for dlmopen | expand

Commit Message

Vivek Das Mohapatra Dec. 16, 2020, 1:26 p.m. UTC
libc.so, libpthread.so etc should have the new unique-dso-by-default
flag set to allow dlmopen to work better (libc et al instance shared
by default when DSOs dlmopened into a new namespace).
---
 Makeconfig         | 1 +
 Makerules          | 2 +-
 htl/Makefile       | 2 +-
 iconvdata/Makefile | 1 +
 nptl/Makefile      | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Makeconfig b/Makeconfig
index 8074613b85..6ed137e2a3 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,-z,unique
 
 # 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 ef0fe67d9a..ffb4f74de0 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,-z,unique
 # 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/htl/Makefile b/htl/Makefile
index 326a920fb3..509af4ba7a 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -205,7 +205,7 @@  $(inst_libdir)/libpthread_syms.a: $(srcdir)/libpthread_syms.a $(+force)
 libc-link.so = $(common-objpfx)libc.so
 
 extra-B-pthread.so = -B$(common-objpfx)htl/
-LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
+LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,unique,-z,nodelete,-z,initfirst
 
 include ../Rules
 
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 4ec2741cdc..121808a8fe 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,-z,unique
 
 modules.so := $(addsuffix .so, $(modules))
 
diff --git a/nptl/Makefile b/nptl/Makefile
index ddd83dfbdd..314931cbaa 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -354,7 +354,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,-z,unique,-z,nodelete,-z,initfirst
 
 tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4