]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
kconfig/randconfig: enable UBSAN for randconfig
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 12 Mar 2025 17:51:43 +0000 (18:51 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 20 Mar 2025 16:16:18 +0000 (17:16 +0100)
Introduce an additional Kconfig check to only offer the option if the
compiler supports -fsanitize=undefined.

We no longer use Travis CI, so the original motivation for not enabling
UBSAN might no longer present.  Regardless, the option won't be present in
the first place if the compiler doesn't support -fsanitize=undefined.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/Kconfig
xen/Kconfig.debug
xen/tools/kconfig/allrandom.config

index 72fdb8376087853abe7981b04ca4f16376decefe..2128f0ccfc0b7d8ba95022cec7288e3c558effff 100644 (file)
@@ -37,6 +37,10 @@ config CC_HAS_VISIBILITY_ATTRIBUTE
 config CC_SPLIT_SECTIONS
        bool
 
+# Compiler supports -fsanitize=undefined
+config CC_HAS_UBSAN
+       def_bool $(cc-option,-fsanitize=undefined)
+
 # Set code alignment.
 #
 # Allow setting on a boolean basis, and then convert such selection to an
index c4a8d86912e09b1038deba982048dcd954eda74e..f7cc5ffaabd75d36b121aac1e614db91c2ce3712 100644 (file)
@@ -98,7 +98,7 @@ config SCRUB_DEBUG
 
 config UBSAN
        bool "Undefined behaviour sanitizer"
-       depends on HAS_UBSAN
+       depends on HAS_UBSAN && CC_HAS_UBSAN
        help
          Enable undefined behaviour sanitizer. It uses compiler to insert code
          snippets so that undefined behaviours in C are detected during runtime.
index 76f74320b5b07eb9b5bf9e299ad070b7385ee536..c7753ac4addbeffbae0024fd2de054a06c6274f9 100644 (file)
@@ -1,4 +1,3 @@
 # Explicit option choices not subject to regular RANDCONFIG
 
 CONFIG_GCOV_FORMAT_AUTODETECT=y
-CONFIG_UBSAN=n