Index: include/llvm/BinaryFormat/Wasm.h =================================================================== --- include/llvm/BinaryFormat/Wasm.h +++ include/llvm/BinaryFormat/Wasm.h @@ -332,7 +332,7 @@ } inline bool operator==(const WasmEventType &LHS, const WasmEventType &RHS) { - return LHS.Attribute == RHS.Attribute && LHS.SigIndex == RHS.SigIndex; + return LHS.Attribute == RHS.Attribute; } inline bool operator!=(const WasmEventType &LHS, const WasmEventType &RHS) { Index: include/llvm/Object/Wasm.h =================================================================== --- include/llvm/Object/Wasm.h +++ include/llvm/Object/Wasm.h @@ -37,16 +37,16 @@ class WasmSymbol { public: WasmSymbol(const wasm::WasmSymbolInfo &Info, - const wasm::WasmSignature *FunctionType, const wasm::WasmGlobalType *GlobalType, - const wasm::WasmEventType *EventType) - : Info(Info), FunctionType(FunctionType), GlobalType(GlobalType), - EventType(EventType) {} + const wasm::WasmEventType *EventType, + const wasm::WasmSignature *Signature) + : Info(Info), GlobalType(GlobalType), EventType(EventType), + Signature(Signature) {} const wasm::WasmSymbolInfo &Info; - const wasm::WasmSignature *FunctionType; const wasm::WasmGlobalType *GlobalType; const wasm::WasmEventType *EventType; + const wasm::WasmSignature *Signature; bool isTypeFunction() const { return Info.Kind == wasm::WASM_SYMBOL_TYPE_FUNCTION; Index: lib/Object/WasmObjectFile.cpp =================================================================== --- lib/Object/WasmObjectFile.cpp +++ lib/Object/WasmObjectFile.cpp @@ -468,7 +468,7 @@ while (Count--) { wasm::WasmSymbolInfo Info; - const wasm::WasmSignature *FunctionType = nullptr; + const wasm::WasmSignature *Signature = nullptr; const wasm::WasmGlobalType *GlobalType = nullptr; const wasm::WasmEventType *EventType = nullptr; @@ -486,13 +486,13 @@ if (IsDefined) { Info.Name = readString(Ctx); unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions; - FunctionType = &Signatures[FunctionTypes[FuncIndex]]; + Signature = &Signatures[FunctionTypes[FuncIndex]]; wasm::WasmFunction &Function = Functions[FuncIndex]; if (Function.SymbolName.empty()) Function.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; - FunctionType = &Signatures[Import.SigIndex]; + Signature = &Signatures[Import.SigIndex]; Info.Name = Import.Field; Info.Module = Import.Module; } @@ -565,6 +565,7 @@ Info.Name = readString(Ctx); unsigned EventIndex = Info.ElementIndex - NumImportedEvents; wasm::WasmEvent &Event = Events[EventIndex]; + Signature = &Signatures[Event.Type.SigIndex]; EventType = &Event.Type; if (Event.SymbolName.empty()) Event.SymbolName = Info.Name; @@ -572,6 +573,7 @@ } else { wasm::WasmImport &Import = *ImportedEvents[Info.ElementIndex]; EventType = &Import.Event; + Signature = &Signatures[EventType->SigIndex]; Info.Name = Import.Field; } break; @@ -589,8 +591,8 @@ Twine(Info.Name), object_error::parse_failed); LinkingData.SymbolTable.emplace_back(Info); - Symbols.emplace_back(LinkingData.SymbolTable.back(), FunctionType, - GlobalType, EventType); + Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType, EventType, + Signature); LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n"); }