Lines Matching refs:Phdr

155                                  const typename ELFT::Phdr &Phdr) {  in getPhdrIndexForError()  argument
158 return ("[index " + Twine(&Phdr - &Headers->front()) + "]").str(); in getPhdrIndexForError()
169 bool checkSectionOffsets(const typename ELFT::Phdr &Phdr, in checkSectionOffsets() argument
175 if (Sec.sh_offset < Phdr.p_offset) in checkSectionOffsets()
180 return (Sec.sh_offset + 1 <= Phdr.p_offset + Phdr.p_filesz); in checkSectionOffsets()
181 return Sec.sh_offset + Sec.sh_size <= Phdr.p_offset + Phdr.p_filesz; in checkSectionOffsets()
187 bool checkSectionVMA(const typename ELFT::Phdr &Phdr, in checkSectionVMA() argument
192 if (Sec.sh_addr < Phdr.p_vaddr) in checkSectionVMA()
198 bool IsTbssInNonTLS = IsTbss && Phdr.p_type != ELF::PT_TLS; in checkSectionVMA()
201 return Sec.sh_addr + 1 <= Phdr.p_vaddr + Phdr.p_memsz; in checkSectionVMA()
202 return Sec.sh_addr + Sec.sh_size <= Phdr.p_vaddr + Phdr.p_memsz; in checkSectionVMA()
206 bool isSectionInSegment(const typename ELFT::Phdr &Phdr, in isSectionInSegment() argument
208 return checkSectionOffsets<ELFT>(Phdr, Sec) && in isSectionInSegment()
209 checkSectionVMA<ELFT>(Phdr, Sec); in isSectionInSegment()
401 Elf_Note_Iterator notes_begin(const Elf_Phdr &Phdr, Error &Err) const { in notes_begin() argument
402 assert(Phdr.p_type == ELF::PT_NOTE && "Phdr is not of type PT_NOTE"); in notes_begin()
404 if (Phdr.p_offset + Phdr.p_filesz > getBufSize()) { in notes_begin()
406 createError("invalid offset (0x" + Twine::utohexstr(Phdr.p_offset) + in notes_begin()
407 ") or size (0x" + Twine::utohexstr(Phdr.p_filesz) + ")"); in notes_begin()
412 if (Phdr.p_align != 0 && Phdr.p_align != 1 && Phdr.p_align != 4 && in notes_begin()
413 Phdr.p_align != 8) { in notes_begin()
415 createError("alignment (" + Twine(Phdr.p_align) + ") is not 4 or 8"); in notes_begin()
418 return Elf_Note_Iterator(base() + Phdr.p_offset, Phdr.p_filesz, in notes_begin()
419 std::max<size_t>(Phdr.p_align, 4), Err); in notes_begin()
461 iterator_range<Elf_Note_Iterator> notes(const Elf_Phdr &Phdr, in notes() argument
463 return make_range(notes_begin(Phdr, Err), notes_end()); in notes()
502 Expected<ArrayRef<uint8_t>> getSegmentContents(const Elf_Phdr &Phdr) const;
651 ELFFile<ELFT>::getSegmentContents(const Elf_Phdr &Phdr) const { in getSegmentContents() argument
652 uintX_t Offset = Phdr.p_offset; in getSegmentContents()
653 uintX_t Size = Phdr.p_filesz; in getSegmentContents()
656 return createError("program header " + getPhdrIndexForError(*this, Phdr) + in getSegmentContents()
661 return createError("program header " + getPhdrIndexForError(*this, Phdr) + in getSegmentContents()
906 for (auto [Idx, Phdr] : llvm::enumerate(*PhdrsOrErr)) { in createFakeSections()
907 if (Phdr.p_type != ELF::PT_LOAD || !(Phdr.p_flags & ELF::PF_X)) in createFakeSections()
912 FakeShdr.sh_addr = Phdr.p_vaddr; in createFakeSections()
913 FakeShdr.sh_size = Phdr.p_memsz; in createFakeSections()
914 FakeShdr.sh_offset = Phdr.p_offset; in createFakeSections()