29constexpr unsigned DefaultSectionAlign = 4;
30constexpr int16_t MaxSectionIndex = INT16_MAX;
31constexpr uint32_t MaxRawDataSize = UINT32_MAX;
44 const Twine &fieldName);
45 bool nameShouldBeInStringTable(
StringRef SymbolName);
46 bool initFileHeader(
uint64_t CurrentOffset);
47 void initAuxFileHeader();
48 bool initSectionHeaders(
uint64_t &CurrentOffset);
50 bool initStringTable();
51 bool assignAddressesAndIndices();
53 void writeFileHeader();
54 void writeAuxFileHeader();
55 void writeSectionHeaders();
56 bool writeSectionData();
57 bool writeRelocations();
68 bool writeAuxSymbol(
const std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym);
83 std::vector<XCOFFYAML::Section> InitSections = Obj.
Sections;
95void XCOFFWriter::reportOverwrite(
uint64_t CurrentOffset,
97 const Twine &fieldName) {
98 ErrHandler(
"current file offset (" +
Twine(CurrentOffset) +
99 ") is bigger than the specified " + fieldName +
" (" +
100 Twine(specifiedOffset) +
") ");
103bool XCOFFWriter::nameShouldBeInStringTable(
StringRef SymbolName) {
108bool XCOFFWriter::initRelocations(
uint64_t &CurrentOffset) {
110 if (!InitSection.Relocations.empty()) {
113 uint64_t UsedSize = RelSize * InitSection.Relocations.size();
117 if (!InitSection.NumberOfRelocations)
118 InitSection.NumberOfRelocations = InitSection.Relocations.size();
121 if (InitSection.FileOffsetToRelocations) {
122 if (CurrentOffset > InitSection.FileOffsetToRelocations) {
123 reportOverwrite(CurrentOffset, InitSection.FileOffsetToRelocations,
124 "FileOffsetToRelocations for the " +
125 InitSection.SectionName +
" section");
128 CurrentOffset = InitSection.FileOffsetToRelocations;
130 InitSection.FileOffsetToRelocations = CurrentOffset;
131 CurrentOffset += UsedSize;
132 if (CurrentOffset > MaxRawDataSize) {
133 ErrHandler(
"maximum object size (" +
Twine(MaxRawDataSize) +
134 ") exceeded when writing relocation data for section " +
135 Twine(InitSection.SectionName));
143bool XCOFFWriter::initSectionHeaders(
uint64_t &CurrentOffset) {
146 for (
uint16_t I = 0, E = InitSections.size();
I < E; ++
I) {
149 !SectionIndexMap[InitSections[
I].SectionName]) {
151 SectionIndexMap[InitSections[
I].SectionName] =
I + 1;
152 if ((
I + 1) > MaxSectionIndex) {
153 ErrHandler(
"exceeded the maximum permitted section index of " +
154 Twine(MaxSectionIndex));
159 if (!InitSections[
I].
Size)
160 InitSections[
I].Size = InitSections[
I].SectionData.binary_size();
173 switch (InitSections[
I].Flags) {
175 CurrentEndDataAddr = InitSections[
I].Address + InitSections[
I].Size;
178 if (!InitSections[
I].Address)
179 InitSections[
I].Address = CurrentEndDataAddr;
182 CurrentEndTDataAddr = InitSections[
I].Address + InitSections[
I].Size;
185 if (!InitSections[
I].Address)
186 InitSections[
I].Address = CurrentEndTDataAddr;
190 if (InitSections[
I].SectionData.binary_size()) {
191 if (InitSections[
I].FileOffsetToData) {
193 if (CurrentOffset > InitSections[
I].FileOffsetToData) {
194 reportOverwrite(CurrentOffset, InitSections[
I].FileOffsetToData,
195 "FileOffsetToData for the " +
199 CurrentOffset = InitSections[
I].FileOffsetToData;
201 CurrentOffset =
alignTo(CurrentOffset, DefaultSectionAlign);
202 InitSections[
I].FileOffsetToData = CurrentOffset;
204 CurrentOffset += InitSections[
I].SectionData.binary_size();
205 if (CurrentOffset > MaxRawDataSize) {
206 ErrHandler(
"maximum object size (" +
Twine(MaxRawDataSize) +
207 ") exceeded when writing data for section " +
Twine(
I + 1) +
212 if (InitSections[
I].SectionSubtype) {
214 static_cast<uint32_t>(*InitSections[
I].SectionSubtype);
216 ErrHandler(
"a DWARFSectionSubtype is only allowed for a DWARF section");
219 unsigned Mask = Is64Bit ? XCOFFSectionHeader64::SectionFlagsTypeMask
220 : XCOFFSectionHeader32::SectionFlagsTypeMask;
221 if (DWARFSubtype & Mask) {
222 ErrHandler(
"the low-order bits of DWARFSectionSubtype must be 0");
225 InitSections[
I].Flags |= DWARFSubtype;
231bool XCOFFWriter::initStringTable() {
232 if (Obj.StrTbl.RawContent) {
233 size_t RawSize = Obj.StrTbl.RawContent->binary_size();
234 if (Obj.StrTbl.Strings || Obj.StrTbl.Length) {
236 "can't specify Strings or Length when RawContent is specified");
239 if (Obj.StrTbl.ContentSize && *Obj.StrTbl.ContentSize < RawSize) {
240 ErrHandler(
"specified ContentSize (" +
Twine(*Obj.StrTbl.ContentSize) +
241 ") is less than the RawContent data size (" +
Twine(RawSize) +
247 if (Obj.StrTbl.ContentSize && *Obj.StrTbl.ContentSize <= 3) {
248 ErrHandler(
"ContentSize shouldn't be less than 4 without RawContent");
253 StrTblBuilder.clear();
255 if (Obj.StrTbl.Strings) {
257 for (
StringRef StringEnt : *Obj.StrTbl.Strings)
258 StrTblBuilder.add(StringEnt);
260 size_t StrTblIdx = 0;
261 size_t NumOfStrings = Obj.StrTbl.Strings->size();
263 if (nameShouldBeInStringTable(YamlSym.
SymbolName)) {
264 if (StrTblIdx < NumOfStrings) {
266 YamlSym.
SymbolName = (*Obj.StrTbl.Strings)[StrTblIdx];
276 if (nameShouldBeInStringTable(YamlSym.
SymbolName))
284 for (
const std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym :
286 if (
auto AS = dyn_cast<XCOFFYAML::FileAuxEnt>(AuxSym.get()))
287 if (nameShouldBeInStringTable(AS->FileNameOrString.value_or(
"")))
288 StrTblBuilder.add(AS->FileNameOrString.value_or(
""));
292 StrTblBuilder.finalize();
294 size_t StrTblSize = StrTblBuilder.getSize();
295 if (Obj.StrTbl.ContentSize && *Obj.StrTbl.ContentSize < StrTblSize) {
296 ErrHandler(
"specified ContentSize (" +
Twine(*Obj.StrTbl.ContentSize) +
297 ") is less than the size of the data that would otherwise be "
299 Twine(StrTblSize) +
")");
306bool XCOFFWriter::initFileHeader(
uint64_t CurrentOffset) {
309 InitFileHdr.NumberOfSections = Obj.Sections.size();
310 InitFileHdr.NumberOfSymTableEntries = Obj.Symbols.size();
315 ErrHandler(
"specified NumberOfAuxEntries " +
317 " is less than the actual number "
318 "of auxiliary entries " +
328 if (InitFileHdr.NumberOfSymTableEntries) {
329 if (Obj.Header.SymbolTableOffset) {
330 if (CurrentOffset > Obj.Header.SymbolTableOffset) {
331 reportOverwrite(CurrentOffset, Obj.Header.SymbolTableOffset,
332 "SymbolTableOffset");
335 CurrentOffset = Obj.Header.SymbolTableOffset;
337 InitFileHdr.SymbolTableOffset = CurrentOffset;
340 if (CurrentOffset > MaxRawDataSize) {
341 ErrHandler(
"maximum object size of " +
Twine(MaxRawDataSize) +
342 " exceeded when writing symbols");
350void XCOFFWriter::initAuxFileHeader() {
352 InitAuxFileHdr = *Obj.AuxHeader;
361 for (
uint16_t I = 0, E = InitSections.size();
I < E; ++
I) {
362 switch (InitSections[
I].Flags) {
364 if (!InitAuxFileHdr.TextSize)
365 InitAuxFileHdr.TextSize = InitSections[
I].Size;
366 if (!InitAuxFileHdr.TextStartAddr)
367 InitAuxFileHdr.TextStartAddr = InitSections[
I].Address;
368 if (!InitAuxFileHdr.SecNumOfText)
369 InitAuxFileHdr.SecNumOfText =
I + 1;
372 if (!InitAuxFileHdr.InitDataSize)
373 InitAuxFileHdr.InitDataSize = InitSections[
I].Size;
374 if (!InitAuxFileHdr.DataStartAddr)
375 InitAuxFileHdr.DataStartAddr = InitSections[
I].Address;
376 if (!InitAuxFileHdr.SecNumOfData)
377 InitAuxFileHdr.SecNumOfData =
I + 1;
380 if (!InitAuxFileHdr.BssDataSize)
381 InitAuxFileHdr.BssDataSize = InitSections[
I].Size;
382 if (!InitAuxFileHdr.SecNumOfBSS)
383 InitAuxFileHdr.SecNumOfBSS =
I + 1;
386 if (!InitAuxFileHdr.SecNumOfTData)
387 InitAuxFileHdr.SecNumOfTData =
I + 1;
390 if (!InitAuxFileHdr.SecNumOfTBSS)
391 InitAuxFileHdr.SecNumOfTBSS =
I + 1;
394 if (!InitAuxFileHdr.SecNumOfLoader)
395 InitAuxFileHdr.SecNumOfLoader =
I + 1;
403bool XCOFFWriter::assignAddressesAndIndices() {
411 if (Obj.Header.AuxHeaderSize)
412 AuxFileHdrSize = Obj.Header.AuxHeaderSize;
413 else if (Obj.AuxHeader)
419 FileHdrSize + AuxFileHdrSize + InitSections.size() * SecHdrSize;
422 if (!initSectionHeaders(CurrentOffset))
426 if (!initFileHeader(CurrentOffset))
428 InitFileHdr.AuxHeaderSize = AuxFileHdrSize;
435 return initStringTable();
438void XCOFFWriter::writeFileHeader() {
439 W.write<
uint16_t>(Obj.Header.Magic ? Obj.Header.Magic : InitFileHdr.Magic);
440 W.write<
uint16_t>(Obj.Header.NumberOfSections ? Obj.Header.NumberOfSections
441 : InitFileHdr.NumberOfSections);
442 W.write<int32_t>(Obj.Header.TimeStamp);
444 W.write<
uint64_t>(InitFileHdr.SymbolTableOffset);
445 W.write<
uint16_t>(InitFileHdr.AuxHeaderSize);
447 W.write<int32_t>(Obj.Header.NumberOfSymTableEntries
448 ? Obj.Header.NumberOfSymTableEntries
449 : InitFileHdr.NumberOfSymTableEntries);
451 W.write<
uint32_t>(InitFileHdr.SymbolTableOffset);
452 W.write<int32_t>(Obj.Header.NumberOfSymTableEntries
453 ? Obj.Header.NumberOfSymTableEntries
454 : InitFileHdr.NumberOfSymTableEntries);
455 W.write<
uint16_t>(InitFileHdr.AuxHeaderSize);
460void XCOFFWriter::writeAuxFileHeader() {
461 W.write<
uint16_t>(InitAuxFileHdr.Magic.value_or(yaml::Hex16(1)));
462 W.write<
uint16_t>(InitAuxFileHdr.Version.value_or(yaml::Hex16(1)));
465 W.write<
uint64_t>(InitAuxFileHdr.TextStartAddr.value_or(yaml::Hex64(0)));
466 W.write<
uint64_t>(InitAuxFileHdr.DataStartAddr.value_or(yaml::Hex64(0)));
467 W.write<
uint64_t>(InitAuxFileHdr.TOCAnchorAddr.value_or(yaml::Hex64(0)));
469 W.write<
uint32_t>(InitAuxFileHdr.TextSize.value_or(yaml::Hex64(0)));
470 W.write<
uint32_t>(InitAuxFileHdr.InitDataSize.value_or(yaml::Hex64(0)));
471 W.write<
uint32_t>(InitAuxFileHdr.BssDataSize.value_or(yaml::Hex64(0)));
472 W.write<
uint32_t>(InitAuxFileHdr.EntryPointAddr.value_or(yaml::Hex64(0)));
473 W.write<
uint32_t>(InitAuxFileHdr.TextStartAddr.value_or(yaml::Hex64(0)));
474 W.write<
uint32_t>(InitAuxFileHdr.DataStartAddr.value_or(yaml::Hex64(0)));
478 W.write<
uint32_t>(InitAuxFileHdr.TOCAnchorAddr.value_or(yaml::Hex64(0)));
480 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfEntryPoint.value_or(0));
481 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfText.value_or(0));
482 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfData.value_or(0));
483 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfTOC.value_or(0));
484 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfLoader.value_or(0));
485 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfBSS.value_or(0));
486 W.write<
uint16_t>(InitAuxFileHdr.MaxAlignOfText.value_or(yaml::Hex16(0)));
487 W.write<
uint16_t>(InitAuxFileHdr.MaxAlignOfData.value_or(yaml::Hex16(0)));
488 W.write<
uint16_t>(InitAuxFileHdr.ModuleType.value_or(yaml::Hex16(0)));
489 W.write<
uint8_t>(InitAuxFileHdr.CpuFlag.value_or(yaml::Hex8(0)));
492 W.write<
uint8_t>(InitAuxFileHdr.TextPageSize.value_or(yaml::Hex8(0)));
493 W.write<
uint8_t>(InitAuxFileHdr.DataPageSize.value_or(yaml::Hex8(0)));
494 W.write<
uint8_t>(InitAuxFileHdr.StackPageSize.value_or(yaml::Hex8(0)));
496 InitAuxFileHdr.FlagAndTDataAlignment.value_or(yaml::Hex8(0x80)));
497 W.write<
uint64_t>(InitAuxFileHdr.TextSize.value_or(yaml::Hex64(0)));
498 W.write<
uint64_t>(InitAuxFileHdr.InitDataSize.value_or(yaml::Hex64(0)));
499 W.write<
uint64_t>(InitAuxFileHdr.BssDataSize.value_or(yaml::Hex64(0)));
500 W.write<
uint64_t>(InitAuxFileHdr.EntryPointAddr.value_or(yaml::Hex64(0)));
501 W.write<
uint64_t>(InitAuxFileHdr.MaxStackSize.value_or(yaml::Hex64(0)));
502 W.write<
uint64_t>(InitAuxFileHdr.MaxDataSize.value_or(yaml::Hex64(0)));
504 W.write<
uint32_t>(InitAuxFileHdr.MaxStackSize.value_or(yaml::Hex64(0)));
505 W.write<
uint32_t>(InitAuxFileHdr.MaxDataSize.value_or(yaml::Hex64(0)));
507 W.write<
uint8_t>(InitAuxFileHdr.TextPageSize.value_or(yaml::Hex8(0)));
508 W.write<
uint8_t>(InitAuxFileHdr.DataPageSize.value_or(yaml::Hex8(0)));
509 W.write<
uint8_t>(InitAuxFileHdr.StackPageSize.value_or(yaml::Hex8(0)));
511 InitAuxFileHdr.FlagAndTDataAlignment.value_or(yaml::Hex8(0)));
513 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfTData.value_or(0));
514 W.write<
uint16_t>(InitAuxFileHdr.SecNumOfTBSS.value_or(0));
526void XCOFFWriter::writeSectionHeaders() {
527 for (
uint16_t I = 0, E = Obj.Sections.size();
I < E; ++
I) {
540 W.write<int32_t>(DerivedSec.
Flags);
552 W.write<int32_t>(DerivedSec.
Flags);
557bool XCOFFWriter::writeSectionData() {
558 for (
uint16_t I = 0, E = Obj.Sections.size();
I < E; ++
I) {
562 int64_t PaddingSize = (
uint64_t)InitSections[
I].FileOffsetToData -
563 (
W.OS.tell() - StartOffset);
564 if (PaddingSize < 0) {
565 ErrHandler(
"redundant data was written before section data");
568 W.OS.write_zeros(PaddingSize);
575bool XCOFFWriter::writeRelocations() {
576 for (
uint16_t I = 0, E = Obj.Sections.size();
I < E; ++
I) {
579 int64_t PaddingSize =
581 if (PaddingSize < 0) {
582 ErrHandler(
"redundant data was written before relocations");
585 W.OS.write_zeros(PaddingSize);
604 ErrHandler(
"cannot specify SymbolType or SymbolAlignment if "
605 "SymbolAlignmentAndType is specified");
613 ErrHandler(
"symbol type must be less than " +
620 const uint8_t ShiftedSymbolAlignmentMask =
625 ErrHandler(
"symbol alignment must be less than " +
626 Twine(1 + ShiftedSymbolAlignmentMask));
655 assert(Is64Bit &&
"can't write the exception auxiliary symbol for XCOFF32");
683 if (nameShouldBeInStringTable(FileName)) {
685 W.write<
uint32_t>(StrTblBuilder.getOffset(FileName));
687 writeName(FileName, W);
703 W.OS.write_zeros(13);
709 W.OS.write_zeros(12);
730 assert(!Is64Bit &&
"can't write the stat auxiliary symbol for XCOFF64");
734 W.OS.write_zeros(10);
738bool XCOFFWriter::writeAuxSymbol(
739 const std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym) {
740 if (
auto AS = dyn_cast<XCOFFYAML::CsectAuxEnt>(AuxSym.get()))
741 return writeAuxSymbol(*AS);
742 else if (
auto AS = dyn_cast<XCOFFYAML::FunctionAuxEnt>(AuxSym.get()))
743 return writeAuxSymbol(*AS);
744 else if (
auto AS = dyn_cast<XCOFFYAML::ExcpetionAuxEnt>(AuxSym.get()))
745 return writeAuxSymbol(*AS);
746 else if (
auto AS = dyn_cast<XCOFFYAML::FileAuxEnt>(AuxSym.get()))
747 return writeAuxSymbol(*AS);
748 else if (
auto AS = dyn_cast<XCOFFYAML::BlockAuxEnt>(AuxSym.get()))
749 return writeAuxSymbol(*AS);
750 else if (
auto AS = dyn_cast<XCOFFYAML::SectAuxEntForDWARF>(AuxSym.get()))
751 return writeAuxSymbol(*AS);
752 else if (
auto AS = dyn_cast<XCOFFYAML::SectAuxEntForStat>(AuxSym.get()))
753 return writeAuxSymbol(*AS);
758bool XCOFFWriter::writeSymbols() {
759 int64_t PaddingSize =
760 InitFileHdr.SymbolTableOffset - (
W.OS.tell() - StartOffset);
761 if (PaddingSize < 0) {
762 ErrHandler(
"redundant data was written before symbols");
765 W.OS.write_zeros(PaddingSize);
771 if (nameShouldBeInStringTable(YamlSym.
SymbolName)) {
782 if (!SectionIndexMap.count(*YamlSym.
SectionName)) {
783 ErrHandler(
"the SectionName " + *YamlSym.
SectionName +
784 " specified in the symbol does not exist");
789 ErrHandler(
"the SectionName " + *YamlSym.
SectionName +
791 ") refer to different sections");
794 W.write<int16_t>(SectionIndexMap[*YamlSym.
SectionName]);
804 if (!NumOfAuxSym && !YamlSym.
AuxEntries.size())
811 for (
const std::unique_ptr<XCOFFYAML::AuxSymbolEnt> &AuxSym :
813 if (!writeAuxSymbol(AuxSym))
825void XCOFFWriter::writeStringTable() {
826 if (Obj.StrTbl.RawContent) {
827 Obj.StrTbl.RawContent->writeAsBinary(
W.OS);
828 if (Obj.StrTbl.ContentSize) {
829 assert(*Obj.StrTbl.ContentSize >= Obj.StrTbl.RawContent->binary_size() &&
830 "Specified ContentSize is less than the RawContent size.");
831 W.OS.write_zeros(*Obj.StrTbl.ContentSize -
832 Obj.StrTbl.RawContent->binary_size());
837 size_t StrTblBuilderSize = StrTblBuilder.getSize();
840 if (!Obj.StrTbl.Length && !Obj.StrTbl.ContentSize) {
841 if (StrTblBuilderSize <= 4)
843 StrTblBuilder.write(
W.OS);
848 std::unique_ptr<WritableMemoryBuffer> Buf =
851 StrTblBuilder.write(
Ptr);
856 : *Obj.StrTbl.ContentSize);
858 W.OS.write(Buf->getBufferStart(), Buf->getBufferSize());
860 if (Obj.StrTbl.ContentSize) {
861 assert(*Obj.StrTbl.ContentSize >= StrTblBuilderSize &&
862 "Specified ContentSize is less than the StringTableBuilder size.");
863 W.OS.write_zeros(*Obj.StrTbl.ContentSize - StrTblBuilderSize);
867bool XCOFFWriter::writeXCOFF() {
868 if (!assignAddressesAndIndices())
870 StartOffset =
W.OS.tell();
872 if (InitFileHdr.AuxHeaderSize)
873 writeAuxFileHeader();
874 if (!Obj.Sections.empty()) {
875 writeSectionHeaders();
876 if (!writeSectionData())
878 if (!writeRelocations())
881 if (!Obj.Symbols.empty() && !writeSymbols())
893 XCOFFWriter Writer(Doc, Out, EH);
894 return Writer.writeXCOFF();
This file defines the DenseMap class.
static Error initRelocations(RelocationSection *Relocs, T RelRange)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Utility for building string tables with deduplicated suffixes.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static std::unique_ptr< WritableMemoryBuffer > getNewMemBuffer(size_t Size, const Twine &BufferName="")
Allocate a new zero-initialized MemoryBuffer of the specified size.
An efficient, type-erasing, non-owning reference to a callable.
static constexpr uint8_t SymbolTypeMask
static constexpr size_t SymbolAlignmentBitOffset
static constexpr uint8_t SymbolAlignmentMask
This class implements an extremely fast bulk output stream that can only output to a stream.
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef.
void writeAsBinary(raw_ostream &OS, uint64_t N=UINT64_MAX) const
Write the contents (regardless of whether it is binary or a hex string) as binary to the given raw_os...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
@ SHR_SYMTAB
At exec time, create shared symbol table for program (main program only).
constexpr size_t RelocationSerializationSize32
constexpr size_t RelocationSerializationSize64
constexpr size_t FileHeaderSize64
constexpr size_t AuxFileHeaderSize64
constexpr size_t SectionHeaderSize64
@ AUX_SECT
Identifies a SECT auxiliary entry.
@ AUX_FILE
Identifies a file auxiliary entry.
@ AUX_EXCEPT
Identifies an exception auxiliary entry.
@ AUX_FCN
Identifies a function auxiliary entry.
@ AUX_SYM
Identifies a symbol auxiliary entry.
@ AUX_CSECT
Identifies a csect auxiliary entry.
constexpr size_t NameSize
constexpr size_t AuxFileHeaderSizeShort
constexpr size_t AuxFileHeaderSize32
@ XFT_FN
Specifies the source-file name.
constexpr size_t FileHeaderSize32
constexpr size_t SectionHeaderSize32
constexpr size_t SymbolTableEntrySize
constexpr size_t FileNamePadSize
static void writeStringTable(std::vector< uint8_t > &B, ArrayRef< const std::string_view > Strings)
void write32be(void *P, uint32_t V)
bool yaml2xcoff(XCOFFYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
This is an optimization pass for GlobalISel generic memory operations.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
std::optional< uint32_t > LineNum
std::optional< uint16_t > LineNumHi
std::optional< uint16_t > LineNumLo
std::optional< uint16_t > TypeChkSectNum
std::optional< uint32_t > ParameterHashIndex
std::optional< uint32_t > SectionOrLength
std::optional< uint32_t > SectionOrLengthHi
std::optional< uint8_t > SymbolAlignmentAndType
std::optional< uint32_t > SectionOrLengthLo
std::optional< uint8_t > SymbolAlignment
std::optional< uint16_t > StabSectNum
std::optional< XCOFF::StorageMappingClass > StorageMappingClass
std::optional< uint32_t > StabInfoIndex
std::optional< XCOFF::SymbolType > SymbolType
std::optional< int32_t > SymIdxOfNextBeyond
std::optional< uint32_t > SizeOfFunction
std::optional< uint64_t > OffsetToExceptionTbl
std::optional< XCOFF::CFileStringType > FileStringType
std::optional< StringRef > FileNameOrString
std::optional< int32_t > SymIdxOfNextBeyond
std::optional< uint32_t > OffsetToExceptionTbl
std::optional< uint64_t > PtrToLineNum
std::optional< uint32_t > SizeOfFunction
std::vector< Section > Sections
llvm::yaml::Hex64 SymbolIndex
llvm::yaml::Hex64 VirtualAddress
std::optional< uint32_t > NumberOfRelocEnt
std::optional< uint32_t > LengthOfSectionPortion
std::optional< uint16_t > NumberOfRelocEnt
std::optional< uint16_t > NumberOfLineNum
std::optional< uint32_t > SectionLength
llvm::yaml::Hex64 FileOffsetToRelocations
llvm::yaml::Hex64 Address
llvm::yaml::Hex64 FileOffsetToData
yaml::BinaryRef SectionData
std::vector< Relocation > Relocations
llvm::yaml::Hex16 NumberOfLineNumbers
llvm::yaml::Hex16 NumberOfRelocations
llvm::yaml::Hex64 FileOffsetToLineNumbers
std::vector< std::unique_ptr< AuxSymbolEnt > > AuxEntries
std::optional< uint16_t > SectionIndex
std::optional< uint8_t > NumberOfAuxEntries
XCOFF::StorageClass StorageClass
std::optional< StringRef > SectionName
Adapter to write values to a stream in a particular byte order.
Common declarations for yaml2obj.