llvm-project
cdd29f5b - [ELF,RISCV] Fix TLSDESC=>IE when there is no TLS section

Commit
1 year ago
[ELF,RISCV] Fix TLSDESC=>IE when there is no TLS section See the comment in handleTlsRelocation. For TLSDESC=>IE (the TLS symbol is defined in another DSO), R_RISCV_TLSDESC_{LOAD_LO12,ADD_LO12_I,CALL} referencing a non-preemptible label uses the `R_RELAX_TLS_GD_TO_LE` code path. If there is no TLS section, `getTlsTpOffset` will be called with null `Out::tlsPhdr`, leading to a null pointer dereference. Since the return value is used by `RISCV::relocateAlloc` and ignored there, just return 0. LoongArch TLSDESC doesn't use STT_NOTYPE labels. The `if (..) return 0;` is a no-op for LoongArch. This patch is a follow-up to #79239 and fixes some comments. Pull Request: https://github.com/llvm/llvm-project/pull/98569
Author
Parents
Loading