[ELF] - Early return from writeTo() if section is SHT_NOBITS. NFCi.
That addresses port commit comments for https://reviews.llvm.org/D33646
llvm-svn: 304777
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 1ced3e8..5a10e8c 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -1099,6 +1099,9 @@
}
template <class ELFT> void OutputSectionCommand::writeTo(uint8_t *Buf) {
+ if (Sec->Type == SHT_NOBITS)
+ return;
+
Sec->Loc = Buf;
// We may have already rendered compressed content when using
@@ -1110,9 +1113,6 @@
return;
}
- if (Sec->Type == SHT_NOBITS)
- return;
-
// Write leading padding.
std::vector<InputSection *> Sections;
for (BaseCommand *Cmd : Commands)