Skip to content

Commit 94f3f43

Browse files
committed
[llvm] Enable TLSDESC by default on Fuchsia targets
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 d6315af commit 94f3f43

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
@@ -1117,9 +1117,10 @@ class Triple {
11171117
isWindowsCygwinEnvironment() || isOHOSFamily();
11181118
}
11191119

1120-
/// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
1121-
/// is enabled by default.
1122-
bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
1120+
/// True if the target uses TLSDESC by default.
1121+
bool hasDefaultTLSDESC() const {
1122+
return isAArch64() || (isAndroid() && isRISCV64()) || isOSFuchsia();
1123+
}
11231124

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

0 commit comments

Comments
 (0)