Skip to content

Commit

Permalink
WASI-SDK.defs: Simplify CFLAGS filters
Browse files Browse the repository at this point in the history
Signed-off-by: Huang Qi <[email protected]>
  • Loading branch information
no1wudi authored and xiaoxiang781216 committed Dec 21, 2023
1 parent 11f2d5e commit afa282c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/WASI-SDK.defs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ ifneq ($(CONFIG_LTO_FULL)$(CONFIG_LTO_THIN),)
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)
# Filter out some flags that wasm-clang does not support,
# -m%: Machine flags, -mcpu=, -mfpu=, -mfloat-abi= etc.
# -Wl,%: Extra linker flags, wasm-ld don't support many of them.
# -fsanitize%: -fsanitize=address, -fsanitize=thread etc.
# -fno-sanitize%: -fno-sanitize=address, -fno-sanitize=thread etc.
# -W%: Warning flags, clang is more strict than gcc

CFLAGS_STRIP = -m% -Wl,% -fsanitize% -fno-sanitize% -W%

WCFLAGS += $(filter-out $(CFLAGS_STRIP),$(CFLAGS))
WCFLAGS += --sysroot=$(WSYSROOT) -nostdlib -D__NuttX__
Expand Down

0 comments on commit afa282c

Please sign in to comment.