From 3f235c71cc53420b70371faa6913d8b643c61514 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 1 Jun 2017 16:32:58 +0000 Subject: [PATCH] Move clearOutputSections earlier. Now it is as early as it can go: just before synchronize. We now have to move synchronize earlier too. llvm-svn: 304434 --- lld/ELF/Writer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 4cd7a8242be3..0ece20631ec5 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -274,6 +274,7 @@ template void Writer::run() { [](OutputSection *S) { S->maybeCompress(); }); Script->synchronize(); + clearOutputSections(); if (Config->Relocatable) { assignFileOffsets(); @@ -301,7 +302,7 @@ template void Writer::run() { openFile(); if (ErrorCount) return; - clearOutputSections(); + if (!Config->OFormatBinary) { writeHeader(); writeSections();