[llvm-branch-commits] [llvm] [lld] [RISCV] Support RISC-V TLSDESC in LLD (PR #77516)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 22 22:23:56 PST 2024


MaskRay wrote:

I have found several issues.

* `tlsDescRel = R_RISCV_TLSDESC_CALL;` should be `R_RISCV_TLSDESC`
* LOAD_LO12_I/ADD_LO12_I/CALL relocations reference a label at the HI20 location. `val` computed by `sec.getRelocTargetVA` cannot be used as-is.
* TLS optimization (https://maskray.me/blog/2021-02-14-all-about-thread-local-storage#link-time-tls-optimization) is actually mandatory for TLSDESC. Unlike ia32, we don't need `adjustTlsExpr`. Some special handling is required.

#79099 reuses an old revision of the LLVM part but otherwise is a rewrite and should fix these issues as well as implement linker relaxation.

https://github.com/llvm/llvm-project/pull/77516


More information about the llvm-branch-commits mailing list