summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-04-02 12:51:51 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-11-20 14:53:07 -0300
commit177cc324eec89421c3107b54748d572f3b1b6d2d (patch)
treea380ba3641cd2147baf2b448e48ca0780b430118
parent28fc61a743b581541bb4836f645f8254ab154e1b (diff)
Extend malloc function hiding to tst-memaling-2 and tst-reallocarray (BZ #32366)
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).
-rw-r--r--malloc/tst-malloc-aux.h3
-rw-r--r--malloc/tst-memalign-2.c2
-rw-r--r--malloc/tst-memalign-3.c1
-rw-r--r--malloc/tst-reallocarray.c2
4 files changed, 8 insertions, 0 deletions
diff --git a/malloc/tst-malloc-aux.h b/malloc/tst-malloc-aux.h
index cd752afa8b..8bed28583a 100644
--- a/malloc/tst-malloc-aux.h
+++ b/malloc/tst-malloc-aux.h
@@ -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 */
diff --git a/malloc/tst-memalign-2.c b/malloc/tst-memalign-2.c
index 4494e641c6..61f9fad3e8 100644
--- a/malloc/tst-memalign-2.c
+++ b/malloc/tst-memalign-2.c
@@ -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;
diff --git a/malloc/tst-memalign-3.c b/malloc/tst-memalign-3.c
index 4b462f08c9..7c6ca49cf4 100644
--- a/malloc/tst-memalign-3.c
+++ b/malloc/tst-memalign-3.c
@@ -27,6 +27,7 @@
#include <support/check.h>
#include <support/xthread.h>
+#include "tst-malloc-aux.h"
typedef struct TestCase {
size_t size;
diff --git a/malloc/tst-reallocarray.c b/malloc/tst-reallocarray.c
index b4df4aa4e6..9df61c317d 100644
--- a/malloc/tst-reallocarray.c
+++ b/malloc/tst-reallocarray.c
@@ -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)
{