[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:03 PST 2025
https://github.com/hstk30-hw created https://github.com/llvm/llvm-project/pull/121488
Fix https://github.com/llvm/llvm-project/issues/88650
>From 759f8f490e7670fb3ab9e72f5e7a195c02fe1431 Mon Sep 17 00:00:00 2001
From: hstk30-hw <hanwei62 at huawei.com>
Date: Thu, 2 Jan 2025 23:43:59 +0800
Subject: [PATCH] [LLD]Fix lld crashes when linker script remove .dynsym
section
---
lld/ELF/SyntheticSections.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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 {
More information about the llvm-commits
mailing list