You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/12/06 16:29:06 UTC

(nuttx-apps) branch master updated (733b6de81 -> f57cd2cf0)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


    from 733b6de81 toywasm: regen for v35
     new 3129b7a46 tools: Emit map file for wasm module
     new f55b8face wamr: Add support for thumb target triple in Toolchain.defs
     new bd159e103 tools: Split origin Wasm.mk into Wasm.mk and WASI-SDK.defs
     new 3c624d38c tools: Allow customize ld flags for each wasm module
     new f57cd2cf0 tools: Move final wasm module to bin/wasm as elf

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 interpreters/wamr/Toolchain.defs | 39 +++++++++++++-----
 tools/WASI-SDK.defs              | 86 ++++++++++++++++++++++++++++++++++++++++
 tools/Wasm.mk                    | 77 +++++++----------------------------
 3 files changed, 130 insertions(+), 72 deletions(-)
 create mode 100644 tools/WASI-SDK.defs


(nuttx-apps) 05/05: tools: Move final wasm module to bin/wasm as elf

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f57cd2cf0c682d0a34475173e5edaad38ab013d3
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Fri Nov 24 11:42:58 2023 +0800

    tools: Move final wasm module to bin/wasm as elf
    
    And leave all intermediate file in apps/wasm,
    such as .map file, entry object etc used in
    wasm module build.
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 interpreters/wamr/Toolchain.defs | 12 ++++++------
 tools/Wasm.mk                    |  7 +++++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/interpreters/wamr/Toolchain.defs b/interpreters/wamr/Toolchain.defs
index 22185efe6..98a848618 100644
--- a/interpreters/wamr/Toolchain.defs
+++ b/interpreters/wamr/Toolchain.defs
@@ -74,14 +74,14 @@ define WAMR_AOT_COMPILE
 	    $(eval WAMRMODE=$(shell echo $(notdir $(bin)) | cut -d'#' -f5)) \
 	    $(if $(CONFIG_INTERPRETERS_WAMR_AOT), \
 	      $(if $(filter AOT,$(WAMRMODE)), \
-	        $(info Wamrc Generate AoT: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot) \
-	        $(shell $(WRC) $(RCFLAGS) -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot \
-	                          $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null), \
+	        $(info Wamrc Generate AoT: $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot) \
+	        $(shell $(WRC) $(RCFLAGS) -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).aot \
+	                          $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null), \
 	        $(if $(filter XIP,$(WAMRMODE)), \
-	          $(info Wamrc Generate XiP: $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip) \
+	          $(info Wamrc Generate XiP: $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip) \
 	          $(shell $(WRC) $(RCFLAGS) --enable-indirect-mode --disable-llvm-intrinsics \
-	                         -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip \
-	                            $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null) \
+	                         -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).xip \
+	                            $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm > /dev/null) \
 	         ) \
 	       ) \
 	     ) \
diff --git a/tools/Wasm.mk b/tools/Wasm.mk
index ed0fe0bbb..99e93f33c 100644
--- a/tools/Wasm.mk
+++ b/tools/Wasm.mk
@@ -39,7 +39,7 @@ define LINK_WASM
 	    $(eval WLDFLAGS=$(shell cat $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).ldflags)) \
 	    $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(WCC_COMPILER_RT_LIB) \
 	        -Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
