Skip to content
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

Merged
merged 6 commits into from
Dec 1, 2020

Commits on Nov 29, 2020

  1. 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.
    ilammy committed Nov 29, 2020
    Configuration menu
    Copy the full SHA
    2ce3c8a View commit details
    Browse the repository at this point in the history
  2. 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.
    ilammy committed Nov 29, 2020
    Configuration menu
    Copy the full SHA
    141ec49 View commit details
    Browse the repository at this point in the history
  3. 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.
    ilammy committed Nov 29, 2020
    Configuration menu
    Copy the full SHA
    c78fcf9 View commit details
    Browse the repository at this point in the history
  4. 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.
    ilammy committed Nov 29, 2020
    Configuration menu
    Copy the full SHA
    af047e6 View commit details
    Browse the repository at this point in the history
  5. 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.
    ilammy committed Nov 29, 2020
    Configuration menu
    Copy the full SHA
    e97d421 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2020

  1. Configuration menu
    Copy the full SHA
    b9555e2 View commit details
    Browse the repository at this point in the history