[v10,01/11] Make mcheck tests conditional on GLIBC_2.23 or earlier

Message ID 20210719184637.1225275-2-siddhesh@sourceware.org
State New
Headers show
Series
  • malloc hooks removal
Related show

Commit Message

H.J. Lu via Libc-alpha July 19, 2021, 6:46 p.m.
Targets with base versions of 2.24 or later won't have
__malloc_initialize_hook because of which the tests will essentially
be the same as the regular malloc tests.  Avoid running them instead
and save time.
---
 malloc/Makefile | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.31.1

Comments

H.J. Lu via Libc-alpha July 22, 2021, 12:26 p.m. | #1
On 7/19/21 2:46 PM, Siddhesh Poyarekar wrote:
> Targets with base versions of 2.24 or later won't have

> __malloc_initialize_hook because of which the tests will essentially

> be the same as the regular malloc tests.  Avoid running them instead

> and save time.


Fixes the < 2.24 check correctly.

OK for 2.34.

Tested without regression on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---

>  malloc/Makefile | 3 +++

>  1 file changed, 3 insertions(+)

> 

> diff --git a/malloc/Makefile b/malloc/Makefile

> index 47369b6084..6cac2e5d8d 100644

> --- a/malloc/Makefile

> +++ b/malloc/Makefile

> @@ -78,6 +78,8 @@ tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \

>  # Run all tests with MALLOC_CHECK_=3

>  tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))

>  

> +# -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.

> +ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)

>  # Tests that don't play well with mcheck.  They are either bugs in mcheck or

>  # the tests expect specific internal behavior that is changed due to linking to

>  # libmcheck.a.

> @@ -100,6 +102,7 @@ tests-exclude-mcheck = tst-mallocstate \

>  	tst-reallocarray

>  

>  tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))

> +endif

>  

>  routines = malloc morecore mcheck mtrace obstack reallocarray \

>    scratch_buffer_dupfree \

> 



-- 
Cheers,
Carlos.

Patch

diff --git a/malloc/Makefile b/malloc/Makefile
index 47369b6084..6cac2e5d8d 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -78,6 +78,8 @@  tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \
 # Run all tests with MALLOC_CHECK_=3
 tests-malloc-check = $(filter-out $(tests-exclude-malloc-check),$(tests))
 
+# -lmcheck needs __malloc_initialize_hook, which was deprecated in 2.24.
+ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes)
 # Tests that don't play well with mcheck.  They are either bugs in mcheck or
 # the tests expect specific internal behavior that is changed due to linking to
 # libmcheck.a.
@@ -100,6 +102,7 @@  tests-exclude-mcheck = tst-mallocstate \
 	tst-reallocarray
 
 tests-mcheck = $(filter-out $(tests-exclude-mcheck), $(tests))
+endif
 
 routines = malloc morecore mcheck mtrace obstack reallocarray \
   scratch_buffer_dupfree \