Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Allow to enable libasan and libubsan via configure
Baptiste Daroussin committed 5 years ago
commit f176816333fcbe5b860a158da759f49640f4045f
parent 69ac806
2 files changed +18 -0
modified auto.def
@@ -16,6 +16,8 @@ options {
	with-ldns => "add support for libldns"
	with-libarchive.pc => "build with libarchive getting flags via pc files"
	with-coverage => "build with llvm coverage support"
+
	with-asan => "build with libasan support"
+
	with-ubsan => "Build with libubsan support"
}

if {[opt-str pkgconfigdir dir]} {
@@ -255,6 +257,15 @@ cc-check-includes bsd/err.h bsd/libutil.h bsd/readpassphrase.h \
	bsd/stdio.h bsd/strlib.h bsd/string.h bsd/sys/cdefs.h \
	bsd/unistd.h
 
+
if {[opt-bool with-asan]} {
+
	define-append ASAN_CFLAGS -O0 -ggdb -fsanitize=address
+
	define-append ASAN_LDFLAGS -fsanitize=address
+
	define asan 1
+
	undefine HAVE_STATIC
+
}
+
if {[opt-bool with-ubsan]} {
+
	define ubsan 1
+
}
if {[opt-bool with-coverage]} {
	define-append COVERAGE_CFLAGS -O0 -ggdb -fprofile-instr-generate -fcoverage-mapping
	define-append COVERAGE_LDFLAGS -fprofile-instr-generate -fuse-ld=/usr/local/bin/ld.lld
modified mk/defs.mk.in
@@ -5,6 +5,13 @@ CC= @CC@
CFLAGS+=	@COVERAGE_CFLAGS@
LDFLAGS+=	@COVERAGE_LDFLAGS@
@endif
+
@if asan
+
CFLAGS+=	-O0 -ggdb -fsanitize=address
+
LDFLAGS+=	-fsanitize=address
+
@endif
+
@if ubsan
+
CFLAGS+=	-fsanitize=undefined
+
@endif
SHOBJ_CFLAGS=	@SHOBJ_CFLAGS@
LIBSOEXT=	@LIBSOEXT@
SH_SOEXT=	@SH_SOEXT@