Skip to content

Commit 566cf0b

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ddbc8a6 commit 566cf0b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,9 @@ endif
994994
ifdef SANITIZE
995995
BASIC_CFLAGS += -fsanitize=$(SANITIZE) -fno-sanitize-recover=$(SANITIZE)
996996
BASIC_CFLAGS += -fno-omit-frame-pointer
997+
ifeq ($(SANITIZE),undefined)
998+
BASIC_CFLAGS += -DNO_UNALIGNED_LOADS
999+
endif
9971000
endif
9981001

9991002
ifndef sysconfdir

0 commit comments

Comments
 (0)