[lld] r259417 - Simplify.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 13:52:00 PST 2016


Author: rafael
Date: Mon Feb  1 15:52:00 2016
New Revision: 259417

URL: http://llvm.org/viewvc/llvm-project?rev=259417&view=rev
Log:
Simplify.

Now that we remember the StringRefs when they are first added, we can
write the table in any order.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=259417&r1=259416&r2=259417&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Feb  1 15:52:00 2016
@@ -1339,17 +1339,8 @@ template <class ELFT> void Writer<ELFT>:
     Sec->writeTo(Buf + Sec->getFileOff());
   }
 
-  // Write all sections but string table sections. We know the sizes of the
-  // string tables already, but they may not have actual strings yet (only
-  // room may be reserved), because writeTo() is allowed to add actual
-  // strings to the string tables.
   for (OutputSectionBase<ELFT> *Sec : OutputSections)
-    if (Sec != Out<ELFT>::Opd && Sec->getType() != SHT_STRTAB)
-      Sec->writeTo(Buf + Sec->getFileOff());
-
-  // Write string table sections.
-  for (OutputSectionBase<ELFT> *Sec : OutputSections)
-    if (Sec != Out<ELFT>::Opd && Sec->getType() == SHT_STRTAB)
+    if (Sec != Out<ELFT>::Opd)
       Sec->writeTo(Buf + Sec->getFileOff());
 }
 




More information about the llvm-commits mailing list