diff --git a/clang/test/Driver/tls-dialect.c b/clang/test/Driver/tls-dialect.c index 3471b55b0eba..9ab79e87353d 100644 --- a/clang/test/Driver/tls-dialect.c +++ b/clang/test/Driver/tls-dialect.c @@ -10,6 +10,11 @@ /// TLSDESC is not on by default in Linux, even on RISC-V, and is covered above // RUN: %clang -### --target=riscv64-android %s 2>&1 | FileCheck --check-prefix=DESC %s +/// Fuchsia supports TLSDESC by default for all architectures. +// RUN: %clang -### --target=riscv64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s +// RUN: %clang -### --target=aarch64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s +// RUN: %clang -### --target=x86_64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s + /// LTO // RUN: %clang -### --target=loongarch64-linux -flto -mtls-dialect=desc %s 2>&1 | FileCheck --check-prefix=LTO-DESC %s // RUN: %clang -### --target=loongarch64-linux -flto %s 2>&1 | FileCheck --check-prefix=LTO-NODESC %s diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index 7d67966d1725..09c0d223d9b4 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -1123,9 +1123,10 @@ public: isWindowsCygwinEnvironment() || isOHOSFamily(); } - /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC - /// is enabled by default. - bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); } + /// True if the target uses TLSDESC by default. + bool hasDefaultTLSDESC() const { + return isAArch64() || (isAndroid() && isRISCV64()) || isOSFuchsia(); + } /// Tests whether the target uses -data-sections as default. bool hasDefaultDataSections() const {