This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix casting MCSymbol to MCSymbolWasm on ELF
ClosedPublic

Authored by jgravelle-google on Feb 12 2018, 12:12 PM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

dschuff added inline comments.Feb 12 2018, 12:14 PM
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
94 ↗(On Diff #133913)

Does emitImportModule do anything for ELF? I assume not, maybe it makes more sense to just explicitly condition this whole thing on BinFormatWasm and that way when we remove ELF it will be easy to find all the mentions of BinFormatELF or BinFormatWasm in the backend and remove them.

  • Gate MCSymbolWasm on BinFormatWasm
jgravelle-google marked an inline comment as done.Feb 12 2018, 12:25 PM
jgravelle-google added inline comments.
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
94 ↗(On Diff #133913)

Yeah it just asserts if we actually do add a "wasm-import-module" attribute. This is less explicitly unsupported, but more refactorable in future.

dschuff accepted this revision.Feb 12 2018, 12:30 PM
dschuff added inline comments.
lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
94 ↗(On Diff #133913)

Yeah my hope is that the "future" for ELF is short and does not include this attribute :)

This revision is now accepted and ready to land.Feb 12 2018, 12:30 PM
This revision was automatically updated to reflect the committed changes.