[lld] r250159 - Simplify by using Out<ELFT>::Opd.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 13 07:45:52 PDT 2015


Author: rafael
Date: Tue Oct 13 09:45:51 2015
New Revision: 250159

URL: http://llvm.org/viewvc/llvm-project?rev=250159&view=rev
Log:
Simplify by using Out<ELFT>::Opd.

Also avoid extra dependencies on the section name.

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=250159&r1=250158&r2=250159&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 13 09:45:51 2015
@@ -651,14 +651,13 @@ template <class ELFT> void Writer<ELFT>:
 
   // PPC64 needs to process relocations in the .opd section before processing
   // relocations in code-containing sections.
-  for (OutputSectionBase<ELFT::Is64Bits> *&Sec : OutputSections)
-    if (Sec->getName() == ".opd") {
-      Out<ELFT>::OpdBuf = Buf + Sec->getFileOff();
-      Sec->writeTo(Buf + Sec->getFileOff());
-    }
+  if (OutputSectionBase<ELFT::Is64Bits> *Sec = Out<ELFT>::Opd) {
+    Out<ELFT>::OpdBuf = Buf + Sec->getFileOff();
+    Sec->writeTo(Buf + Sec->getFileOff());
+  }
 
   for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections)
-    if (Sec->getName() != ".opd")
+    if (Sec != Out<ELFT>::Opd)
       Sec->writeTo(Buf + Sec->getFileOff());
 }
 




More information about the llvm-commits mailing list