• Home
  • Raw
  • Download

Lines Matching refs:Seg

39 template <class ELFT> void ELFWriter<ELFT>::writePhdr(const Segment &Seg) {  in writePhdr()  argument
41 Seg.Index * sizeof(Elf_Phdr); in writePhdr()
43 Phdr.p_type = Seg.Type; in writePhdr()
44 Phdr.p_flags = Seg.Flags; in writePhdr()
45 Phdr.p_offset = Seg.Offset; in writePhdr()
46 Phdr.p_vaddr = Seg.VAddr; in writePhdr()
47 Phdr.p_paddr = Seg.PAddr; in writePhdr()
48 Phdr.p_filesz = Seg.FileSize; in writePhdr()
49 Phdr.p_memsz = Seg.MemSize; in writePhdr()
50 Phdr.p_align = Seg.Align; in writePhdr()
329 Segment *Seg = Sec->ParentSegment; in sectionPhysicalAddr() local
330 if (Seg && Seg->Type != ELF::PT_LOAD) in sectionPhysicalAddr()
331 Seg = nullptr; in sectionPhysicalAddr()
332 return Seg ? Seg->PAddr + Sec->OriginalOffset - Seg->OriginalOffset in sectionPhysicalAddr()
1198 static bool sectionWithinSegment(const SectionBase &Sec, const Segment &Seg) { in sectionWithinSegment() argument
1210 bool SegmentIsTLS = Seg.Type == PT_TLS; in sectionWithinSegment()
1214 return Seg.VAddr <= Sec.Addr && in sectionWithinSegment()
1215 Seg.VAddr + Seg.MemSize >= Sec.Addr + SecSize; in sectionWithinSegment()
1218 return Seg.Offset <= Sec.OriginalOffset && in sectionWithinSegment()
1219 Seg.Offset + Seg.FileSize >= Sec.OriginalOffset + SecSize; in sectionWithinSegment()
1425 Segment &Seg = Obj.addSegment(Data); in readProgramHeaders() local
1426 Seg.Type = Phdr.p_type; in readProgramHeaders()
1427 Seg.Flags = Phdr.p_flags; in readProgramHeaders()
1428 Seg.OriginalOffset = Phdr.p_offset + EhdrOffset; in readProgramHeaders()
1429 Seg.Offset = Phdr.p_offset + EhdrOffset; in readProgramHeaders()
1430 Seg.VAddr = Phdr.p_vaddr; in readProgramHeaders()
1431 Seg.PAddr = Phdr.p_paddr; in readProgramHeaders()
1432 Seg.FileSize = Phdr.p_filesz; in readProgramHeaders()
1433 Seg.MemSize = Phdr.p_memsz; in readProgramHeaders()
1434 Seg.Align = Phdr.p_align; in readProgramHeaders()
1435 Seg.Index = Index++; in readProgramHeaders()
1437 if (sectionWithinSegment(Sec, Seg)) { in readProgramHeaders()
1438 Seg.addSection(&Sec); in readProgramHeaders()
1439 if (!Sec.ParentSegment || Sec.ParentSegment->Offset > Seg.Offset) in readProgramHeaders()
1440 Sec.ParentSegment = &Seg; in readProgramHeaders()
2031 for (auto &Seg : Obj.segments()) in writePhdrs() local
2032 writePhdr(Seg); in writePhdrs()
2077 for (Segment &Seg : Obj.segments()) { in writeSegmentData()
2078 size_t Size = std::min<size_t>(Seg.FileSize, Seg.getContents().size()); in writeSegmentData()
2079 std::memcpy(Buf.getBufferStart() + Seg.Offset, Seg.getContents().data(), in writeSegmentData()
2220 for (Segment *Seg : Segments) { in layoutSegments()
2225 if (Seg->ParentSegment != nullptr) { in layoutSegments()
2226 Segment *Parent = Seg->ParentSegment; in layoutSegments()
2227 Seg->Offset = in layoutSegments()
2228 Parent->Offset + Seg->OriginalOffset - Parent->OriginalOffset; in layoutSegments()
2230 Seg->Offset = in layoutSegments()
2231 alignTo(Offset, std::max<uint64_t>(Seg->Align, 1), Seg->VAddr); in layoutSegments()
2233 Offset = std::max(Offset, Seg->Offset + Seg->FileSize); in layoutSegments()
2313 for (Segment *Seg : Segments) { in layoutSegmentsForOnlyKeepDebug()
2318 if (Seg->ParentSegment != nullptr && Seg->MemSize == 0) in layoutSegmentsForOnlyKeepDebug()
2319 Seg->Offset = Seg->ParentSegment->Offset; in layoutSegmentsForOnlyKeepDebug()
2321 const SectionBase *FirstSec = Seg->firstSection(); in layoutSegmentsForOnlyKeepDebug()
2322 if (Seg->Type == PT_PHDR || !FirstSec) in layoutSegmentsForOnlyKeepDebug()
2327 for (const SectionBase *Sec : Seg->Sections) { in layoutSegmentsForOnlyKeepDebug()
2335 if (Seg->Offset < HdrEnd && HdrEnd <= Seg->Offset + Seg->FileSize) { in layoutSegmentsForOnlyKeepDebug()
2336 FileSize += Offset - Seg->Offset; in layoutSegmentsForOnlyKeepDebug()
2337 Offset = Seg->Offset; in layoutSegmentsForOnlyKeepDebug()
2341 Seg->Offset = Offset; in layoutSegmentsForOnlyKeepDebug()
2342 Seg->FileSize = FileSize; in layoutSegmentsForOnlyKeepDebug()