summaryrefslogtreecommitdiff
path: root/src/wasm-linker.h
Commit message (Collapse)AuthorAgeFilesLines
* Add flag to s2wasm to export __growWasmMemory function (#696)jgravelle-google2016-09-091-20/+4
| | | | | | | | | | | | | | | | | | | | | * Add a flag to s2wasm to export grow_memory Binaryen's wasm.js-post.js calls back in to wasm in order to grow the linear memory, via a function that asm2wasm exports called __growWasmMemory. This changes exposes that method through s2wasm when invoked with a flag. * Move AsmConstWalker from wasm-linker to wasm-emscripten * Add test for memory growth in s2wasm * Move makeDynCallThunks into wasm-emscripten module * Move mutation in getTableSegment into a separate method * Move emscripten metadata generation into wasm-emscripten Also make AsmConstWalker internal to the wasm-emscripten module, as it's only used for the metadata pass.
* export kindsAlon Zakai2016-09-071-0/+1
|
* offset support in tableAlon Zakai2016-08-151-0/+4
|
* support expressions in segment offsetsAlon Zakai2016-08-121-2/+2
|
* Create a dummy function to prevent NULL miscomparisons, if necessary (#658)Dominic Chen2016-08-031-0/+11
| | | Resolves WebAssembly/spec#312
* support pre-assigning indexes for functions that are called indirectly (#616)Dominic Chen2016-08-021-2/+10
| | | This patch adds support for an ".indidx" primitive that pre-assigns table indexes for functions that are called indirectly. It is used by the upstream LLVM WebAssembly backend to support fine-grained control-flow integrity for indirect function calls by emitting instrumentation at each indirect call site to check that the destination index is within certain ranges that correspond to disjoint equivalence classes of indirect call targets. The reason that this primitive is necessary is because the layout of the table section isn't determined until the WebAssembly linker is executed, but indirect function to table index mappings need to be known when opt is executed to generate the correct range checking in the LLVM IR.
* add support for symbol assignments, closes #4422 (#615)Dominic Chen2016-07-111-8/+21
| | | Adds support for aliases to objects, to go along with the existing support for aliases to functions.
* Do not generate duplicate import thunks at link time. (#569)Derek Schuff2016-06-031-1/+1
| | | | | Previously every address-take of an import would cause a new thunk to be generated. Now check in getImportThunk if the thunk exists already and just return it if so.
* Generate thunks for address-taken imports (#554)Derek Schuff2016-06-021-0/+16
| | | | | | | | | | | Under emscripten, C code can take the address of a function implemented in Javascript (which is exposed via an import in wasm). Because imports do not have linear memory address in wasm, we need to generate a thunk to be the target of the indirect call; it call the import directly. This is facilited by a new .s directive (.functype) which declares the types of functions which are declared but not defined. Fixes https://github.com/WebAssembly/binaryen/issues/392
* Use a class with implicit overflow checks for Address (#486)Derek Schuff2016-05-121-4/+2
| | | | It includes implicit conversion from u64 and implicit conversion to address_t. This makes it easier to use without ugly casting and but still gets the overflow checks.
* Introduce a separate type for linear memory addresses (#477)Derek Schuff2016-05-111-20/+22
| | | | | | | We've been using size_t (and other things) for addresses, which is generally wrong because it depends on the host, when it should in fact depend on the target. This is a partial fix for #278 (i.e. it's the right fix, I don't think it's applied quite everywhere yet).
* [Linker] Handle archive filesDerek Schuff2016-05-051-1/+8
| | | | | | | | Add a class to parse archive files. Support linking archive files, with archive semantics (i.e. an archive member is linked in if it satisfies an undefined reference). Archive files must be gnu-format archives containing .s files. Add tests for linking semantics.
* just use a simple vector in data segmentsAlon Zakai2016-04-271-0/+5
|
* allocate only expressions in arenas - functions, imports, exports, function ↵Alon Zakai2016-04-271-1/+1
| | | | types, can more simply be held by unique_ptrs on the owning module. this avoids need to coordinate arena allocation for their elements, and only the far more plentiful expression nodes are a perf factor anyhow
* Split construction, scanning, and building phases of S2WasmBuilder (#400)Derek Schuff2016-04-271-14/+34
| | | | | | | | | | | Instead of doing all of the S2Wasm work in the constructor, split construction, scanning (to determine implemented functions) and building of the wasm module. This allows the linker to get the symbol information (e.g. implemented functions) without having to build an entire module (which will be useful for archives) and to allow the linker to link a new object into the existing one by building the wasm module in place on the existing module.
* Defer creation of CallImports to link time (#395)Derek Schuff2016-04-261-0/+7
| | | s2wasm currently creates a Call AST node if the target is implemented in the current object (thus far assumed to be the final executable) and a CallImport node if not. In preparation for adding additional objects to the link before layout time, we make only Call nodes until link time, and then convert them to CallImport if they are undefined at that time.
* Separate LinkerObject from Linker (#383)Derek Schuff2016-04-251-70/+98
| | | | | Create the LinkerObject class, which has a wasm Module and represents the module plus the information needed to relocate and lay it out. Each Linker owns a "main executable" LinkerObject, and S2WasmBuilder requires a LinkerObject instead of just a Module because LLVM asm files require relocation/linking before they represent a full wasm module. No merging support yet, but the real functionality for #370 is coming soon.
* Simplify statics, segments, and relocations (#380)Derek Schuff2016-04-221-18/+38
| | | | Also defer address assignment until layout time in preparation for separating linker objects out from Linker
* Move wasm-linker into its own cpp file (#375)Derek Schuff2016-04-211-249/+6
| | | | | | | Still making things nicer for #370 Pulling wasm-linker into its own file also necessitated pulling asm_v_wasm.h into a cpp file. It goes into a new lib directory, src/asmjs. No actual code changes in this PR.
* Move Fatal into utilities.h (#376)Derek Schuff2016-04-211-18/+0
| | | | | Follow-on from #372. Probably we should do even better for error handling, and that might mean a cpp file in support, but for now this is a small improvement.
* Factor linker-related functionality of S2WasmBuilder into its own class (#372)Derek Schuff2016-04-211-0/+463
This is the first of a couple of refactorings in for #370 No functionality change, and minimal code change to make it work.