| 1 |
// Android, Cygwin and OpenBSD use emutls by default. |
| 2 |
// Clang should pass -femulated-tls to cc1 if they are used, |
| 3 |
// and cc1 should set up EmulatedTLS to LLVM CodeGen. |
| 4 |
// |
| 5 |
// RUN: %clang -### --target=arm-linux-androideabi %s 2>&1 \ |
| 6 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 7 |
// RUN: %clang -### --target=arm-linux-gnu %s 2>&1 \ |
| 8 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 9 |
// RUN: %clang -### --target=i686-pc-cygwin %s 2>&1 \ |
| 10 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 11 |
// RUN: %clang -### --target=x86_64-pc-cygwin %s 2>&1 \ |
| 12 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 13 |
// RUN: %clang -### --target=i686-pc-openbsd %s 2>&1 \ |
| 14 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 15 |
|
| 16 |
// RUN: %clang -### -target arm-linux-androideabi -fno-emulated-tls -femulated-tls %s 2>&1 \ |
| 17 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 18 |
// RUN: %clang -### -target arm-linux-gnu %s -fno-emulated-tls -femulated-tls 2>&1 \ |
| 19 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 20 |
// RUN: %clang -### -target i686-pc-cygwin %s -fno-emulated-tls -femulated-tls 2>&1 \ |
| 21 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 22 |
// RUN: %clang -### -target x86_64-pc-cygwin %s -fno-emulated-tls -femulated-tls 2>&1 \ |
| 23 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 24 |
// RUN: %clang -### -target i686-pc-openbsd %s -fno-emulated-tls -femulated-tls 2>&1 \ |
| 25 |
// RUN: | FileCheck -check-prefix=EMU %s |
| 26 |
|
| 27 |
// RUN: %clang -### -target arm-linux-androideabi -femulated-tls -fno-emulated-tls %s 2>&1 \ |
| 28 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 29 |
// RUN: %clang -### -target arm-linux-gnu %s -femulated-tls -fno-emulated-tls 2>&1 \ |
| 30 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 31 |
// RUN: %clang -### -target i686-pc-cygwin %s -femulated-tls -fno-emulated-tls 2>&1 \ |
| 32 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 33 |
// RUN: %clang -### -target x86_64-pc-cygwin %s -femulated-tls -fno-emulated-tls 2>&1 \ |
| 34 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 35 |
// RUN: %clang -### -target i686-pc-openbsd %s -femulated-tls -fno-emulated-tls 2>&1 \ |
| 36 |
// RUN: | FileCheck -check-prefix=NOEMU %s |
| 37 |
|
| 38 |
// Test that when lto is used any -emualted-tls flags are passed to the linker |
| 39 |
// LINUX and Android have different defaults for EmulatedTLS |
| 40 |
// RUN: %clang -### -flto --target=riscv64-linux -fno-emulated-tls %s 2>&1 \ |
| 41 |
// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS |
| 42 |
// RUN: %clang -### -flto --target=riscv64-linux-android10000 -femulated-tls %s 2>&1 \ |
| 43 |
// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS |
| 44 |
// RUN: %clang -### -flto --target=riscv64-linux -femulated-tls %s 2>&1 \ |
| 45 |
// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS |
| 46 |
// RUN: %clang -### -flto --target=riscv64-linux-android10000 -fno-emulated-tls %s 2>&1 \ |
| 47 |
// RUN: | FileCheck %s --check-prefix=LTO_NOEMUTLS |
| 48 |
// RUN: %clang -### -flto --target=amd64-unknown-openbsd %s 2>&1 \ |
| 49 |
// RUN: | FileCheck %s --check-prefix=LTO_EMUTLS |
| 50 |
|
| 51 |
// Default without -f[no-]emulated-tls, will be decided by the target triple. |
| 52 |
// DEFAULT-NOT: "-cc1" {{.*}}"-femulated-tls" |
| 53 |
|
| 54 |
// EMU: "-cc1" |
| 55 |
// EMU-SAME: "-femulated-tls" |
| 56 |
|
| 57 |
// NOEMU: "-cc1" |
| 58 |
// NOEMU-NOT: "-femulated-tls" |
| 59 |
|
| 60 |
// LTO related checks |
| 61 |
// LTO_NOEMUTLS-NOT: "-plugin-opt=-emulated-tls" |
| 62 |
|
| 63 |
// LTO_EMUTLS: "-plugin-opt=-emulated-tls" |