unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* tst-interpose-static-thread-{m,malloc-}check linking statically?
@ 2021-07-21 19:04 Samuel Thibault via Libc-alpha
       [not found] ` <41e663cf-208d-4d9d-a8eb-351163d6e168@email.android.com>
  2021-07-22 14:01 ` [PATCH] Exclude static tests for mcheck and malloc-check Siddhesh Poyarekar via Libc-alpha
  0 siblings, 2 replies; 8+ messages in thread
From: Samuel Thibault via Libc-alpha @ 2021-07-21 19:04 UTC (permalink / raw)
  To: libc-alpha, Siddhesh Poyarekar, DJ Delorie

Hello,

tl;dr: I believe we want the patch below? AIUI the
tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to
be linked completely statically?


On the GNU/Hurd port we have an issue linking the
tst-interpose-static-thread-{m,malloc-}check
tests:

gcc -pie -Wl,-O1 -nostdlib -nostartfiles -o /usr/src/glibc-upstream/build/malloc/tst-interpose-static-thread-mcheck    -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /usr/src/glibc-upstream/build/csu/Scrt1.o /usr/src/glibc-upstream/build/csu/crti.o `gcc  --print-file-name=crtbeginS.o` /usr/src/glibc-upstream/build/malloc/tst-interpose-static-thread.o /usr/src/glibc-upstream/build/support/libsupport_nonshared.a /usr/src/glibc-upstream/build/malloc/libmcheck.a /usr/src/glibc-upstream/build/malloc/tst-interpose-aux-thread.o ../htl/libpthread_syms.a /usr/src/glibc-upstream/build/htl/libpthread.a /usr/src/glibc-upstream/build/mach/libmachuser.a /usr/src/glibc-upstream/build/hurd/libhurduser.a  -Wl,-dynamic-linker=/lib/i386-gnu/ld.so.1 -Wl,-rpath-link=/usr/src/glibc-upstream/build:/usr/src/glibc-upstream/build/math:/usr/src/glibc-upstream/build/elf:/usr/src/glibc-upstream/build/dlfcn:/usr/src/glibc-upstream/build/nss:/usr/src/glibc-upstream/build/nis:/usr/src/glibc-upstream/build/rt:/usr/src/glibc-upstream/build/resolv:/usr/src/glibc-upstream/build/mathvec:/usr/src/glibc-upstream/build/support:/usr/src/glibc-upstream/build/crypt:/usr/src/glibc-upstream/build/htl:/usr/src/glibc-upstream/build/mach:/usr/src/glibc-upstream/build/hurd -lgcc -Wl,--as-needed -lgcc_s  -Wl,--no-as-needed /usr/src/glibc-upstream/build/libc.so.0.3 /usr/src/glibc-upstream/build/libc_nonshared.a -Wl,--as-needed /usr/src/glibc-upstream/build/elf/ld.so -Wl,--no-as-needed -lgcc -Wl,--as-needed -lgcc_s  -Wl,--no-as-needed `gcc  --print-file-name=crtendS.o` /usr/src/glibc-upstream/build/csu/crtn.o
/usr/bin/ld: /usr/src/glibc-upstream/build/htl/libpthread.a(pt-sysdep.o): in function `_init_routine':
/usr/src/glibc-upstream/htl/../sysdeps/mach/hurd/htl/pt-sysdep.c:88: undefined reference to `_dl_init_static_tls'
collect2: error: ld returned 1 exit status

The problem is that libpthread.a is getting linked in, but not libc.a,
and thus _dl_init_static_tls (from libc.a) is not available to
libpthread. But I'm wondering: are we supposed to support linking
libpthread statically in while not linking libc statically in? The
source code suggests me that we aren't.

Samuel

diff --git a/malloc/Makefile b/malloc/Makefile
index 47369b6084..fc66abe94b 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -46,7 +46,11 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
 
 tests-static := \
 	 tst-interpose-static-nothread \
+	 tst-interpose-static-nothread-mcheck \
+	 tst-interpose-static-nothread-malloc-check \
 	 tst-interpose-static-thread \
