summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-12-05 02:22:26 +0100
committerMark Wielaard <mark@klomp.org>2021-12-09 00:29:48 +0100
commit5ba884a576afb0ec22660678790621b2a1c4a8e1 (patch)
tree6d4782418b13256c4b7337bf802f46340a9cada7 /libcpu
parentb947f95c2ce7520bf439386209c95454f1add69e (diff)
downloadelfutils-5ba884a576afb0ec22660678790621b2a1c4a8e1.tar.gz
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 <mark@klomp.org>
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/ChangeLog5
-rw-r--r--libcpu/Makefile.am10
2 files changed, 14 insertions, 1 deletions
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 <mark@klomp.org>
+
+ * Makefile.am (GENDIS_ENV): New variable, depends on
+ USE_ADDRESS_SANITIZER.
+
2020-12-20 Dmitry V. Levin <ldv@altlinux.org>
* .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