diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 4f198d854937..aff063b499e1 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1098,9 +1098,8 @@ static void writeCieFde(uint8_t *Buf, ArrayRef D) { } template void EhOutputSection::finalize() { - if (Finalized) - return; - Finalized = true; + if (this->Header.sh_size) + return; // Already finalized. size_t Off = 0; for (CieRecord *Cie : Cies) { diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 1dbd7d8366e7..776e8f1bdecf 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -414,8 +414,6 @@ private: // CIE records are uniquified by their contents and personality functions. llvm::DenseMap, SymbolBody *>, CieRecord> CieMap; - - bool Finalized = false; }; template