From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2206) id E37053854830; Fri, 9 Jul 2021 11:01:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E37053854830 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Siddhesh Poyarekar To: glibc-cvs@sourceware.org Subject: [glibc/siddhesh/other-lib-compat] Avoid running __malloc_initialize_hook tests on newer targets X-Act-Checkin: glibc X-Git-Author: Siddhesh Poyarekar X-Git-Refname: refs/heads/siddhesh/other-lib-compat X-Git-Oldrev: 1e5235c5618b60fb196afb292ea88578577e8bc5 X-Git-Newrev: 606de233c42c9e8060fc0ac631b1c2f62c9dcb37 Message-Id: <20210709110148.E37053854830@sourceware.org> Date: Fri, 9 Jul 2021 11:01:48 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 11:01:49 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=606de233c42c9e8060fc0ac631b1c2f62c9dcb37 commit 606de233c42c9e8060fc0ac631b1c2f62c9dcb37 Author: Siddhesh Poyarekar Date: Fri Jul 9 16:29:45 2021 +0530 Avoid running __malloc_initialize_hook tests on newer targets Newer targets do not have __malloc_initialize_hook because of which this test should fail on those targets. Make the test conditional on the ABI versions. A new macro OTHER_LIB_COMPAT has been introduced to allow this check. Diff: --- include/shlib-compat.h | 13 +++++++++---- malloc/tst-mallocstate.c | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/shlib-compat.h b/include/shlib-compat.h index 6c423c8cb0..76398a9add 100644 --- a/include/shlib-compat.h +++ b/include/shlib-compat.h @@ -43,6 +43,14 @@ && (!(ABI_##lib##_##obsoleted - 0) \ || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))) +/* Like LIB_COMPAT, but it can check versions in other libraries. It is + not always false for !IS_IN (LIB). */ +#define OTHER_LIB_COMPAT(lib, introduced, obsoleted) \ + _OTHER_LIB_COMPAT (lib, introduced, obsoleted) +#define _OTHER_LIB_COMPAT(lib, introduced, obsoleted) \ + (!(ABI_##lib##_##obsoleted - 0) \ + || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))) + #ifdef SHARED /* Similar to LIB_COMPAT, but evaluate to 0 for static build. The @@ -56,10 +64,7 @@ /* Like SHLIB_COMPAT, but it can check versions in other libraries. It is not always false for !IS_IN (LIB). */ #define OTHER_SHLIB_COMPAT(lib, introduced, obsoleted) \ - _OTHER_SHLIB_COMPAT (lib, introduced, obsoleted) -#define _OTHER_SHLIB_COMPAT(lib, introduced, obsoleted) \ - (!(ABI_##lib##_##obsoleted - 0) \ - || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))) + _OTHER_LIB_COMPAT (lib, introduced, obsoleted) /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to the version set name to use for e.g. symbols first introduced into diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c index ba726505e7..73d3f85b01 100644 --- a/malloc/tst-mallocstate.c +++ b/malloc/tst-mallocstate.c @@ -377,6 +377,11 @@ my_free (void *ptr) static int do_test (void) { +/* The test will not work on newer targets since __malloc_initialize_hook was + deprecated in 2.24. */ +#if !OTHER_LIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_24) + FAIL_UNSUPPORTED ("Target does not have __malloc_initialize_hook"); +#endif my_free (malloc (1)); TEST_VERIFY_EXIT (heap_initialized);