randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.58k stars 566 forks source link

Feature request: using WASM exceptions. #3775

Open Trafo opened 1 year ago

Trafo commented 1 year ago

At the moment Botan is not using the WASM exceptions:

lang_flags "-s DISABLE_EXCEPTION_CATCHING=0 -std=c++20 -D_REENTRANT"
lang_binary_linker_flags "-s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -s NO_DISABLE_EXCEPTION_CATCHING"

(in src/build-data/cc/emcc.txt) Can we make it configurable or directly switch to use WASM exceptions, which are from my point of view, much better?:

lang_flags "-fwasm-exceptions -std=c++20 -D_REENTRANT"
lang_binary_linker_flags "-s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -fwasm-exceptions"
randombit commented 1 year ago

@reneme it looks like you added the Emscripten build; wdyt?

reneme commented 1 year ago

The patch you propose looks reasonable to me. Please feel free to create a pull request for that, @Trafo.