Skip to content

Commit

Permalink
Delete what looks like dead code.
Browse files Browse the repository at this point in the history
The start of a segment should not have a gap that needs trap
instructions.

llvm-svn: 310696
  • Loading branch information
espindola committed Aug 11, 2017
1 parent 19913b2 commit 0158e2a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lld/ELF/Writer.cpp
Expand Up @@ -1870,10 +1870,8 @@ template <class ELFT> void Writer<ELFT>::writeTrapInstr() {
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));
}
Expand Down

0 comments on commit 0158e2a

Please sign in to comment.