[lld] r310696 - Delete what looks like dead code.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 23:07:02 PDT 2017


Author: rafael
Date: Thu Aug 10 23:07:02 2017
New Revision: 310696

URL: http://llvm.org/viewvc/llvm-project?rev=310696&view=rev
Log:
Delete what looks like dead code.

The start of a segment should not have a gap that needs trap
instructions.

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=310696&r1=310695&r2=310696&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Aug 10 23:07:02 2017
@@ -1870,10 +1870,8 @@ template <class ELFT> void Writer<ELFT>:
     if (P->p_type != PT_LOAD || !(P->p_flags & PF_X))
       continue;
 
-    // We only fill the first and the last page of the segment because the
-    // middle part will be overwritten by output sections.
-    fillTrapInstr(Buf + alignDown(P->p_offset, Target->PageSize),
-                  Buf + alignTo(P->p_offset, Target->PageSize));
+    // We only fill the last page of the segment because the rest will be
+    // overwritten by output sections.
     fillTrapInstr(Buf + alignDown(P->p_offset + P->p_filesz, Target->PageSize),
                   Buf + alignTo(P->p_offset + P->p_filesz, Target->PageSize));
   }




More information about the llvm-commits mailing list