Skip to content

Commit

Permalink
[clang][driver] Set TLSDESC as the default for Android on RISC-V (#81198
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ilovepi authored Feb 9, 2024
1 parent d86f216 commit 407f9c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions clang/test/Driver/tls-dialect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions llvm/include/llvm/TargetParser/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 407f9c0

Please sign in to comment.