The following extra-libs have been merged into libc proper:
nptl/libpthread
htl/libpthread
dlfcn/libdl
login/libutil
resolv/libanl
Since they now exist as contentless stubs to satisfy link requirements
for older applications they do not need to be treated as part of the
core libc cluster when opened in a secondary namespace.
---
dlfcn/Makefile | 1 +
extra-lib.mk | 25 +++++++++++++++++++++++++
htl/Makefile | 5 ++---
login/Makefile | 1 +
nptl/Makefile | 4 +---
resolv/Makefile | 2 ++
6 files changed, 32 insertions(+), 6 deletions(-)
@@ -35,6 +35,7 @@ routines = \
libc_dlerror_result \
extra-libs-others := libdl
+not-df-gnu-unique := libdl
libdl-shared-only-routines += libdl-compat
@@ -101,11 +101,36 @@ $(objpfx)$(lib).so: $(firstword $($(lib)-map) \
$(addprefix $(common-objpfx), \
$(filter $(lib).map, \
$(version-maps))))
+
+############################################################################
+# the following have had all functional contents merged back into libc and
+# are no longer considered part of the implicitly DF_GNU_1_UNIQUE cluster:
+# nptl/libpthread htl/libpthread dlfcn/libdl login/libutil resolv/libanl
+
+# NOTE: the mechanisms are reversed depending on linker support:
+# If linker support is present, libraries get the unique flag by default and we
+# _suppress_ this with the -z nounique parameter.
+# If linker support is absent then the flag is _added_ via a hacked up extra
+# object from the elf/ subdir to those DSOs that need it.
+
+# The not-df-gnu-unique variable should contain a space separated list of
+# stub library names (eg pthread for libpthread.so) of extra-libs which should
+# NOT have the uniqueness flag.
+# It should be set in the Makefile of the relevant subdir:
ifneq ($(ld-zunique),yes)
+ifeq (,$(strip $(filter $(not-df-gnu-unique),$(lib))))
$(objpfx)$(lib).so: $(common-objpfx)/elf/dynamic-notes.os
+else
endif
+else
+ifneq (,$(strip $(filter $(not-df-gnu-unique),$(lib))))
+LDFLAGS-$(patsubst lib%,%,$(lib)).so += -Wl,-z,nounique
+else
endif
+endif
+############################################################################
+endif
endif
# This will define `libof-ROUTINE := LIB' for each of the routines.
@@ -169,6 +169,7 @@ shared-only-routines = forward
extra-libs := libpthread
extra-libs-others := $(extra-libs)
+not-df-gnu-unique := libpthread
install-lib := libpthread.so
install-lib-ldscripts := libpthread_syms.a
@@ -202,10 +203,8 @@ $(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/
+# Turn off DF_GNU_1_UNIQUE for libpthread now that it's a stub.
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
-ifeq ($(ld-zunique),yes)
-LDFLAGS-pthread.so += -Wl,-z,unique
-endif
include ../Rules
@@ -50,6 +50,7 @@ ifeq ($(have-GLIBC_2.33),yes)
# Empty compatibility library for old binaries.
extra-libs := libutil
extra-libs-others := $(extra-libs)
+not-df-gnu-unique := libutil
libutil-routines := libutil-compat
libutil-shared-only-routines := libutil-compat
@@ -27,6 +27,7 @@ headers := pthread.h semaphore.h bits/semaphore.h \
extra-libs := libpthread
extra-libs-others := $(extra-libs)
+not-df-gnu-unique := libpthread
routines = \
alloca_cutoff \
@@ -376,9 +377,6 @@ CPPFLAGS-tst-pthread-gdb-attach-static.c := \
tst-pthread-gdb-attach-no-pie = yes
LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
-ifeq ($(ld-zunique),yes)
-LDFLAGS-pthread.so += -Wl,-z,unique
-endif
tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4
@@ -77,8 +77,10 @@ tests-internal += tst-inet_aton_exact
generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
extra-libs := libresolv libnss_dns
+not-df-gnu-unique :=
ifeq ($(have-thread-library),yes)
extra-libs += libanl
+not-df-gnu-unique += libanl
routines += gai_sigqueue
tests += \