Граф коммитов

1825 Коммитов

Автор SHA1 Сообщение Дата
Sam Clegg d72835a3b9
Add new REVERSE_DEPS setting to control reverse dependencies (#13448)
See settings.js for details of how the option works.

Fixes: #13409
2021-02-09 09:49:46 -08:00
jprendes 46ade19398
Add side module table entries to functionsInTableMap (#13385)
Fix incorrect "function in Table but not functionsInTableMap" assertions
by adding new entries in the table from a side module to
functionsInTableMap.

Fixes #13347
Fixes #13040
2021-02-04 14:29:18 -08:00
juj 5d22425c86
4GB emmalloc (#13258)
* Add support for emmalloc for 4GB heap sizes. Fix an issue that caused -s MAXIMUM_MEMORY=4G -s ABORTING_MALLOC=0 to crash, instead of returning zero on failed growth operation. Remove the unnecessary 16MB minimum heap growth size clamp: heap growth is not that costly, and 16MB can be excessive for tiny applications. Add emmalloc-debug and emmalloc-debug-log MALLOC options that allow building emmalloc with its debugging options, without needing to manually edit emmalloc.cpp sources to activate. Remove old asm.js/32-bit only code in emmalloc. Remove old workaround for wasm2js codegen bug in emmalloc.

* Update embuilder.py.

* Rename emmalloc special targets to "memvalidate" and "verbose", and adjust their variations to fix embuilder.py.

* Update tests.

* Update variations.

* Fix emmalloc system lib naming.

* Fix memory region merging check and test_emmalloc naming.

* Address review

* Fix case on test_zzz_zzz_4gb_fail

* Rebaseline code size tests
2021-02-04 12:58:43 +02:00
Derek Schuff 771c941f00
Revert "Cleanup tools/emprofile.py and add more testing. NFC (#13403)" (#13410)
This reverts commit 9fc7f41b9b.
2021-02-03 14:11:23 -08:00
Sam Clegg 9fc7f41b9b
Cleanup tools/emprofile.py and add more testing. NFC (#13403) 2021-02-02 13:25:34 -08:00
Derek Schuff cc08b2b299
Don't rely on LLVM's -debug flag in tests (#13390)
It's compiled away in release/non-asserts mode, so the invocation fails
with an unknown argument.
2021-02-01 17:54:57 -08:00
Sam Clegg df83597bee
Update llvm dependency to 13.0 (#13383)
Followup on #13358.  Remove exceptions now that llvm 13 has rolled
into emscripten-releases.
2021-01-29 11:39:07 -08:00
Sam Clegg 06825ec9e4
Don't export all symbols in RELOCATABLE mode. (#13366)
Since we don't have many users who use RELOCATABLE directly it
went unnoticed that setting this option on its own was causing all
symbols to be included and exported.

Fixes #13029
2021-01-28 15:57:25 -08:00
Sam Clegg 96ffe11d0f
Remove complexity in caching of llvm-nm results. NFC (#13360)
This extra argument (include_internal) and the extra complexity
it entailed had only a single call site in the test suite.

Calling llvm-nm directly in the test suite is much simpler.
2021-01-28 13:49:07 -08:00
Sam Clegg deab7783df
Update expected llvm version to 13.0 (#13358)
This change temporarily disables the version check to allow
the llvm change to roll in.

Copied from the previous time around: #11637.
2021-01-28 11:46:45 -08:00
iamahuman 6928ece32d
emcc: support merging static library into a single object (#7683)
Remove the optimization (again) for the special case of single object
input, which skips the linker and directly copies the input object file
to output.

This behavior interferes with linking (merging) all objects in a
library archive into a single object, done with the following command:

    cc -o lib.o -r -Wl,--whole-archive lib.a

The optimization was once useful when no clear distinction was made
between compile mode and link-only mode.  It was also required for
compatibility (see #9510 and #9571).

However, #9510 was addressed by #9511, and #9600 introduced the '-r'
flag that allows to explicitly indicate linking to an object, making the
optimization less useful.
2021-01-21 15:49:14 -08:00
Patric Stout b0da998f6c
Zero sin_zero when writing a sockaddr_in (#13003)
Although not strictly defined by POSIX, it is done by most (all?)
other implementations, most often in patches over the years as
places got forgotten.
This is mostly useful to allow quick comparing between sockaddr_in
to see if they are the same address.

Fixes #12998
2021-01-20 13:39:52 -08:00
Sam Clegg 585c5e6990
Refactor gen_struct_info to allow separate compilation. NFC. (#13270)
As part of the pending musl update we can no longer (or at least it
becomes problematic) to compile internal musl headers alongside the
public headers.  To avoid this, this change updates gen_struct_info.py
to compile internal headers separately.

To facilitate this, this change adds support for compiling groups of
headers and merging the results into a single json output.

As part of debugging this I added support for compiling every header
file in isolation.  While this is slow, it uncovered a couple of
issues where structs and defines that were listed under the wrong
header and also a header that could not be compiled on its own
(SDL_pixels.h).
2021-01-20 08:52:37 -08:00
Sam Clegg 462ddb4c63
Implement fstatat flag: AT_EMPTY_PATH (#13282)
Also, add new test for fstatat.

I notived this issue while updating to the new musl version that
uses this internally.
2021-01-20 07:55:13 -08:00
Sam Clegg ee483fc6c3
test_other: use self.do_runf where it makes sense. NFC. (#13275) 2021-01-18 09:48:00 -08:00
Sam Clegg 0e92f931e6
Improve error message when check for multiple of page size (#13279)
Also:
- remove duplication of wasm page size specification
- remove old reference to asm.js

Fixes: #13277
2021-01-18 08:18:22 -08:00
Kagami Sascha Rosylight 97f13a10ad
Add libgif port (#13139)
This is useful in building the JPEG XL reference software, for example.
2021-01-13 14:56:33 -08:00
Sam Clegg e099eca3f4
Avoid mangling + demangling in jsifier.js (#13230)
We had a bug that only showed up with symbols that start with `$_`.
These happen to exist in `library_fetch.js` e.g:
`$__emscripten_fetch_xhr`.  In this case, when we mangle, we remove the
leading `$` giving `__emscripten_fetch_xhr`, and then if we demangle we
do that wrong thing and end up removing the `_` instead of re-adding the
  `$`.

This change avoids the round trip by always storing both the mangled
and demangled version of a given symbol.

See #12268
2021-01-11 14:44:25 -08:00
Sam Clegg bbec22890a
Allow overriding STRICT mode setting (#13229)
STRICT mode enables a bunch of other settings but it should still be
possible to individually re-enable them.
2021-01-11 08:39:44 -08:00
Sam Clegg 298b2af371
Build a complete sysroot in the cache directory (#13090)
Rather than adding various include paths, copy any needed headers into
the sysroot along with any libraries.

This means that emscripten can work a lot more like the
traditional cross compiler (e.g. clang -target=xxx --sysroot=yyy),
and we can start to think of the emscripten driver as a seperate
thing to the sysroot.

Fixes: #9353
2021-01-10 04:09:02 -08:00
Sam Clegg 91a177b3ad
Remove remnands of WebVR support (#13210)
See initial removal or the library in #10460.
2021-01-08 14:45:48 -08:00
Thomas Ballinger e0e4f4f31c
JSON-escape directory and file names in file_packager (#13147)
Fixes #13146 which is a directory name with a single quote in it,
that must be escaped.
2021-01-07 10:21:50 -08:00
Sam Clegg 62007d1adb
tests: remove use of `.bc` extension. NFC. (#13164) 2021-01-07 02:52:28 -08:00
Sam Clegg d0d12c7062
Speed up `emcc -v` by not running sanity checks. (#13176)
Since some build tools run `emcc -v` regularly we want to be fast.  This
change avoid running sanity checks which means fewer subprocesses.

On my machine this takes `emcc -v ` from ~300 to ~200 ms.

Add a new options `--check` which will force the running of sanity
checks.

See: #13004
2021-01-06 16:48:27 -08:00
Thomas Lively 0ec8cdae9c
SPLIT_MODULE with dynamic linking (#13070)
Adds an INITIAL_MEMORY option that can be used to ensure that the instrumented
and split modules use the same table size. This is necessary because the table
is created in JS when using dynamic linking, so the table size is baked in to
the JS shared by the instrumented and split builds.

Also makes the dynamic linking infrastructure ignore all exports that start with
`%`. Users should pass --export-prefix='%' to wasm-split so that all of its
synthesized exports will make it through to the secondary module without
interference from the dynamic linker.
2021-01-06 14:37:18 -08:00
Lukas Rieger 81ae87611e
Fix loading wasm in electron by falling back to XHR (#12921)
fixes mono/mono#20592

should fix #11671
2021-01-06 14:31:58 -08:00
Sam Clegg cc8223f995
Remove redundant setting of noExitRuntime in test code. NFC (#13137)
Tests that set a main loop to make an async call don't need to
set this explicitly.
2021-01-06 07:29:27 -08:00
Sam Clegg 8cb4e354c9
tests: use run_in_out_file_test where possible. NFC. (#13169) 2021-01-02 05:24:56 -08:00
Sam Clegg 18c7d69c3e
tests: rely on `-s` settings defaults to True/1. NFC. (#13156)
Generated using:
  `perl -pi -e "s/('-s', '[A-Z_]*)=1'/\1'/g" tests/*.py`

This is good because it is less noise in the test commands, but it also
serves to remind folks reading the tests that this is the easiest
(prefered) way to set settings.
2021-01-02 01:39:21 -08:00
Sam Clegg a8f787e4f8
tests: assume set_setting defaults to 1. NFC. (#13155)
Generated with:
  `perl -pi -e 's/(set_setting.*), 1\)/\1)/g' tests/*.py`
2020-12-31 05:55:14 -08:00
Sam Clegg 23309a45ab
Report correct default target in `emcc -v` (#13132) 2020-12-31 02:48:02 -08:00
Sam Clegg ca07b207f3
Move chdir contextmanager to utils.py. NFC. (#13091) 2020-12-22 11:05:43 -08:00
Derek Schuff aeaf110be9
Add test for http://llvm.org/PR48156 (#13069)
The test is similar to the one from #13038 and covers the change in llvm/llvm-project@cb77e87
2020-12-17 16:48:09 -08:00
Thomas Lively 6e28e4fa4f
Implement proxy handler for SPLIT_MODULE (#13056)
For now, the proxy handler synchronously instantiates the deferred module, then
forwards the original call to the newly patched table slot. This PR extracts the
`instantiateSync` function out of `createWasm` so that the proxy handler can use
it as well.

Updates the existing SPLIT_MODULE test so that the profile will be empty,
causing all functions to be placed in the deferred module.
2020-12-16 19:54:04 -08:00
Sam Clegg b42b59020e
Reduce minmal pthread dependencies (#13048)
Explictly depend on the internal thread functions that we need, and
allow unused ones to be DCE'd.

The biggest win here was removing the forced dependency on vsnprintf
which was being pulled in via
`emscripten_sync_run_in_main_thread_xprintf_varargs`.  Interestingly
this function doesn't seem to have any callers at all but I assume
it has some use so leaving it in the code for now.
2020-12-16 15:50:57 -08:00
Sam Clegg 097cfb8726
Add metadce test for minimal threaded program (#13047)
This sets up a baseline for the size of mutli-threads
program which we can then work to improve on and also
prevents regressions.
2020-12-15 10:09:58 -08:00
Sam Clegg a2eb73f500
Fix null pointer read in realpath (#13032)
Calling realpath with SAFE_HEAP enabled was causing a read of
address zero because realpath calls sys_open with a third argument
and therefor without any varargs at all

Fixes: #12999
2020-12-14 11:32:47 -08:00
Sam Clegg 8e11952d8e
Re-enable test (#13023) 2020-12-12 09:13:59 -08:00
Sam Clegg b8328b9531
Temporarily disable test_metadce_hello_main_module_2 (#13010)
This test needs to be disaled so that a recent llvm change
can roll: https://reviews.llvm.org/D93066

It causes the following diff/failure:

```
AssertionError: Unexpected difference:
--- /b/s/w/ir/k/install/emscripten/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs
+++ /b/s/w/ir/k/install/emscripten/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs.new
@@ -4,7 +4,8 @@
 $__overflow
 $__stdio_write
 $__towrite
-$__wasm_apply_relocs
+$__wasm_apply_data_relocs
+$__wasm_apply_global_relocs
 $__wasm_call_ctors
 $dlmalloc
 $fwrite
```
2020-12-11 09:54:07 -08:00
Milek7 d42c1f98b7
Properly set addrlen in socket syscalls (#12997)
We also don't need to return JS object from __write_sockaddr, change it to returning just errno.

Fixes: #12996
2020-12-10 08:24:15 -08:00
Sam Clegg d01730f674
tests: avoid modifying global JS_ENGINES (#12967)
Modifying this global state seems wrong. Its probably safe because when
we run tests in parallel we use seperate processes, but it wouldn't work
if we switched to using threads.

Instead maintain test-local list of JS engines, and also a seperate list
of extra arguments for node and/v8.
2020-12-08 17:52:20 -08:00
Sam Clegg 8e01def089
Check for file existence while parsing arguments (#12953)
This prevents the user from seeing backtraces like:

```
Traceback (most recent call last):
  File "./emcc.py", line 3310, in <module>
    sys.exit(main(sys.argv))
  File "./emcc.py", line 3303, in main
    ret = run(args)
  File "./emcc.py", line 916, in run
    options, settings_changes, user_js_defines, newargs = parse_args(newargs)
  File "./emcc.py", line 2446, in parse_args
    options.pre_js += open(consume_arg_file()).read() + '\n'
FileNotFoundError: [Errno 2] No such file or directory: 'foo.js'
```
2020-12-04 09:15:52 -08:00
Derek Schuff 3a302c15e4
Remove existing file in test_split_module before renaming over it (#12959)
This behavior seems to be failing tests on Windows.
2020-12-03 15:08:32 -08:00
Sam Clegg 11da087802
Use file_packager launcher script. NFC. (#12956)
Just like emcc and other tools we don't need to know internally
that this is python tool.  Plus using the launcher script means
we are testing whata our users will run.
2020-12-03 14:07:03 -08:00
Sam Clegg ed3976e2fa
Initial framework for SPLIT_MODULE option (#12939)
This option uses the new wasm-split tool in binaryen to generate profile
data and then split a module into a primary and secondary component
modules that can be linked together at runtime.
2020-12-03 10:21:30 -08:00
Sam Clegg 292a0ae285
Improve SYSCALL_DEBUG to include arguments (#12948) 2020-12-03 10:20:09 -08:00
Sam Clegg 1216d230ea
Fix `-s` handling when the following argument is uppercase (#12913)
For example `-s -DFOO` should not be treated as a setting
because `-DFOO` is not a syntactically valid setting name.

Fixes: #12911
2020-11-30 11:33:17 -08:00
Sam Clegg 5dc1e7c36e
Merge pthreads library into libc (#12880)
This is how musl does it and there is no reason we shouldn't
follow suite.
2020-11-25 18:57:34 -08:00
Sam Clegg d5de3ab92f
Fix other.test_system_include_paths on windows (#12877)
Normalize paths before comparing them.
2020-11-24 13:16:08 -08:00
Sam Clegg 72b0caf40c
Paraeterize browser.test_html5 (#12851)
Also rename to test_html5_core so that running test_html5_core*
can be used to run all the variants without matching other tests
that exist with that prefix.
2020-11-24 08:42:15 -08:00