LLVM  14.0.0git
Wasm.h
Go to the documentation of this file.
1 //===- Wasm.h - Wasm object file implementation -----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the WasmObjectFile class, which implements the ObjectFile
10 // interface for Wasm files.
11 //
12 // See: https://github.com/WebAssembly/design/blob/main/BinaryEncoding.md
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_OBJECT_WASM_H
17 #define LLVM_OBJECT_WASM_H
18 
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/BinaryFormat/Wasm.h"
22 #include "llvm/Config/llvm-config.h"
23 #include "llvm/MC/MCSymbolWasm.h"
24 #include "llvm/Object/Binary.h"
25 #include "llvm/Object/ObjectFile.h"
26 #include "llvm/Support/Error.h"
28 #include <cstddef>
29 #include <cstdint>
30 #include <vector>
31 
32 namespace llvm {
33 namespace object {
34 
35 class WasmSymbol {
36 public:
43 
48 
49  bool isTypeFunction() const {
51  }
52 
53  bool isTypeTable() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_TABLE; }
54 
55  bool isTypeData() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_DATA; }
56 
57  bool isTypeGlobal() const {
59  }
60 
61  bool isTypeSection() const {
63  }
64 
65  bool isTypeTag() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG; }
66 
67  bool isDefined() const { return !isUndefined(); }
68 
69  bool isUndefined() const {
70  return (Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) != 0;
71  }
72 
73  bool isBindingWeak() const {
75  }
76 
77  bool isBindingGlobal() const {
79  }
80 
81  bool isBindingLocal() const {
83  }
84 
85  unsigned getBinding() const {
87  }
88 
89  bool isHidden() const {
91  }
92 
93  unsigned getVisibility() const {
95  }
96 
97  void print(raw_ostream &Out) const;
98 
99 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
100  LLVM_DUMP_METHOD void dump() const;
101 #endif
102 };
103 
104 struct WasmSection {
105  WasmSection() = default;
106 
107  uint32_t Type = 0; // Section type (See below)
108  uint32_t Offset = 0; // Offset with in the file
109  StringRef Name; // Section name (User-defined sections only)
110  uint32_t Comdat = UINT32_MAX; // From the "comdat info" section
111  ArrayRef<uint8_t> Content; // Section content
112  std::vector<wasm::WasmRelocation> Relocations; // Relocations for this section
113 };
114 
115 struct WasmSegment {
118 };
119 
120 class WasmObjectFile : public ObjectFile {
121 
122 public:
124 
125  const wasm::WasmObjectHeader &getHeader() const;
126  const WasmSymbol &getWasmSymbol(const DataRefImpl &Symb) const;
127  const WasmSymbol &getWasmSymbol(const SymbolRef &Symbol) const;
128  const WasmSection &getWasmSection(const SectionRef &Section) const;
130 
131  static bool classof(const Binary *v) { return v->isWasm(); }
132 
133  const wasm::WasmDylinkInfo &dylinkInfo() const { return DylinkInfo; }
134  const wasm::WasmProducerInfo &getProducerInfo() const { return ProducerInfo; }
136  return TargetFeatures;
137  }
138  ArrayRef<wasm::WasmSignature> types() const { return Signatures; }
139  ArrayRef<wasm::WasmImport> imports() const { return Imports; }
140  ArrayRef<wasm::WasmTable> tables() const { return Tables; }
141  ArrayRef<wasm::WasmLimits> memories() const { return Memories; }
142  ArrayRef<wasm::WasmGlobal> globals() const { return Globals; }
143  ArrayRef<wasm::WasmTag> tags() const { return Tags; }
144  ArrayRef<wasm::WasmExport> exports() const { return Exports; }
145  ArrayRef<WasmSymbol> syms() const { return Symbols; }
146  const wasm::WasmLinkingData &linkingData() const { return LinkingData; }
147  uint32_t getNumberOfSymbols() const { return Symbols.size(); }
148  ArrayRef<wasm::WasmElemSegment> elements() const { return ElemSegments; }
149  ArrayRef<WasmSegment> dataSegments() const { return DataSegments; }
150  ArrayRef<wasm::WasmFunction> functions() const { return Functions; }
151  ArrayRef<wasm::WasmDebugName> debugNames() const { return DebugNames; }
152  uint32_t startFunction() const { return StartFunction; }
153  uint32_t getNumImportedGlobals() const { return NumImportedGlobals; }
154  uint32_t getNumImportedTables() const { return NumImportedTables; }
155  uint32_t getNumImportedFunctions() const { return NumImportedFunctions; }
156  uint32_t getNumImportedTags() const { return NumImportedTags; }
157  uint32_t getNumSections() const { return Sections.size(); }
158  void moveSymbolNext(DataRefImpl &Symb) const override;
159 
160  Expected<uint32_t> getSymbolFlags(DataRefImpl Symb) const override;
161 
162  basic_symbol_iterator symbol_begin() const override;
163 
164  basic_symbol_iterator symbol_end() const override;
165  Expected<StringRef> getSymbolName(DataRefImpl Symb) const override;
166 
167  Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const override;
168  uint64_t getWasmSymbolValue(const WasmSymbol &Sym) const;
169  uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
170  uint32_t getSymbolAlignment(DataRefImpl Symb) const override;
171  uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override;
175 
176  // Overrides from SectionRef.
177  void moveSectionNext(DataRefImpl &Sec) const override;
178  Expected<StringRef> getSectionName(DataRefImpl Sec) const override;
179  uint64_t getSectionAddress(DataRefImpl Sec) const override;
180  uint64_t getSectionIndex(DataRefImpl Sec) const override;
181  uint64_t getSectionSize(DataRefImpl Sec) const override;
183  getSectionContents(DataRefImpl Sec) const override;
184  uint64_t getSectionAlignment(DataRefImpl Sec) const override;
185  bool isSectionCompressed(DataRefImpl Sec) const override;
186  bool isSectionText(DataRefImpl Sec) const override;
187  bool isSectionData(DataRefImpl Sec) const override;
188  bool isSectionBSS(DataRefImpl Sec) const override;
189  bool isSectionVirtual(DataRefImpl Sec) const override;
191  relocation_iterator section_rel_end(DataRefImpl Sec) const override;
192 
193  // Overrides from RelocationRef.
194  void moveRelocationNext(DataRefImpl &Rel) const override;
195  uint64_t getRelocationOffset(DataRefImpl Rel) const override;
196  symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override;
197  uint64_t getRelocationType(DataRefImpl Rel) const override;
199  SmallVectorImpl<char> &Result) const override;
200 
201  section_iterator section_begin() const override;
202  section_iterator section_end() const override;
203  uint8_t getBytesInAddress() const override;
204  StringRef getFileFormatName() const override;
205  Triple::ArchType getArch() const override;
206  SubtargetFeatures getFeatures() const override;
207  bool isRelocatableObject() const override;
208  bool isSharedObject() const;
209 
210  struct ReadContext {
211  const uint8_t *Start;
212  const uint8_t *Ptr;
213  const uint8_t *End;
214  };
215 
216 private:
217  bool isValidFunctionIndex(uint32_t Index) const;
218  bool isDefinedFunctionIndex(uint32_t Index) const;
219  bool isValidGlobalIndex(uint32_t Index) const;
220  bool isValidTableNumber(uint32_t Index) const;
221  bool isDefinedGlobalIndex(uint32_t Index) const;
222  bool isDefinedTableNumber(uint32_t Index) const;
223  bool isValidTagIndex(uint32_t Index) const;
224  bool isDefinedTagIndex(uint32_t Index) const;
225  bool isValidFunctionSymbol(uint32_t Index) const;
226  bool isValidTableSymbol(uint32_t Index) const;
227  bool isValidGlobalSymbol(uint32_t Index) const;
228  bool isValidTagSymbol(uint32_t Index) const;
229  bool isValidDataSymbol(uint32_t Index) const;
230  bool isValidSectionSymbol(uint32_t Index) const;
231  wasm::WasmFunction &getDefinedFunction(uint32_t Index);
232  const wasm::WasmFunction &getDefinedFunction(uint32_t Index) const;
233  wasm::WasmGlobal &getDefinedGlobal(uint32_t Index);
234  wasm::WasmTag &getDefinedTag(uint32_t Index);
235 
236  const WasmSection &getWasmSection(DataRefImpl Ref) const;
238  uint32_t getSymbolSectionIdImpl(const WasmSymbol &Symb) const;
239 
240  Error parseSection(WasmSection &Sec);
241  Error parseCustomSection(WasmSection &Sec, ReadContext &Ctx);
242 
243  // Standard section types
244  Error parseTypeSection(ReadContext &Ctx);
245  Error parseImportSection(ReadContext &Ctx);
246  Error parseFunctionSection(ReadContext &Ctx);
247  Error parseTableSection(ReadContext &Ctx);
248  Error parseMemorySection(ReadContext &Ctx);
249  Error parseTagSection(ReadContext &Ctx);
250  Error parseGlobalSection(ReadContext &Ctx);
251  Error parseExportSection(ReadContext &Ctx);
252  Error parseStartSection(ReadContext &Ctx);
253  Error parseElemSection(ReadContext &Ctx);
254  Error parseCodeSection(ReadContext &Ctx);
255  Error parseDataSection(ReadContext &Ctx);
256  Error parseDataCountSection(ReadContext &Ctx);
257 
258  // Custom section types
259  Error parseDylinkSection(ReadContext &Ctx);
260  Error parseDylink0Section(ReadContext &Ctx);
261  Error parseNameSection(ReadContext &Ctx);
262  Error parseLinkingSection(ReadContext &Ctx);
263  Error parseLinkingSectionSymtab(ReadContext &Ctx);
264  Error parseLinkingSectionComdat(ReadContext &Ctx);
265  Error parseProducersSection(ReadContext &Ctx);
266  Error parseTargetFeaturesSection(ReadContext &Ctx);
267  Error parseRelocSection(StringRef Name, ReadContext &Ctx);
268 
269  wasm::WasmObjectHeader Header;
270  std::vector<WasmSection> Sections;
271  wasm::WasmDylinkInfo DylinkInfo;
272  wasm::WasmProducerInfo ProducerInfo;
273  std::vector<wasm::WasmFeatureEntry> TargetFeatures;
274  std::vector<wasm::WasmSignature> Signatures;
275  std::vector<wasm::WasmTable> Tables;
276  std::vector<wasm::WasmLimits> Memories;
277  std::vector<wasm::WasmGlobal> Globals;
278  std::vector<wasm::WasmTag> Tags;
279  std::vector<wasm::WasmImport> Imports;
280  std::vector<wasm::WasmExport> Exports;
281  std::vector<wasm::WasmElemSegment> ElemSegments;
282  std::vector<WasmSegment> DataSegments;
283  llvm::Optional<size_t> DataCount;
284  std::vector<wasm::WasmFunction> Functions;
285  std::vector<WasmSymbol> Symbols;
286  std::vector<wasm::WasmDebugName> DebugNames;
287  uint32_t StartFunction = -1;
288  bool HasLinkingSection = false;
289  bool HasDylinkSection = false;
290  bool SeenCodeSection = false;
291  bool HasMemory64 = false;
292  wasm::WasmLinkingData LinkingData;
293  uint32_t NumImportedGlobals = 0;
294  uint32_t NumImportedTables = 0;
295  uint32_t NumImportedFunctions = 0;
296  uint32_t NumImportedTags = 0;
297  uint32_t CodeSection = 0;
298  uint32_t DataSection = 0;
299  uint32_t TagSection = 0;
300  uint32_t GlobalSection = 0;
301  uint32_t TableSection = 0;
302 };
303 
305 public:
306  // We define orders for all core wasm sections and known custom sections.
307  enum : int {
308  // Sentinel, must be zero
310 
311  // Core sections
325 
326  // Custom sections
327  // "dylink" should be the very first section in the module
329  // "linking" section requires DATA section in order to validate data symbols
331  // Must come after "linking" section in order to validate reloc indexes.
333  // "name" section must appear after DATA. Comes after "linking" to allow
334  // symbol table to set default function name.
336  // "producers" section must appear after "name" section.
338  // "target_features" section must appear after producers section
340 
341  // Must be last
343 
344  };
345 
346  // Sections that may or may not be present, but cannot be predecessors
348 
349  bool isValidSectionOrder(unsigned ID, StringRef CustomSectionName = "");
350 
351 private:
352  bool Seen[WASM_NUM_SEC_ORDERS] = {}; // Sections that have been seen already
353 
354  // Returns -1 for unknown sections.
355  int getSectionOrder(unsigned ID, StringRef CustomSectionName = "");
356 };
357 
358 } // end namespace object
359 
361  Sym.print(OS);
362  return OS;
363 }
364 
365 } // end namespace llvm
366 
367 #endif // LLVM_OBJECT_WASM_H
llvm::object::WasmSectionOrderChecker
Definition: Wasm.h:304
MemoryBuffer.h
llvm::wasm::WASM_SYMBOL_TYPE_SECTION
@ WASM_SYMBOL_TYPE_SECTION
Definition: Wasm.h:373
llvm::wasm::WasmTag
Definition: Wasm.h:117
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_IMPORT
@ WASM_SEC_ORDER_IMPORT
Definition: Wasm.h:313
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:506
llvm::object::WasmObjectFile::linkingData
const wasm::WasmLinkingData & linkingData() const
Definition: Wasm.h:146
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::object::WasmObjectFile::WasmObjectFile
WasmObjectFile(MemoryBufferRef Object, Error &Err)
Definition: WasmObjectFile.cpp:260
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_TAG
@ WASM_SEC_ORDER_TAG
Definition: Wasm.h:317
llvm::object::WasmObjectFile::symbol_begin
basic_symbol_iterator symbol_begin() const override
Definition: WasmObjectFile.cpp:1558
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_LINKING
@ WASM_SEC_ORDER_LINKING
Definition: Wasm.h:330
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_CODE
@ WASM_SEC_ORDER_CODE
Definition: Wasm.h:323
llvm::object::WasmObjectFile::getFeatures
SubtargetFeatures getFeatures() const override
Definition: WasmObjectFile.cpp:1837
llvm::object::WasmSegment
Definition: Wasm.h:115
llvm::object::WasmObjectFile::ReadContext::Start
const uint8_t * Start
Definition: Wasm.h:211
llvm::object::WasmObjectFile::debugNames
ArrayRef< wasm::WasmDebugName > debugNames() const
Definition: Wasm.h:151
llvm::object::WasmSection::Content
ArrayRef< uint8_t > Content
Definition: Wasm.h:111
StringRef.h
llvm::object::WasmObjectFile::syms
ArrayRef< WasmSymbol > syms() const
Definition: Wasm.h:145
llvm::object::WasmObjectFile::getBytesInAddress
uint8_t getBytesInAddress() const override
The number of bytes used to represent an address in this object file format.
Definition: WasmObjectFile.cpp:1827
llvm::object::WasmSectionOrderChecker::isValidSectionOrder
bool isValidSectionOrder(unsigned ID, StringRef CustomSectionName="")
Definition: WasmObjectFile.cpp:1960
llvm::object::WasmSymbol::Info
const wasm::WasmSymbolInfo & Info
Definition: Wasm.h:44
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_PRODUCERS
@ WASM_SEC_ORDER_PRODUCERS
Definition: Wasm.h:337
llvm::object::WasmSymbol::isDefined
bool isDefined() const
Definition: Wasm.h:67
llvm::object::WasmSegment::Data
wasm::WasmDataSegment Data
Definition: Wasm.h:117
llvm::wasm::WASM_SYMBOL_BINDING_LOCAL
const unsigned WASM_SYMBOL_BINDING_LOCAL
Definition: Wasm.h:393
llvm::wasm::WASM_SYMBOL_TYPE_TABLE
@ WASM_SYMBOL_TYPE_TABLE
Definition: Wasm.h:375
llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL
@ WASM_SYMBOL_TYPE_GLOBAL
Definition: Wasm.h:372
llvm::object::WasmSection
Definition: Wasm.h:104
Error.h
llvm::wasm::WasmRelocation
Definition: Wasm.h:184
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_EXPORT
@ WASM_SEC_ORDER_EXPORT
Definition: Wasm.h:319
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_TARGET_FEATURES
@ WASM_SEC_ORDER_TARGET_FEATURES
Definition: Wasm.h:339
llvm::object::WasmSymbol::isTypeFunction
bool isTypeFunction() const
Definition: Wasm.h:49
llvm::object::WasmObjectFile::dylinkInfo
const wasm::WasmDylinkInfo & dylinkInfo() const
Definition: Wasm.h:133
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::object::WasmObjectFile::isSectionCompressed
bool isSectionCompressed(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1743
llvm::object::WasmObjectFile::getSectionName
Expected< StringRef > getSectionName(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1693
llvm::Optional< size_t >
llvm::wasm::WASM_SYMBOL_UNDEFINED
const unsigned WASM_SYMBOL_UNDEFINED
Definition: Wasm.h:396
llvm::object::WasmObjectFile::memories
ArrayRef< wasm::WasmLimits > memories() const
Definition: Wasm.h:141
llvm::object::WasmObjectFile::getSymbolValueImpl
uint64_t getSymbolValueImpl(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1619
llvm::object::WasmObjectFile::getRelocationTypeName
void getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl< char > &Result) const override
Definition: WasmObjectFile.cpp:1796
llvm::object::WasmObjectFile::isSectionBSS
bool isSectionBSS(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1755
llvm::object::WasmObjectFile::functions
ArrayRef< wasm::WasmFunction > functions() const
Definition: Wasm.h:150
llvm::wasm::WasmSymbolInfo::Kind
uint8_t Kind
Definition: Wasm.h:198
llvm::object::WasmObjectFile::types
ArrayRef< wasm::WasmSignature > types() const
Definition: Wasm.h:138
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::wasm::WasmFunction
Definition: Wasm.h:140
llvm::object::WasmObjectFile::getNumImportedGlobals
uint32_t getNumImportedGlobals() const
Definition: Wasm.h:153
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_DATA
@ WASM_SEC_ORDER_DATA
Definition: Wasm.h:324
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_START
@ WASM_SEC_ORDER_START
Definition: Wasm.h:320
llvm::object::WasmObjectFile::isRelocatableObject
bool isRelocatableObject() const override
True if this is a relocatable object (.o/.obj).
Definition: WasmObjectFile.cpp:1841
llvm::object::WasmObjectFile::getArch
Triple::ArchType getArch() const override
Definition: WasmObjectFile.cpp:1833
llvm::MemoryBufferRef
Definition: MemoryBufferRef.h:22
llvm::object::WasmObjectFile::getNumberOfSymbols
uint32_t getNumberOfSymbols() const
Definition: Wasm.h:147
llvm::wasm::WasmProducerInfo
Definition: Wasm.h:60
llvm::object::WasmObjectFile::getNumSections
uint32_t getNumSections() const
Definition: Wasm.h:157
llvm::object::WasmObjectFile::moveSectionNext
void moveSectionNext(DataRefImpl &Sec) const override
Definition: WasmObjectFile.cpp:1691
llvm::object::WasmSymbol::isHidden
bool isHidden() const
Definition: Wasm.h:89
llvm::object::WasmSection::Name
StringRef Name
Definition: Wasm.h:109
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_FUNCTION
@ WASM_SEC_ORDER_FUNCTION
Definition: Wasm.h:314
llvm::wasm::WASM_SYMBOL_BINDING_WEAK
const unsigned WASM_SYMBOL_BINDING_WEAK
Definition: Wasm.h:392
llvm::object::WasmSymbol::GlobalType
const wasm::WasmGlobalType * GlobalType
Definition: Wasm.h:45
llvm::object::WasmSymbol::Signature
const wasm::WasmSignature * Signature
Definition: Wasm.h:47
llvm::Triple::ArchType
ArchType
Definition: Triple.h:47
llvm::object::WasmObjectFile::ReadContext::End
const uint8_t * End
Definition: Wasm.h:213
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
llvm::object::WasmObjectFile::ReadContext::Ptr
const uint8_t * Ptr
Definition: Wasm.h:212
llvm::wasm::WASM_SYMBOL_VISIBILITY_MASK
const unsigned WASM_SYMBOL_VISIBILITY_MASK
Definition: Wasm.h:389
MCSymbolWasm.h
llvm::object::WasmObjectFile::getWasmRelocation
const wasm::WasmRelocation & getWasmRelocation(const RelocationRef &Ref) const
Definition: WasmObjectFile.cpp:1856
llvm::object::WasmObjectFile
Definition: Wasm.h:120
llvm::wasm::WASM_SYMBOL_VISIBILITY_HIDDEN
const unsigned WASM_SYMBOL_VISIBILITY_HIDDEN
Definition: Wasm.h:395
llvm::object::WasmSymbol::isTypeTag
bool isTypeTag() const
Definition: Wasm.h:65
llvm::object::WasmSymbol
Definition: Wasm.h:35
llvm::object::WasmObjectFile::isSectionText
bool isSectionText(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1747
llvm::object::WasmObjectFile::getSymbolAlignment
uint32_t getSymbolAlignment(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1623
llvm::SubtargetFeatures
Manages the enabling and disabling of subtarget specific features.
Definition: SubtargetFeature.h:183
llvm::object::WasmObjectFile::getSymbolSectionId
uint32_t getSymbolSectionId(SymbolRef Sym) const
Definition: WasmObjectFile.cpp:1667
llvm::wasm::WasmGlobalType
Definition: Wasm.h:105
llvm::object::WasmObjectFile::getNumImportedTags
uint32_t getNumImportedTags() const
Definition: Wasm.h:156
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_DYLINK
@ WASM_SEC_ORDER_DYLINK
Definition: Wasm.h:328
llvm::object::WasmSectionOrderChecker::WASM_NUM_SEC_ORDERS
@ WASM_NUM_SEC_ORDERS
Definition: Wasm.h:342
llvm::object::WasmObjectFile::getSymbolSection
Expected< section_iterator > getSymbolSection(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1657
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION
@ WASM_SYMBOL_TYPE_FUNCTION
Definition: Wasm.h:370
llvm::object::WasmObjectFile::moveRelocationNext
void moveRelocationNext(DataRefImpl &Rel) const override
Definition: WasmObjectFile.cpp:1774
llvm::object::WasmObjectFile::getTargetFeatures
ArrayRef< wasm::WasmFeatureEntry > getTargetFeatures() const
Definition: Wasm.h:135
llvm::Comdat
Definition: Comdat.h:31
llvm::object::WasmSymbol::isUndefined
bool isUndefined() const
Definition: Wasm.h:69
llvm::object::WasmObjectFile::getHeader
const wasm::WasmObjectHeader & getHeader() const
Definition: WasmObjectFile.cpp:1534
llvm::object::WasmSymbol::print
void print(raw_ostream &Out) const
Definition: WasmObjectFile.cpp:40
llvm::object::WasmObjectFile::getSectionIndex
uint64_t getSectionIndex(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1722
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_ELEM
@ WASM_SEC_ORDER_ELEM
Definition: Wasm.h:321
llvm::object::WasmObjectFile::elements
ArrayRef< wasm::WasmElemSegment > elements() const
Definition: Wasm.h:148
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_TYPE
@ WASM_SEC_ORDER_TYPE
Definition: Wasm.h:312
llvm::wasm::WasmDylinkInfo
Definition: Wasm.h:50
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_RELOC
@ WASM_SEC_ORDER_RELOC
Definition: Wasm.h:332
llvm::OutputFileType::Object
@ Object
llvm::object::SectionRef
This is a value type class that represents a single section in the list of sections in the object fil...
Definition: ObjectFile.h:80
llvm::object::WasmSymbol::isTypeSection
bool isTypeSection() const
Definition: Wasm.h:61
llvm::object::WasmObjectFile::tables
ArrayRef< wasm::WasmTable > tables() const
Definition: Wasm.h:140
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
llvm::object::WasmSymbol::isBindingWeak
bool isBindingWeak() const
Definition: Wasm.h:73
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
uint64_t
llvm::object::WasmObjectFile::getSymbolType
Expected< SymbolRef::Type > getSymbolType(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1634
llvm::object::symbol_iterator
Definition: ObjectFile.h:207
llvm::object::WasmObjectFile::section_begin
section_iterator section_begin() const override
Definition: WasmObjectFile.cpp:1815
llvm::object::WasmSymbol::isTypeData
bool isTypeData() const
Definition: Wasm.h:55
llvm::object::WasmObjectFile::imports
ArrayRef< wasm::WasmImport > imports() const
Definition: Wasm.h:139
llvm::object::WasmObjectFile::getSymbolFlags
Expected< uint32_t > getSymbolFlags(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1540
ArrayRef.h
llvm::wasm::WASM_SYMBOL_TYPE_TAG
@ WASM_SYMBOL_TYPE_TAG
Definition: Wasm.h:374
llvm::object::WasmSection::WasmSection
WasmSection()=default
llvm::object::WasmObjectFile::getProducerInfo
const wasm::WasmProducerInfo & getProducerInfo() const
Definition: Wasm.h:134
llvm::object::WasmObjectFile::getNumImportedTables
uint32_t getNumImportedTables() const
Definition: Wasm.h:154
ObjectFile.h
llvm::object::WasmObjectFile::getSectionAddress
uint64_t getSectionAddress(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1720
llvm::object::WasmObjectFile::startFunction
uint32_t startFunction() const
Definition: Wasm.h:152
llvm::object::content_iterator
Definition: SymbolicFile.h:67
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_NAME
@ WASM_SEC_ORDER_NAME
Definition: Wasm.h:335
llvm::object::WasmObjectFile::getWasmSymbolValue
uint64_t getWasmSymbolValue(const WasmSymbol &Sym) const
Definition: WasmObjectFile.cpp:1593
llvm::object::WasmObjectFile::isSharedObject
bool isSharedObject() const
Definition: WasmObjectFile.cpp:1843
llvm::object::WasmObjectFile::getSymbolName
Expected< StringRef > getSymbolName(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1580
llvm::object::WasmObjectFile::getNumImportedFunctions
uint32_t getNumImportedFunctions() const
Definition: Wasm.h:155
llvm::object::WasmSymbol::isBindingGlobal
bool isBindingGlobal() const
Definition: Wasm.h:77
llvm::ArrayRef< uint8_t >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:228
llvm::object::Binary::isWasm
bool isWasm() const
Definition: Binary.h:134
llvm::object::Binary
Definition: Binary.h:32
llvm::object::WasmObjectFile::getSectionContents
Expected< ArrayRef< uint8_t > > getSectionContents(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1732
llvm::object::WasmSymbol::isTypeGlobal
bool isTypeGlobal() const
Definition: Wasm.h:57
llvm::wasm::WasmObjectHeader
Definition: Wasm.h:34
llvm::wasm::WasmGlobal
Definition: Wasm.h:110
uint32_t
llvm::wasm::WASM_SYMBOL_BINDING_MASK
const unsigned WASM_SYMBOL_BINDING_MASK
Definition: Wasm.h:388
llvm::object::WasmObjectFile::globals
ArrayRef< wasm::WasmGlobal > globals() const
Definition: Wasm.h:142
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_MEMORY
@ WASM_SEC_ORDER_MEMORY
Definition: Wasm.h:316
llvm::object::DataRefImpl
Definition: SymbolicFile.h:33
llvm::object::WasmObjectFile::isSectionVirtual
bool isSectionVirtual(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1757
llvm::object::WasmSection::Offset
uint32_t Offset
Definition: Wasm.h:108
llvm::wasm::WasmSymbolInfo
Definition: Wasm.h:196
llvm::object::WasmSegment::SectionOffset
uint32_t SectionOffset
Definition: Wasm.h:116
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_NONE
@ WASM_SEC_ORDER_NONE
Definition: Wasm.h:309
llvm::object::WasmObjectFile::isSectionData
bool isSectionData(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1751
llvm::object::WasmObjectFile::getSectionSize
uint64_t getSectionSize(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1726
llvm::object::WasmSymbol::WasmSymbol
WasmSymbol(const wasm::WasmSymbolInfo &Info, const wasm::WasmGlobalType *GlobalType, const wasm::WasmTableType *TableType, const wasm::WasmSignature *Signature)
Definition: Wasm.h:37
llvm::object::WasmObjectFile::getWasmSection
const WasmSection & getWasmSection(const SectionRef &Section) const
Definition: WasmObjectFile.cpp:1851
llvm::object::WasmObjectFile::ReadContext
Definition: Wasm.h:210
llvm::object::WasmObjectFile::dataSegments
ArrayRef< WasmSegment > dataSegments() const
Definition: Wasm.h:149
llvm::object::WasmObjectFile::getSectionAlignment
uint64_t getSectionAlignment(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1739
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_DATACOUNT
@ WASM_SEC_ORDER_DATACOUNT
Definition: Wasm.h:322
llvm::object::WasmObjectFile::moveSymbolNext
void moveSymbolNext(DataRefImpl &Symb) const override
Definition: WasmObjectFile.cpp:1538
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::object::WasmObjectFile::getRelocationSymbol
symbol_iterator getRelocationSymbol(DataRefImpl Rel) const override
Definition: WasmObjectFile.cpp:1781
llvm::object::WasmSymbol::getBinding
unsigned getBinding() const
Definition: Wasm.h:85
llvm::object::WasmObjectFile::tags
ArrayRef< wasm::WasmTag > tags() const
Definition: Wasm.h:143
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::wasm::WASM_SYMBOL_BINDING_GLOBAL
const unsigned WASM_SYMBOL_BINDING_GLOBAL
Definition: Wasm.h:391
llvm::object::WasmObjectFile::getWasmSymbol
const WasmSymbol & getWasmSymbol(const DataRefImpl &Symb) const
Definition: WasmObjectFile.cpp:1572
llvm::wasm::WasmSymbolInfo::Flags
uint32_t Flags
Definition: Wasm.h:199
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_TABLE
@ WASM_SEC_ORDER_TABLE
Definition: Wasm.h:315
llvm::object::WasmObjectFile::section_end
section_iterator section_end() const override
Definition: WasmObjectFile.cpp:1821
llvm::wasm::WasmDataSegment
Definition: Wasm.h:154
llvm::object::WasmObjectFile::getSymbolAddress
Expected< uint64_t > getSymbolAddress(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1584
llvm::object::WasmObjectFile::getRelocationOffset
uint64_t getRelocationOffset(DataRefImpl Rel) const override
Definition: WasmObjectFile.cpp:1776
llvm::object::WasmObjectFile::symbol_end
basic_symbol_iterator symbol_end() const override
Definition: WasmObjectFile.cpp:1565
llvm::object::WasmObjectFile::section_rel_begin
relocation_iterator section_rel_begin(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1759
Wasm.h
llvm::object::WasmSymbol::TableType
const wasm::WasmTableType * TableType
Definition: Wasm.h:46
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
Binary.h
llvm::object::WasmObjectFile::getCommonSymbolSizeImpl
uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const override
Definition: WasmObjectFile.cpp:1628
llvm::object::WasmSymbol::isTypeTable
bool isTypeTable() const
Definition: Wasm.h:53
llvm::object::WasmObjectFile::exports
ArrayRef< wasm::WasmExport > exports() const
Definition: Wasm.h:144
llvm::object::WasmSymbol::getVisibility
unsigned getVisibility() const
Definition: Wasm.h:93
llvm::SmallVectorImpl< char >
llvm::object::SymbolRef
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:167
llvm::object::WasmObjectFile::classof
static bool classof(const Binary *v)
Definition: Wasm.h:131
llvm::wasm::WasmLinkingData
Definition: Wasm.h:227
llvm::object::WasmSymbol::dump
LLVM_DUMP_METHOD void dump() const
Definition: WasmObjectFile.cpp:54
llvm::object::WasmObjectFile::getRelocationType
uint64_t getRelocationType(DataRefImpl Rel) const override
Definition: WasmObjectFile.cpp:1791
llvm::object::RelocationRef
This is a value type class that represents a single relocation in the list of relocations in the obje...
Definition: ObjectFile.h:51
llvm::object::WasmSectionOrderChecker::DisallowedPredecessors
static int DisallowedPredecessors[WASM_NUM_SEC_ORDERS][WASM_NUM_SEC_ORDERS]
Definition: Wasm.h:347
llvm::object::WasmObjectFile::section_rel_end
relocation_iterator section_rel_end(DataRefImpl Sec) const override
Definition: WasmObjectFile.cpp:1766
llvm::wasm::WasmTableType
Definition: Wasm.h:83
llvm::object::WasmSection::Relocations
std::vector< wasm::WasmRelocation > Relocations
Definition: Wasm.h:112
llvm::object::WasmObjectFile::getFileFormatName
StringRef getFileFormatName() const override
Definition: WasmObjectFile.cpp:1831
llvm::wasm::WASM_SYMBOL_TYPE_DATA
@ WASM_SYMBOL_TYPE_DATA
Definition: Wasm.h:371
llvm::wasm::WasmSignature
Definition: Wasm.h:421
llvm::object::WasmSymbol::isBindingLocal
bool isBindingLocal() const
Definition: Wasm.h:81
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38
llvm::object::WasmSectionOrderChecker::WASM_SEC_ORDER_GLOBAL
@ WASM_SEC_ORDER_GLOBAL
Definition: Wasm.h:318