[llvm] r324942 - [WebAssembly] Fix casting MCSymbol to MCSymbolWasm on ELF
Jacob Gravelle via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 13:41:12 PST 2018
Author: jgravelle
Date: Mon Feb 12 13:41:12 2018
New Revision: 324942
URL: http://llvm.org/viewvc/llvm-project?rev=324942&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp?rev=324942&r1=324941&r2=324942&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp Mon Feb 12 13:41:12 2018
@@ -84,13 +84,15 @@ void WebAssemblyAsmPrinter::EmitEndOfAsm
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);
}
}
}
More information about the llvm-commits
mailing list