From caf2e66bcecf3370472bcb9dca266ae5037f7284 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Fri, 5 Aug 2022 18:34:44 +0200 Subject: emcc: Handle -gsource-map (close #2646) --- xmake/modules/core/tools/emcc.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xmake/modules/core/tools/emcc.lua b/xmake/modules/core/tools/emcc.lua index 8c08e4b0d..18fc32848 100644 --- a/xmake/modules/core/tools/emcc.lua +++ b/xmake/modules/core/tools/emcc.lua @@ -45,6 +45,19 @@ end function nf_rpathdir(self, dir) end +-- make the symbol flag +function nf_symbol(self, level) + local kind = self:kind() + if kind == "ld" or kind == "sh" then + -- emscripten requires -gsource-map when linking to map JS/wasm code back to original source + if level == "debug" then + return "-gsource-map" + end + end + + return _super.nf_symbol(self, level) +end + -- make the link arguments list function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- cgit v1.3.1