Skip to content

Commit 407f9c0

Browse files
authored
[clang][driver] Set TLSDESC as the default for Android on RISC-V (#81198)
1 parent d86f216 commit 407f9c0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clang/test/Driver/tls-dialect.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// RUN: %clang -### --target=riscv64-linux %s 2>&1 | FileCheck --check-prefix=NODESC %s
44
// RUN: %clang -### --target=x86_64-linux -mtls-dialect=gnu %s 2>&1 | FileCheck --check-prefix=NODESC %s
55

6+
/// Android supports TLSDESC by default on RISC-V
7+
/// TLSDESC is not on by default in Linux, even on RISC-V, and is covered above
8+
// RUN: %clang -### --target=riscv64-android %s 2>&1 | FileCheck --check-prefix=DESC %s
9+
610
/// LTO
711
// RUN: %clang -### --target=riscv64-linux -flto -mtls-dialect=desc %s 2>&1 | FileCheck --check-prefix=LTO-DESC %s
812
// RUN: %clang -### --target=riscv64-linux -flto %s 2>&1 | FileCheck --check-prefix=LTO-NODESC %s

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,10 +1035,7 @@ class Triple {
10351035

10361036
/// True if the target supports both general-dynamic and TLSDESC, and TLSDESC
10371037
/// is enabled by default.
1038-
bool hasDefaultTLSDESC() const {
1039-
// TODO: Improve check for other platforms, like Android, and RISC-V
1040-
return false;
1041-
}
1038+
bool hasDefaultTLSDESC() const { return isAndroid() && isRISCV64(); }
10421039

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

0 commit comments

Comments
 (0)