summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSirLynix <[email protected]>2022-08-05 18:34:44 +0200
committerSirLynix <[email protected]>2022-08-05 18:34:44 +0200
commitcaf2e66bcecf3370472bcb9dca266ae5037f7284 (patch)
tree2a8aa82fd9bdf417783db848dc44813f13a088ae
parent67a3575689b9761677b48bfb4588712f117924fb (diff)
emcc: Handle -gsource-map (close #2646)
-rw-r--r--xmake/modules/core/tools/emcc.lua13
1 files changed, 13 insertions, 0 deletions
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)