+	 tst-interpose-static-thread-mcheck \
+	 tst-interpose-static-thread-malloc-check \
 	 tst-malloc-usable-static \
 
 # Test for the malloc_set_state symbol removed in glibc 2.25.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: tst-interpose-static-thread-{m,malloc-}check linking statically?
       [not found] ` <41e663cf-208d-4d9d-a8eb-351163d6e168@email.android.com>
@ 2021-07-22  2:09   ` Siddhesh Poyarekar
  2021-07-22 18:36   ` Samuel Thibault via Libc-alpha
  1 sibling, 0 replies; 8+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-22  2:09 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha

[resending to list; I forgot that libc-alpha drops html emails]

On 7/22/21 2:48 AM, Siddhesh Poyarekar wrote:
> On 22-Jul-2021 00:34, Samuel Thibault via Libc-alpha <libc-alpha@sourceware.org> wrote:
>>
>> tl;dr: I believe we want the patch below? AIUI the
>> tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to
>> be linked completely statically?
> 
> 
> Those tests ought to be removed when malloc hooks get dropped since mcheck and malloc-check won't work with static libraries.
> 
> Siddhesh
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] Exclude static tests for mcheck and malloc-check
  2021-07-21 19:04 tst-interpose-static-thread-{m,malloc-}check linking statically? Samuel Thibault via Libc-alpha
       [not found] ` <41e663cf-208d-4d9d-a8eb-351163d6e168@email.android.com>
@ 2021-07-22 14:01 ` Siddhesh Poyarekar via Libc-alpha
  2021-07-24 14:52   ` Samuel Thibault via Libc-alpha
  1 sibling, 1 reply; 8+ messages in thread
From: Siddhesh Poyarekar via Libc-alpha @ 2021-07-22 14:01 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

mcheck and malloc-check no longer work with static binaries, so drop
those tests.

Reported-by: Samuel Thibault <samuel.thibault@gnu.org>
---
 malloc/Makefile | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/malloc/Makefile b/malloc/Makefile
index d54285192a..9b70831d38 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -75,7 +75,8 @@ tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
 	tst-compathooks-off tst-compathooks-on
 
 # Run all tests with MALLOC_CHECK_=3
-tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
+tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
+				  $(tests-static),$(tests))
 
 # -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.
 ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
@@ -94,7 +95,7 @@ tests-exclude-mcheck = tst-mallocstate \
 	tst-malloc_info \
 	tst-compathooks-off tst-compathooks-on
 
-tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
+tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
 endif
 
 routines = malloc mcheck mtrace obstack reallocarray \
@@ -290,16 +291,8 @@ $(objpfx)tst-interpose-thread-mcheck: \
 $(objpfx)tst-interpose-thread-malloc-check: \
   $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
 $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o
-$(objpfx)tst-interpose-static-nothread-mcheck: \
-	$(objpfx)tst-interpose-aux-nothread.o
-$(objpfx)tst-interpose-static-nothread-malloc-check: \
-	$(objpfx)tst-interpose-aux-nothread.o
 $(objpfx)tst-interpose-static-thread: \
   $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
-$(objpfx)tst-interpose-static-thread-mcheck: \
-  $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
-$(objpfx)tst-interpose-static-thread-malloc-check: \
-  $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
 
 tst-dynarray-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray.mtrace \
 		   LD_PRELOAD=$(objpfx)libc_malloc_debug.so
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: tst-interpose-static-thread-{m,malloc-}check linking statically?
       [not found] ` <41e663cf-208d-4d9d-a8eb-351163d6e168@email.android.com>
  2021-07-22  2:09   ` Siddhesh Poyarekar
@ 2021-07-22 18:36   ` Samuel Thibault via Libc-alpha
  2021-07-23  1:28     ` Siddhesh Poyarekar
  1 sibling, 1 reply; 8+ messages in thread
From: Samuel Thibault via Libc-alpha @ 2021-07-22 18:36 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha

