[llvm] Enable TLSDESC by default on Fuchsia targets (#124990)

Fuchsia uses TLSDESC by default for all target architectures. We also
make the comment and check for hasDefaultTLSDESC more accurately reflect
its usage.
This commit is contained in:
Paul Kirth
2025-01-30 10:25:25 -08:00
committed by GitHub
parent c8f4189eeb
commit 08c76730f3
2 changed files with 9 additions and 3 deletions

View File

@@ -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

View File

@@ -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 {