public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] malloc: Fix malloc debug for 2.35 onwards
@ 2021-11-13  0:40 Stafford Horne
  2021-11-15  2:34 ` Siddhesh Poyarekar
  0 siblings, 1 reply; 9+ messages in thread
From: Stafford Horne @ 2021-11-13  0:40 UTC (permalink / raw)
  To: GLIBC patches

The change 1e5a5866cb ("Remove malloc hooks [BZ #23328]") has broken
ports that are using GLIBC_2_35, like the new OpenRISC port I am working
on.

The libc_malloc_debug.so library used to bring in the debug
infrastructure is currently essentially empty for GLIBC_2_35 ports like
mine causing mtrace tests to fail:

    cat sysdeps/unix/sysv/linux/or1k/shlib-versions
    DEFAULT                 GLIBC_2.35
    ld=ld-linux-or1k.so.1

    FAIL: posix/bug-glob2-mem
    FAIL: posix/bug-regex14-mem
    FAIL: posix/bug-regex2-mem
    FAIL: posix/bug-regex21-mem
    FAIL: posix/bug-regex31-mem
    FAIL: posix/bug-regex36-mem
    FAIL: malloc/tst-mtrace.

The issue seems to be with the ifdefs in malloc/malloc-debug.c. The
ifdefs are currently essentially exluding all symbols for ports > 2.35.
In short:

    if (SHLIB_COMPAT 2.0 -> 2.34)
      debug api
      inlcude .c files
      implement apis

      Generate debug compat api
    endif

This fix changes this to:

    debug api
    inlcude .c files
    implement apis

    if (SHLIB_COMPAT 2.0 -> 2.34)
      Generate debug compat api
    endif

Fixes: 1e5a5866cb ("Remove malloc hooks [BZ #23328]")
Cc: Siddhesh Poyarekar <siddhesh@gotplt.org>
---
 malloc/malloc-debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/malloc/malloc-debug.c b/malloc/malloc-debug.c
index 3d7e6d44fd..6f2b6a2d23 100644
--- a/malloc/malloc-debug.c
+++ b/malloc/malloc-debug.c
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <sys/param.h>
 
-#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_34)
 /* Support only the glibc allocators.  */
 extern void *__libc_malloc (size_t);
 extern void __libc_free (void *);
@@ -640,6 +639,7 @@ compat_symbol (libc_malloc_debug, malloc_set_state, malloc_set_state,
 	       GLIBC_2_0);
 #endif
 
+#if SHLIB_COMPAT (libc_malloc_debug, GLIBC_2_0, GLIBC_2_34)
 /* Do not allow linking against the library.  */
 compat_symbol (libc_malloc_debug, aligned_alloc, aligned_alloc, GLIBC_2_16);
 compat_symbol (libc_malloc_debug, calloc, calloc, GLIBC_2_0);
-- 
2.31.1


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

end of thread, other threads:[~2021-11-16  5:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13  0:40 [PATCH] malloc: Fix malloc debug for 2.35 onwards Stafford Horne
2021-11-15  2:34 ` Siddhesh Poyarekar
2021-11-15  2:40   ` Siddhesh Poyarekar
2021-11-15 21:07     ` Stafford Horne
2021-11-15 22:47       ` Siddhesh Poyarekar
2021-11-16  5:12         ` Stafford Horne
2021-11-16  5:15           ` Siddhesh Poyarekar
2021-11-16  5:29             ` Stafford Horne
2021-11-15 21:04   ` Stafford Horne

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).