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;
10int var;
11
12void set_var() {
13 var = 123;
14 tls_var = &var;
15}
16int main() {
17 set_var();
18 fprintf(stderr, format: "Test alloc: %p\n", tls_var);
19 fflush(stderr);
20 return 0;
21}
22

source code of compiler-rt/test/sanitizer_common/TestCases/Linux/use_tls_test.cpp