Lines Matching refs:Obj
40 B += Obj.ProgramHdrSegment.Offset + Seg.Index * sizeof(Elf_Phdr); in writePhdr()
785 Obj->Flags = 0x0; in initFileHeader()
786 Obj->Type = ET_REL; in initFileHeader()
787 Obj->OSABI = ELFOSABI_NONE; in initFileHeader()
788 Obj->ABIVersion = 0; in initFileHeader()
789 Obj->Entry = 0x0; in initFileHeader()
790 Obj->Machine = EMachine; in initFileHeader()
791 Obj->Version = 1; in initFileHeader()
794 void BinaryELFBuilder::initHeaderSegment() { Obj->ElfHdrSegment.Index = 0; } in initHeaderSegment()
797 auto &StrTab = Obj->addSection<StringTableSection>(); in addStrTab()
800 Obj->SectionNames = &StrTab; in addStrTab()
805 auto &SymTab = Obj->addSection<SymbolTableSection>(); in addSymTab()
813 Obj->SymbolTable = &SymTab; in addSymTab()
821 auto &DataSection = Obj->addSection<Section>(Data); in addData()
841 for (auto &Section : Obj->sections()) { in initSections()
842 Section.initialize(Obj->sections()); in initSections()
854 return std::move(Obj); in build()
858 for (auto &Parent : Obj.segments()) { in setParentSegment()
878 Segment &Seg = Obj.addSegment(Data); in readProgramHeaders()
889 for (auto &Section : Obj.sections()) { in readProgramHeaders()
900 auto &ElfHdr = Obj.ElfHdrSegment; in readProgramHeaders()
904 auto &PrHdr = Obj.ProgramHdrSegment; in readProgramHeaders()
920 for (auto &Child : Obj.segments()) in readProgramHeaders()
928 auto SecTable = Obj.sections(); in initGroupSection()
982 DefSection = Obj.sections().getSection( in initSymbolTable()
986 if (!isValidReservedSectionIndex(Sym.st_shndx, Obj.Machine)) { in initSymbolTable()
993 DefSection = Obj.sections().getSection( in initSymbolTable()
1047 return Obj.addSection<DynamicRelocationSection>(Data); in makeSection()
1049 return Obj.addSection<RelocationSection>(); in makeSection()
1056 return Obj.addSection<Section>(Data); in makeSection()
1058 return Obj.addSection<StringTableSection>(); in makeSection()
1064 return Obj.addSection<Section>(Data); in makeSection()
1067 return Obj.addSection<GroupSection>(Data); in makeSection()
1070 return Obj.addSection<DynamicSymbolTableSection>(Data); in makeSection()
1073 return Obj.addSection<DynamicSection>(Data); in makeSection()
1075 auto &SymTab = Obj.addSection<SymbolTableSection>(); in makeSection()
1076 Obj.SymbolTable = &SymTab; in makeSection()
1080 auto &ShndxSection = Obj.addSection<SectionIndexSection>(); in makeSection()
1081 Obj.SectionIndexTable = &ShndxSection; in makeSection()
1085 return Obj.addSection<Section>(Data); in makeSection()
1093 return Obj.addSection<CompressedSection>(Data, DecompressedSize, in makeSection()
1097 return Obj.addSection<Section>(Data); in makeSection()
1130 if (Obj.SectionIndexTable) in readSectionHeaders()
1131 Obj.SectionIndexTable->initialize(Obj.sections()); in readSectionHeaders()
1136 if (Obj.SymbolTable) { in readSectionHeaders()
1137 Obj.SymbolTable->initialize(Obj.sections()); in readSectionHeaders()
1138 initSymbolTable(Obj.SymbolTable); in readSectionHeaders()
1144 for (auto &Section : Obj.sections()) { in readSectionHeaders()
1145 if (&Section == Obj.SymbolTable) in readSectionHeaders()
1147 Section.initialize(Obj.sections()); in readSectionHeaders()
1151 initRelocations(RelSec, Obj.SymbolTable, in readSectionHeaders()
1154 initRelocations(RelSec, Obj.SymbolTable, in readSectionHeaders()
1165 Obj.OSABI = Ehdr.e_ident[EI_OSABI]; in build()
1166 Obj.ABIVersion = Ehdr.e_ident[EI_ABIVERSION]; in build()
1167 Obj.Type = Ehdr.e_type; in build()
1168 Obj.Machine = Ehdr.e_machine; in build()
1169 Obj.Version = Ehdr.e_version; in build()
1170 Obj.Entry = Ehdr.e_entry; in build()
1171 Obj.Flags = Ehdr.e_flags; in build()
1180 Obj.SectionNames = in build()
1181 Obj.sections().template getSectionOfType<StringTableSection>( in build()
1203 auto Obj = llvm::make_unique<Object>(); in create() local
1205 ELFBuilder<ELF32LE> Builder(*O, *Obj); in create()
1207 return Obj; in create()
1209 ELFBuilder<ELF64LE> Builder(*O, *Obj); in create()
1211 return Obj; in create()
1213 ELFBuilder<ELF32BE> Builder(*O, *Obj); in create()
1215 return Obj; in create()
1217 ELFBuilder<ELF64BE> Builder(*O, *Obj); in create()
1219 return Obj; in create()
1236 Ehdr.e_ident[EI_OSABI] = Obj.OSABI; in writeEhdr()
1237 Ehdr.e_ident[EI_ABIVERSION] = Obj.ABIVersion; in writeEhdr()
1239 Ehdr.e_type = Obj.Type; in writeEhdr()
1240 Ehdr.e_machine = Obj.Machine; in writeEhdr()
1241 Ehdr.e_version = Obj.Version; in writeEhdr()
1242 Ehdr.e_entry = Obj.Entry; in writeEhdr()
1245 Ehdr.e_phnum = llvm::size(Obj.segments()); in writeEhdr()
1246 Ehdr.e_phoff = (Ehdr.e_phnum != 0) ? Obj.ProgramHdrSegment.Offset : 0; in writeEhdr()
1248 Ehdr.e_flags = Obj.Flags; in writeEhdr()
1250 if (WriteSectionHeaders && size(Obj.sections()) != 0) { in writeEhdr()
1252 Ehdr.e_shoff = Obj.SHOffset; in writeEhdr()
1259 auto Shnum = size(Obj.sections()) + 1; in writeEhdr()
1270 if (Obj.SectionNames->Index >= SHN_LORESERVE) in writeEhdr()
1273 Ehdr.e_shstrndx = Obj.SectionNames->Index; in writeEhdr()
1283 for (auto &Seg : Obj.segments()) in writePhdrs()
1288 uint8_t *B = Buf.getBufferStart() + Obj.SHOffset; in writeShdrs()
1298 uint64_t Shnum = size(Obj.sections()) + 1; in writeShdrs()
1304 if (Obj.SectionNames != nullptr && Obj.SectionNames->Index >= SHN_LORESERVE) in writeShdrs()
1305 Shdr.sh_link = Obj.SectionNames->Index; in writeShdrs()
1312 for (auto &Sec : Obj.sections()) in writeShdrs()
1317 for (auto &Sec : Obj.sections()) in writeSectionData()
1451 auto &ElfHdr = Obj.ElfHdrSegment; in initEhdrSegment()
1466 for (auto &Segment : Obj.segments()) in assignOffsets()
1468 OrderedSegments.push_back(&Obj.ElfHdrSegment); in assignOffsets()
1469 OrderedSegments.push_back(&Obj.ProgramHdrSegment); in assignOffsets()
1476 Offset = layoutSections(Obj.sections(), Offset); in assignOffsets()
1481 Obj.SHOffset = Offset; in assignOffsets()
1488 return Obj.SHOffset + size(Obj.sections()) * sizeof(Elf_Shdr) + in totalSize()
1506 if (Obj.SectionNames == nullptr && WriteSectionHeaders) in finalize()
1510 Obj.sortSections(); in finalize()
1516 if (size(Obj.sections()) >= SHN_LORESERVE) { in finalize()
1517 auto Sections = Obj.sections(); in finalize()
1528 if (Obj.SymbolTable != nullptr && Obj.SectionIndexTable == nullptr) { in finalize()
1531 auto &Shndx = Obj.addSection<SectionIndexSection>(); in finalize()
1532 Obj.SymbolTable->setShndxTable(&Shndx); in finalize()
1533 Shndx.setSymTab(Obj.SymbolTable); in finalize()
1538 if (Obj.SectionIndexTable != nullptr) { in finalize()
1539 Obj.removeSections([this](const SectionBase &Sec) { in finalize()
1540 return &Sec == Obj.SectionIndexTable; in finalize()
1547 if (Obj.SectionNames != nullptr) in finalize()
1548 for (const auto &Section : Obj.sections()) { in finalize()
1549 Obj.SectionNames->addString(Section.Name); in finalize()
1559 for (auto &Sec : Obj.sections()) { in finalize()
1567 if (Obj.SymbolTable != nullptr) in finalize()
1568 Obj.SymbolTable->prepareForLayout(); in finalize()
1573 if (Obj.SectionNames != nullptr) in finalize()
1574 Obj.SectionNames->finalize(); in finalize()
1577 uint64_t Offset = Obj.SHOffset + sizeof(Elf_Shdr); in finalize()
1578 for (auto &Section : Obj.sections()) { in finalize()
1582 Section.NameIndex = Obj.SectionNames->findIndex(Section.Name); in finalize()
1591 for (auto &Section : Obj.sections()) { in write()
1609 for (auto &Section : Obj.sections()) { in finalize()
1662 for (auto &Section : Obj.sections()) { in finalize()