tools: Allow customize ld flags for each wasm module
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
bd159e103c
commit
3c624d38cd
@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM),)
|
|||||||
WCFLAGS += -DCONFIG_LIBM=1 -I$(APPDIR)$(DELIM)include$(DELIM)wasm
|
WCFLAGS += -DCONFIG_LIBM=1 -I$(APPDIR)$(DELIM)include$(DELIM)wasm
|
||||||
endif
|
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=main -Wl,--export=__main_argc_argv
|
||||||
WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
|
WLDFLAGS += -Wl,--export=__heap_base -Wl,--export=__data_end
|
||||||
WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
|
WLDFLAGS += -Wl,--no-entry -Wl,--strip-all -Wl,--allow-undefined
|
||||||
|
@ -36,6 +36,7 @@ define LINK_WASM
|
|||||||
$(eval INITIAL_MEMORY=$(shell echo $(notdir $(bin)) | cut -d'#' -f2)) \
|
$(eval INITIAL_MEMORY=$(shell echo $(notdir $(bin)) | cut -d'#' -f2)) \
|
||||||
$(eval STACKSIZE=$(shell echo $(notdir $(bin)) | cut -d'#' -f3)) \
|
$(eval STACKSIZE=$(shell echo $(notdir $(bin)) | cut -d'#' -f3)) \
|
||||||
$(eval PROGNAME=$(shell echo $(notdir $(bin)) | cut -d'#' -f1)) \
|
$(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) \
|
$(eval RETVAL=$(shell $(WCC) $(bin) $(WBIN) $(WCFLAGS) $(WLDFLAGS) $(WCC_COMPILER_RT_LIB) \
|
||||||
-Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
|
-Wl,--Map=$(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).map \
|
||||||
-o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
|
-o $(APPDIR)$(DELIM)wasm$(DELIM)$(PROGNAME).wasm || echo 1;)) \
|
||||||
@ -99,6 +100,7 @@ $(WBIN): $(WOBJS)
|
|||||||
$(shell cp -rf $(strip $(main:=$(SUFFIX).wo)) \
|
$(shell cp -rf $(strip $(main:=$(SUFFIX).wo)) \
|
||||||
$(strip $(APPDIR)/wasm/$(progname)#$(WASM_INITIAL_MEMORY)#$(STACKSIZE)#$(PRIORITY)#$(WAMR_MODE)#$(dstname)) \
|
$(strip $(APPDIR)/wasm/$(progname)#$(WASM_INITIAL_MEMORY)#$(STACKSIZE)#$(PRIORITY)#$(WAMR_MODE)#$(dstname)) \
|
||||||
) \
|
) \
|
||||||
|
$(shell echo $(WLDFLAGS) > $(APPDIR)/wasm/$(progname).ldflags) \
|
||||||
)
|
)
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
|
Loading…
Reference in New Issue
Block a user