]> git.neil.brown.name Git - git.git/commitdiff
Makefile: disable unaligned loads with UBSan
authorJeff King <peff@peff.net>
Mon, 10 Jul 2017 13:24:50 +0000 (09:24 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Jul 2017 17:02:31 +0000 (10:02 -0700)
The undefined behavior sanitizer complains about unaligned
loads, even if they're OK for a particular platform in
practice. It's possible that they _are_ a problem, of
course, but since it's a known tradeoff the UBSan errors are
just noise.

Let's quiet it automatically by building with
NO_UNALIGNED_LOADS when SANITIZE=undefined is in use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile

index d03880e6901d5a56470358ab2e58f39e80170700..852dedc25c57b61e5f3747d1c1efb533329fb543 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -994,6 +994,9 @@ endif
 ifdef SANITIZE
 BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
 BASIC_CFLAGS += -fno-omit-frame-pointer
+ifeq ($(SANITIZE),undefined)
+BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
+endif
 endif
 
 ifndef sysconfdir