-	        -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
+	        -o $(BINDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
 	    $(if $(RETVAL), \
 	        $(error wasm build failed for $(PROGNAME).wasm) \
 	    ) \
@@ -86,7 +86,10 @@ endif
 
 all:: $(WBIN)
 
-depend:: $(APPDIR)$(DELIM)include$(DELIM)wasm$(DELIM)math.h
+$(BINDIR)/wasm:
+	$(Q) mkdir -p $(BINDIR)/wasm
+
+depend:: $(APPDIR)$(DELIM)include$(DELIM)wasm$(DELIM)math.h $(BINDIR)/wasm
 
 $(WOBJS): %.c$(SUFFIX).wo : %.c
 	$(Q) $(WCC) $(WCFLAGS) -c $^ -o $@


(nuttx-apps) 04/05: tools: Allow customize ld flags for each wasm module

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 3c624d38cd2c7f3b59db1325b98e4de57d76847c
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Tue Nov 21 10:52:56 2023 +0800

    tools: Allow customize ld flags for each wasm module
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 tools/WASI-SDK.defs | 2 +-
 tools/Wasm.mk       | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/WASI-SDK.defs b/tools/WASI-SDK.defs
index fee81bedc..e6da857cf 100644
--- a/tools/WASI-SDK.defs
+++ b/tools/WASI-SDK.defs
@@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM),)
 WCFLAGS += -DCONFIG_LIBM=1 -I$(APPDIR)$(DELIM)include$(DELIM)wasm
 endif
 
-WLDFLAGS += -z stack-size=$(STACKSIZE) -Wl,--initial-memory=$(INITIAL_MEMORY)
+WLDFLAGS += -z stack-size=$(STACKSIZE) -Wl,--initial-memory=$(WASM_INITIAL_MEMORY)
 WLDFLAGS += -Wl,--export=main -Wl,--export=__main_argc_argv
 WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
 WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
diff --git a/tools/Wasm.mk b/tools/Wasm.mk
index cce65f1b4..ed0fe0bbb 100644
--- a/tools/Wasm.mk
+++ b/tools/Wasm.mk
@@ -36,6 +36,7 @@ define LINK_WASM
 	    $(eval INITIAL_MEMORY=$(shell echo $(notdir $(bin)) | cut -d'#' -f2)) \
 	    $(eval STACKSIZE=$(shell echo $(notdir $(bin)) | cut -d'#' -f3)) \
 	    $(eval PROGNAME=$(shell echo $(notdir $(bin)) | cut -d'#' -f1)) \
+	    $(eval WLDFLAGS=$(shell cat $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).ldflags)) \
 	    $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(WCC_COMPILER_RT_LIB) \
 	        -Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
 	        -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
@@ -99,6 +100,7 @@ $(WBIN): $(WOBJS)
 	  $(shell cp -rf $(strip $(main:=$(SUFFIX).wo)) \
 	    $(strip $(APPDIR)/wasm/$(progname)#$(WASM_INITIAL_MEMORY)#$(STACKSIZE)#$(PRIORITY)#$(WAMR_MODE)#$(dstname)) \
 	   ) \
+	  $(shell echo $(WLDFLAGS) > $(APPDIR)/wasm/$(progname).ldflags) \
 	 )
 
 clean::


(nuttx-apps) 03/05: tools: Split origin Wasm.mk into Wasm.mk and WASI-SDK.defs

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit bd159e103c083b2be12607b35d6e0623699c5729
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Fri Nov 17 10:44:48 2023 +0800

    tools: Split origin Wasm.mk into Wasm.mk and WASI-SDK.defs
    
    Try to follow current NuttX's toolchain parttern:
    Wasm.mk: Provide target rule for building wasm module
    WASI-SDK.defs: Provide compile flags for building
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 tools/WASI-SDK.defs | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/Wasm.mk       | 67 +++++------------------------------------
 2 files changed, 93 insertions(+), 60 deletions(-)

