From 5ba884a576afb0ec22660678790621b2a1c4a8e1 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 5 Dec 2021 02:22:26 +0100 Subject: configure: Add --enable-sanitize-address --enable-sanitize-address makes sure that all code is compiled with -fsanitizer=address and all tests run against libasan. It can be combined with --enable-sanitize-undefined, but not with --enable-valgrind. In maintainer mode there is one program that causes leaks, i386_gendis, so disable leak detection for that program. One testcase, test_nlist, needs special linker flags, make sure it also uses -fsanitizer=address when using the address sanitizer. Signed-off-by: Mark Wielaard --- libcpu/ChangeLog | 5 +++++ libcpu/Makefile.am | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'libcpu') diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index 7cca9419..48fbba19 100644 --- a/libcpu/ChangeLog +++ b/libcpu/ChangeLog @@ -1,3 +1,8 @@ +2021-12-04 Mark Wielaard + + * Makefile.am (GENDIS_ENV): New variable, depends on + USE_ADDRESS_SANITIZER. + 2020-12-20 Dmitry V. Levin * .gitignore: New file. diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am index 43844ecf..57d0a164 100644 --- a/libcpu/Makefile.am +++ b/libcpu/Makefile.am @@ -61,8 +61,16 @@ noinst_HEADERS += memory-access.h i386_parse.h i386_data.h noinst_PROGRAMS = i386_gendis$(EXEEXT) +# i386_gendis doesn't clean up, ignore leaks. +# It is just a build tool to generate source in maintainer mode. +if USE_ADDRESS_SANITIZER +GENDIS_ENV=env ASAN_OPTIONS=detect_leaks=0 +else +GENDIS_ENV= +endif + $(srcdir)/%_dis.h: %_defs i386_gendis$(EXEEXT) - $(AM_V_GEN)./i386_gendis$(EXEEXT) $< > $@T + $(AM_V_GEN) $(GENDIS_ENV) ./i386_gendis$(EXEEXT) $< > $@T $(AM_V_at)mv -f $@T $@ else -- cgit v1.2.1