summaryrefslogtreecommitdiff
path: root/scripts/test/lld.py
Commit message (Collapse)AuthorAgeFilesLines
* [wasm-emscripten-finalize] Remove --separate-data-segments (#6091)Sam Clegg2023-11-271-37/+12
| | | See #6088
* Remove metadata generation from wasm-emscripten-finalize (#4863)Sam Clegg2022-08-071-10/+0
| | | | This is no longer needed by emscripten as of: https://github.com/emscripten-core/emscripten/pull/16529
* Add --no-emit-metadata option to wasm-emscripten-finalize (#4450)Sam Clegg2022-01-191-1/+3
| | | | | | This is useful for the case where we might want to finalize without extracting metadata. See: https://github.com/emscripten-core/emscripten/pull/15918
* Fixed wasm-emscripten-finalize AsmConstWalker not handling 64-bit pointers ↵Wouter van Oortmerssen2020-12-141-3/+9
| | | | | (#3431) Also improved the LLD test scripts to accomodate 64-bit tests.
* Introduce lit/FileCheck tests (#3367)Thomas Lively2020-11-181-2/+0
| | | | | | | | | | | | | | | lit and FileCheck are the tools used to run the majority of tests in LLVM. Each lit test file contains the commands to be run for that test, so lit tests are much more flexible and can be more precise than our current ad hoc testing system. FileCheck reads expected test output from comments, so it allows test output to be written alongside and interspersed with test input, making tests more readable and precise than in our current system. This PR adds a new suite to check.py that runs lit tests in the test/lit directory. A few tests have been ported to demonstrate the features of the new test runner. This change is motivated by a need for greater flexibility in testing wasm-split. See #3359.
* Move optional metadata field so its not last (#2909)Sam Clegg2020-06-111-6/+15
| | | | To avoid the conditional trailing comma.
* Add additional test for --check-stack-overflow (#2857)Sam Clegg2020-05-181-31/+33
| | | | | This test verifies that functions in the llvm input source that do stack pointer manipulation get correctly handled by `wasm-emscripten-finalize --check-stack-overflow` (StackLimitEnforcer)
* Remove executable bit from test scripts (#2734)Sam Clegg2020-04-091-5/+0
| | | | | | | | | | | | | | | | | | These are no all driven by only by the two top level scripts: check.py auto_update_tests.py What is more all of them were broken when run isolation due to relative import rules in python3. e.g.: ``` $ scripts/test/binaryenjs.py Traceback (most recent call last): File "scripts/test/binaryenjs.py", line 21, in <module> from . import shared ImportError: cannot import name 'shared' from '__main__' (scripts/test/binaryenjs.py) ```
* JS/Wasm BigInt support for wasm-emscripten-finalize (#2726)Alon Zakai2020-04-071-0/+2
| | | | | If wasm-emscripten-finalize is given the BigInt flag, then we will be using BigInts on the JS side, and need no legalization at all since i64s will just be BigInts.
* Avoid unnecessary fp$ in side modules (#2717)Alon Zakai2020-03-311-15/+15
| | | | | | | | | | | | | | | | Now that we update the dylink section properly, we can do the same optimization in side modules as in main ones: if the module provides a function, don't call an $fp method during startup, instead add it to the table ourselves and use the relative offset to the table base. Fix an issue when the table has no segments initially: the code just added an offset of 0, but that's not right. Instead, an a __table_base import and use that as the offset. As this is ABI-specific I did it on wasm-emscripten-finalize, leaving TableUtils to just assert on having a singleton segment. Add a test of a wasm file with a dylink section to the lld tests.
* Convert remaining python scripts to run under python3 (#2643)Sam Clegg2020-02-111-1/+1
|
* Support stack overflow checks in standalone mode (#2525)Alon Zakai2019-12-121-7/+7
| | | | | | | | | In normal mode we call a JS import, but we can't import from JS in standalone mode. Instead, just trap in that case with an unreachable. (The error reporting is not as good in this case, but at least it catches all errors and halts, and the emitted wasm is valid for standalone mode.) Helps emscripten-core/emscripten#10019
* Rename a couple of files that were missing in #2518 (#2521)Sam Clegg2019-12-101-1/+1
|
* Use wat over wast for text format filenames (#2518)Sam Clegg2019-12-081-15/+15
|
* Use package name in imports (NFC) (#2462)Heejin Ahn2019-11-221-14/+15
| | | | | Don't directly import names from shared.py and support.py, and use prefixes instead. Also this reorders imports based on PEP recommendation.
* Simplify test scripts (NFC) (#2457)Heejin Ahn2019-11-201-3/+3
| | | | | | | | This makes test scripts simpler by reducing loop depths and extracting repeating code into methods or variables. - `get_tests` returns a list of tests with specified extensions. This includes files with a full path rather than just file names. - Reduces loop depths by using early exits and `get_tests`.
* Add a --standalone-wasm flag to wasm-emscripten-finalize (#2333)Alon Zakai2019-09-181-0/+2
| | | The flag indicates that we want to run the wasm by itself, without JS support. In that case we don't emit JS dynCalls etc., and we also emit a wasi _start if there is a main, i.e., we try to use the current conventions in the wasm-only space.
* Switch python indentation from 2-space to 4-space (#2299)Sam Clegg2019-08-161-56/+56
| | | | | | | | pep8 specifies 4 space indentation. The use of 2 spaces is, I believe a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. Since there isn't too much code in binaryen today it seems reasonable to make the switch.
* Implement --check-stack-overflow flag for wasm-emscripten-finalize (#2278)Guanzhong Chen2019-08-021-4/+6
|
* Python3-ify check.py and auto_update_tests.py (#2270)Alon Zakai2019-07-311-7/+7
| | | | | I fixed flatten.bin.txt which seems to have just had some corrupted data, and I removed some fancy unicode from the spec comments tests, which I'm not sure it's important enough to figure out how to fix. Fixes #1691
* Handle passive segments in wasm-emscripten-finalize (#2217)Thomas Lively2019-07-111-3/+11
|
* Ignore --initial-stack-pointer arg to wasm-emscripten-finalize (#2201)Sam Clegg2019-07-101-1/+1
| | | | | | | | | | | | | We were passing bad value in --initial-stack-pointer which did not include the STATIC_BUMP (since STATIC_BUMP is determinted by the output of finalize). If emscripten wants to set the stack pointer position it can do so by calling the stackRestore() function at startup. This argument will be removed completely once we stop passing it on the emscripten side. See https://github.com/emscripten-core/emscripten/issues/8905
* wasm-emscripten-finalize: Improve shared library support (#1961)Sam Clegg2019-04-021-4/+11
| | | | | | | | | | | | | | | | | Convert PIC code generated by llvm to work with the current emscripten ABI for dynamic linking: - Convert mutable global imports from GOT.mem and GOT.func into internal globals. - Initialize these globals on started up in g$foo and f$foo imported functions to calculate addresses at runtime. Also: - Add a test case for linking and finalizing a shared library - Allow __stack_pointer global to be non-existent as can be case for a shared library. - Allow __stack_pointer global to be an import, as can be the case for a shared library.
* Improve test scripts (#1959)* Improve test scripts * feedback [skip ci]Sam Clegg2019-03-211-0/+21
| | | | | - Move auto_update_tests.py code into respective scripts - Use shared argument parsing in generate_lld_tests.py - Use wasm-ld rather than passing -flavor
* wasm-emscripten-finalize: Remove JSCall thunk generation (#1938)Sam Clegg2019-03-121-1/+0
| | | | We now implement addFunction by creating a wasm module to wrap that JS function and simply adding it to the table.
* Emscripten stack simplification (#1870)Alon Zakai2019-01-161-1/+1
| | | | | | This takes advantage of the recent memory simplification in emscripten, where JS static allocation is done at compile time. That means we know the stack's initial location at compile time, and can apply it. This is the binaryen side of that: * asm2wasm support for asm.js globals with an initial value var X = Y; where Y is not 0 (which is what the stack now is). * wasm-emscripten-finalize support for a flag --initial-stack-pointer=X, and remove the old code to import the stack's initial location.
* Add wasm-emscripten-finalize flag to separate data segments into a file (#1741)Derek Schuff2018-11-141-5/+11
| | | | This writes the data section into a file suitable for use with emscripten's --memory-init-file flag
* Cleanup scripts in scripts/test (#1566)Sam Clegg2018-05-251-1/+0
| | | | | | | | | | Remove executable bit and #! from scripts that don't have entry point. Add missing licence test. Move arg parsing into a function. Remove legacy --only_prepare (with underscrore) argument.
* include the filename in erroneous diff output where possible (#1452)Nathan Froyd2018-03-191-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Failing test cases often start out with: ``` incorrect output, diff: --- expected +++ actual ``` which makes it difficult to figure out where the expected output might live. That information can be derived from examining the tests, of course, but it'd be much nicer if it were provided in the diff to see straightaway. We do this by introducing a new check, one which takes a filename of expected output, which then enables us to display the failing file, e.g.: ``` incorrect output, diff: --- /home/froydnj/src/binaryen.git/test/passes/code-folding.txt +++ actual ``` which is arguably nicer. Having this new check also enables reducing some boilerplate `open(...).read()` calls in various places. There are still a few places using `fail_if_not_identical`, usually because `.strip()` is used on the expected output.
* Fold wasm-link-metadata into wasm-emscripten-finalize (#1408)Jacob Gravelle2018-02-141-29/+3
| | | | | | | * wasm-link-metadata: Use `__data_end` symbol. * Add --global-base param to emscripten-wasm-finalize to compute staticBump properly * Let ModuleWriter write to a provided Output object
* Emscripten addFunction support for Wasm backend (#1395)Heejin Ahn2018-02-071-19/+36
| | | This adds necessary command line options for addFunction support, and generates required jsCall imports and generates jsCall thunk functions.
* First pass at LLD support for Emscripten (#1346)Jacob Gravelle2018-01-221-0/+62
* Skeleton of a beginning of o2wasm, WIP and probably not going to be used * Get building post-cherry-pick * ast->ir, remove commented out code, include a debug module print because linking * Read linking section, print emscripten metadata json * WasmBinaryWriter emits user sections on Module * Remove debugging prints, everything that isn't needed to build metadata * Rename o2wasm to lld-metadata * lld-metadata support for outputting to file * Use tables index instead of function index for initializer functions * Add lld-emscripten tool to add emscripten-runtime functions to wasm modules (built with lld) * Handle EM_ASM in lld-emscripten * Add a list of functions to forcibly export (for initializer functions) * Disable incorrect initializer function reading * Add error printing when parsing .o files in lld-metadata * Remove ';; METADATA: ' prefix from lld-metadata, output is now standalone json * Support em_asm consts that aren't at the start of a segment * Initial test framework for lld-metadata tool * Add em_asm test * Add support for WASM_INIT_FUNCS in the linking section * Remove reloc section parsing because it's unused * lld-emscripten can read and write text * Add test harness for lld-emscripten * Export all functions for now * Add missing lld test output * Add support for reading object files differently Only difference so far is in importing mutable globals being an object file representation for symbols, but invalid wasm. * Update help strings * Update linking tests for stackAlloc fix * Rename lld-emscripten,lld-metadata to wasm-emscripten-finalize,wasm-link-metadata * Add help text to header comments * auto& instead of auto & * Extract LinkType to abi/wasm-object.h * Remove special handling for wasm object file reading, allow mutable globals * Add braces around default switch case * Fix flake8 errors * Handle generating dyncall thunks for imports as well * Use explicit bool for stackPointerGlobal * Use glob patterns for lld file iteration * Use __wasm_call_ctors for all initializer functions