Index: llvm/trunk/include/llvm/BinaryFormat/Wasm.h =================================================================== --- llvm/trunk/include/llvm/BinaryFormat/Wasm.h +++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h @@ -214,6 +214,7 @@ enum : unsigned { WASM_LIMITS_FLAG_HAS_MAX = 0x1, + WASM_LIMITS_FLAG_IS_SHARED = 0x2, }; // Kind codes used in the custom "name" section Index: llvm/trunk/lib/Object/WasmObjectFile.cpp =================================================================== --- llvm/trunk/lib/Object/WasmObjectFile.cpp +++ llvm/trunk/lib/Object/WasmObjectFile.cpp @@ -193,7 +193,7 @@ static wasm::WasmLimits readLimits(WasmObjectFile::ReadContext &Ctx) { wasm::WasmLimits Result; - Result.Flags = readVaruint1(Ctx); + Result.Flags = readVaruint32(Ctx); Result.Initial = readVaruint32(Ctx); if (Result.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX) Result.Maximum = readVaruint32(Ctx); Index: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp =================================================================== --- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp +++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp @@ -416,6 +416,7 @@ IO &IO, WasmYAML::LimitFlags &Value) { #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X) BCase(HAS_MAX); + BCase(IS_SHARED); #undef BCase } Index: llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml +++ llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml @@ -0,0 +1,36 @@ +# RUN: yaml2obj %s | obj2yaml | FileCheck %s +--- !WASM +FileHeader: + Version: 0x00000001 +Sections: + - Type: TYPE + Signatures: + - Index: 0 + ReturnType: I32 + ParamTypes: + - I32 + - Type: IMPORT + Imports: + - Module: foo + Field: imported_memory + Kind: MEMORY + Memory: + Flags: [ HAS_MAX, IS_SHARED ] + Initial: 0x00000010 + Maximum: 0x00000011 + +... +# CHECK: --- !WASM +# CHECK: FileHeader: +# CHECK: Version: 0x00000001 +# CHECK: Sections: +# CHECK: - Type: IMPORT +# CHECK: Imports: +# CHECK: - Module: foo +# CHECK: Field: imported_memory +# CHECK: Kind: MEMORY +# CHECK: Memory: +# CHECK: Flags: [ HAS_MAX, IS_SHARED ] +# CHECK: Initial: 0x00000010 +# CHECK: Maximum: 0x00000011 +# CHECK: ...