Remove the SYSCALL_USE_SOCKETCALL definition which was causing
musl to use a single syscall for all socket calls (a mostly legacy
linux convention apparently).
This is much better for emscripten because it allows DCE and more
precise dependencies.
This allows us to then remove some of our emscripten-specific
arch headers that are not longer needed (since they do not
differ from the generic version).
This is part of making musl updates easier.
See #7279
Use <<< >>> for late-substitution replacements as opposed to {{{ }}}
which is used to by the JS compiler.
This avoids the somewhat confusing getQuoted function which works as
an escape hatch.
This fixes big where linking MAIN_MODULE and libgl was bring in
undefined references to GL2 symbols. Normally including this extra
`webgl.c` file in the library would be harmless since it will be ignored
if no GL2 symbols are used.
However, with MAIN_MODULE mode all objects from all libraries are
included which means that webgl2.o is included which itself references
all webgl2 symbols.
The problem specifically is that `webgl2.c` includes
`emscripten_webgl2_get_proc_address` which in turn references all
the `emscripten_XXX` versions of the GL2 API such as
`emscripten_glReadBuffer` which are defined in `library_webgl2.js`
Fixes: #13101
This class/code used to do a lot more in the past so it made sense
to have a separate class. Now that the logic is simpler we can just
directly die the metadata for a further simplification.
* In PR #7918, the option MEMFS_APPEND_TO_TYPED_ARRAYS=0 was removed, dropping the support for using regular JS Arrays to back MEMFS file storage. In this PR, complete the removal of old code that related to JS Array backing, since all files are now typed array backed.
* Migrate tests to use the MEMFS typed array API.
* Fix tests.
This support is still experimental and has some major
caveats:
- Only supports load-time dynamic linking
- No support for sharing TLS data between dylibs.
The major change is that workers now also call the module `run` function
although they exit early, once dynamic libraries have all been loaded.
See: #3494
When registering atexit handlers in __postset functions the convention
elsewhere seems to be to prefer this helper function (which does
nothing when EXIT_RUNTIME is not set).
Rather then using `getQuoted` and then special-case replacements for
pre/post we can just use internal settings.
This has the advantage that these settings can be included in library
code as we as the pre/post js.
After this change getQuoted now only has a couple of remainging
uses for ATINITS, ATEXITS, ATMAINS and WASM_BINARY_DATA
- Properly read from the circular buffer (fixes#13173)
- Fix requested frame count check (it was failing when requested frequency was higher than source frequency)
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
Its hard for me to tell exactly what this was originally trying
to express, but right now it looks broken.
Prior to bcf60cea I think it might
have made more sense when the function was just one element of the
list, but then with bcf60cea it became a function with the list inside
it as expressions that do nothing.
We want these files to take presence over the clang builtin
include so we put them in the compat directory which is explictly
added to include path and therefore comes before clang's builtin
include directory.
Now that we build the sysroot, including the header tree programatically
we can restore the original layout of the musl and libcxx directories.
This will make future updates and comparisons with upstream easier.
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
This was split out from the change to use a single sysroot (#13090). I
think it cleaner this way: There is single cache, with single lock file
and the root doesn't change, but the libraries live in sub-directories
within the cache.