Skip to content

Commit 759f8f4

Browse files
authored
[LLD]Fix lld crashes when linker script remove .dynsym section
1 parent 4b22ef7 commit 759f8f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3800,7 +3800,8 @@ VersionTableSection::VersionTableSection(Ctx &ctx)
38003800
void VersionTableSection::finalizeContents() {
38013801
// At the moment of june 2016 GNU docs does not mention that sh_link field
38023802
// should be set, but Sun docs do. Also readelf relies on this field.
3803-
getParent()->link = getPartition(ctx).dynSymTab->getParent()->sectionIndex;
3803+
if (OutputSection *sec = getPartition(ctx).dynSymTab->getParent())
3804+
getParent()->link = sec->sectionIndex;
38043805
}
38053806

38063807
size_t VersionTableSection::getSize() const {

0 commit comments

Comments
 (0)