[PATCH] D44986: Initialize Elf header to Zero

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 12:35:11 PDT 2018


MaskRay added a comment.

  template <class ELFT> void Writer<ELFT>::writeTrapInstr() {
    if (Script->HasSectionsCommand)
      return;
  
    // Fill the last page.
    uint8_t *Buf = Buffer->getBufferStart();
    for (PhdrEntry *P : Phdrs)
      if (P->p_type == PT_LOAD && (P->p_flags & PF_X)) ///////////////////
        fillTrap(Buf + alignDown(P->p_offset + P->p_filesz, Target->PageSize),
                 Buf + alignTo(P->p_offset + P->p_filesz, Target->PageSize));

How about `if (P->p_type == PT_LOAD && P->p_flags & PF_X && P->LastSec != Out::ProgramHeaders)`


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44986





More information about the llvm-commits mailing list