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::