[WebAssembly] Fix casting MCSymbol to MCSymbolWasm on ELF

Summary:
wasm32-unknown-unknown-elf has MCSymbols that are not MCSymbolWasms, so
we need a non-asserting cast here.

Reviewers: dschuff, sunfish

Subscribers: jfb, sbc100, aheejin, llvm-commits

Differential Revision: https://reviews.llvm.org/D43205

llvm-svn: 324942
This commit is contained in:
Jacob Gravelle 2018-02-12 21:41:12 +00:00
parent 014c000f6a
commit ca358da5e7
1 changed files with 5 additions and 3 deletions

View File

@ -84,13 +84,15 @@ void WebAssemblyAsmPrinter::EmitEndOfAsmFile(Module &M) {
SmallVector<MVT, 4> Results;
SmallVector<MVT, 4> Params;
ComputeSignatureVTs(F, TM, Params, Results);
MCSymbolWasm *Sym = cast<MCSymbolWasm>(getSymbol(&F));
MCSymbol *Sym = getSymbol(&F);
getTargetStreamer()->emitIndirectFunctionType(Sym, Params, Results);
if (F.hasFnAttribute("wasm-import-module")) {
if (TM.getTargetTriple().isOSBinFormatWasm() &&
F.hasFnAttribute("wasm-import-module")) {
MCSymbolWasm *WasmSym = cast<MCSymbolWasm>(Sym);
StringRef Name = F.getFnAttribute("wasm-import-module")
.getValueAsString();
getTargetStreamer()->emitImportModule(Sym, Name);
getTargetStreamer()->emitImportModule(WasmSym, Name);
}
}
}