~rcr/rirc

6660defeb7bade304a22a44e5e9650fc4906adc2 — Richard Robbins 2 months ago 6e6e6a1
fix sanitizer scripts linker flags
3 files changed, 6 insertions(+), 10 deletions(-)

M Makefile
M scripts/sanitizers_build.sh
M scripts/sanitizers_test.sh
M Makefile => Makefile +3 -7
@@ 20,17 20,13 @@ CLFAGS_RIRC += -D_DARWIN_C_SOURCE
CFLAGS ?= -O2 -flto
CFLAGS += -DNDEBUG

CFLAGS_DEBUG ?=
CFLAGS_DEBUG += -O0 -g3 -Wall -Wextra -Werror

LDFLAGS_RIRC += -lpthread
LDFLAGS_RIRC := -lpthread

LDFLAGS ?= -flto
LDFLAGS += $(LDFLAGS_RIRC)

LDFLAGS_DEBUG ?=
LDFLAGS_DEBUG += $(LDFLAGS_RIRC)

SRC       := $(shell find $(PATH_SRC) -name '*.c' | sort)
SRC_GPERF := $(patsubst %, %.out, $(shell find $(PATH_SRC) -name '*.gperf'))



@@ 42,11 38,11 @@ OBJS_T += $(PATH_BUILD)/utils/tree.t # Header only file

rirc: $(RIRC_LIBS) $(SRC_GPERF) $(OBJS_R)
	@echo "$(CC) $(LDFLAGS) $@"
	@$(CC) $(LDFLAGS) -o $@ $(OBJS_R) $(RIRC_LIBS)
	@$(CC) $(LDFLAGS) $(LDFLAGS_RIRC) -o $@ $(OBJS_R) $(RIRC_LIBS)

rirc.debug: $(RIRC_LIBS) $(SRC_GPERF) $(OBJS_D)
	@echo "$(CC) $(LDFLAGS_DEBUG) $@"
	@$(CC) $(LDFLAGS_DEBUG) -o $@ $(OBJS_D) $(RIRC_LIBS)
	@$(CC) $(LDFLAGS_DEBUG) $(LDFLAGS_RIRC) -o $@ $(OBJS_D) $(RIRC_LIBS)

$(PATH_BUILD)/%.o: $(PATH_SRC)/%.c $(CONFIG) | $(PATH_BUILD)
	@echo "$(CC) $(CFLAGS) $<"

M scripts/sanitizers_build.sh => scripts/sanitizers_build.sh +2 -2
@@ 5,14 5,14 @@ set -e
export CC=clang

export CFLAGS_DEBUG="-fsanitize=address,undefined -fno-omit-frame-pointer"
export LDFLAGS="-fsanitize=address,undefined -fuse-ld=lld"
export LDFLAGS_DEBUG="-fsanitize=address,undefined -fuse-ld=lld"

make clean rirc.debug

mv rirc.debug rirc.debug.address

export CFLAGS_DEBUG="-fsanitize=thread,undefined -fno-omit-frame-pointer"
export LDFLAGS="-fsanitize=thread,undefined -fuse-ld=lld"
export LDFLAGS_DEBUG="-fsanitize=thread,undefined -fuse-ld=lld"

make clean rirc.debug


M scripts/sanitizers_test.sh => scripts/sanitizers_test.sh +1 -1
@@ 4,7 4,7 @@ set -e

export CC=clang
export CFLAGS_DEBUG="-fsanitize=address,undefined -fno-omit-frame-pointer"
export LDFLAGS="-fsanitize=address,undefined -fuse-ld=lld"
export LDFLAGS_DEBUG="-fsanitize=address,undefined -fuse-ld=lld"

# for core dumps:
# export ASAN_OPTIONS="abort_on_error=1:disable_coredump=0"