From e767d5c7c144ab911842229a9a8fee527d9616e9 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 13 Dec 2022 15:03:23 -0800 Subject: [PATCH] [contrib][linux-kernel] Fix stack detection for newer gcc Newer gcc versions were getting smart and omitting the `memset()`. Get around this issue by outlining the `memset()` into a different function. This test is still hacky, but it works... --- contrib/linux-kernel/test/test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/linux-kernel/test/test.c b/contrib/linux-kernel/test/test.c index 6cd1730bb..67d248e0c 100644 --- a/contrib/linux-kernel/test/test.c +++ b/contrib/linux-kernel/test/test.c @@ -186,11 +186,14 @@ static void __attribute__((noinline)) use(void *x) { asm volatile("" : "+r"(x)); } +static void __attribute__((noinline)) fill_stack(void) { + memset(g_stack, 0x33, 8192); +} + static void __attribute__((noinline)) set_stack(void) { char stack[8192]; g_stack = stack; - memset(g_stack, 0x33, 8192); use(g_stack); } @@ -208,6 +211,7 @@ static void __attribute__((noinline)) check_stack(void) { static void test_stack_usage(test_data_t const *data) { set_stack(); + fill_stack(); test_f2fs(); test_btrfs(data); test_decompress_unzstd(data);