Commit Graph

11 Commits

Author SHA1 Message Date
Nicholas Wilson 874eedd779 [WebAssembly] Add export/import for function pointer table
This enables callback-style programming where the JavaScript environment
can call back into the Wasm environment using a function pointer
received from the module.

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

llvm-svn: 328643
2018-03-27 17:38:51 +00:00
Nicholas Wilson 3e3f5fb3a3 [WebAssembly] Use DenseMapInfo traits from LLVM repo. NFC
Differential Revision: https://reviews.llvm.org/D44150

llvm-svn: 327527
2018-03-14 15:58:16 +00:00
Sam Clegg 8518e7ded5 [WebAssembly] Use uint8_t for single byte values to match the spec
Differential Revision: https://reviews.llvm.org/D43922

llvm-svn: 326455
2018-03-01 18:06:39 +00:00
Sam Clegg ea397f67e3 [WebAssembly] Use Twine rather than StringRef for logging messages
Also add missing tracing to writeU8.

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

llvm-svn: 326398
2018-03-01 00:42:57 +00:00
Sam Clegg 9310297438 [WebAssembly] Add explicit symbol table
This change modified lld to in response the llvm change which
moved to a more explicit symbol table in the object format.

Based on patches by Nicholas Wilson:
 1. https://reviews.llvm.org/D41955
 2. https://reviews.llvm.org/D42585

The primary difference that we see in the test output is that
for relocatable (-r) output we now have symbol table which
replaces exports/imports and globals.

See: https://github.com/WebAssembly/tool-conventions/issues/38
Differential Revision: https://reviews.llvm.org/D43264

llvm-svn: 325861
2018-02-23 05:08:53 +00:00
Rui Ueyama bf450d905d Do not create a temporary data structure for relocations.
This patch removes `OutRelocations` vector from the InputChunk and
directly consume `Relocations` vector instead. This should make the linker
faster because we don't create a temporary data structure, and it matches
the lld's design principle that we don't create temporary data structures
for object files but instead directly consume mmap'ed data whenever possible.

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

llvm-svn: 325549
2018-02-20 04:26:26 +00:00
Rui Ueyama 1184253891 Refactor wasm/WriterUtil.{cpp,h}.
Summary:
 - Makes code more in line with LLVM style (e.g. const char * -> StringRef)
 - Do not use formatv since we can construct message just by `+`
 - Replace some odd types such as `const StringRef` with more common type
 - Do not use default arguments if they are not necessary

Reviewers: sbc100

Subscribers: jfb, aheejin, llvm-commits, sunfish

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

llvm-svn: 325383
2018-02-16 20:38:00 +00:00
Rui Ueyama 7b9ed65666 Style fix. NFC.
llvm-svn: 325377
2018-02-16 19:53:29 +00:00
Sam Clegg 1a9b7b911d [WebAssembly] Update to match llvm change rL323901. NFC
See: https://reviews.llvm.org/rL323901

Patch by Nicholas Wilson!

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

llvm-svn: 323903
2018-01-31 19:54:34 +00:00
Sam Clegg b862159683 [WebAssembly] Allow function signature checking at link time
This change allows checking of function signatures but
does not yes enable it by default.  In this mode, linking
two objects that were compiled with a different signatures
for the same function will produce a link error.

New options for enabling and disabling this feature have been
added: (--check-signatures/--no-check-signatures).

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

llvm-svn: 319396
2017-11-30 01:40:08 +00:00
Sam Clegg c94d393ad5 [WebAssembly] Initial wasm linker implementation
This linker backend is still a work in progress but is
enough to link simple programs including linking against
library archives.

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

llvm-svn: 318539
2017-11-17 18:14:09 +00:00