Skip to content

Commit 08c7673

Browse files
authored
[llvm] Enable TLSDESC by default on Fuchsia targets (llvm#124990)
Fuchsia uses TLSDESC by default for all target architectures. We also make the comment and check for hasDefaultTLSDESC more accurately reflect its usage.
1 parent c8f4189 commit 08c7673

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

clang/test/Driver/tls-dialect.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
/// TLSDESC is not on by default in Linux, even on RISC-V, and is covered above
1111
// RUN: %clang -### --target=riscv64-android %s 2>&1 | FileCheck --check-prefix=DESC %s
1212

13+
/// Fuchsia supports TLSDESC by default for all architectures.
14+
// RUN: %clang -### --target=riscv64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s
15+
// RUN: %clang -### --target=aarch64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s
16+
// RUN: %clang -### --target=x86_64-unknown-fuchsia %s 2>&1 | FileCheck --check-prefix=DESC %s
17+
1318
/// LTO
1419
// RUN: %clang -### --target=loongarch64-linux -flto -mtls-dialect=desc %s 2>&1 | FileCheck --check-prefix=LTO-DESC %s
1520
// RUN: %clang -### --target=loongarch64-linux -flto %s 2>&1 | FileCheck --check-prefix=LTO-NODESC %s

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,9 +1123,10 @@ class Triple {
11231123
isWindowsCygwinEnvironment() || isOHOSFamily();
11241124
}
11251125

1126-
/// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
1127-
/// is enabled by default.
1128-
bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
1126+
/// True if the target uses TLSDESC by default.
1127+
bool hasDefaultTLSDESC() const {
1128+
return isAArch64() || (isAndroid() && isRISCV64()) || isOSFuchsia();
1129+
}
11291130

11301131
/// Tests whether the target uses -data-sections as default.
11311132
bool hasDefaultDataSections() const {

0 commit comments

Comments
 (0)