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
This commit is contained in:
Rafael Espindola 2017-06-01 16:32:58 +00:00
parent 805f5152c5
commit 3f235c71cc
1 changed files with 2 additions and 1 deletions

View File

@ -274,6 +274,7 @@ template <class ELFT> void Writer<ELFT>::run() {
[](OutputSection *S) { S->maybeCompress<ELFT>(); });
Script->synchronize();
clearOutputSections();
if (Config->Relocatable) {
assignFileOffsets();
@ -301,7 +302,7 @@ template <class ELFT> void Writer<ELFT>::run() {
openFile();
if (ErrorCount)
return;
clearOutputSections();
if (!Config->OFormatBinary) {
writeHeader();
writeSections();