Partial WebAssembly backend

Pip Cet pipcet@gmail.com
Sat Mar 4 16:30:00 GMT 2017


I'd like to announce a WebAssembly backend for the GNU toolchain
(binutils, gcc, glibc) that I've been working on for a while.

WebAssembly (https://www.w3.org/community/webassembly/) is an object
file format for a virtual machine implementing conventional 32-bit
integer/64-bit floating-point arithmetic. Version 1 has been released
on February 28 (https://lists.w3.org/Archives/Public/public-webassembly/2017Feb/0002.html),
and enabled in various browsers, including Mozilla.

This binutils port produces and deals with ELF files containing
WebAssembly code; WebAssembly modules (in the WebAssembly object file
format) can be output using special linker scripts and -Obinary, but
they cannot be used as input for any of the binutils programs at
present.

(While the gcc port, in particular, makes some decisions that
negatively affect performance, the binutils port is quite general and
should permit the assembly, linking, and manipulation of all
WebAssembly code, provided it is still encapsulated in ELF files).

The code is at https://github.com/pipcet/binutils-gdb, included from
the larger project at https://github.com/pipcet/asmjs. Some
documentation is available at
https://github.com/pipcet/asmjs/blob/everything/wasm32.org (specific
to the wasm32 target) and
https://github.com/pipcet/asmjs/blob/everything/asmjs.org (for all
three targets: asmjs, wasm32, and wasm64). The GitHub sources include
support for using asm.js instead of wasm, and some rudimentary support
for simulating a 64-bit machine using wasm.

I'd appreciate any questions, comments or advice, and in particular
I'd like to ask whether it is possible in theory to include this
backend in the standard GNU binutils distribution; some work would be
required on my end to do that, and I'm not sure it's worth the effort
if there is no chance of inclusion at the end of the process.

If anyone else has been or is planning to work on a WebAssembly
backend, it would be great to hear from them, and maybe some of my
code could be reused for that.

Pip Cet



More information about the Binutils mailing list