Siddhesh Poyarekar, le jeu. 22 juil. 2021 02:48:06 +0530, a ecrit:
> On 22-Jul-2021 00:34, Samuel Thibault via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> 
> > tl;dr: I believe we want the patch below? AIUI the
> > tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to
> > be linked completely statically?
> 
> Those tests ought to be removed when malloc hooks get dropped since mcheck and
> malloc-check won't work with static libraries.

So this?  Or just excluding tst-interpose-static-thread?

diff --git a/malloc/Makefile b/malloc/Makefile
index d54285192a..0980e2901b 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -72,7 +72,8 @@ test-srcs = tst-mtrace
 # with MALLOC_CHECK_=3 because they expect a specific failure.
 tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
 	tst-mxfast tst-safe-linking \
-	tst-compathooks-off tst-compathooks-on
+	tst-compathooks-off tst-compathooks-on \
+	tst-interpose-static-nothread tst-interpose-static-thread
 
 # Run all tests with MALLOC_CHECK_=3
 tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
@@ -92,7 +93,8 @@ tests-exclude-mcheck = tst-mallocstate \
 	tst-malloc-thread-fail \
 	tst-malloc-usable-tunables \
 	tst-malloc_info \
-	tst-compathooks-off tst-compathooks-on
+	tst-compathooks-off tst-compathooks-on \
+	tst-interpose-static-nothread tst-interpose-static-thread
 
 tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
 endif

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: tst-interpose-static-thread-{m,malloc-}check linking statically?
  2021-07-22 18:36   ` Samuel Thibault via Libc-alpha
@ 2021-07-23  1:28     ` Siddhesh Poyarekar
  2021-07-23  7:45       ` Samuel Thibault via Libc-alpha
  0 siblings, 1 reply; 8+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-23  1:28 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha

On 7/23/21 12:06 AM, Samuel Thibault wrote:
> Siddhesh Poyarekar, le jeu. 22 juil. 2021 02:48:06 +0530, a ecrit:
>> On 22-Jul-2021 00:34, Samuel Thibault via Libc-alpha
>> <libc-alpha@sourceware.org> wrote:
>>
>>> tl;dr: I believe we want the patch below? AIUI the
>>> tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to
>>> be linked completely statically?
>>
>> Those tests ought to be removed when malloc hooks get dropped since mcheck and
>> malloc-check won't work with static libraries.
> 
> So this?  Or just excluding tst-interpose-static-thread?

Excluding all static tets, like this:

https://patchwork.sourceware.org/project/glibc/patch/20210722140115.2911835-1-siddhesh@sourceware.org/

Could you please see if the above patch fixes it for you?

Thanks,
Siddhesh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: tst-interpose-static-thread-{m,malloc-}check linking statically?
  2021-07-23  1:28     ` Siddhesh Poyarekar
@ 2021-07-23  7:45       ` Samuel Thibault via Libc-alpha
  2021-07-23 11:18         ` Siddhesh Poyarekar
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Thibault via Libc-alpha @ 2021-07-23  7:45 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha

Siddhesh Poyarekar, le ven. 23 juil. 2021 06:58:01 +0530, a ecrit:
> On 7/23/21 12:06 AM, Samuel Thibault wrote:
> > Siddhesh Poyarekar, le jeu. 22 juil. 2021 02:48:06 +0530, a ecrit:
> > > On 22-Jul-2021 00:34, Samuel Thibault via Libc-alpha
> > > <libc-alpha@sourceware.org> wrote:
> > > 
> > > > tl;dr: I believe we want the patch below? AIUI the
> > > > tst-interpose-static-{no,}thread-{m,malloc-}check tests are supposed to
> > > > be linked completely statically?
> > > 
> > > Those tests ought to be removed when malloc hooks get dropped since mcheck and
> > > malloc-check won't work with static libraries.
> > 
> > So this?  Or just excluding tst-interpose-static-thread?
> 
> Excluding all static tets, like this:
> 
> https://patchwork.sourceware.org/project/glibc/patch/20210722140115.2911835-1-siddhesh@sourceware.org/
> 
> Could you please see if the above patch fixes it for you?

Yes, that fixes it!

Samuel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: tst-interpose-static-thread-{m,malloc-}check linking statically?
  2021-07-23  7:45       ` Samuel Thibault via Libc-alpha
@ 2021-07-23 11:18         ` Siddhesh Poyarekar
  0 siblings, 0 replies; 8+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-23 11:18 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: libc-alpha

On 7/23/21 1:15 PM, Samuel Thibault wrote:
>> Excluding all static tets, like this:
>>
>> https://patchwork.sourceware.org/project/glibc/patch/20210722140115.2911835-1-siddhesh@sourceware.org/
>>
>> Could you please see if the above patch fixes it for you?
> 
> Yes, that fixes it!

Thanks for confirming, could you please review the patch too?  I can 
then push it since it is a bug fix and doesn't impact ABI.

Siddhesh

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Exclude static tests for mcheck and malloc-check
  2021-07-22 14:01 ` [PATCH] Exclude static tests for mcheck and malloc-check Siddhesh Poyarekar via Libc-alpha
@ 2021-07-24 14:52   ` Samuel Thibault via Libc-alpha
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault via Libc-alpha @ 2021-07-24 14:52 UTC (permalink / raw)
  To: Siddhesh Poyarekar; +Cc: libc-alpha

Siddhesh Poyarekar, le jeu. 22 juil. 2021 19:31:15 +0530, a ecrit:
> mcheck and malloc-check no longer work with static binaries, so drop
> those tests.
> 
> Reported-by: Samuel Thibault <samuel.thibault@gnu.org>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  malloc/Makefile | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/malloc/Makefile b/malloc/Makefile
> index d54285192a..9b70831d38 100644
> --- a/malloc/Makefile
> +++ b/malloc/Makefile
> @@ -75,7 +75,8 @@ tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
>  	tst-compathooks-off tst-compathooks-on
>  
>  # Run all tests with MALLOC_CHECK_=3
> -tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
> +tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \
> +				  $(tests-static),$(tests))
>  
>  # -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.
>  ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
> @@ -94,7 +95,7 @@ tests-exclude-mcheck = tst-mallocstate \
>  	tst-malloc_info \
>  	tst-compathooks-off tst-compathooks-on
>  
> -tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
> +tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests))
>  endif
>  
>  routines = malloc mcheck mtrace obstack reallocarray \
> @@ -290,16 +291,8 @@ $(objpfx)tst-interpose-thread-mcheck: \
>  $(objpfx)tst-interpose-thread-malloc-check: \
>    $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
>  $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o
> -$(objpfx)tst-interpose-static-nothread-mcheck: \
> -	$(objpfx)tst-interpose-aux-nothread.o
> -$(objpfx)tst-interpose-static-nothread-malloc-check: \
> -	$(objpfx)tst-interpose-aux-nothread.o
>  $(objpfx)tst-interpose-static-thread: \
>    $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
> -$(objpfx)tst-interpose-static-thread-mcheck: \
> -  $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
> -$(objpfx)tst-interpose-static-thread-malloc-check: \
> -  $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
>  
>  tst-dynarray-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray.mtrace \
>  		   LD_PRELOAD=$(objpfx)libc_malloc_debug.so

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-24 14:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 19:04 tst-interpose-static-thread-{m,malloc-}check linking statically? Samuel Thibault via Libc-alpha
     [not found] ` <41e663cf-208d-4d9d-a8eb-351163d6e168@email.android.com>
2021-07-22  2:09   ` Siddhesh Poyarekar
2021-07-22 18:36   ` Samuel Thibault via Libc-alpha
2021-07-23  1:28     ` Siddhesh Poyarekar
2021-07-23  7:45       ` Samuel Thibault via Libc-alpha
2021-07-23 11:18         ` Siddhesh Poyarekar
2021-07-22 14:01 ` [PATCH] Exclude static tests for mcheck and malloc-check Siddhesh Poyarekar via Libc-alpha
2021-07-24 14:52   ` Samuel Thibault via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).