| 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 | |
| 6 | volatile int Global; |
| 7 | void StoreToGlobal() { Global = 42; } |
| 8 | |
| 9 | __attribute__((section(".preinit_array"), used)) |
| 10 | void (*__StoreToGlobal_preinit)() = StoreToGlobal; |
| 11 | |
| 12 | int main() { return Global != 42; } |
| 13 |
