1// Test that HWASan shadow is initialized before .preinit_array functions run.
2
3// RUN: %clang_hwasan %s -o %t
4// RUN: %run %t
5
6volatile int Global;
7void StoreToGlobal() { Global = 42; }
8
9__attribute__((section(".preinit_array"), used))
10void (*__StoreToGlobal_preinit)() = StoreToGlobal;
11
12int main() { return Global != 42; }
13

source code of compiler-rt/test/hwasan/TestCases/preinit_array.c