From 81ed005c4cf8e74d803a99c322eca0b681ff00f4 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 31 Jul 2022 19:55:05 -0700 Subject: [PATCH] [ELF] Remove EhFrameSection::addSection. NFC --- lld/ELF/SyntheticSections.cpp | 19 +++++++------------ lld/ELF/SyntheticSections.h | 2 -- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index af424d6ceead..f21e60e44da4 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -431,16 +431,6 @@ void EhFrameSection::addSectionAux(EhInputSection *sec) { addRecords(sec, rels.relas); } -void EhFrameSection::addSection(EhInputSection *sec) { - sec->parent = this; - - alignment = std::max(alignment, sec->alignment); - sections.push_back(sec); - - for (auto *ds : sec->dependentSections) - dependentSections.push_back(ds); -} - // Used by ICF::handleLSDA(). This function is very similar to // EhFrameSection::addRecords(). template @@ -3345,8 +3335,13 @@ template void elf::splitSections() { void elf::combineEhSections() { llvm::TimeTraceScope timeScope("Combine EH sections"); - for (EhInputSection *sec : ehInputSections) - sec->getPartition().ehFrame->addSection(sec); + for (EhInputSection *sec : ehInputSections) { + EhFrameSection &eh = *sec->getPartition().ehFrame; + sec->parent = &eh; + eh.alignment = std::max(eh.alignment, sec->alignment); + eh.sections.push_back(sec); + llvm::append_range(eh.dependentSections, sec->dependentSections); + } if (!mainPart->armExidx) return; diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 120532245f63..5cbe7702fd81 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -52,8 +52,6 @@ public: return SyntheticSection::classof(d) && d->name == ".eh_frame"; } - void addSection(EhInputSection *sec); - SmallVector sections; size_t numFdes = 0;