[PATCH 5/5] Makefile: disable unaligned loads with UBSan
- From
Jeff King <peff@peff.net>
- Date
- Jul 10, 2017, 13:24 UTC
- Message-ID
- <20170710132450.yxojk5cybejy7und@sigill.intra.peff.net>
- In-Reply-To
- <20170710132418.d6bvzxwvbejretb4@sigill.intra.peff.net>
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> --- Makefile | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile index cc03b3c95..3c341b2a6 100644 --- a/Makefile +++ b/Makefile @@ -1015,6 +1015,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
-- 2.13.2.1071.gcd8104b61