17 #ifndef LLVM_OBJECT_WASM_H
18 #define LLVM_OBJECT_WASM_H
47 : Name(Name), Type(Type), Section(Section), ElementIndex(ElementIndex) {}
63 Out <<
"Name=" <<
Name <<
", Type=" <<
static_cast<int>(
Type)
67 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
100 const std::vector<wasm::WasmSignature>&
types()
const {
return Signatures; }
101 const std::vector<uint32_t>&
functionTypes()
const {
return FunctionTypes; }
102 const std::vector<wasm::WasmImport>&
imports()
const {
return Imports; }
103 const std::vector<wasm::WasmTable>&
tables()
const {
return Tables; }
104 const std::vector<wasm::WasmLimits>&
memories()
const {
return Memories; }
105 const std::vector<wasm::WasmGlobal>&
globals()
const {
return Globals; }
106 const std::vector<wasm::WasmExport>&
exports()
const {
return Exports; }
110 return Symbols.size();
113 const std::vector<wasm::WasmElemSegment>&
elements()
const {
121 const std::vector<wasm::WasmFunction>&
functions()
const {
return Functions; }
172 unsigned getArch()
const override;
183 const uint8_t *getPtr(
size_t Offset)
const;
189 Error parseTypeSection(
const uint8_t *
Ptr,
const uint8_t *
End);
190 Error parseImportSection(
const uint8_t *
Ptr,
const uint8_t *
End);
191 Error parseFunctionSection(
const uint8_t *
Ptr,
const uint8_t *
End);
192 Error parseTableSection(
const uint8_t *
Ptr,
const uint8_t *
End);
193 Error parseMemorySection(
const uint8_t *
Ptr,
const uint8_t *
End);
194 Error parseGlobalSection(
const uint8_t *
Ptr,
const uint8_t *
End);
195 Error parseExportSection(
const uint8_t *
Ptr,
const uint8_t *
End);
196 Error parseStartSection(
const uint8_t *
Ptr,
const uint8_t *
End);
197 Error parseElemSection(
const uint8_t *
Ptr,
const uint8_t *
End);
198 Error parseCodeSection(
const uint8_t *
Ptr,
const uint8_t *
End);
199 Error parseDataSection(
const uint8_t *
Ptr,
const uint8_t *
End);
202 Error parseNameSection(
const uint8_t *
Ptr,
const uint8_t *
End);
203 Error parseLinkingSection(
const uint8_t *
Ptr,
const uint8_t *
End);
208 std::vector<WasmSection> Sections;
209 std::vector<wasm::WasmSignature> Signatures;
210 std::vector<uint32_t> FunctionTypes;
211 std::vector<wasm::WasmTable> Tables;
212 std::vector<wasm::WasmLimits> Memories;
213 std::vector<wasm::WasmGlobal> Globals;
214 std::vector<wasm::WasmImport> Imports;
215 std::vector<wasm::WasmExport> Exports;
216 std::vector<wasm::WasmElemSegment> ElemSegments;
217 std::vector<WasmSegment> DataSegments;
218 std::vector<wasm::WasmFunction> Functions;
219 std::vector<WasmSymbol> Symbols;
222 bool HasLinkingSection =
false;
238 #endif // LLVM_OBJECT_WASM_H
const std::vector< wasm::WasmImport > & imports() const
bool isSectionText(DataRefImpl Sec) const override
uint64_t getRelocationType(DataRefImpl Rel) const override
uint64_t getSectionAddress(DataRefImpl Sec) const override
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
const std::vector< wasm::WasmExport > & exports() const
StringRef getFileFormatName() const override
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
uint64_t getSectionSize(DataRefImpl Sec) const override
section_iterator section_begin() const override
const wasm::WasmRelocation & getWasmRelocation(const RelocationRef &Ref) const
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
unsigned getArch() const override
std::error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const override
const std::vector< wasm::WasmTable > & tables() const
std::error_code getSectionName(DataRefImpl Sec, StringRef &Res) const override
const std::vector< uint32_t > & functionTypes() const
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
std::vector< wasm::WasmRelocation > Relocations
uint64_t getRelocationOffset(DataRefImpl Rel) const override
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
const WasmSection & getWasmSection(const SectionRef &Section) const
const ArrayRef< uint8_t > & code() const
This is a value type class that represents a single relocation in the list of relocations in the obje...
Tagged union holding either a T or a Error.
static bool classof(const Binary *v)
const std::vector< wasm::WasmElemSegment > & elements() const
LLVM_DUMP_METHOD void dump() const
wasm::WasmDataSegment Data
WasmSymbol(StringRef Name, SymbolType Type, uint32_t Section, uint32_t ElementIndex)
bool isSectionBitcode(DataRefImpl Sec) const override
const std::vector< WasmSegment > & dataSegments() const
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
uint64_t getSectionIndex(DataRefImpl Sec) const override
void moveSectionNext(DataRefImpl &Sec) const override
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
ArrayRef< uint8_t > Content
The instances of the Type class are immutable: once they are created, they are never changed...
section_iterator section_end() const override
const std::vector< wasm::WasmFunction > & functions() const
const wasm::WasmObjectHeader & getHeader() const
static const unsigned End
uint64_t getSectionAlignment(DataRefImpl Sec) const override
bool isSectionBSS(DataRefImpl Sec) const override
bool isSectionData(DataRefImpl Sec) const override
const std::vector< wasm::WasmSignature > & types() const
basic_symbol_iterator symbol_begin() const override
const wasm::WasmLinkingData & linkingData() const
SubtargetFeatures getFeatures() const override
bool isSectionCompressed(DataRefImpl Sec) const override
const WasmSymbol & getWasmSymbol(const DataRefImpl &Symb) const
void print(raw_ostream &Out) const
void moveSymbolNext(DataRefImpl &Symb) const override
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Manages the enabling and disabling of subtarget specific features.
This is a value type class that represents a single symbol in the list of symbols in the object file...
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
const std::vector< wasm::WasmGlobal > & globals() const
void moveRelocationNext(DataRefImpl &Rel) const override
uint32_t startFunction() const
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
const std::vector< wasm::WasmLimits > & memories() const
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
Lightweight error class with error context and mandatory checking.
This class implements an extremely fast bulk output stream that can only output to a stream...
uint32_t getNumberOfSymbols() const
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
relocation_iterator section_rel_end(DataRefImpl Sec) const override
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)
basic_symbol_iterator symbol_end() const override