1 | // Test that executable with ELF-TLS will link/run successfully |
---|---|
2 | // RUN: %clangxx -fno-emulated-tls %s -o %t |
3 | // RUN: %run %t 2>&1 |
4 | // REQUIRES: android-29 |
5 | |
6 | #include <stdio.h> |
7 | #include <stdlib.h> |
8 | |
9 | __thread void *tls_var; |
10 | int var; |
11 | |
12 | void set_var() { |
13 | var = 123; |
14 | tls_var = &var; |
15 | } |
16 | int main() { |
17 | set_var(); |
18 | fprintf(stderr, format: "Test alloc: %p\n", tls_var); |
19 | fflush(stderr); |
20 | return 0; |
21 | } |
22 |