[llvm] 08c7673 - [llvm] Enable TLSDESC by default on Fuchsia targets (#124990)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 10:25:29 PST 2025
Author: Paul Kirth
Date: 2025-01-30T10:25:25-08:00
New Revision: 08c76730f35e1dd3c9330b47fc304a35e6d9087e
URL: https://github.com/llvm/llvm-project/commit/08c76730f35e1dd3c9330b47fc304a35e6d9087e
DIFF: https://github.com/llvm/llvm-project/commit/08c76730f35e1dd3c9330b47fc304a35e6d9087e.diff
LOG: [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.
Added:
Modified:
clang/test/Driver/tls-dialect.c
llvm/include/llvm/TargetParser/Triple.h
Removed:
################################################################################
diff --git a/clang/test/Driver/tls-dialect.c b/clang/test/Driver/tls-dialect.c
index 3471b55b0ebae94..9ab79e87353d885 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 7d67966d1725639..09c0d223d9b4d3a 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1123,9 +1123,10 @@ class Triple {
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 {
More information about the llvm-commits
mailing list