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

wasm: Upgrade Emscripten 2.0.13 => 3.0.0 #880

Merged
merged 7 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ _Code:_

- **WebAssembly**

- Updated Emscripten toolchain to the latest version ([#760](https://github.com/cossacklabs/themis/pull/760)).
- Updated Emscripten toolchain to the latest version ([#760](https://github.com/cossacklabs/themis/pull/760), [#880](https://github.com/cossacklabs/themis/pull/880)).
- Node.js v16 is now supported ([#801](https://github.com/cossacklabs/themis/pull/801)).
- TypeScript type definitions and ES6 module are now available, thanks to [**@maxammann**](https://github.com/maxammann) ([#792](https://github.com/cossacklabs/themis/pull/792)).
```js
Expand Down
2 changes: 1 addition & 1 deletion src/wrappers/themis/wasm/emscripten/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.13
3.0.0
2 changes: 1 addition & 1 deletion src/wrappers/themis/wasm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/wrappers/themis/wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wasm-themis",
"version": "0.13.2",
"version": "0.13.13",
"description": "Themis is a convenient cryptographic library for data protection.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/wrappers/themis/wasm/wasmthemis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ WASM_PRE_JS = $(abspath $(WASM_PATH)/emscripten/pre.js)

WASM_PACKAGE = $(BIN_PATH)/wasm-themis.tgz

$(BIN_PATH)/libthemis.js: LDFLAGS += -s EXTRA_EXPORTED_RUNTIME_METHODS=@$(WASM_RUNTIME)
$(BIN_PATH)/libthemis.js: LDFLAGS += -s EXPORTED_RUNTIME_METHODS=@$(WASM_RUNTIME)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why has the changed variable's name? who depends on it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why has the changed variable's name?

Emscripten changelog quoted in commit message:

2.0.18: 04/23/2021
------------------

- `EXTRA_EXPORTED_RUNTIME_METHODS` is deprecated in favor of just using
  `EXPORTED_RUNTIME_METHODS`.

who depends on it?

That would be the linker. This tells what Emscripten runtime methods to retain so that WasmThemis can make use of them.

$(BIN_PATH)/libthemis.js: LDFLAGS += -s ALLOW_TABLE_GROWTH
$(BIN_PATH)/libthemis.js: LDFLAGS += -s MODULARIZE=1
# FIXME(ilammy, 2020-11-29): rely in EMSCRIPTEN_KEEPALIVE instead of LINKABLE
# For some reason existing EMSCRIPTEN_KEEPALIVE macros do not work and without
# LINKABLE flag wasm-ld ends up stripping *all* Themis functions from "*.wasm"
# output, as if removed by dead code elimination.
$(BIN_PATH)/libthemis.js: LDFLAGS += -s LINKABLE=1
# FIXME(ilammy, 2021-11-24): figure out why Emscripten linker is so stupid
# Same as above. For some reason Emscripten linker will either strip everything
# from our WebAssembly module, or complain that BoringSSL functions that Themis
# does not use are missing the from the binary. Suppress the warnings.
$(BIN_PATH)/libthemis.js: LDFLAGS += -s ERROR_ON_UNDEFINED_SYMBOLS=0
$(BIN_PATH)/libthemis.js: LDFLAGS += --pre-js $(WASM_PRE_JS)

$(BIN_PATH)/libthemis.js: CMD = $(CC) -o $@ $(filter %.o %a, $^) $(LDFLAGS)
Expand Down