aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-07-10 09:24:50 -0400
committerJunio C Hamano <gitster@pobox.com>2017-07-10 10:02:31 -0700
commit566cf0b3bd6458a74e8a3df8c01d27f35e7814f2 (patch)
treec94e14da28e1bb5d6e5862cb964579e6425415a0 /Makefile
parentddbc8a6d3e15acba2e145fb9c8cd93c1531cc576 (diff)
downloadgit-566cf0b3bd6458a74e8a3df8c01d27f35e7814f2.tar.gz
git-566cf0b3bd6458a74e8a3df8c01d27f35e7814f2.tar.xz
Makefile: disable unaligned loads with UBSan
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>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d03880e69..852dedc25 100644
--- 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