Index: lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -84,13 +84,14 @@ SmallVector Results; SmallVector Params; ComputeSignatureVTs(F, TM, Params, Results); - MCSymbolWasm *Sym = cast(getSymbol(&F)); + MCSymbol *Sym = getSymbol(&F); getTargetStreamer()->emitIndirectFunctionType(Sym, Params, Results); - if (F.hasFnAttribute("wasm-import-module")) { + MCSymbolWasm *WasmSym = dyn_cast(Sym); + if (WasmSym && F.hasFnAttribute("wasm-import-module")) { StringRef Name = F.getFnAttribute("wasm-import-module") .getValueAsString(); - getTargetStreamer()->emitImportModule(Sym, Name); + getTargetStreamer()->emitImportModule(WasmSym, Name); } } }