[lld] r312327 - [ELF] - Never call splitIntoPieces() twice. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 05:04:52 PDT 2017


Author: grimar
Date: Fri Sep  1 05:04:52 2017
New Revision: 312327

URL: http://llvm.org/viewvc/llvm-project?rev=312327&view=rev
Log:
[ELF] - Never call splitIntoPieces() twice. NFC.

Previously it was called twice for .comment synthetic section.
That created 2 pieces of data, which was deduplicated anyways,
but was not clean.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=312327&r1=312326&r2=312327&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Sep  1 05:04:52 2017
@@ -923,6 +923,7 @@ MergeInputSection::MergeInputSection(Obj
 // Note that this function is called from parallelForEach. This must be
 // thread-safe (i.e. no memory allocation from the pools).
 void MergeInputSection::splitIntoPieces() {
+  assert(Pieces.empty());
   ArrayRef<uint8_t> Data = this->Data;
   uint64_t EntSize = this->Entsize;
   if (this->Flags & SHF_STRINGS)

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=312327&r1=312326&r2=312327&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Sep  1 05:04:52 2017
@@ -112,7 +112,6 @@ template <class ELFT> MergeInputSection
   auto *Ret =
       make<MergeInputSection>((ObjFile<ELFT> *)nullptr, &Hdr, ".comment");
   Ret->Data = getVersion();
-  Ret->splitIntoPieces();
   return Ret;
 }
 




More information about the llvm-commits mailing list