diff --git a/tools/WASI-SDK.defs b/tools/WASI-SDK.defs
new file mode 100644
index 000000000..fee81bedc
--- /dev/null
+++ b/tools/WASI-SDK.defs
@@ -0,0 +1,86 @@
+
+############################################################################
+# apps/tools/WASI-SDK.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+# wasi-sdk toolchain
+
+WCC ?= $(WASI_SDK_PATH)/bin/clang
+WAR ?= $(WASI_SDK_PATH)/bin/llvm-ar rcs
+
+# Sysroot for building wasm module, default is NuttX
+
+WSYSROOT ?= $(TOPDIR)
+
+# Force disable wasm build when WCC is not exist
+
+ifeq ($(wildcard $(WCC)),)
+  WASM_BUILD = n
+else
+  WASM_BUILD ?= n
+endif
+
+# Force disable wasm build when WASM_SYSROOT is not defined and on specific
+# targets that do not support wasm build.
+# Since some architecture level inline assembly instructions can not be
+# recognized by wasm-clang. For example:
+# Error: /github/workspace/sources/nuttx/include/arch/chip/irq.h:220:27: error: invalid output constraint '=a' in asm
+# asm volatile("rdtscp" : "=a" (lo), "=d" (hi)::"memory");
+
+ifeq ($(CONFIG_ARCH_INTEL64)$(CONFIG_ARCH_SPARC_V8)$(CONFIG_ARCH_AVR)$(CONFIG_ARCH_XTENSA),y)
+  WASM_BUILD = n
+endif
+
+# Build optimization flags from scratch
+
+ifeq ($(CONFIG_DEBUG_FULLOPT),y)
+  WCFLAGS += -Oz
+else ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
+  WCFLAGS += $(CONFIG_DEBUG_OPTLEVEL)
+endif
+
+ifneq ($(CONFIG_LTO_FULL)$(CONFIG_LTO_THIN),)
+  WCFLAGS += -flto
+  WLDFLAGS += -flto
+endif
+
+# Build other compiler flags from native compiler
+
+CFLAGS_STRIP = -fsanitize=kernel-address -fsanitize=address -fsanitize=undefined
+CFLAGS_STRIP += $(ARCHCPUFLAGS) $(ARCHCFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(ARCHOPTIMIZATION) $(EXTRAFLAGS)
+
+WCFLAGS += $(filter-out $(CFLAGS_STRIP),$(CFLAGS))
+WCFLAGS += --sysroot=$(WSYSROOT) -nostdlib -D__NuttX__
+
+# If CONFIG_LIBM not defined, then define it to 1
+ifeq ($(CONFIG_LIBM),)
+WCFLAGS += -DCONFIG_LIBM=1 -I$(APPDIR)$(DELIM)include$(DELIM)wasm
+endif
+
+WLDFLAGS += -z stack-size=$(STACKSIZE) -Wl,--initial-memory=$(INITIAL_MEMORY)
+WLDFLAGS += -Wl,--export=main -Wl,--export=__main_argc_argv
+WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
+WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
+
+WCC_COMPILER_RT_LIB = $(shell $(WCC) --print-libgcc-file-name)
+ifeq ($(wildcard $(WCC_COMPILER_RT_LIB)),)
+  # if "--print-libgcc-file-name" unable to find the correct libgcc PATH
+  # then go ahead and try "--print-file-name"
+  WCC_COMPILER_RT_LIB := $(wildcard $(shell $(WCC) --print-file-name $(notdir $(WCC_COMPILER_RT_LIB))))
+endif
diff --git a/tools/Wasm.mk b/tools/Wasm.mk
index c571f881e..cce65f1b4 100644
--- a/tools/Wasm.mk
+++ b/tools/Wasm.mk
@@ -22,63 +22,13 @@
 # Only build wasm if one of the following runtime is enabled
 
 ifneq ($(CONFIG_INTERPRETERS_WAMR)$(CONFIG_INTERPRETERS_WASM)$(CONFIG_INTERPRETERS_TOYWASM),)
+include $(APPDIR)$(DELIM)tools$(DELIM)WASI-SDK.defs
 include $(APPDIR)$(DELIM)interpreters$(DELIM)wamr$(DELIM)Toolchain.defs
 
-# wasi-sdk toolchain setting
-
-WCC ?= $(WASI_SDK_PATH)/bin/clang
-WAR ?= $(WASI_SDK_PATH)/bin/llvm-ar rcs
-
-# sysroot for building wasm, default is NuttX
-
-ifeq ($(WSYSROOT),)
-	WSYSROOT := $(TOPDIR)
-	
-	# Force disable wasm build when WASM_SYSROOT is not defined and on specific
-	# targets that do not support wasm build.
-	# Since some architecture level inline assembly instructions can not be
-	# recognized by wasm-clang. For example:
-	# Error: /github/workspace/sources/nuttx/include/arch/chip/irq.h:220:27: error: invalid output constraint '=a' in asm
-    # asm volatile("rdtscp" : "=a" (lo), "=d" (hi)::"memory");
-
-	ifeq ($(CONFIG_ARCH_INTEL64)$(CONFIG_ARCH_SPARC_V8)$(CONFIG_ARCH_AVR)$(CONFIG_ARCH_XTENSA),y)
-		WASM_BUILD = n
-	endif
-
-endif
-
-# Only build wasm when WCC is exist
-
-ifneq ($(wildcard $(WCC)),)
-
-CFLAGS_STRIP = -fsanitize=kernel-address -fsanitize=address -fsanitize=undefined
-CFLAGS_STRIP += $(ARCHCPUFLAGS) $(ARCHCFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(ARCHOPTIMIZATION) $(EXTRAFLAGS)
-
-WCFLAGS += $(filter-out $(CFLAGS_STRIP),$(CFLAGS))
-WCFLAGS += --sysroot=$(WSYSROOT) -nostdlib -D__NuttX__
-
-# If CONFIG_LIBM not defined, then define it to 1
-ifeq ($(CONFIG_LIBM),)
-WCFLAGS += -DCONFIG_LIBM=1 -I$(APPDIR)$(DELIM)include$(DELIM)wasm
-endif
-
-WLDFLAGS += -z stack-size=$(STACKSIZE) -Wl,--initial-memory=$(INITIAL_MEMORY)
-WLDFLAGS += -Wl,--export=main -Wl,--export=__main_argc_argv
-WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
-WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
-
-COMPILER_RT_LIB = $(shell $(WCC) --print-libgcc-file-name)
-ifeq ($(wildcard $(COMPILER_RT_LIB)),)
-  # if "--print-libgcc-file-name" unable to find the correct libgcc PATH
-  # then go ahead and try "--print-file-name"
-  COMPILER_RT_LIB := $(wildcard $(shell $(WCC) --print-file-name $(notdir $(COMPILER_RT_LIB))))
-endif
-
-# If called from $(APPDIR)/Make.defs, WASM_BUILD is not defined
+# If called from $(APPDIR)/Makefile,
 # Provide LINK_WASM, but only execute it when file wasm/*.wo exists
 
-ifeq ($(WASM_BUILD),)
-
+ifeq ($(CURDIR),$(APPDIR))
 
 define LINK_WASM
 	$(if $(wildcard $(APPDIR)$(DELIM)wasm$(DELIM)*), \
@@ -86,7 +36,7 @@ define LINK_WASM
 	    $(eval INITIAL_MEMORY=$(shell echo $(notdir $(bin)) | cut -d'#' -f2)) \
 	    $(eval STACKSIZE=$(shell echo $(notdir $(bin)) | cut -d'#' -f3)) \
 	    $(eval PROGNAME=$(shell echo $(notdir $(bin)) | cut -d'#' -f1)) \
-	    $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(COMPILER_RT_LIB) \
+	    $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(WCC_COMPILER_RT_LIB) \
 	        -Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
 	        -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
 	    $(if $(RETVAL), \
@@ -97,15 +47,13 @@ define LINK_WASM
 	 )
 endef
 
-endif # WASM_BUILD
+endif # CURDIR
 
 # Default values for WASM_BUILD, it's a three state variable:
 #   y - build wasm module only
-#   n - don't build wasm module
+#   n - don't build wasm module, default
 #   both - build wasm module and native module
 
-WASM_BUILD ?= n
-
 ifneq ($(WASM_BUILD),n)
 
 WASM_INITIAL_MEMORY ?= 65536
@@ -160,5 +108,4 @@ clean::
 
 endif # WASM_BUILD
 
-endif # WCC
-endif
+endif # CONFIG_INTERPRETERS_WAMR || CONFIG_INTERPRETERS_WASM || CONFIG_INTERPRETERS_TOYWASM


(nuttx-apps) 02/05: wamr: Add support for thumb target triple in Toolchain.defs

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f55b8face6e5ccb3b5d7e53eb637c2e48e6b581a
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Fri Nov 10 15:26:26 2023 +0800

    wamr: Add support for thumb target triple in Toolchain.defs
    
    Before WAMR 1.3.0, eabihf in wamrc is `gnueabihf`, so without
    this patch call wamrc will failed with target abi was `eabihf`,
    we should convert the standard llvm target to wamrc required.
    
    Both `eabihf` and `gnueabihf` supported after WAMR 1.3.0.
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 interpreters/wamr/Toolchain.defs | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/interpreters/wamr/Toolchain.defs b/interpreters/wamr/Toolchain.defs
index c00e1707a..22185efe6 100644
--- a/interpreters/wamr/Toolchain.defs
+++ b/interpreters/wamr/Toolchain.defs
@@ -37,16 +37,35 @@ else ifeq ($(CONFIG_ARCH_SIM),y)
   else
     WTARGET = x86_64
   endif
-else
+else ifeq ($(findstring thumb,$(LLVM_ARCHTYPE)),thumb)
+
+  # target triple of thumb may very complex, such as thumbv8m.main+dsp+mve.fp+fp.dp
+  # so we just use the target name before the first plus sign
 
-  # Flags for other architectures (arm or riscv)
+  WTARGET = $(shell echo $(LLVM_ARCHTYPE) | cut -d'+' -f1)
+endif
 
+# If WTARGET is not defined, then use the same as LLVM_ARCHTYPE
+
+ifeq ($(WTARGET),)
   WTARGET = $(LLVM_ARCHTYPE)
-  WCPU    = $(LLVM_CPUTYPE)
+endif
 
+# If WCPU is not defined, then use the same as LLVM_CPU
+
+ifeq ($(WCPU),)
+  WCPU = $(LLVM_CPUTYPE)
+endif
+
+# If LLVM_ABITYPE is eabihf, then convert it to gnueabihf which is used by wamrc
+
+ifeq ($(LLVM_ABITYPE),eabihf)
+  WABITYPE = gnueabihf
+else
+  WABITYPE = $(LLVM_ABITYPE)
 endif
 
-RCFLAGS += --target=$(WTARGET) --target-abi=$(LLVM_ABITYPE) --cpu=$(WCPU)
+RCFLAGS += --target=$(WTARGET) --target-abi=$(WABITYPE) --cpu=$(WCPU)
 
 define WAMR_AOT_COMPILE
 	$(if $(wildcard $(APPDIR)$(DELIM)wasm$(DELIM)*.wo), \


(nuttx-apps) 01/05: tools: Emit map file for wasm module

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 3129b7a4659dfd2c8e82b9b3ff596a1e9d6976d2
Author: Huang Qi <hu...@xiaomi.com>
AuthorDate: Fri Aug 18 16:48:37 2023 +0800

    tools: Emit map file for wasm module
    
    Emit map file like NuttX's `System.map` for more
    debug information.
    
    Signed-off-by: Huang Qi <hu...@xiaomi.com>
---
 tools/Wasm.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/Wasm.mk b/tools/Wasm.mk
index e112dc01e..c571f881e 100644
--- a/tools/Wasm.mk
+++ b/tools/Wasm.mk
@@ -87,6 +87,7 @@ define LINK_WASM
 	    $(eval STACKSIZE=$(shell echo $(notdir $(bin)) | cut -d'#' -f3)) \
 	    $(eval PROGNAME=$(shell echo $(notdir $(bin)) | cut -d'#' -f1)) \
 	    $(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(COMPILER_RT_LIB) \
+	        -Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
 	        -o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
 	    $(if $(RETVAL), \
 	        $(error wasm build failed for $(PROGNAME).wasm) \