Commit Graph

11 Commits

Author SHA1 Message Date
Simon Pilgrim
347f8943df Fix signed/unsigned warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299194 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-31 10:45:35 +00:00
Dan Gohman
546a4623a5 [WebAssembly] Initial linking metadata support
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 23:58:19 +00:00
Derek Schuff
cdcf70c249 [WebAssembly] Fix import type to be signed LEBs
This fix is a follow up a previous change with stored
value types as signed integers in memory.

In future, once the yaml<->wasm binary patche lands we
can add test coverage for this kind of thing.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 15:46:47 +00:00
Derek Schuff
d289ddded8 [WebAssembly] Fix some broken type encodings in wasm binary
A recent change switch the in-memory wasm value types
to be signed integers, but I missing a few cases where
these were being writing to the binary.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297991 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-16 20:49:48 +00:00
Derek Schuff
f04cbf365e [WebAssembly] Update format of 'names' section.
This change updates to the format of the 'names' sectionin the
generated wasm binary to match the latest changesto the design
and 'wabt'.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297877 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-15 19:36:02 +00:00
Derek Schuff
25754c1409 [WebAssembly] Use LEB encoding for value types
Previously we were using the encoded LEB hex values
for the value types.  This change uses the decoded
negative value and the LEB encoder to write them out.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14 20:23:22 +00:00
Dan Gohman
6d8f20c219 [WebAssembly] Add some comments and tidy up whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296402 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-27 22:41:39 +00:00
Dan Gohman
8f5a7d69cc [WebAssembly] Add support for using a wasm global for the stack pointer.
This replaces the __stack_pointer variable which was allocated in linear
memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296201 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:46:05 +00:00
Dan Gohman
53ff96ab08 [WebAssembly] Basic support for Wasm object file encoding.
With the "wasm32-unknown-unknown-wasm" triple, this allows writing out
simple wasm object files, and is another step in a larger series toward
migrating from ELF to general wasm object support. Note that this code
and the binary format itself is still experimental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-24 23:18:00 +00:00
Dan Gohman
6d5b578789 [WebAssembly] Implement the wasm binary container header.
Also, update the version number to 0x1, which is what engines are now
expecting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295860 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 18:50:20 +00:00
Dan Gohman
d660a5d68c [WebAssembly] Add skeleton MC support for the Wasm container format
This just adds the basic skeleton for supporting a new object file format.
All of the actual encoding will be implemented in followup patches.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295803 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-22 01:23:18 +00:00