[lld] [LLD]Fix lld crashes when linker script remove .dynsym section (PR #121488)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 07:46:35 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-elf
Author: None (hstk30-hw)
<details>
<summary>Changes</summary>
Fix https://github.com/llvm/llvm-project/issues/88650
---
Full diff: https://github.com/llvm/llvm-project/pull/121488.diff
1 Files Affected:
- (modified) lld/ELF/SyntheticSections.cpp (+2-1)
``````````diff
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index baa7a083404fe7..8d98aad50a6ceb 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3800,7 +3800,8 @@ VersionTableSection::VersionTableSection(Ctx &ctx)
void VersionTableSection::finalizeContents() {
// At the moment of june 2016 GNU docs does not mention that sh_link field
// should be set, but Sun docs do. Also readelf relies on this field.
- getParent()->link = getPartition(ctx).dynSymTab->getParent()->sectionIndex;
+ if (OutputSection *sec = getPartition(ctx).dynSymTab->getParent())
+ getParent()->link = sec->sectionIndex;
}
size_t VersionTableSection::getSize() const {
``````````
</details>
https://github.com/llvm/llvm-project/pull/121488
More information about the llvm-commits
mailing list