1 // RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=0
2 // RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=1
3 
4 // https://code.google.com/p/address-sanitizer/issues/detail?id=260
5 // REQUIRES: lld
6 
7 int undefined();
8 
9 // On i386 clang adds --export-dynamic when linking with ASan, which adds all
10 // non-hidden globals to GC roots.
11 __attribute__((visibility("hidden"))) int (*unused)() = undefined;
12 
13 int main() {
14         return 0;
15 }
16