Skip to content

Commit

Permalink
build: Do not use undefined-sanitizer on RISC-V
Browse files Browse the repository at this point in the history
It seems some RISC-V systems don't support UBSan yet.  Let's get rid of
it in the default sanitizer list on RISC-V for now.

    LINK     misc/demangler
  /usr/bin/ld: cannot find -lubsan: No such file or directory
  collect2: error: ld returned 1 exit status

Signed-off-by: Namhyung Kim <[email protected]>
  • Loading branch information
namhyung committed Dec 21, 2023
1 parent 96f2ea1 commit 58128d6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ BENCH_LDFLAGS = -Wl,-z,noexecstack $(LDFLAGS_$@) $(LDFLAGS_bench)
LIB_LDFLAGS = $(COMMON_LDFLAGS) $(LDFLAGS_$@) $(LDFLAGS_lib) -Wl,--no-undefined
TEST_LDFLAGS = $(COMMON_LDFLAGS)

DEFAULT_SANITIZERS := address,leak
ifneq ($(ARCH), riscv64)
DEFAULT_SANITIZERS += $(DEFAULT_SANITIZERS),undefined
endif

ifeq ($(DEBUG), 1)
COMMON_CFLAGS += -O0 -g3 -DDEBUG_MODE=1 -Werror
else
Expand Down Expand Up @@ -128,7 +133,7 @@ ifeq ($(COVERAGE), 1)
endif

ifeq ($(ASAN), 1)
ASAN_CFLAGS := -O0 -g -fsanitize=address,leak,undefined
ASAN_CFLAGS := -O0 -g -fsanitize=$(DEFAULT_SANITIZERS)
UFTRACE_CFLAGS += $(ASAN_CFLAGS)
DEMANGLER_CFLAGS += $(ASAN_CFLAGS)
SYMBOLS_CFLAGS += $(ASAN_CFLAGS)
Expand All @@ -139,7 +144,7 @@ endif

ifneq ($(SAN),)
ifeq ($(SAN), all)
SAN_CFLAGS := -O0 -g -fsanitize=address,leak,undefined
SAN_CFLAGS := -O0 -g -fsanitize=$(DEFAULT_SANITIZERS)
else
SAN_CFLAGS := -O0 -g -fsanitize=$(SAN)
endif
Expand Down

0 comments on commit 58128d6

Please sign in to comment.