[lld] r304777 - [ELF] - Early return from writeTo() if section is SHT_NOBITS. NFCi.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 00:46:28 PDT 2017


Author: grimar
Date: Tue Jun  6 02:46:28 2017
New Revision: 304777

URL: http://llvm.org/viewvc/llvm-project?rev=304777&view=rev
Log:
[ELF] - Early return from writeTo() if section is SHT_NOBITS. NFCi.

That addresses port commit comments for https://reviews.llvm.org/D33646

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=304777&r1=304776&r2=304777&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Jun  6 02:46:28 2017
@@ -1099,6 +1099,9 @@ template <class ELFT> void OutputSection
 }
 
 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 @@ template <class ELFT> void OutputSection
     return;
   }
 
-  if (Sec->Type == SHT_NOBITS)
-    return;
-
   // Write leading padding.
   std::vector<InputSection *> Sections;
   for (BaseCommand *Cmd : Commands)




More information about the llvm-commits mailing list