diff options
author | Paul Kirth <paulkirth@google.com> | 2024-01-23 16:16:07 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 16:16:07 -0800 |
commit | 03a61d34ebf4f8eeaa6861bec3ab39c75bb41778 (patch) | |
tree | b40e7c22db320a412a4a6c8d049a31156aff6cf7 /llvm/lib/CodeGen/CommandFlags.cpp | |
parent | d657519838e4b2310e13ec5ff52599e041860825 (diff) | |
download | llvm-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/CodeGen/CommandFlags.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CommandFlags.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index c6d7827..51406fb 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -93,6 +93,7 @@ CGOPT(bool, XCOFFTracebackTable) CGOPT(std::string, BBSections) CGOPT(unsigned, TLSSize) CGOPT_EXP(bool, EmulatedTLS) +CGOPT_EXP(bool, EnableTLSDESC) CGOPT(bool, UniqueSectionNames) CGOPT(bool, UniqueBasicBlockSectionNames) CGOPT(EABI, EABIVersion) @@ -404,6 +405,11 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() { "emulated-tls", cl::desc("Use emulated TLS model"), cl::init(false)); CGBINDOPT(EmulatedTLS); + static cl::opt<bool> EnableTLSDESC( + "enable-tlsdesc", cl::desc("Enable the use of TLS Descriptors"), + cl::init(false)); + CGBINDOPT(EnableTLSDESC); + static cl::opt<bool> UniqueSectionNames( "unique-section-names", cl::desc("Give unique names to every section"), cl::init(true)); @@ -568,6 +574,8 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) { Options.TLSSize = getTLSSize(); Options.EmulatedTLS = getExplicitEmulatedTLS().value_or(TheTriple.hasDefaultEmulatedTLS()); + Options.EnableTLSDESC = + getExplicitEnableTLSDESC().value_or(TheTriple.hasDefaultTLSDESC()); Options.ExceptionModel = getExceptionModel(); Options.EmitStackSizeSection = getEnableStackSizeSection(); Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter(); |