From 1bd1daf73a58360a6fbd39f30f9a33728e1c7af4 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Mon, 20 Jul 2026 16:24:08 +0100 Subject: [PATCH] toolchains/emscripten/defs.mak LINK with LD --- toolchains/emscripten/defs.mak | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/toolchains/emscripten/defs.mak b/toolchains/emscripten/defs.mak index c1137bea..43f1933f 100644 --- a/toolchains/emscripten/defs.mak +++ b/toolchains/emscripten/defs.mak @@ -18,6 +18,13 @@ # Activate the WASM link target in magic/Makefile. MAKE_WASM = 1 +# Preserve DWARF debug info through emcc -r (partial-link) steps. +# Without -g, emcc -r defaults to GENERATE_DWARF=0, which causes building.py +# to add --strip-debug to wasm-ld, discarding the DWARF produced by -g in +# CFLAGS. That leaves magic.wasm without debug sections, making -gsource-map +# produce an empty source map at the final link. +LINK = $(LD) -r -g + # Emscripten linker flags. # The link step runs from the magic/ subdirectory, so embed-file paths # are relative to that directory (../scmos, ../windows/...).