[all-commits] [llvm/llvm-project] cdd29f: [ELF, RISCV] Fix TLSDESC=>IE when there is no TLS s...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Jul 11 17:59:22 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7
https://github.com/llvm/llvm-project/commit/cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7
Author: Fangrui Song <i at maskray.me>
Date: 2024-07-11 (Thu, 11 Jul 2024)
Changed paths:
M lld/ELF/Arch/RISCV.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/Relocations.cpp
M lld/test/ELF/riscv-tlsdesc.s
Log Message:
-----------
[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
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list