Home | History | Annotate | Download | only in yaml2obj

Lines Matching refs:Header

47     return Obj.Header.Machine == COFF::IMAGE_FILE_MACHINE_AMD64;
51 return Obj.OptionalHeader->Header.FileAlignment;
72 std::copy(Name.begin(), Name.end(), Sec.Header.Name);
81 Sec.Header.Name[0] = '/';
82 std::copy(str.begin(), str.end(), Sec.Header.Name + 1);
94 Sec.Header.Characteristics |= (Log2_32(Sec.Alignment) + 1) << 20;
109 std::copy(Name.begin(), Name.end(), Sym.Header.Name);
114 Sym.Header.Name + 4) = Index;
117 Sym.Header.Type = Sym.SimpleType;
118 Sym.Header.Type |= Sym.ComplexType << COFF::SCT_COMPLEX_TYPE_SHIFT;
158 CP.Obj.Header.SizeOfOptionalHeader =
171 // The section table starts immediately after the header, including the
172 // optional header.
174 CP.getHeaderSize() + CP.Obj.Header.SizeOfOptionalHeader;
187 S.Header.SizeOfRawData = S.SectionData.binary_size();
189 S.Header.SizeOfRawData =
190 alignTo(S.Header.SizeOfRawData, CP.getFileAlignment());
191 S.Header.PointerToRawData = CurrentSectionDataOffset;
192 CurrentSectionDataOffset += S.Header.SizeOfRawData;
194 S.Header.PointerToRelocations = CurrentSectionDataOffset;
195 S.Header.NumberOfRelocations = S.Relocations.size();
197 S.Header.NumberOfRelocations * COFF::RelocationSize;
200 S.Header.SizeOfRawData = 0;
201 S.Header.PointerToRawData = 0;
226 i->Header.NumberOfAuxSymbols = NumberOfAuxSymbols;
230 // Store all the allocated start addresses in the header.
231 CP.Obj.Header.NumberOfSections = CP.Obj.Sections.size();
232 CP.Obj.Header.NumberOfSymbols = NumberOfSymbols;
234 CP.Obj.Header.PointerToSymbolTable = SymbolTableStart;
236 CP.Obj.Header.PointerToSymbolTable = 0;
297 static uint32_t initializeOptionalHeader(COFFParser &CP, uint16_t Magic, T Header) {
298 memset(Header, 0, sizeof(*Header));
299 Header->Magic = Magic;
300 Header->SectionAlignment = CP.Obj.OptionalHeader->Header.SectionAlignment;
301 Header->FileAlignment = CP.Obj.OptionalHeader->Header.FileAlignment;
305 Header->FileAlignment);
306 uint32_t SizeOfImage = alignTo(SizeOfHeaders, Header->SectionAlignment);
309 if (S.Header.Characteristics & COFF::IMAGE_SCN_CNT_CODE)
310 SizeOfCode += S.Header.SizeOfRawData;
311 if (S.Header.Characteristics & COFF::IMAGE_SCN_CNT_INITIALIZED_DATA)
312 SizeOfInitializedData += S.Header.SizeOfRawData;
313 if (S.Header.Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)
314 SizeOfUninitializedData += S.Header.SizeOfRawData;
316 Header->BaseOfCode = S.Header.VirtualAddress; // RVA
318 BaseOfData = S.Header.VirtualAddress; // RVA
319 if (S.Header.VirtualAddress)
320 SizeOfImage += alignTo(S.Header.VirtualSize, Header->SectionAlignment);
322 Header->SizeOfCode = SizeOfCode;
323 Header->SizeOfInitializedData = SizeOfInitializedData;
324 Header->SizeOfUninitializedData = SizeOfUninitializedData;
325 Header->AddressOfEntryPoint =
326 CP.Obj.OptionalHeader->Header.AddressOfEntryPoint; // RVA
327 Header->ImageBase = CP.Obj.OptionalHeader->Header.ImageBase;
328 Header->MajorOperatingSystemVersion =
329 CP.Obj.OptionalHeader->Header.MajorOperatingSystemVersion;
330 Header->MinorOperatingSystemVersion =
331 CP.Obj.OptionalHeader->Header.MinorOperatingSystemVersion;
332 Header->MajorImageVersion =
333 CP.Obj.OptionalHeader->Header.MajorImageVersion;
334 Header->MinorImageVersion =
335 CP.Obj.OptionalHeader->Header.MinorImageVersion;
336 Header->MajorSubsystemVersion =
337 CP.Obj.OptionalHeader->Header.MajorSubsystemVersion;
338 Header->MinorSubsystemVersion =
339 CP.Obj.OptionalHeader->Header.MinorSubsystemVersion;
340 Header->SizeOfImage = SizeOfImage;
341 Header->SizeOfHeaders = SizeOfHeaders;
342 Header->Subsystem = CP.Obj.OptionalHeader->Header.Subsystem;
343 Header->DLLCharacteristics = CP.Obj.OptionalHeader->Header.DLLCharacteristics;
344 Header->SizeOfStackReserve = CP.Obj.OptionalHeader->Header.SizeOfStackReserve;
345 Header->SizeOfStackCommit = CP.Obj.OptionalHeader->Header.SizeOfStackCommit;
346 Header->SizeOfHeapReserve = CP.Obj.OptionalHeader->Header.SizeOfHeapReserve;
347 Header->SizeOfHeapCommit = CP.Obj.OptionalHeader->Header.SizeOfHeapCommit;
348 Header->NumberOfRvaAndSize = COFF::NUM_DATA_DIRECTORIES + 1;
380 << binary_le(CP.Obj.Header.Machine)
381 << binary_le(CP.Obj.Header.TimeDateStamp);
387 << binary_le(CP.Obj.Header.NumberOfSections)
388 << binary_le(CP.Obj.Header.PointerToSymbolTable)
389 << binary_le(CP.Obj.Header.NumberOfSymbols);
391 OS << binary_le(CP.Obj.Header.Machine)
392 << binary_le(static_cast<int16_t>(CP.Obj.Header.NumberOfSections))
393 << binary_le(CP.Obj.Header.TimeDateStamp)
394 << binary_le(CP.Obj.Header.PointerToSymbolTable)
395 << binary_le(CP.Obj.Header.NumberOfSymbols)
396 << binary_le(CP.Obj.Header.SizeOfOptionalHeader)
397 << binary_le(CP.Obj.Header.Characteristics);
429 OS.write(i->Header.Name, COFF::NameSize);
430 OS << binary_le(i->Header.VirtualSize)
431 << binary_le(i->Header.VirtualAddress)
432 << binary_le(i->Header.SizeOfRawData)
433 << binary_le(i->Header.PointerToRawData)
434 << binary_le(i->Header.PointerToRelocations)
435 << binary_le(i->Header.PointerToLineNumbers)
436 << binary_le(i->Header.NumberOfRelocations)
437 << binary_le(i->Header.NumberOfLineNumbers)
438 << binary_le(i->Header.Characteristics);
448 CurSymbol += 1 + I->Header.NumberOfAuxSymbols;
453 if (!S.Header.SizeOfRawData)
455 assert(S.Header.PointerToRawData >= OS.tell());
456 OS << num_zeros(S.Header.PointerToRawData - OS.tell());
458 assert(S.Header
459 OS << num_zeros(S.Header.SizeOfRawData - S.SectionData.binary_size());
473 OS.write(i->Header.Name, COFF::NameSize);
474 OS << binary_le(i->Header.Value);
476 OS << binary_le(i->Header.SectionNumber);
478 OS << binary_le(static_cast<int16_t>(i->Header.SectionNumber));
479 OS << binary_le(i->Header.Type)
480 << binary_le(i->Header.StorageClass)
481 << binary_le(i->Header.NumberOfAuxSymbols);
530 if (CP.Obj.Header.PointerToSymbolTable)
543 errs() << "yaml2obj: Failed to layout optional header for COFF file!\n";