diff options
author | Fangrui Song <i@maskray.me> | 2024-07-11 17:59:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 17:59:00 -0700 |
commit | cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7 (patch) | |
tree | 0e59dd8e65ee59dc379f034ad64489a7e9aa4ddf /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | db3d3378ba751337c12147d11367006f23becc0c (diff) | |
download | llvm-cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7.zip llvm-cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7.tar.gz llvm-cdd29f5bd2f5e55ae116be1a912f0b036d7c98e7.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions