Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

ilovepi
Copy link
Contributor

@ilovepi ilovepi commented Jan 29, 2025

Fuchsia uses TLSDESC by default for all target architectures.

Copy link
Contributor Author

ilovepi commented Jan 29, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ilovepi ilovepi marked this pull request as ready for review January 29, 2025 21:31
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Jan 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 29, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Paul Kirth (ilovepi)

Changes

Fuchsia uses TLSDESC by default for all target architectures.


Full diff: https://github.com/llvm/llvm-project/pull/124990.diff

2 Files Affected:

  • (modified) clang/test/Driver/tls-dialect.c (+5)
  • (modified) llvm/include/llvm/TargetParser/Triple.h (+3-1)
diff --git a/clang/test/Driver/tls-dialect.c b/clang/test/Driver/tls-dialect.c
index 3471b55b0ebae9..9ab79e87353d88 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 8097300c6e630c..6afc6ec974ca72 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1119,7 +1119,9 @@ class Triple {
 
   /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
   /// is enabled by default.
-  bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
+  bool hasDefaultTLSDESC() const {
+    return (isAndroid() && isRISCV64()) || isOSFuchsia();
+  }
 
   /// Tests whether the target uses -data-sections as default.
   bool hasDefaultDataSections() const {

Fuchsia uses TLSDESC by default for all target architectures. We also
make the comment and check for hasDefaultTLSDESC more accurately reflect
its usage.
@ilovepi ilovepi force-pushed the users/ilovepi/fuchsia-default-tlsdesc branch from 6b6eb8c to 94f3f43 Compare January 30, 2025 18:22
Copy link
Contributor Author

ilovepi commented Jan 30, 2025

Merge activity

  • Jan 30, 1:23 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 30, 1:25 PM EST: A user merged this pull request with Graphite.

@ilovepi ilovepi merged commit 08c7673 into main Jan 30, 2025
5 of 6 checks passed
@ilovepi ilovepi deleted the users/ilovepi/fuchsia-default-tlsdesc branch January 30, 2025 18:25
TheBlindArchitect pushed a commit to XSLabs/fuchsia that referenced this pull request May 15, 2025
After llvm/llvm-project#124990, LLVM sets
TLSDESC as the default for Fuchsia targets. This patch moves the config
setting into clang_defaults.

Fixed: 322984857
Change-Id: Idca5a2c13e7f2128a5c28b337689db4ed4caf1ba
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1265705
Fuchsia-Auto-Submit: Paul Kirth <[email protected]>
Reviewed-by: Roland McGrath <[email protected]>
Commit-Queue: Auto-Submit <auto-submit-builder@fuchsia-internal-service-accts.iam.gserviceaccount.com>
TheBlindArchitect pushed a commit to XSLabs/integration that referenced this pull request May 15, 2025
After llvm/llvm-project#124990, LLVM sets
TLSDESC as the default for Fuchsia targets. This patch moves the config
setting into clang_defaults.

Original-Fixed: 322984857
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1265705
Original-Revision: de98695b8e0d754cf3129d5c6ce3ffcab8942144
GitOrigin-RevId: 84140e178e483e2b8ecf96b44174d88b03dd3213
Change-Id: Ie3618aeae4b207ef3da51999bfa5dee2a43818bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants