Emscripten: Increase the main thread stack size

At least when LO tries to download a document and
UUIInteractionHelper::handleErrorHandlerRequest wants to show a MessageDialog
via Qt, the stack grows relatively large, and gray_convert_glyph
(workdir/UnpackedTarball/freetype/src/smooth/ftgrays.c) alone allocates on the
stack a buffer of size FT_MAX_GRAY_POOL * sizeof(TCell) = 1024 * 16 = 16K, which
causes (silent, due to no -sSTACK_OVERFLOW_CHECK=2) stack overflow.

So (somewhat randomly) double the size of the main thread stack to 128K; but, at
least for now, keep the default value of 64K for other threads (which would
otherwise inherit the explicitly set -sSTACK_SIZE value via the
-sDEFUALT_PTHREAD_STACK_SIZE=0 default).

Change-Id: I96583f4af93c84b15c67f310068c5631fb129d40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172011
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann 2024-08-18 15:15:29 +02:00
parent 3d27d68c21
commit 4f41c19a03

View file

@ -17,6 +17,9 @@ gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS)
# Initial memory size
gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB
# Double the main thread stack size, but keep the default value for other threads:
gb_EMSCRIPTEN_LDFLAGS += -sSTACK_SIZE=131072 -sDEFAULT_PTHREAD_STACK_SIZE=65536
# To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
# See emscripten.py, finalize_wasm, modify_wasm = True
# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)