https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/124990
>From 94f3f4365a49f39ee8e4bd598355ad21d7de82ab Mon Sep 17 00:00:00 2001 From: Paul Kirth <paulki...@google.com> Date: Wed, 29 Jan 2025 19:12:17 +0000 Subject: [PATCH] [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. --- clang/test/Driver/tls-dialect.c | 5 +++++ llvm/include/llvm/TargetParser/Triple.h | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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..2f9ed5fb0c6a15 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -1117,9 +1117,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 { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits