Blame view

scripts/Makefile.ubsan 1.2 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  # SPDX-License-Identifier: GPL-2.0
bb2732112   Masahiro Yamada   kbuild: move CFLA...
2
3
  
  export CFLAGS_UBSAN :=
0887a7ebc   Kees Cook   ubsan: add trap i...
4
5
6
  ifdef CONFIG_UBSAN_ALIGNMENT
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)
  endif
277a10850   Kees Cook   ubsan: split "bou...
7
  ifdef CONFIG_UBSAN_BOUNDS
6a6155f66   George Popescu   ubsan: introduce ...
8
9
10
11
12
13
14
15
16
        ifdef CONFIG_CC_IS_CLANG
              CFLAGS_UBSAN += -fsanitize=array-bounds
        else
              CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds)
        endif
  endif
  
  ifdef CONFIG_UBSAN_LOCAL_BOUNDS
        CFLAGS_UBSAN += -fsanitize=local-bounds
277a10850   Kees Cook   ubsan: split "bou...
17
18
19
  endif
  
  ifdef CONFIG_UBSAN_MISC
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
20
21
22
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=shift)
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=integer-divide-by-zero)
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=unreachable)
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
23
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=signed-integer-overflow)
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
24
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=object-size)
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
25
26
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=bool)
        CFLAGS_UBSAN += $(call cc-option, -fsanitize=enum)
277a10850   Kees Cook   ubsan: split "bou...
27
  endif
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
28

0887a7ebc   Kees Cook   ubsan: add trap i...
29
30
  ifdef CONFIG_UBSAN_TRAP
        CFLAGS_UBSAN += $(call cc-option, -fsanitize-undefined-trap-on-error)
c6d308534   Andrey Ryabinin   UBSAN: run-time u...
31
  endif
725c4d22b   Christian Borntraeger   ubsan: allow to d...
32

a76bcf557   Arnd Bergmann   Kbuild: enable -W...
33
34
35
        # -fsanitize=* options makes GCC less smart than usual and
        # increase number of 'maybe-uninitialized false-positives
        CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)