[clang] 407f9c0 - [clang][driver] Set TLSDESC as the default for Android on RISC-V (#81198)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 9 10:34:04 PST 2024


Author: Paul Kirth
Date: 2024-02-09T10:33:58-08:00
New Revision: 407f9c06ea2a4f3fc32647ba22e5b60f695ca4b3

URL: https://github.com/llvm/llvm-project/commit/407f9c06ea2a4f3fc32647ba22e5b60f695ca4b3
DIFF: https://github.com/llvm/llvm-project/commit/407f9c06ea2a4f3fc32647ba22e5b60f695ca4b3.diff

LOG: [clang][driver] Set TLSDESC as the default for Android on RISC-V (#81198)

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 4e105ce3cea5d9..f73915b28ec2a3 100644
--- a/clang/test/Driver/tls-dialect.c
+++ b/clang/test/Driver/tls-dialect.c
@@ -3,6 +3,10 @@
 // RUN: %clang -### --target=riscv64-linux %s 2>&1 | FileCheck --check-prefix=NODESC %s
 // RUN: %clang -### --target=x86_64-linux -mtls-dialect=gnu %s 2>&1 | FileCheck --check-prefix=NODESC %s
 
+/// Android supports TLSDESC by default on RISC-V
+/// 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
+
 /// LTO
 // RUN: %clang -### --target=riscv64-linux -flto -mtls-dialect=desc %s 2>&1 | FileCheck --check-prefix=LTO-DESC %s
 // RUN: %clang -### --target=riscv64-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 98d8490cc9f7a2..e73207021392ec 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1035,10 +1035,7 @@ class Triple {
 
   /// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
   /// is enabled by default.
-  bool hasDefaultTLSDESC() const {
-    // TODO: Improve check for other platforms, like Android, and RISC-V
-    return false;
-  }
+  bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
 
   /// Tests whether the target uses -data-sections as default.
   bool hasDefaultDataSections() const {


        


More information about the cfe-commits mailing list