[PATCH] malloc: Turn tst-mallocstate into a non-internal test

DJ Delorie dj@redhat.com
Fri Mar 5 01:15:01 GMT 2021


Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> writes:
> compat_symbol_reference no longer needs tests-internal.  Do not build
> the test at all for newer targets, so that no spurious UNSUPPORTED
> result is generated.

If this is your only goal, changing "return 77" to "return 0" would have
sufficed ;-)

> -tests-internal := tst-mallocstate tst-scratch_buffer
> +# Test for the malloc_set_state symbol removed in glibc 2.25.
> +ifeq ($(have-GLIBC_2.24)$(build-shared),yesyes)
> +tests += tst-mallocstate
> +endif

If a platform has been around long enough to have been released in glibc
2.24, then we want to add this test.  Ok.

> -# Export the __malloc_initialize_hook variable to libc.so.
> -LDFLAGS-tst-mallocstate = -rdynamic
> -

This is unexplained?  I assume it's part of whatever
"compat_symbol_reference no longer needs tests-internal" encompases.

> -#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_25)

If the test only runs on 2.24-or-older platforms, we don't need to test
for 2.25-or-newer platforms.  Ok.

>  /* Interpose the initialization callback.  */
>  void (*volatile __malloc_initialize_hook) (void) = init_heap;
> +compat_symbol_reference (libc, __malloc_initialize_hook,
> +                         __malloc_initialize_hook, GLIBC_2_0);

How does this work?  On x86-64, that symbol is GLIBC_2.2.5, not
GLIBC_2.0.


More information about the Libc-alpha mailing list