]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Extend malloc function hiding to tst-memaling-2 and tst-reallocarray (BZ #32366)
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 2 Apr 2025 15:51:51 +0000 (12:51 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 28 Oct 2025 16:54:55 +0000 (13:54 -0300)
Add "tst-malloc-aux.h" on tst-memalign-2.c and extend the mechanism
to handle reallocarray as well (clang-20 also optimize-out
reallocarray).

malloc/tst-malloc-aux.h
malloc/tst-memalign-2.c
malloc/tst-memalign-3.c
malloc/tst-reallocarray.c

index cd752afa8ba1c7810a3071f5887fa701c398a1d7..8bed28583a09aca913b48bd0ec8e1b7f13cbff96 100644 (file)
@@ -34,6 +34,7 @@ static __typeof (posix_memalign) * volatile posix_memalign_indirect
 static __typeof (pvalloc) * volatile pvalloc_indirect = pvalloc;
 static __typeof (realloc) * volatile realloc_indirect = realloc;
 static __typeof (valloc) * volatile valloc_indirect = valloc;
+static __typeof (reallocarray) * volatile reallocarray_indirect = reallocarray;
 
 #undef aligned_alloc
 #undef calloc
@@ -43,6 +44,7 @@ static __typeof (valloc) * volatile valloc_indirect = valloc;
 #undef pvalloc
 #undef realloc
 #undef valloc
+#undef reallocarray
 
 #define aligned_alloc aligned_alloc_indirect
 #define calloc calloc_indirect
@@ -52,5 +54,6 @@ static __typeof (valloc) * volatile valloc_indirect = valloc;
 #define pvalloc pvalloc_indirect
 #define realloc realloc_indirect
 #define valloc valloc_indirect
+#define reallocarray reallocarray_indirect
 
 #endif /* TST_MALLOC_AUX_H */
index 4494e641c64fce29b48d3746213b20b87bf9f6c6..61f9fad3e8989a98cf00617aca9deacab02aa84a 100644 (file)
@@ -25,6 +25,8 @@
 #include <libc-pointer-arith.h>
 #include <support/check.h>
 
+#include "tst-malloc-aux.h"
+
 typedef struct TestCase {
   size_t size;
   size_t alignment;
index 4b462f08c9a2416c4998542fff111a5bf7be0888..7c6ca49cf4fd50ee617f833d951b084d5b354205 100644 (file)
@@ -27,6 +27,7 @@
 #include <support/check.h>
 #include <support/xthread.h>
 
+#include "tst-malloc-aux.h"
 
 typedef struct TestCase {
   size_t size;
index b4df4aa4e6dfde3f3c0b45156238e04ed28ec1c1..9df61c317db63e2cfc604724e7ca4b0242774bb2 100644 (file)
@@ -22,6 +22,8 @@
 #include <support/check.h>
 #include <libc-diag.h>
 
+#include "tst-malloc-aux.h"
+
 static void *
 reallocarray_nowarn (void *ptr, size_t nmemb, size_t size)
 {