diff options
| author | H.J. Lu <hjl.tools@gmail.com> | 2024-12-17 18:41:45 +0800 |
|---|---|---|
| committer | H.J. Lu <hjl.tools@gmail.com> | 2024-12-17 20:51:08 +0800 |
| commit | f9493a15ea9cfb63a815c00c23142369ec09d8ce (patch) | |
| tree | a52b33877ef03bb3343a999bb7930383dc37e3e8 /malloc/tst-malloc-backtrace.c | |
| parent | bd0ea9ff7e8d5f7d54112dfa96d541c3c60e36ae (diff) | |
| download | glibc-f9493a15ea9cfb63a815c00c23142369ec09d8ce.tar.xz glibc-f9493a15ea9cfb63a815c00c23142369ec09d8ce.zip | |
Hide all malloc functions from compiler [BZ #32366]
Since -1 isn't a power of two, compiler may reject it, hide memalign from
Clang 19 which issues an error:
tst-memalign.c:86:31: error: requested alignment is not a power of 2 [-Werror,-Wnon-power-of-two-alignment]
86 | p = memalign (-1, pagesize);
| ^~
tst-memalign.c:86:31: error: requested alignment must be 4294967296 bytes or smaller; maximum alignment assumed [-Werror,-Wbuiltin-assume-aligned-alignment]
86 | p = memalign (-1, pagesize);
| ^~
Update tst-malloc-aux.h to hide all malloc functions and include it in
all malloc tests to prevent compiler from optimizing out any malloc
functions.
Tested with Clang 19.1.5 and GCC 15 20241206 for BZ #32366.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'malloc/tst-malloc-backtrace.c')
| -rw-r--r-- | malloc/tst-malloc-backtrace.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/malloc/tst-malloc-backtrace.c b/malloc/tst-malloc-backtrace.c index c7b1d65e5c..65fa91f6fd 100644 --- a/malloc/tst-malloc-backtrace.c +++ b/malloc/tst-malloc-backtrace.c @@ -22,6 +22,8 @@ #include <support/support.h> #include <libc-diag.h> +#include "tst-malloc-aux.h" + #define SIZE 4096 /* Wrap free with a function to prevent gcc from optimizing it out. */ |
