]>
Commit | Line | Data |
---|---|---|
92a42be0 SL |
1 | // REQUIRES: asan-64-bits |
2 | // Regression test: __tls_get_addr interceptor must recognize static TLS. | |
3 | // | |
4 | // RUN: %clangxx_asan -DSHARED %s -shared -o %t-so.so -fPIC | |
5 | // RUN: %clangxx_asan %s -ldl -pthread -o %t %t-so.so | |
6 | // RUN: %env_asan_opts=verbosity=2 %run %t 2>&1 | FileCheck %s | |
7 | ||
8 | // CHECK: before | |
9 | // CHECK: __tls_get_addr: static tls | |
10 | // CHECK: after | |
11 | ||
12 | // XFAIL: powerpc64, aarch64 | |
13 | ||
14 | #ifndef SHARED | |
15 | #include <stdio.h> | |
16 | ||
17 | unsigned *f(); | |
18 | int main(int argc, char *argv[]) { | |
19 | fprintf(stderr, "before\n"); | |
20 | f(); | |
21 | fprintf(stderr, "after\n"); | |
22 | return 0; | |
23 | } | |
24 | #else // SHARED | |
25 | static __thread unsigned ThreadLocal; | |
26 | unsigned *f() { | |
27 | return &ThreadLocal; | |
28 | } | |
29 | #endif |