summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-12-07 06:28:44 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2022-01-19 10:56:17 +0100
commitf090004c5f236275ca5142fc578f0375872c0336 (patch)
tree89211048517f2a6ced6529f3c34e2d0cc7070024
parentc3d25b55990e2205af56747aa2935f4ff11ad0aa (diff)
WASM adapt link and debug flags
Changes the linker flags, so a debug build will not rewrite the WASM binary code for instrumentation, as this takes ages and more then 64GB of RAM, currently. For the same reason - long link times - prefer DWARF debugging to the external source maps. Initial memory and thread pool size are linker flags, so move them. Change-Id: I5cf39842e5091ef55b4fac719f881575e69fe8d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128589 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk17
1 files changed, 14 insertions, 3 deletions
diff --git a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
index 3a7441454f0d..2dd31741d3a0 100644
--- a/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/EMSCRIPTEN_INTEL_GCC.mk
@@ -13,13 +13,22 @@ include $(GBUILDDIR)/platform/unxgcc.mk
gb_RUN_CONFIGURE := $(SRCDIR)/solenv/bin/run-configure
# avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps
-gb_EMSCRIPTEN_CPPFLAGS := -pthread -s TOTAL_MEMORY=1GB -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4
-gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS) --bind -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=2 -s EXIT_RUNTIME=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"]
+gb_EMSCRIPTEN_CPPFLAGS := -pthread -s USE_PTHREADS=1
+gb_EMSCRIPTEN_LDFLAGS := $(gb_EMSCRIPTEN_CPPFLAGS)
+
+# Initial memory size and worker thread pool
+gb_EMSCRIPTEN_LDFLAGS += -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=4
+
+# To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
+# See emscrypten.py, finalize_wasm, modify_wasm = True
+# So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
+gb_EMSCRIPTEN_LDFLAGS += --bind -s WASM_BIGINT=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s ASSERTIONS=1 -s EXIT_RUNTIME=0 -s EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16","printErr"]
gb_EMSCRIPTEN_QTDEFS := -DQT_NO_LINKED_LIST -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
gb_Executable_EXT := .html
gb_EMSCRIPTEN_EXCEPT := -s DISABLE_EXCEPTION_CATCHING=0
+gb_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS)
gb_LinkTarget_CFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS)
gb_LinkTarget_CXXFLAGS += $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_QTDEFS) $(gb_EMSCRIPTEN_EXCEPT)
gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_LDFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_EXCEPT)
@@ -27,8 +36,10 @@ gb_LinkTarget_LDFLAGS += $(gb_EMSCRIPTEN_LDFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb
# Linker and compiler optimize + debug flags are handled in LinkTarget.mk
gb_LINKEROPTFLAGS :=
gb_LINKERSTRIPDEBUGFLAGS :=
-# This maps to g4, AKA source maps. The LO default would otherwise be g2!
+# This maps to g3, no source maps, but DWARF with current emscripten!
+# https://developer.chrome.com/blog/wasm-debugging-2020/
gb_DEBUGINFO_FLAGS = -g
+#gb_DEBUGINFO_FLAGS = -gsource-map --source-map-base=file://$(WORKDIR)/LinkTarget/Executable
# We need at least code elimination, otherwise linking OOMs even with 64GB.
# So we "fake" -Og support to mean -O1 for Emscripten and always enable it for debug in configure.
gb_COMPILERDEBUGOPTFLAGS := -O1