aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2024-01-23 16:16:07 -0800
committerGitHub <noreply@github.com>2024-01-23 16:16:07 -0800
commit03a61d34ebf4f8eeaa6861bec3ab39c75bb41778 (patch)
treeb40e7c22db320a412a4a6c8d049a31156aff6cf7 /llvm/lib/Target/TargetMachine.cpp
parentd657519838e4b2310e13ec5ff52599e041860825 (diff)
downloadllvm-03a61d34ebf4f8eeaa6861bec3ab39c75bb41778.zip
llvm-03a61d34ebf4f8eeaa6861bec3ab39c75bb41778.tar.gz
llvm-03a61d34ebf4f8eeaa6861bec3ab39c75bb41778.tar.bz2
[RISCV] Support TLSDESC in the RISC-V backend (#66915)
This patch adds basic TLSDESC support in the RISC-V backend. Specifically, we add new relocation types for TLSDESC, as prescribed in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373, and add a new pseudo instruction to simplify code generation. This patch does not try to optimize the local dynamic case, which can be improved in separate patches. Linker side changes will also be handled separately. The current implementation is only enabled when passing the new `-enable-tlsdesc` codegen flag.
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/TargetMachine.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index abd0fdf..0839fb2 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -213,6 +213,7 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
}
bool TargetMachine::useEmulatedTLS() const { return Options.EmulatedTLS; }
+bool TargetMachine::useTLSDESC() const { return Options.EnableTLSDESC; }
TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
bool IsPIE = GV->getParent()->getPIELevel() != PIELevel::Default;