[lld] r286826 - Factor out removeEmptyCommands. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 06:23:36 PST 2016


Author: rafael
Date: Mon Nov 14 08:23:35 2016
New Revision: 286826

URL: http://llvm.org/viewvc/llvm-project?rev=286826&view=rev
Log:
Factor out removeEmptyCommands. NFC.

Modified:
    lld/trunk/ELF/LinkerScript.cpp
    lld/trunk/ELF/LinkerScript.h

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=286826&r1=286825&r2=286826&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Nov 14 08:23:35 2016
@@ -513,7 +513,7 @@ void LinkerScript<ELFT>::assignOffsets(O
                 [this](std::unique_ptr<BaseCommand> &B) { process(*B.get()); });
 }
 
-template <class ELFT> void LinkerScript<ELFT>::adjustSectionsBeforeSorting() {
+template <class ELFT> void LinkerScript<ELFT>::removeEmptyCommands() {
   // It is common practice to use very generic linker scripts. So for any
   // given run some of the output sections in the script will be empty.
   // We could create corresponding empty output sections, but that would
@@ -536,6 +536,10 @@ template <class ELFT> void LinkerScript<
         return true;
       });
   Opt.Commands.erase(Pos, Opt.Commands.end());
+}
+
+template <class ELFT> void LinkerScript<ELFT>::adjustSectionsBeforeSorting() {
+  removeEmptyCommands();
 
   // If the output section contains only symbol assignments, create a
   // corresponding output section. The bfd linker seems to only create them if

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=286826&r1=286825&r2=286826&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Mon Nov 14 08:23:35 2016
@@ -219,6 +219,7 @@ public:
 
   void processCommands(OutputSectionFactory<ELFT> &Factory);
   void createSections(OutputSectionFactory<ELFT> &Factory);
+  void removeEmptyCommands();
   void adjustSectionsBeforeSorting();
 
   std::vector<PhdrEntry<ELFT>> createPhdrs();




More information about the llvm-commits mailing list