diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/Wasm.h | 12 | ||||
-rw-r--r-- | llvm/include/llvm/MC/MCSectionWasm.h | 11 | ||||
-rw-r--r-- | llvm/include/llvm/ObjectYAML/WasmYAML.h | 3 |
3 files changed, 22 insertions, 4 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index 51f6ab2594b..7848be1cbfa 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -131,12 +131,13 @@ struct WasmFunction { }; struct WasmDataSegment { - uint32_t MemoryIndex; - WasmInitExpr Offset; + uint32_t InitFlags; + uint32_t MemoryIndex; // present if InitFlags & WASM_SEGMENT_HAS_MEMINDEX + WasmInitExpr Offset; // present if InitFlags & WASM_SEGMENT_IS_PASSIVE == 0 ArrayRef<uint8_t> Content; StringRef Name; // from the "segment info" section uint32_t Alignment; - uint32_t Flags; + uint32_t LinkerFlags; uint32_t Comdat; // from the "comdat info" section }; @@ -247,6 +248,11 @@ enum : unsigned { WASM_LIMITS_FLAG_IS_SHARED = 0x2, }; +enum : unsigned { + WASM_SEGMENT_IS_PASSIVE = 0x01, + WASM_SEGMENT_HAS_MEMINDEX = 0x02, +}; + // Kind codes used in the custom "name" section enum : unsigned { WASM_NAMES_FUNCTION = 0x1, diff --git a/llvm/include/llvm/MC/MCSectionWasm.h b/llvm/include/llvm/MC/MCSectionWasm.h index 0e576b7ba40..1adc8126492 100644 --- a/llvm/include/llvm/MC/MCSectionWasm.h +++ b/llvm/include/llvm/MC/MCSectionWasm.h @@ -42,6 +42,9 @@ class MCSectionWasm final : public MCSection { // segment uint32_t SegmentIndex = 0; + // Whether this data segment is passive + bool IsPassive = false; + friend class MCContext; MCSectionWasm(StringRef Section, SectionKind K, const MCSymbolWasm *group, unsigned UniqueID, MCSymbol *Begin) @@ -75,6 +78,14 @@ public: uint32_t getSegmentIndex() const { return SegmentIndex; } void setSegmentIndex(uint32_t Index) { SegmentIndex = Index; } + bool getPassive() const { + assert(isWasmData()); + return IsPassive; + } + void setPassive(bool V = true) { + assert(isWasmData()); + IsPassive = V; + } static bool classof(const MCSection *S) { return S->getVariant() == SV_Wasm; } }; diff --git a/llvm/include/llvm/ObjectYAML/WasmYAML.h b/llvm/include/llvm/ObjectYAML/WasmYAML.h index f5260bbb1ed..1d69d78e613 100644 --- a/llvm/include/llvm/ObjectYAML/WasmYAML.h +++ b/llvm/include/llvm/ObjectYAML/WasmYAML.h @@ -111,8 +111,9 @@ struct Relocation { }; struct DataSegment { - uint32_t MemoryIndex; uint32_t SectionOffset; + uint32_t InitFlags; + uint32_t MemoryIndex; wasm::WasmInitExpr Offset; yaml::BinaryRef Content; }; |