23using namespace object;
28#define RETURN_IF_ERROR(X) \
32#define UNWRAP_REF_OR_RETURN(Name, Expr) \
33 auto Name##OrErr = Expr; \
35 return Name##OrErr.takeError(); \
36 const auto &Name = *Name##OrErr;
38#define UNWRAP_OR_RETURN(Name, Expr) \
39 auto Name##OrErr = Expr; \
41 return Name##OrErr.takeError(); \
42 auto Name = *Name##OrErr;
61 return make_error<GenericBinaryError>(
62 Source.getBufferIdentifier() +
": too small to be a resource file",
63 object_error::invalid_file_type);
65 return std::move(Ret);
70 return make_error<EmptyResError>(
getFileName() +
" contains no entries",
71 object_error::unexpected_eof);
77 : Reader(
Ref), Owner(Owner) {}
82 if (
auto E =
Ref.loadNext())
102 IsString = IDFlag != 0xffff;
115Error ResourceEntryRef::loadNext() {
120 return make_error<GenericBinaryError>(Owner->
getFileName() +
121 ": header size too small",
140 : Root(
false), MinGW(MinGW) {}
144 case 1:
OS <<
"CURSOR (ID 1)";
break;
145 case 2:
OS <<
"BITMAP (ID 2)";
break;
146 case 3:
OS <<
"ICON (ID 3)";
break;
147 case 4:
OS <<
"MENU (ID 4)";
break;
148 case 5:
OS <<
"DIALOG (ID 5)";
break;
149 case 6:
OS <<
"STRINGTABLE (ID 6)";
break;
150 case 7:
OS <<
"FONTDIR (ID 7)";
break;
151 case 8:
OS <<
"FONT (ID 8)";
break;
152 case 9:
OS <<
"ACCELERATOR (ID 9)";
break;
153 case 10:
OS <<
"RCDATA (ID 10)";
break;
154 case 11:
OS <<
"MESSAGETABLE (ID 11)";
break;
155 case 12:
OS <<
"GROUP_CURSOR (ID 12)";
break;
156 case 14:
OS <<
"GROUP_ICON (ID 14)";
break;
157 case 16:
OS <<
"VERSIONINFO (ID 16)";
break;
158 case 17:
OS <<
"DLGINCLUDE (ID 17)";
break;
159 case 19:
OS <<
"PLUGPLAY (ID 19)";
break;
160 case 20:
OS <<
"VXD (ID 20)";
break;
161 case 21:
OS <<
"ANICURSOR (ID 21)";
break;
162 case 22:
OS <<
"ANIICON (ID 22)";
break;
163 case 23:
OS <<
"HTML (ID 23)";
break;
164 case 24:
OS <<
"MANIFEST (ID 24)";
break;
165 default:
OS <<
"ID " <<
TypeID;
break;
173 std::vector<UTF16> EndianCorrectedSrc;
174 EndianCorrectedSrc.resize(Src.size() + 1);
175 llvm::copy(Src, EndianCorrectedSrc.begin() + 1);
185 OS <<
"duplicate resource:";
188 if (Entry.checkTypeString()) {
191 UTF8 =
"(failed conversion from UTF16)";
192 OS <<
'\"' <<
UTF8 <<
'\"';
197 if (Entry.checkNameString()) {
200 UTF8 =
"(failed conversion from UTF16)";
201 OS <<
'\"' <<
UTF8 <<
'\"';
203 OS <<
"ID " << Entry.getNameID();
206 OS <<
"/language " << Entry.getLanguage() <<
", in " << File1 <<
" and in "
217 UTF8 =
"(failed conversion from UTF16)";
218 OS <<
'\"' <<
UTF8 <<
'\"';
228 const std::vector<WindowsResourceParser::StringOrID> &Context,
233 OS <<
"duplicate resource:";
235 if (Context.size() >= 1) {
240 if (Context.size() >= 2) {
245 if (Context.size() >= 3) {
249 OS <<
", in " << File1 <<
" and in " << File2;
263 std::vector<std::string> &Duplicates) {
264 auto TypeIt = Root.IDChildren.find( 24);
265 if (TypeIt == Root.IDChildren.end())
268 TreeNode *TypeNode = TypeIt->second.get();
270 TypeNode->IDChildren.find( 1);
271 if (NameIt == TypeNode->IDChildren.end())
274 TreeNode *NameNode = NameIt->second.get();
275 if (NameNode->IDChildren.size() <= 1)
280 auto LangZeroIt = NameNode->IDChildren.find(0);
281 if (LangZeroIt != NameNode->IDChildren.end() &&
282 LangZeroIt->second->IsDataNode) {
283 uint32_t RemovedIndex = LangZeroIt->second->DataIndex;
284 NameNode->IDChildren.erase(LangZeroIt);
285 Data.erase(Data.begin() + RemovedIndex);
286 Root.shiftDataIndexDown(RemovedIndex);
289 if (NameNode->IDChildren.size() <= 1)
294 auto FirstIt = NameNode->IDChildren.begin();
295 uint32_t FirstLang = FirstIt->first;
296 TreeNode *FirstNode = FirstIt->second.get();
297 auto LastIt = NameNode->IDChildren.rbegin();
299 TreeNode *LastNode = LastIt->second.get();
300 Duplicates.push_back(
301 (
"duplicate non-default manifests with languages " +
Twine(FirstLang) +
302 " in " + InputFilenames[FirstNode->Origin] +
" and " +
Twine(LastLang) +
303 " in " + InputFilenames[LastNode->Origin])
311bool WindowsResourceParser::shouldIgnoreDuplicate(
313 return MinGW && !Entry.checkTypeString() &&
314 Entry.getTypeID() == 24 &&
315 !Entry.checkNameString() &&
316 Entry.getNameID() == 1 &&
317 Entry.getLanguage() == 0;
320bool WindowsResourceParser::shouldIgnoreDuplicate(
321 const std::vector<StringOrID> &Context)
const {
322 return MinGW && Context.size() == 3 && !Context[0].IsString &&
323 Context[0].ID == 24 && !Context[1].IsString &&
324 Context[1].ID == 1 &&
325 !Context[2].IsString && Context[2].ID == 0;
329 std::vector<std::string> &Duplicates) {
332 auto E = EntryOrErr.takeError();
347 uint32_t Origin = InputFilenames.size();
348 InputFilenames.push_back(std::string(WR->
getFileName()));
353 bool IsNewNode = Root.addEntry(Entry, Origin, Data,
StringTable, Node);
355 if (!shouldIgnoreDuplicate(Entry))
357 Entry, InputFilenames[Node->Origin], WR->
getFileName()));
367 std::vector<std::string> &Duplicates) {
369 uint32_t Origin = InputFilenames.size();
370 InputFilenames.push_back(std::string(Filename));
371 std::vector<StringOrID> Context;
372 return addChildren(Root, RSR, BaseTable, Origin, Context, Duplicates);
377 Root.
print(Writer,
"Resource Tree");
380bool WindowsResourceParser::TreeNode::addEntry(
382 std::vector<std::vector<uint8_t>> &
Data,
383 std::vector<std::vector<UTF16>> &
StringTable, TreeNode *&Result) {
384 TreeNode &TypeNode = addTypeNode(Entry,
StringTable);
385 TreeNode &NameNode = TypeNode.addNameNode(Entry,
StringTable);
386 return NameNode.addLanguageNode(Entry, Origin, Data, Result);
389Error WindowsResourceParser::addChildren(TreeNode &Node,
393 std::vector<StringOrID> &Context,
394 std::vector<std::string> &Duplicates) {
401 if (Entry.Offset.isSubDir()) {
406 Child = &Node.addNameChild(NameString,
StringTable);
407 Context.push_back(StringOrID(NameString));
409 Child = &
Node.addIDChild(Entry.Identifier.ID);
410 Context.push_back(StringOrID(Entry.Identifier.ID));
415 addChildren(*Child, RSR, NextTable, Origin, Context, Duplicates);
425 "unexpected string key for data object");
430 Context.push_back(StringOrID(
Entry.Identifier.ID));
433 Origin, Data.size(), Child);
437 reinterpret_cast<const uint8_t *
>(Contents.data()),
440 if (!shouldIgnoreDuplicate(Context))
442 Context, InputFilenames[Child->Origin], InputFilenames.back()));
451WindowsResourceParser::TreeNode::TreeNode(
uint32_t StringIndex)
452 : StringIndex(StringIndex) {}
454WindowsResourceParser::TreeNode::TreeNode(
uint16_t MajorVersion,
458 : IsDataNode(
true), DataIndex(DataIndex), MajorVersion(MajorVersion),
462std::unique_ptr<WindowsResourceParser::TreeNode>
463WindowsResourceParser::TreeNode::createStringNode(
uint32_t Index) {
464 return std::unique_ptr<TreeNode>(
new TreeNode(Index));
467std::unique_ptr<WindowsResourceParser::TreeNode>
468WindowsResourceParser::TreeNode::createIDNode() {
469 return std::unique_ptr<TreeNode>(
new TreeNode(0));
472std::unique_ptr<WindowsResourceParser::TreeNode>
473WindowsResourceParser::TreeNode::createDataNode(
uint16_t MajorVersion,
478 return std::unique_ptr<TreeNode>(
new TreeNode(
485 if (
Entry.checkTypeString())
488 return addIDChild(
Entry.getTypeID());
494 if (
Entry.checkNameString())
497 return addIDChild(
Entry.getNameID());
500bool WindowsResourceParser::TreeNode::addLanguageNode(
502 std::vector<std::vector<uint8_t>> &Data, TreeNode *&Result) {
503 bool Added = addDataChild(
Entry.getLanguage(),
Entry.getMajorVersion(),
504 Entry.getMinorVersion(),
Entry.getCharacteristics(),
505 Origin, Data.size(), Result);
507 Data.push_back(
Entry.getData());
511bool WindowsResourceParser::TreeNode::addDataChild(
515 auto NewChild = createDataNode(MajorVersion, MinorVersion,
Characteristics,
517 auto ElementInserted = IDChildren.emplace(
ID, std::move(NewChild));
518 Result = ElementInserted.first->second.get();
519 return ElementInserted.second;
524 auto Child = IDChildren.find(
ID);
525 if (Child == IDChildren.end()) {
526 auto NewChild = createIDNode();
528 IDChildren.emplace(
ID, std::move(NewChild));
531 return *(Child->second);
536 std::string NameString;
539 auto Child = StringChildren.find(NameString);
540 if (Child == StringChildren.end()) {
544 StringChildren.emplace(NameString, std::move(NewChild));
547 return *(Child->second);
553 for (
auto const &Child : StringChildren) {
554 Child.second->print(Writer, Child.first);
556 for (
auto const &Child : IDChildren) {
557 Child.second->print(Writer,
to_string(Child.first));
565 uint32_t Size = (IDChildren.size() + StringChildren.size()) *
578 for (
auto const &Child : StringChildren) {
579 Size += Child.second->getTreeSize();
581 for (
auto const &Child : IDChildren) {
582 Size += Child.second->getTreeSize();
589void WindowsResourceParser::TreeNode::shiftDataIndexDown(
uint32_t Index) {
590 if (IsDataNode && DataIndex >= Index) {
593 for (
auto &Child : IDChildren)
594 Child.second->shiftDataIndexDown(Index);
595 for (
auto &Child : StringChildren)
596 Child.second->shiftDataIndexDown(Index);
607 void performFileLayout();
608 void performSectionOneLayout();
609 void performSectionTwoLayout();
610 void writeCOFFHeader(
uint32_t TimeDateStamp);
611 void writeFirstSectionHeader();
612 void writeSecondSectionHeader();
613 void writeFirstSection();
614 void writeSecondSection();
617 void writeDirectoryTree();
618 void writeDirectoryStringTable();
619 void writeFirstSectionRelocations();
620 std::unique_ptr<WritableMemoryBuffer> OutputBuffer;
634 std::vector<uint32_t> StringTableOffsets;
635 std::vector<uint32_t> DataOffsets;
636 std::vector<uint32_t> RelocationAddresses;
647 FileSize,
"internal .obj file created from .res files");
650void WindowsResourceCOFFWriter::performFileLayout() {
657 performSectionOneLayout();
658 performSectionTwoLayout();
661 SymbolTableOffset = FileSize;
669void WindowsResourceCOFFWriter::performSectionOneLayout() {
670 SectionOneOffset = FileSize;
673 uint32_t CurrentStringOffset = SectionOneSize;
676 StringTableOffsets.push_back(CurrentStringOffset);
678 CurrentStringOffset += StringSize;
679 TotalStringTableSize += StringSize;
684 SectionOneRelocations = FileSize + SectionOneSize;
685 FileSize += SectionOneSize;
691void WindowsResourceCOFFWriter::performSectionTwoLayout() {
694 SectionTwoOffset = FileSize;
696 for (
auto const &Entry : Data) {
697 DataOffsets.push_back(SectionTwoSize);
700 FileSize += SectionTwoSize;
704std::unique_ptr<MemoryBuffer>
706 BufferStart = OutputBuffer->getBufferStart();
708 writeCOFFHeader(TimeDateStamp);
709 writeFirstSectionHeader();
710 writeSecondSectionHeader();
712 writeSecondSection();
716 return std::move(OutputBuffer);
723 "Src is larger than COFF::NameSize");
725 "Dest not zeroed upon initialization");
726 memcpy(Dest, Src.data(), Src.size());
729void WindowsResourceCOFFWriter::writeCOFFHeader(
uint32_t TimeDateStamp) {
732 Header->Machine = MachineType;
733 Header->NumberOfSections = 2;
734 Header->TimeDateStamp = TimeDateStamp;
735 Header->PointerToSymbolTable = SymbolTableOffset;
737 Header->NumberOfSymbols = Data.size() + 5;
738 Header->SizeOfOptionalHeader = 0;
743void WindowsResourceCOFFWriter::writeFirstSectionHeader() {
746 auto *SectionOneHeader =
747 reinterpret_cast<coff_section *
>(BufferStart + CurrentOffset);
749 SectionOneHeader->VirtualSize = 0;
750 SectionOneHeader->VirtualAddress = 0;
751 SectionOneHeader->SizeOfRawData = SectionOneSize;
752 SectionOneHeader->PointerToRawData = SectionOneOffset;
753 SectionOneHeader->PointerToRelocations = SectionOneRelocations;
754 SectionOneHeader->PointerToLinenumbers = 0;
755 SectionOneHeader->NumberOfRelocations = Data.size();
756 SectionOneHeader->NumberOfLinenumbers = 0;
761void WindowsResourceCOFFWriter::writeSecondSectionHeader() {
764 auto *SectionTwoHeader =
765 reinterpret_cast<coff_section *
>(BufferStart + CurrentOffset);
767 SectionTwoHeader->VirtualSize = 0;
768 SectionTwoHeader->VirtualAddress = 0;
769 SectionTwoHeader->SizeOfRawData = SectionTwoSize;
770 SectionTwoHeader->PointerToRawData = SectionTwoOffset;
771 SectionTwoHeader->PointerToRelocations = 0;
772 SectionTwoHeader->PointerToLinenumbers = 0;
773 SectionTwoHeader->NumberOfRelocations = 0;
774 SectionTwoHeader->NumberOfLinenumbers = 0;
779void WindowsResourceCOFFWriter::writeFirstSection() {
783 writeDirectoryTree();
784 writeDirectoryStringTable();
785 writeFirstSectionRelocations();
790void WindowsResourceCOFFWriter::writeSecondSection() {
792 for (
auto const &RawDataEntry : Data) {
793 llvm::copy(RawDataEntry, BufferStart + CurrentOffset);
800void WindowsResourceCOFFWriter::writeSymbolTable() {
806 Symbol->SectionNumber = 0xffff;
809 Symbol->NumberOfAuxSymbols = 0;
816 Symbol->SectionNumber = 1;
819 Symbol->NumberOfAuxSymbols = 1;
823 Aux->
Length = SectionOneSize;
824 Aux->NumberOfRelocations = Data.size();
825 Aux->NumberOfLinenumbers = 0;
827 Aux->NumberLowPart = 0;
835 Symbol->SectionNumber = 2;
838 Symbol->NumberOfAuxSymbols = 1;
842 Aux->
Length = SectionTwoSize;
843 Aux->NumberOfRelocations = 0;
844 Aux->NumberOfLinenumbers = 0;
846 Aux->NumberLowPart = 0;
851 for (
unsigned i = 0; i < Data.size(); i++) {
855 Symbol->Value = DataOffsets[i];
856 Symbol->SectionNumber = 2;
859 Symbol->NumberOfAuxSymbols = 0;
864void WindowsResourceCOFFWriter::writeStringTable() {
866 auto COFFStringTable =
reinterpret_cast<void *
>(BufferStart + CurrentOffset);
867 memset(COFFStringTable, 0, 4);
870void WindowsResourceCOFFWriter::writeDirectoryTree() {
873 std::queue<const WindowsResourceParser::TreeNode *>
Queue;
874 Queue.push(&Resources);
879 std::vector<const WindowsResourceParser::TreeNode *> DataEntriesTreeOrder;
882 while (!
Queue.empty()) {
883 auto CurrentNode =
Queue.front();
891 auto &IDChildren = CurrentNode->getIDChildren();
892 auto &StringChildren = CurrentNode->getStringChildren();
899 for (
auto const &Child : StringChildren) {
902 Entry->Identifier.setNameOffset(
903 StringTableOffsets[Child.second->getStringIndex()]);
904 if (Child.second->checkIsDataNode()) {
905 Entry->Offset.DataEntryOffset = NextLevelOffset;
907 DataEntriesTreeOrder.push_back(Child.second.get());
909 Entry->Offset.SubdirOffset = NextLevelOffset + (1 << 31);
911 (Child.second->getStringChildren().size() +
912 Child.second->getIDChildren().size()) *
914 Queue.push(Child.second.get());
919 for (
auto const &Child : IDChildren) {
922 Entry->Identifier.ID = Child.first;
923 if (Child.second->checkIsDataNode()) {
924 Entry->Offset.DataEntryOffset = NextLevelOffset;
926 DataEntriesTreeOrder.push_back(Child.second.get());
928 Entry->Offset.SubdirOffset = NextLevelOffset + (1 << 31);
930 (Child.second->getStringChildren().size() +
931 Child.second->getIDChildren().size()) *
933 Queue.push(Child.second.get());
940 RelocationAddresses.resize(Data.size());
942 for (
const auto *DataNodes : DataEntriesTreeOrder) {
945 RelocationAddresses[DataNodes->getDataIndex()] = CurrentRelativeOffset;
947 Entry->DataSize = Data[DataNodes->getDataIndex()].size();
955void WindowsResourceCOFFWriter::writeDirectoryStringTable() {
962 auto *Start =
reinterpret_cast<UTF16 *
>(BufferStart + CurrentOffset);
968 alignTo(TotalStringTableSize,
sizeof(
uint32_t)) - TotalStringTableSize;
971void WindowsResourceCOFFWriter::writeFirstSectionRelocations() {
977 for (
unsigned i = 0; i < Data.size(); i++) {
981 Reloc->SymbolTableIndex = NextSymbolIndex++;
1010 return Writer.
write(TimeDateStamp);
static void writeSymbolTable(raw_ostream &Out, object::Archive::Kind Kind, bool Deterministic, ArrayRef< MemberData > Members, StringRef StringTable, uint64_t MembersOffset, unsigned NumSyms, uint64_t PrevMemberOffset=0, uint64_t NextMemberOffset=0, bool Is64Bit=false)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define RETURN_IF_ERROR(Expr)
COFFYAML::WeakExternalCharacteristics Characteristics
static Expected< StringRef > getFileName(const DebugStringTableSubsectionRef &Strings, const DebugChecksumsSubsectionRef &Checksums, uint32_t FileID)
#define UNI_UTF16_BYTE_ORDER_MARK_SWAPPED
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
#define UNWRAP_OR_RETURN(Name, Expr)
#define UNWRAP_REF_OR_RETURN(Name, Expr)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
Provides read only access to a subclass of BinaryStream.
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
Error readWideString(ArrayRef< UTF16 > &Dest)
Similar to readCString, however read a null-terminated UTF16 string instead.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t bytesRemaining() const
uint64_t getOffset() const
Error padToAlignment(uint32_t Align)
void setOffset(uint64_t Off)
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
A table of densely packed, null-terminated strings indexed by offset.
constexpr size_t size() const
Returns the byte size of the table.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
TypeID
Definitions of all of the base types for the Type system.
static std::unique_ptr< WritableMemoryBuffer > getNewMemBuffer(size_t Size, const Twine &BufferName="")
Allocate a new zero-initialized MemoryBuffer of the specified size.
StringRef getFileName() const
Error moveNext(bool &End)
Expected< const coff_resource_dir_table & > getBaseTable()
Expected< const coff_resource_dir_table & > getEntrySubDir(const coff_resource_dir_entry &Entry)
Expected< const coff_resource_data_entry & > getEntryData(const coff_resource_dir_entry &Entry)
Expected< ArrayRef< UTF16 > > getEntryNameString(const coff_resource_dir_entry &Entry)
Expected< StringRef > getContents(const coff_resource_data_entry &Entry)
Expected< const coff_resource_dir_entry & > getTableEntry(const coff_resource_dir_table &Table, uint32_t Index)
WindowsResourceCOFFWriter(COFF::MachineTypes MachineType, const WindowsResourceParser &Parser, Error &E)
std::unique_ptr< MemoryBuffer > write(uint32_t TimeDateStamp)
const Children< std::string > & getStringChildren() const
uint32_t getTreeSize() const
const Children< uint32_t > & getIDChildren() const
void print(ScopedPrinter &Writer, StringRef Name) const
void cleanUpManifests(std::vector< std::string > &Duplicates)
const TreeNode & getTree() const
void printTree(raw_ostream &OS) const
ArrayRef< std::vector< uint8_t > > getData() const
WindowsResourceParser(bool MinGW=false)
ArrayRef< std::vector< UTF16 > > getStringTable() const
Error parse(WindowsResource *WR, std::vector< std::string > &Duplicates)
Expected< ResourceEntryRef > getHeadEntry()
static Expected< std::unique_ptr< WindowsResource > > createWindowsResource(MemoryBufferRef Source)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ IMAGE_SCN_CNT_INITIALIZED_DATA
@ IMAGE_REL_ARM64_ADDR32NB
@ IMAGE_REL_AMD64_ADDR32NB
@ IMAGE_SYM_CLASS_STATIC
Static.
@ IMAGE_FILE_32BIT_MACHINE
Machine is based on a 32bit word architecture.
@ IMAGE_SYM_DTYPE_NULL
No complex type; simple scalar variable.
const uint32_t MIN_HEADER_SIZE
static void printStringOrID(const WindowsResourceParser::StringOrID &S, raw_string_ostream &OS, bool IsType, bool IsID)
Expected< std::unique_ptr< MemoryBuffer > > writeWindowsResourceCOFF(llvm::COFF::MachineTypes MachineType, const WindowsResourceParser &Parser, uint32_t TimeDateStamp)
const size_t WIN_RES_NULL_ENTRY_SIZE
const uint32_t WIN_RES_DATA_ALIGNMENT
void printResourceTypeName(uint16_t TypeID, raw_ostream &OS)
const uint32_t WIN_RES_HEADER_ALIGNMENT
static std::string makeDuplicateResourceError(const ResourceEntryRef &Entry, StringRef File1, StringRef File2)
static void coffnamecpy(char(&Dest)[COFF::NameSize], StringRef Src)
const size_t WIN_RES_MAGIC_SIZE
static Error readStringOrId(BinaryStreamReader &Reader, uint16_t &ID, ArrayRef< UTF16 > &Str, bool &IsString)
static bool convertUTF16LEToUTF8String(ArrayRef< UTF16 > Src, std::string &Out)
coff_symbol< support::ulittle16_t > coff_symbol16
static void writeStringTable(std::vector< uint8_t > &B, ArrayRef< const std::string_view > Strings)
const uint32_t SECTION_ALIGNMENT
void write16le(void *P, uint16_t V)
constexpr bool IsBigEndianHost
This is an optimization pass for GlobalISel generic memory operations.
std::string to_string(const T &Value)
Triple::ArchType getMachineArchType(T machine)
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
Error write(MCStreamer &Out, ArrayRef< std::string > Inputs, OnCuIndexOverflow OverflowOptValue)
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
@ Ref
The access may reference the value stored in memory.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
OutputIt copy(R &&Range, OutputIt Out)
void consumeError(Error Err)
Consume a Error without doing anything.
support::ulittle32_t Length
support::ulittle32_t VirtualAddress
support::ulittle16_t NumberOfNameEntries
support::ulittle32_t Characteristics
support::ulittle16_t NumberOfIDEntries
support::ulittle32_t TimeDateStamp
support::ulittle16_t MinorVersion
support::ulittle16_t MajorVersion