Commit Graph

30 Commits

Author SHA1 Message Date
Fangrui Song 33c59abf5c [WebAssembly] Wrap definitions in namespace lld { namespace wasm {. NFC
Similar to D68323, but for wasm.

Reviewed By: ruiu

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

llvm-svn: 374279
2019-10-10 05:25:39 +00:00
Thomas Lively 09768c5d7a [WebAssembly] Initialize memory in start function
Summary:
 - `__wasm_init_memory` is now the WebAssembly start function instead
   of being called from `__wasm_call_ctors` or called directly by the
   runtime.
 - Adds a new synthetic data symbol `__wasm_init_memory_flag` that is
   atomically incremented from zero to one by the thread responsible
   for initializing memory.
 - All threads now unconditionally perform data.drop on all passive
   segments.
 - Removes --passive-segments and --active-segments flags and controls
   segment type based on --shared-memory instead. The deleted flags
   were only present to ameliorate the upgrade path in Emscripten.

Reviewers: sbc100, aheejin

Subscribers: dschuff, jgravelle-google, sunfish, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 370965
2019-09-04 19:50:39 +00:00
Heejin Ahn 9f96a58ccc [WebAssembly] Rename except_ref type to exnref
Summary:
We agreed to rename `except_ref` to `exnref` for consistency with other
reference types in
https://github.com/WebAssembly/exception-handling/issues/79. This also
renames WebAssemblyInstrExceptRef.td to WebAssemblyInstrRef.td in order
to use the file for other reference types in future.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 366145
2019-07-15 22:49:25 +00:00
Rui Ueyama 136d27ab4d [Coding style change][lld] Rename variables for non-ELF ports
This patch does the same thing as r365595 to other subdirectories,
which completes the naming style change for the entire lld directory.

With this, the naming style conversion is complete for lld.

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

llvm-svn: 365730
2019-07-11 05:40:30 +00:00
Fangrui Song 196a440411 [wasm] Simplify. NFC
llvm-svn: 358663
2019-04-18 13:33:29 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00
Thomas Lively 25ff893712 [WebAssembly] Instruction renaming
Summary: Associated with D56338.

Reviewers: aheejin, aardappel

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 350610
2019-01-08 06:25:55 +00:00
Heejin Ahn e915a71f18 [WebAssembly] Add support for the event section
Summary:
This adds support for the 'event section' specified in the exception
handling proposal.

Wasm exception handling binary model spec:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md#changes-to-the-binary-model

Reviewers: sbc100, ruiu

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 348703
2018-12-08 06:17:43 +00:00
Heejin Ahn b6254c515f [WebAssembly] Delete unused using statements (NFC)
Reviewers: sbc100, dschuff

Subscribers: mehdi_amini, jgravelle-google, sunfish, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 347370
2018-11-21 00:51:37 +00:00
Sam Clegg c1a3b9d51a [WebAssembly] Remove duplicate function. NFC.
Differential Revision: https://reviews.llvm.org/D53963

llvm-svn: 345806
2018-11-01 01:08:37 +00:00
Derek Schuff 371842b853 [WebAssembly] Refactor use of signatures
Update use of WebAssemblySignature to go along with D52580

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

llvm-svn: 343734
2018-10-03 22:25:32 +00:00
Thomas Lively d661e265c7 [WebAssembly] Add v128 value type
Reviewers: sbc100, aheejin, dschuff

Subscribers: jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 342690
2018-09-20 22:07:18 +00:00
Peter Collingbourne e3f652973e Support: Simplify endian stream interface. NFCI.
Provide some free functions to reduce verbosity of endian-writing
a single value, and replace the endianness template parameter with
a field.

Part of PR37466.

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

llvm-svn: 332757
2018-05-18 19:46:24 +00:00
Nicola Zaghen e7245b429b [lld] Update uses of DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM

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

llvm-svn: 332351
2018-05-15 13:36:20 +00:00
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
Heejin Ahn 2dce27d852 [WebAssembly] Add except_ref as a first-class type
Summary:
Add except_ref as a first-class type, according to the [[https://github.com/WebAssembly/exception-handling/blob/master/proposals/Level-1.md | Level 1 exception handling proposal ]].
Companion to D43706.

Reviewers: sbc100

Subscribers: jfb, dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 326986
2018-03-08 04:06:57 +00:00
Nicholas Wilson dbd90bf8d1 [WebAssembly] Run clang-format. NFC
llvm-svn: 326896
2018-03-07 13:28:16 +00:00
Nicholas Wilson 36f14f41e6 [WebAssembly] Rename global types to match the notation in the spec
llvm-svn: 326583
2018-03-02 14:54:34 +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
Rui Ueyama 26a84fc84f [WebAssembly] Fix variable name.
llvm-svn: 326301
2018-02-28 03:43:38 +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
Sam Clegg 3141ddc58d Consistent (non) use of empty lines in include blocks
The profailing style in lld seem to be to not include such empty lines.
Clang-tidy/clang-format seem to handle this just fine.

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

llvm-svn: 325629
2018-02-20 21:53:18 +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
Rui Ueyama e48f223ed6 Remove `else` or `break` after `fatal`. NFC.
fatal() does not return, so we don't need `else` or `break` after a call
of fatal.

llvm-svn: 319355
2017-11-29 20:45:58 +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