31 #include <system_error> 33 #define DEBUG_TYPE "wasm-object" 51 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 58 auto ObjectFile = llvm::make_unique<WasmObjectFile>(Buffer, Err);
60 return std::move(Err);
65 #define VARINT7_MAX ((1<<7)-1) 66 #define VARINT7_MIN (-(1<<7)) 67 #define VARUINT7_MAX (1<<7) 68 #define VARUINT1_MAX (1) 70 static uint8_t
readUint8(WasmObjectFile::ReadContext &Ctx) {
71 if (Ctx.Ptr == Ctx.End)
77 if (Ctx.Ptr + 4 > Ctx.End)
84 static int32_t
readFloat32(WasmObjectFile::ReadContext &Ctx) {
86 memcpy(&Result, Ctx.Ptr,
sizeof(Result));
87 Ctx.Ptr +=
sizeof(Result);
91 static int64_t
readFloat64(WasmObjectFile::ReadContext &Ctx) {
93 memcpy(&Result, Ctx.Ptr,
sizeof(Result));
94 Ctx.Ptr +=
sizeof(Result);
98 static uint64_t
readULEB128(WasmObjectFile::ReadContext &Ctx) {
100 const char*
Error =
nullptr;
110 if (Ctx.Ptr + StringLen > Ctx.End)
113 StringRef(reinterpret_cast<const char *>(Ctx.Ptr), StringLen);
114 Ctx.Ptr += StringLen;
118 static int64_t
readLEB128(WasmObjectFile::ReadContext &Ctx) {
120 const char*
Error =
nullptr;
137 if (result > INT32_MAX || result < INT32_MIN)
144 if (result > UINT32_MAX)
153 static uint8_t
readOpcode(WasmObjectFile::ReadContext &Ctx) {
158 WasmObjectFile::ReadContext &Ctx) {
178 return make_error<GenericBinaryError>(
"Invalid opcode in init_expr",
184 return make_error<GenericBinaryError>(
"Invalid init_expr",
207 WasmObjectFile::ReadContext &Ctx) {
208 Section.Offset = Ctx.Ptr - Ctx.Start;
210 LLVM_DEBUG(
dbgs() <<
"readSection type=" << Section.Type <<
"\n");
213 return make_error<StringError>(
"Zero length section",
215 if (Ctx.Ptr + Size > Ctx.End)
216 return make_error<StringError>(
"Section too large",
219 const uint8_t *NameStart = Ctx.Ptr;
221 Size -= Ctx.Ptr - NameStart;
233 Err = make_error<StringError>(
"Bad magic number",
239 Ctx.
Start = getPtr(0);
243 if (Ctx.
Ptr + 4 > Ctx.
End) {
244 Err = make_error<StringError>(
"Missing version number",
251 Err = make_error<StringError>(
"Bad version number",
257 while (Ctx.
Ptr < Ctx.
End) {
260 if ((Err = parseSection(Sec)))
263 Sections.push_back(Sec);
274 return parseCustomSection(Sec, Ctx);
276 return parseTypeSection(Ctx);
278 return parseImportSection(Ctx);
280 return parseFunctionSection(Ctx);
282 return parseTableSection(Ctx);
284 return parseMemorySection(Ctx);
286 return parseGlobalSection(Ctx);
288 return parseExportSection(Ctx);
290 return parseStartSection(Ctx);
292 return parseElemSection(Ctx);
294 return parseCodeSection(Ctx);
296 return parseDataSection(Ctx);
298 return make_error<GenericBinaryError>(
"Bad section type",
305 if (Functions.size() != FunctionTypes.size()) {
306 return make_error<GenericBinaryError>(
"Names must come after code section",
310 while (Ctx.
Ptr < Ctx.
End) {
313 const uint8_t *SubSectionEnd = Ctx.
Ptr +
Size;
319 if (!Seen.
insert(Index).second)
320 return make_error<GenericBinaryError>(
"Function named more than once",
323 if (!isValidFunctionIndex(Index) || Name.
empty())
324 return make_error<GenericBinaryError>(
"Invalid name entry",
327 if (isDefinedFunctionIndex(Index))
338 if (Ctx.
Ptr != SubSectionEnd)
339 return make_error<GenericBinaryError>(
"Name sub-section ended prematurely",
344 return make_error<GenericBinaryError>(
"Name section ended prematurely",
350 HasLinkingSection =
true;
351 if (Functions.size() != FunctionTypes.size()) {
352 return make_error<GenericBinaryError>(
358 return make_error<GenericBinaryError>(
359 "Unexpected metadata version: " +
Twine(LinkingData.
Version) +
364 const uint8_t *OrigEnd = Ctx.
End;
365 while (Ctx.
Ptr < OrigEnd) {
369 LLVM_DEBUG(
dbgs() <<
"readSubsection type=" <<
int(Type) <<
" size=" << Size
374 if (
Error Err = parseLinkingSectionSymtab(Ctx))
379 if (Count > DataSegments.size())
380 return make_error<GenericBinaryError>(
"Too many segment names",
382 for (
uint32_t i = 0; i < Count; i++) {
392 for (
uint32_t i = 0; i < Count; i++) {
396 if (!isValidFunctionSymbol(Init.
Symbol))
397 return make_error<GenericBinaryError>(
"Invalid function symbol: " +
405 if (
Error Err = parseLinkingSectionComdat(Ctx))
413 return make_error<GenericBinaryError>(
416 if (Ctx.
Ptr != OrigEnd)
417 return make_error<GenericBinaryError>(
"Linking section ended prematurely",
425 Symbols.reserve(Count);
428 std::vector<wasm::WasmImport *> ImportedGlobals;
429 std::vector<wasm::WasmImport *> ImportedFunctions;
430 ImportedGlobals.reserve(Imports.size());
431 ImportedFunctions.reserve(Imports.size());
432 for (
auto &
I : Imports) {
434 ImportedFunctions.emplace_back(&
I);
436 ImportedGlobals.emplace_back(&
I);
453 return make_error<GenericBinaryError>(
"invalid function symbol index",
457 unsigned FuncIndex = Info.
ElementIndex - NumImportedFunctions;
458 FunctionType = &Signatures[FunctionTypes[FuncIndex]];
464 FunctionType = &Signatures[Import.
SigIndex];
474 return make_error<GenericBinaryError>(
"invalid global symbol index",
479 return make_error<GenericBinaryError>(
"undefined weak global symbol",
483 unsigned GlobalIndex = Info.
ElementIndex - NumImportedGlobals;
485 GlobalType = &Global.
Type;
491 GlobalType = &Import.
Global;
499 if (Index >= DataSegments.size())
500 return make_error<GenericBinaryError>(
"invalid data symbol index",
504 if (Offset + Size > DataSegments[Index].
Data.Content.size())
505 return make_error<GenericBinaryError>(
"invalid data symbol offset",
514 return make_error<GenericBinaryError>(
515 "Section symbols must have local binding",
525 return make_error<GenericBinaryError>(
"Invalid symbol type",
532 return make_error<GenericBinaryError>(
"Duplicate symbol name " +
536 Symbols.emplace_back(LinkingData.
SymbolTable.back(), FunctionType,
538 LLVM_DEBUG(
dbgs() <<
"Adding symbol: " << Symbols.back() <<
"\n");
547 for (
unsigned ComdatIndex = 0; ComdatIndex < ComdatCount; ++ComdatIndex) {
549 if (Name.
empty() || !ComdatSet.
insert(Name).second)
550 return make_error<GenericBinaryError>(
"Bad/duplicate COMDAT name " +
Twine(Name),
552 LinkingData.
Comdats.emplace_back(Name);
555 return make_error<GenericBinaryError>(
"Unsupported COMDAT flags",
559 while (EntryCount--) {
564 return make_error<GenericBinaryError>(
"Invalid COMDAT entry type",
567 if (Index >= DataSegments.size())
568 return make_error<GenericBinaryError>(
"COMDAT data index out of range",
570 if (DataSegments[Index].
Data.Comdat != UINT32_MAX)
571 return make_error<GenericBinaryError>(
"Data segment in two COMDATs",
573 DataSegments[
Index].Data.Comdat = ComdatIndex;
576 if (!isDefinedFunctionIndex(Index))
577 return make_error<GenericBinaryError>(
"COMDAT function index out of range",
579 if (getDefinedFunction(Index).
Comdat != UINT32_MAX)
580 return make_error<GenericBinaryError>(
"Function in two COMDATs",
582 getDefinedFunction(Index).
Comdat = ComdatIndex;
592 if (SectionIndex >= Sections.size())
593 return make_error<GenericBinaryError>(
"Invalid section index",
598 while (RelocCount--) {
603 switch (Reloc.
Type) {
604 case wasm::R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
605 case wasm::R_WEBASSEMBLY_TABLE_INDEX_SLEB:
606 case wasm::R_WEBASSEMBLY_TABLE_INDEX_I32:
607 if (!isValidFunctionSymbol(Reloc.
Index))
608 return make_error<GenericBinaryError>(
"Bad relocation function index",
611 case wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB:
612 if (Reloc.
Index >= Signatures.size())
613 return make_error<GenericBinaryError>(
"Bad relocation type index",
616 case wasm::R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
617 if (!isValidGlobalSymbol(Reloc.
Index))
618 return make_error<GenericBinaryError>(
"Bad relocation global index",
621 case wasm::R_WEBASSEMBLY_MEMORY_ADDR_LEB:
622 case wasm::R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
623 case wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32:
624 if (!isValidDataSymbol(Reloc.
Index))
625 return make_error<GenericBinaryError>(
"Bad relocation data index",
629 case wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32:
630 if (!isValidFunctionSymbol(Reloc.
Index))
631 return make_error<GenericBinaryError>(
"Bad relocation function index",
635 case wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32:
636 if (!isValidSectionSymbol(Reloc.
Index))
637 return make_error<GenericBinaryError>(
"Bad relocation section index",
642 return make_error<GenericBinaryError>(
"Bad relocation type: " +
651 if (Reloc.
Type == wasm::R_WEBASSEMBLY_TABLE_INDEX_I32 ||
652 Reloc.
Type == wasm::R_WEBASSEMBLY_MEMORY_ADDR_I32 ||
653 Reloc.
Type == wasm::R_WEBASSEMBLY_SECTION_OFFSET_I32 ||
654 Reloc.
Type == wasm::R_WEBASSEMBLY_FUNCTION_OFFSET_I32)
656 if (Reloc.
Offset + Size > EndOffset)
657 return make_error<GenericBinaryError>(
"Bad relocation offset",
663 return make_error<GenericBinaryError>(
"Reloc section ended prematurely",
669 if (Sec.
Name ==
"name") {
670 if (
Error Err = parseNameSection(Ctx))
672 }
else if (Sec.
Name ==
"linking") {
673 if (
Error Err = parseLinkingSection(Ctx))
676 if (
Error Err = parseRelocSection(Sec.
Name, Ctx))
684 Signatures.reserve(Count);
690 return make_error<GenericBinaryError>(
"Invalid signature type",
695 while (ParamCount--) {
701 if (ReturnCount != 1) {
702 return make_error<GenericBinaryError>(
707 Signatures.push_back(Sig);
710 return make_error<GenericBinaryError>(
"Type section ended prematurely",
717 Imports.reserve(Count);
718 for (
uint32_t i = 0; i < Count; i++) {
725 NumImportedFunctions++;
729 NumImportedGlobals++;
739 return make_error<GenericBinaryError>(
"Invalid table element type",
743 return make_error<GenericBinaryError>(
746 Imports.push_back(Im);
749 return make_error<GenericBinaryError>(
"Import section ended prematurely",
756 FunctionTypes.reserve(Count);
757 uint32_t NumTypes = Signatures.size();
760 if (Type >= NumTypes)
761 return make_error<GenericBinaryError>(
"Invalid function type",
763 FunctionTypes.push_back(Type);
766 return make_error<GenericBinaryError>(
"Function section ended prematurely",
773 Tables.reserve(Count);
777 return make_error<GenericBinaryError>(
"Invalid table element type",
782 return make_error<GenericBinaryError>(
"Table section ended prematurely",
789 Memories.reserve(Count);
794 return make_error<GenericBinaryError>(
"Memory section ended prematurely",
800 GlobalSection = Sections.size();
802 Globals.reserve(Count);
805 Global.
Index = NumImportedGlobals + Globals.size();
810 Globals.push_back(Global);
813 return make_error<GenericBinaryError>(
"Global section ended prematurely",
820 Exports.reserve(Count);
821 for (
uint32_t i = 0; i < Count; i++) {
828 if (!isValidFunctionIndex(Ex.
Index))
829 return make_error<GenericBinaryError>(
"Invalid function export",
833 if (!isValidGlobalIndex(Ex.
Index))
834 return make_error<GenericBinaryError>(
"Invalid global export",
841 return make_error<GenericBinaryError>(
844 Exports.push_back(Ex);
847 return make_error<GenericBinaryError>(
"Export section ended prematurely",
852 bool WasmObjectFile::isValidFunctionIndex(
uint32_t Index)
const {
853 return Index < NumImportedFunctions + FunctionTypes.size();
856 bool WasmObjectFile::isDefinedFunctionIndex(
uint32_t Index)
const {
857 return Index >= NumImportedFunctions && isValidFunctionIndex(Index);
860 bool WasmObjectFile::isValidGlobalIndex(
uint32_t Index)
const {
861 return Index < NumImportedGlobals + Globals.size();
864 bool WasmObjectFile::isDefinedGlobalIndex(
uint32_t Index)
const {
865 return Index >= NumImportedGlobals && isValidGlobalIndex(Index);
868 bool WasmObjectFile::isValidFunctionSymbol(
uint32_t Index)
const {
869 return Index < Symbols.size() && Symbols[
Index].isTypeFunction();
872 bool WasmObjectFile::isValidGlobalSymbol(
uint32_t Index)
const {
873 return Index < Symbols.size() && Symbols[
Index].isTypeGlobal();
876 bool WasmObjectFile::isValidDataSymbol(
uint32_t Index)
const {
877 return Index < Symbols.size() && Symbols[
Index].isTypeData();
880 bool WasmObjectFile::isValidSectionSymbol(
uint32_t Index)
const {
881 return Index < Symbols.size() && Symbols[
Index].isTypeSection();
885 assert(isDefinedFunctionIndex(Index));
886 return Functions[Index - NumImportedFunctions];
890 assert(isDefinedGlobalIndex(Index));
891 return Globals[Index - NumImportedGlobals];
896 if (!isValidFunctionIndex(StartFunction))
897 return make_error<GenericBinaryError>(
"Invalid start function",
903 CodeSection = Sections.size();
905 if (FunctionCount != FunctionTypes.size()) {
906 return make_error<GenericBinaryError>(
"Invalid function count",
910 while (FunctionCount--) {
912 const uint8_t *FunctionStart = Ctx.
Ptr;
914 const uint8_t *FunctionEnd = Ctx.
Ptr +
Size;
917 Function.
Index = NumImportedFunctions + Functions.size();
919 Function.
Size = FunctionEnd - FunctionStart;
922 Function.
Locals.reserve(NumLocalDecls);
923 while (NumLocalDecls--) {
927 Function.
Locals.push_back(Decl);
933 Function.
Comdat = UINT32_MAX;
936 Functions.push_back(Function);
939 return make_error<GenericBinaryError>(
"Code section ended prematurely",
946 ElemSegments.reserve(Count);
951 return make_error<GenericBinaryError>(
"Invalid TableIndex",
960 ElemSegments.push_back(Segment);
963 return make_error<GenericBinaryError>(
"Elem section ended prematurely",
969 DataSection = Sections.size();
971 DataSegments.reserve(Count);
978 if (Size > (
size_t)(Ctx.
End - Ctx.
Ptr))
979 return make_error<GenericBinaryError>(
"Invalid segment size",
989 DataSegments.push_back(Segment);
992 return make_error<GenericBinaryError>(
"Data section ended prematurely",
997 const uint8_t *WasmObjectFile::getPtr(
size_t Offset)
const {
1011 LLVM_DEBUG(
dbgs() <<
"getSymbolFlags: ptr=" << &Sym <<
" " << Sym <<
"\n");
1033 Ref.
d.
a = Symbols.size();
1038 return Symbols[Symb.
d.
a];
1114 Ref.
d.
a = CodeSection;
1117 Ref.
d.
a = GlobalSection;
1120 Ref.
d.
a = DataSection;
1138 case wasm::WASM_SEC_##X: \ 1160 return std::error_code();
1181 return std::error_code();
1208 RelocRef.
d.
a = Ref.
d.
a;
1216 RelocRef.
d.
a = Ref.
d.
a;
1232 if (Rel.
Type == wasm::R_WEBASSEMBLY_TYPE_INDEX_LEB)
1250 #define WASM_RELOC(name, value) \ 1256 #include "llvm/BinaryFormat/WasmRelocs.def" 1272 Ref.
d.
a = Sections.size();
1287 return HasLinkingSection;
1292 return Sections[Ref.
d.
a];
1309 assert(Ref.
d.
b < Sec.Relocations.size());
1310 return Sec.Relocations[Ref.
d.
b];
bool isSectionText(DataRefImpl Sec) const override
uint64_t getRelocationType(DataRefImpl Rel) const override
static int64_t readFloat64(WasmObjectFile::ReadContext &Ctx)
std::vector< WasmInitFunc > InitFunctions
uint64_t getSectionAddress(DataRefImpl Sec) const override
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
StringRef getFileFormatName() const override
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Compute iterated dominance frontiers using a linear time algorithm.
uint64_t getSectionSize(DataRefImpl Sec) const override
static Error readInitExpr(wasm::WasmInitExpr &Expr, WasmObjectFile::ReadContext &Ctx)
section_iterator section_begin() const override
const unsigned WASM_SYMBOL_BINDING_LOCAL
const WasmSymbol & getWasmSymbol(const DataRefImpl &Symb) const
Implements a dense probed hash-table based set.
static Error readSection(WasmSection &Section, WasmObjectFile::ReadContext &Ctx)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
const uint32_t WasmMetadataVersion
This class is the base class for all object file types.
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
std::error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const override
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
std::vector< StringRef > Comdats
std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const override
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
static uint8_t readOpcode(WasmObjectFile::ReadContext &Ctx)
static int64_t readVarint64(WasmObjectFile::ReadContext &Ctx)
const unsigned WASM_SYMBOL_UNDEFINED
std::vector< wasm::WasmRelocation > Relocations
std::string toString(Error E)
Write all error messages (if any) in E to a string.
uint64_t getRelocationOffset(DataRefImpl Rel) const override
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
DataRefImpl getRawDataRefImpl() const
int64_t decodeSLEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a SLEB128 value.
This is a value type class that represents a single relocation in the list of relocations in the obje...
The access may reference the value stored in memory.
Tagged union holding either a T or a Error.
const uint32_t WasmVersion
ArrayRef< uint8_t > Content
static uint64_t readULEB128(WasmObjectFile::ReadContext &Ctx)
content_iterator< SectionRef > section_iterator
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Class to represent function types.
wasm::WasmDataSegment Data
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
bool isSectionBitcode(DataRefImpl Sec) const override
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
Triple::ArchType getArch() const override
uint64_t getSectionIndex(DataRefImpl Sec) const override
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
void moveSectionNext(DataRefImpl &Sec) const override
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
std::vector< uint32_t > Functions
static uint32_t readVaruint32(WasmObjectFile::ReadContext &Ctx)
bool isBindingLocal() const
static int32_t readFloat32(WasmObjectFile::ReadContext &Ctx)
Import information from summary.
LLVM_DUMP_METHOD void dump() const
ArrayRef< uint8_t > Content
The instances of the Type class are immutable: once they are created, they are never changed...
uint64_t getWasmSymbolValue(const WasmSymbol &Sym) const
size_t size() const
size - Get the array size.
static uint32_t readUint32(WasmObjectFile::ReadContext &Ctx)
std::pair< iterator, bool > insert(const ValueT &V)
section_iterator section_end() const override
const unsigned WASM_SYMBOL_BINDING_WEAK
uint32_t CodeSectionOffset
uint64_t decodeULEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a ULEB128 value.
const wasm::WasmRelocation & getWasmRelocation(const RelocationRef &Ref) const
uint64_t getSectionAlignment(DataRefImpl Sec) const override
bool isSectionBSS(DataRefImpl Sec) const override
DataRefImpl getRawDataRefImpl() const
bool isSectionData(DataRefImpl Sec) const override
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::pair< typename base::iterator, bool > insert(StringRef Key)
basic_symbol_iterator symbol_begin() const override
static Expected< std::unique_ptr< WasmObjectFile > > createWasmObjectFile(MemoryBufferRef Object)
SubtargetFeatures getFeatures() const override
bool isSectionCompressed(DataRefImpl Sec) const override
static ErrorSuccess success()
Create a success value.
static uint8_t readVaruint1(WasmObjectFile::ReadContext &Ctx)
friend class RelocationRef
std::vector< uint8_t > ParamTypes
void moveSymbolNext(DataRefImpl &Symb) const override
uint64_t getSymbolValue(DataRefImpl Symb) const
const wasm::WasmSymbolInfo & Info
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
static uint8_t readUint8(WasmObjectFile::ReadContext &Ctx)
bool isTypeFunction() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static StringRef readString(WasmObjectFile::ReadContext &Ctx)
Manages the enabling and disabling of subtarget specific features.
const wasm::WasmObjectHeader & getHeader() const
static int32_t readVarint32(WasmObjectFile::ReadContext &Ctx)
Helper for Errors used as out-parameters.
This is a value type class that represents a single symbol in the list of symbols in the object file...
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
static int64_t readLEB128(WasmObjectFile::ReadContext &Ctx)
union llvm::wasm::WasmInitExpr::@135 Value
const unsigned WASM_SYMBOL_BINDING_MASK
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
void moveRelocationNext(DataRefImpl &Rel) const override
uint32_t read32le(const void *P)
This is a value type class that represents a single symbol in the list of symbols in the object file...
static wasm::WasmLimits readLimits(WasmObjectFile::ReadContext &Ctx)
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static wasm::WasmTable readTable(WasmObjectFile::ReadContext &Ctx)
WasmDataReference DataRef
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
Lightweight error class with error context and mandatory checking.
content_iterator< RelocationRef > relocation_iterator
StringSet - A wrapper for StringMap that provides set-like functionality.
This class implements an extremely fast bulk output stream that can only output to a stream...
const WasmSection & getWasmSection(const SectionRef &Section) const
struct llvm::object::DataRefImpl::@261 d
StringRef - Represent a constant reference to a string, i.e.
bool isSectionVirtual(DataRefImpl Sec) const override
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
uint32_t getSymbolFlags(DataRefImpl Symb) const override
std::vector< WasmSymbolInfo > SymbolTable
std::vector< WasmLocalDecl > Locals
bool isBindingWeak() const
StringRef getData() const
relocation_iterator section_rel_end(DataRefImpl Sec) const override
DataRefImpl getRawDataRefImpl() const
This is a value type class that represents a single section in the list of sections in the object fil...
WasmObjectFile(MemoryBufferRef Object, Error &Err)
void print(raw_ostream &Out) const
basic_symbol_iterator symbol_end() const override