-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Emscripten to 2.0.9 upstream #760
Commits on Nov 29, 2020
-
Update Emscripten to 2.0.9 upstream
For quite some time Themis has been pinning Emscripten to an outdated version of the "fastcomp" flavor because recent versions have been broken, and the new "upstream" flavor has been broken as well. However, Emscripten 2.0+ does not support the "fastcomp" flavor anymore so there is no hope for an fix. Eventually we'd have to migrate to the "upstream" flavor. I have tried out the lastest Emscripten 2.0.9 upstream and it seems to be working--after some further tweaks. There are no signs of the issues that were observed before and prevented Themis Core from being compiled. With the latest version is can be compiled and run. Update the Emscripten version we use on CI to 2.0.9. This is also the version that we'd be building packages with for the next release. Note that the version is pinned and will need to be updated later, we won't be tracking the "latest" tag for a while, until we're sure that WasmThemis works fine with Emscripten 2.0.
Configuration menu - View commit details
-
Copy full SHA for 2ce3c8a - Browse repository at this point
Copy the full SHA 2ce3c8aView commit details -
Disable stack protector for Emscript builds
As noted in the linked issue, the upstream flavor of Emscripten does not yet support LLVM's stack protector so have it disabled. Otherwise linker will produce errors about missing symbols, because they're not there. Some day it may be implemented though so I leave a FIXME in the code.
Configuration menu - View commit details
-
Copy full SHA for 141ec49 - Browse repository at this point
Copy the full SHA 141ec49View commit details -
Use new allocate() API of Emscripten
Themis Core uses the allocate() function provided by Emscripten runtime for quick on-stack allocations. This is a semi-private function which has unstable API. With the new Emscripten version its API has changed, now it accepts a "slab" parameter which indicates the size of the stack that needs to be allocated--for the entire function. That is, if we allocate memory on stack, allocate() may be called only once.
Configuration menu - View commit details
-
Copy full SHA for c78fcf9 - Browse repository at this point
Copy the full SHA c78fcf9View commit details -
Stop using deprecated RESERVED_FUNCTION_POINTERS
RESERVED_FUNCTION_POINTERS does not have much effect on the "upstream" flavor but it was important for the "fastcomp" flavor. Now that since Emscripten 2.0.1 the "fastcomp" flavor is not supported anymore, this option has been a synonym for ALLOW_TABLE_GROWTH. Use the new option instead directly then.
Configuration menu - View commit details
-
Copy full SHA for af047e6 - Browse repository at this point
Copy the full SHA af047e6View commit details -
Work around issues with dead code elimination
For some reason wasm-ld likes to strip *all* (each and every) function of Themis Core from the resulting *.wasm file. While they are there in the object files and archives, linker's dead code elimination thinks they are not needed in the WebAssembly code. Normally this is prevented by EMSCRIPTEN_KEEPALIVE attribute--which we still have and it's still defined--but for some reason it does not work. As a temporary workaround, pass the LINKABLE option to the linker which disables dead code elimination and other link-time optimizations. This leads to somemwhat bigger WebAssembly file which may be a bit slower, but at least this prevents issues. It might be some transient issue with a toolchain so there is a FIXME in the code. We'd need to keep an eye on it for some future releases. However, I have not found any similar issues in Emscripten tracker.
Configuration menu - View commit details
-
Copy full SHA for e97d421 - Browse repository at this point
Copy the full SHA e97d421View commit details
Commits on Nov 30, 2020
-
Configuration menu - View commit details
-
Copy full SHA for b9555e2 - Browse repository at this point
Copy the full SHA b9555e2View commit details