llvm-project/compiler-rt/test/hwasan/TestCases/preinit_array.c

13 lines
325 B
C

// Test that HWASan shadow is initialized before .preinit_array functions run.
// RUN: %clang_hwasan %s -o %t
// RUN: %run %t
volatile int Global;
void StoreToGlobal() { Global = 42; }
__attribute__((section(".preinit_array"), used))
void (*__StoreToGlobal_preinit)() = StoreToGlobal;
int main() { return Global != 42; }