[PATCH] D70378: [LLD][COFF] Fix missing cache cleanup in COFF::link()

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 13:44:39 PDT 2020


aganea updated this revision to Diff 265014.
aganea edited reviewers, added: MaskRay, amccarth; removed: blackhole12.
aganea edited subscribers, added: blackhole12; removed: MaskRay.
aganea added a comment.

Taking over the patch, after discussing with Erik.

I went back to the original idea of having a single function for clearing `outputSections`. I felt that in the end, there were too many changes to support a single line of code in Driver.cpp.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70378/new/

https://reviews.llvm.org/D70378

Files:
  lld/COFF/Driver.cpp
  lld/COFF/Writer.cpp
  lld/COFF/Writer.h


Index: lld/COFF/Writer.h
===================================================================
--- lld/COFF/Writer.h
+++ lld/COFF/Writer.h
@@ -50,6 +50,9 @@
   void writeHeaderTo(uint8_t *buf);
   void addContributingPartialSection(PartialSection *sec);
 
+  // Clear the output sections static container.
+  static void clear();
+
   // Returns the size of this section in an executable memory image.
   // This may be smaller than the raw size (the raw size is multiple
   // of disk sector size, so there may be padding at end), or may be
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -87,6 +87,8 @@
   return osidx == 0 ? nullptr : outputSections[osidx - 1];
 }
 
+void OutputSection::clear() { outputSections.clear(); }
+
 namespace {
 
 class DebugDirectoryChunk : public NonSectionChunk {
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -90,6 +90,7 @@
   BitcodeFile::instances.clear();
   memset(MergeChunk::instances, 0, sizeof(MergeChunk::instances));
   TpiSource::clear();
+  OutputSection::clear();
 
   return !errorCount();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70378.265014.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200519/c424edca/attachment.bin>


More information about the llvm-commits mailing list