This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Linking metadata support
AbandonedPublic

Authored by sunfish on Mar 16 2017, 5:39 PM.

Details

Reviewers
None
Summary

Add support for the new relocations and linking metadata section support in https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. In particular, this allows LLVM to indicate which variable is the stack pointer, so that it can be linked with other objects.

This also adds support for emitting type relocations for call_indirect instructions.

Right now, this is mainly tested by using wabt and hexdump to examine the output on selected testcases. We'll add more tests as the design stablizes and more of the pieces are in place.

Diff Detail

Repository
rL LLVM

Event Timeline

sunfish created this revision.Mar 16 2017, 5:39 PM
sbc100 added inline comments.Mar 16 2017, 5:56 PM
include/llvm/Support/Wasm.h
99

In the long run we probably need to revisit the style used in this file, but for now doesn't makes sense to follow the local convention and go for something like WASM_??_STACK_POINTER

117

I've used StringRef for these kinds of things, so they can point to non-null-terminated strings in the binary.

sunfish marked an inline comment as done.Mar 30 2017, 5:08 PM
sunfish added inline comments.
include/llvm/Support/Wasm.h
99

Sounds good.

117

Makes sense.

sunfish abandoned this revision.Mar 30 2017, 5:11 PM
sunfish marked an inline comment as done.