[RFC,v12,8/8] Drop DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE from the libpthread DSO

Message ID 20210708163255.812-9-vivek@collabora.com
State Superseded
Delegated to: Adhemerval Zanella Netto
Headers
Series Implementation of RTLD_SHARED for dlmopen |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit fail Patch series failed to apply

Commit Message

Vivek Dasmohapatra July 8, 2021, 4:32 p.m. UTC
  libpthread should have no contents that are sensitive
to duplication anymore, so doesn't require special
treatment under dlmopen.
---
 extra-lib.mk  | 2 ++
 htl/Makefile  | 3 ++-
 nptl/Makefile | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

Adhemerval Zanella Aug. 9, 2021, 8:10 p.m. UTC | #1
On 08/07/2021 13:32, Vivek Das Mohapatra via Libc-alpha wrote:
> libpthread should have no contents that are sensitive
> to duplication anymore, so doesn't require special
> treatment under dlmopen.

LGTM, but this patch should be merged with the one that actually adds
actually handles DT_GNU_FLAGS_1/DF_GNU_1_UNIQUE.

> ---
>  extra-lib.mk  | 2 ++
>  htl/Makefile  | 3 ++-
>  nptl/Makefile | 3 ++-
>  3 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/extra-lib.mk b/extra-lib.mk
> index 9051958ec0..38184adae1 100644
> --- a/extra-lib.mk
> +++ b/extra-lib.mk
> @@ -102,9 +102,11 @@ $(objpfx)$(lib).so: $(firstword $($(lib)-map) \
>  					    $(filter $(lib).map, \
>  						     $(version-maps))))
>  ifneq ($(ld-zunique),yes)
> +ifneq ($(lib),libpthread)
>  $(objpfx)$(lib).so: $(common-objpfx)/elf/dynamic-notes.os
>  endif
>  endif
> +endif
>  
>  endif
>  
> diff --git a/htl/Makefile b/htl/Makefile
> index c2a25dcd79..ce6d9a8cd1 100644
> --- a/htl/Makefile
> +++ b/htl/Makefile
> @@ -202,9 +202,10 @@ $(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
> +LDFLAGS-pthread.so += -Wl,-z,nounique
>  endif
>  
>  include ../Rules
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 81353b9455..7fcddbb263 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -376,8 +376,9 @@ 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
> +# Turn off DF_GNU_1_UNIQUE for libpthread now that it's a stub.
>  ifeq ($(ld-zunique),yes)
> -LDFLAGS-pthread.so += -Wl,-z,unique
> +LDFLAGS-pthread.so += -Wl,-z,nounique
>  endif
>  
>  tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4
>
  
Florian Weimer Aug. 9, 2021, 9:24 p.m. UTC | #2
* Vivek Das Mohapatra via Libc-alpha:

> libpthread should have no contents that are sensitive
> to duplication anymore, so doesn't require special
> treatment under dlmopen.

htl still needs to be UNIQUE.

(Sorry for providing incorrect information earlier.)

Thanks,
Florian
  

Patch

diff --git a/extra-lib.mk b/extra-lib.mk
index 9051958ec0..38184adae1 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -102,9 +102,11 @@  $(objpfx)$(lib).so: $(firstword $($(lib)-map) \
 					    $(filter $(lib).map, \
 						     $(version-maps))))
 ifneq ($(ld-zunique),yes)
+ifneq ($(lib),libpthread)
 $(objpfx)$(lib).so: $(common-objpfx)/elf/dynamic-notes.os
 endif
 endif
+endif
 
 endif
 
diff --git a/htl/Makefile b/htl/Makefile
index c2a25dcd79..ce6d9a8cd1 100644
--- a/htl/Makefile
+++ b/htl/Makefile
@@ -202,9 +202,10 @@  $(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
+LDFLAGS-pthread.so += -Wl,-z,nounique
 endif
 
 include ../Rules
diff --git a/nptl/Makefile b/nptl/Makefile
index 81353b9455..7fcddbb263 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -376,8 +376,9 @@  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
+# Turn off DF_GNU_1_UNIQUE for libpthread now that it's a stub.
 ifeq ($(ld-zunique),yes)
-LDFLAGS-pthread.so += -Wl,-z,unique
+LDFLAGS-pthread.so += -Wl,-z,nounique
 endif
 
 tests += tst-cancelx7 tst-cancelx17 tst-cleanupx4