Merge remote-tracking branch 'origin/chrome-platform-5.7-fixes' into for-kernelci
[linux-2.6-block.git] / scripts / Makefile.ubsan
CommitLineData
b2441318 1# SPDX-License-Identifier: GPL-2.0
c6d30853 2ifdef CONFIG_UBSAN
0887a7eb
KC
3
4ifdef CONFIG_UBSAN_ALIGNMENT
5 CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)
6endif
7
277a1085
KC
8ifdef CONFIG_UBSAN_BOUNDS
9 CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds)
10endif
11
12ifdef CONFIG_UBSAN_MISC
c6d30853
AR
13 CFLAGS_UBSAN += $(call cc-option, -fsanitize=shift)
14 CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero)
15 CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable)
c6d30853 16 CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow)
c6d30853 17 CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size)
c6d30853
AR
18 CFLAGS_UBSAN += $(call cc-option, -fsanitize=bool)
19 CFLAGS_UBSAN += $(call cc-option, -fsanitize=enum)
277a1085 20endif
c6d30853 21
0887a7eb
KC
22ifdef CONFIG_UBSAN_TRAP
23 CFLAGS_UBSAN += $(call cc-option, -fsanitize-undefined-trap-on-error)
c6d30853 24endif
725c4d22 25
a76bcf55
AB
26 # -fsanitize=* options makes GCC less smart than usual and
27 # increase number of 'maybe-uninitialized false-positives
28 CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
c6d30853 29endif