summaryrefslogtreecommitdiff
path: root/lld/COFF/MarkLive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF/MarkLive.cpp')
-rw-r--r--lld/COFF/MarkLive.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lld/COFF/MarkLive.cpp b/lld/COFF/MarkLive.cpp
index 6d34cb864e3c..0afa615a1933 100644
--- a/lld/COFF/MarkLive.cpp
+++ b/lld/COFF/MarkLive.cpp
@@ -28,10 +28,12 @@ void markLive(ArrayRef<Chunk *> chunks) {
// as we push, so sections never appear twice in the list.
SmallVector<SectionChunk *, 256> worklist;
- // COMDAT section chunks are dead by default. Add non-COMDAT chunks.
+ // COMDAT section chunks are dead by default. Add non-COMDAT chunks. Do not
+ // traverse DWARF sections. They are live, but they should not keep other
+ // sections alive.
for (Chunk *c : chunks)
if (auto *sc = dyn_cast<SectionChunk>(c))
- if (sc->live)
+ if (sc->live && !sc->isDWARF())
worklist.push_back(sc);
auto enqueue = [&](SectionChunk *c) {