[WebAssembly] relocations for dwarf

Current LLVM crashes (assertion in debug) when emitting debug info in a wasm file. While I realize there's no definitive info on what/how debug info will look when that gets decided on, crashing is probably not the thing it should do.

Attached is a patch that makes llvm emit mostly valid dwarf debug info; while there's no debugger that can currently understand this, I think it's a step forward.

If there's no interest in this I'll just use it for my own purposes.

My changes:

Added a new relocation type: R_WEBASSEMBLY_FUNCTION_OFFSET_I32
A relocation like this contains the offset of the target label relative to the start of the wasm code section. This relocation is only for data -> code relocations of course.

Carlo Kok
RemObjects Software

llvm-diff.txt (7.18 KB)