mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
[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...
This commit is contained in:
committed by
Nick Terrell
parent
b0bcbbfe16
commit
e767d5c7c1
@ -186,11 +186,14 @@ static void __attribute__((noinline)) use(void *x) {
|
|||||||
asm volatile("" : "+r"(x));
|
asm volatile("" : "+r"(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__((noinline)) fill_stack(void) {
|
||||||
|
memset(g_stack, 0x33, 8192);
|
||||||
|
}
|
||||||
|
|
||||||
static void __attribute__((noinline)) set_stack(void) {
|
static void __attribute__((noinline)) set_stack(void) {
|
||||||
|
|
||||||
char stack[8192];
|
char stack[8192];
|
||||||
g_stack = stack;
|
g_stack = stack;
|
||||||
memset(g_stack, 0x33, 8192);
|
|
||||||
use(g_stack);
|
use(g_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +211,7 @@ static void __attribute__((noinline)) check_stack(void) {
|
|||||||
|
|
||||||
static void test_stack_usage(test_data_t const *data) {
|
static void test_stack_usage(test_data_t const *data) {
|
||||||
set_stack();
|
set_stack();
|
||||||
|
fill_stack();
|
||||||
test_f2fs();
|
test_f2fs();
|
||||||
test_btrfs(data);
|
test_btrfs(data);
|
||||||
test_decompress_unzstd(data);
|
test_decompress_unzstd(data);
|
||||||
|
Reference in New Issue
Block a user