mirror of git://sourceware.org/git/glibc.git
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).
This commit is contained in:
parent
628d34afdc
commit
3fff436ecf
|
@ -34,6 +34,7 @@ static __typeof (posix_memalign) * volatile posix_memalign_indirect
|
||||||
static __typeof (pvalloc) * volatile pvalloc_indirect = pvalloc;
|
static __typeof (pvalloc) * volatile pvalloc_indirect = pvalloc;
|
||||||
static __typeof (realloc) * volatile realloc_indirect = realloc;
|
static __typeof (realloc) * volatile realloc_indirect = realloc;
|
||||||
static __typeof (valloc) * volatile valloc_indirect = valloc;
|
static __typeof (valloc) * volatile valloc_indirect = valloc;
|
||||||
|
static __typeof (reallocarray) * volatile reallocarray_indirect = reallocarray;
|
||||||
|
|
||||||
#undef aligned_alloc
|
#undef aligned_alloc
|
||||||
#undef calloc
|
#undef calloc
|
||||||
|
@ -43,6 +44,7 @@ static __typeof (valloc) * volatile valloc_indirect = valloc;
|
||||||
#undef pvalloc
|
#undef pvalloc
|
||||||
#undef realloc
|
#undef realloc
|
||||||
#undef valloc
|
#undef valloc
|
||||||
|
#undef reallocarray
|
||||||
|
|
||||||
#define aligned_alloc aligned_alloc_indirect
|
#define aligned_alloc aligned_alloc_indirect
|
||||||
#define calloc calloc_indirect
|
#define calloc calloc_indirect
|
||||||
|
@ -52,5 +54,6 @@ static __typeof (valloc) * volatile valloc_indirect = valloc;
|
||||||
#define pvalloc pvalloc_indirect
|
#define pvalloc pvalloc_indirect
|
||||||
#define realloc realloc_indirect
|
#define realloc realloc_indirect
|
||||||
#define valloc valloc_indirect
|
#define valloc valloc_indirect
|
||||||
|
#define reallocarray reallocarray_indirect
|
||||||
|
|
||||||
#endif /* TST_MALLOC_AUX_H */
|
#endif /* TST_MALLOC_AUX_H */
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <libc-pointer-arith.h>
|
#include <libc-pointer-arith.h>
|
||||||
#include <support/check.h>
|
#include <support/check.h>
|
||||||
|
|
||||||
|
#include "tst-malloc-aux.h"
|
||||||
|
|
||||||
typedef struct TestCase {
|
typedef struct TestCase {
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t alignment;
|
size_t alignment;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <support/check.h>
|
#include <support/check.h>
|
||||||
#include <support/xthread.h>
|
#include <support/xthread.h>
|
||||||
|
|
||||||
|
#include "tst-malloc-aux.h"
|
||||||
|
|
||||||
typedef struct TestCase {
|
typedef struct TestCase {
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <support/check.h>
|
#include <support/check.h>
|
||||||
#include <libc-diag.h>
|
#include <libc-diag.h>
|
||||||
|
|
||||||
|
#include "tst-malloc-aux.h"
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
reallocarray_nowarn (void *ptr, size_t nmemb, size_t size)
|
reallocarray_nowarn (void *ptr, size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue