[PATCH 03/27] kbuild: Add CONFIG_OBJTOOL_CONTROL_FLOW
From: Josh Poimboeuf
Date: Fri Aug 28 2026 - 00:53:15 EST
Add a config option for when objtool reverse engineers the control flow
graph of every function.
No functional change.
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
lib/Kconfig.debug | 10 ++++++++--
lib/Kconfig.ubsan | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 9ca9b2519d604..0ea5ad31969ce 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -588,8 +588,14 @@ config NOINSTR_VALIDATION
select OBJTOOL
default y
-# For when objtool defers its work to the linked image (vmlinux.o or module.o)
-# rather than running on individual translation units.
+# Objtool reverse-engineers the control flow graph
+config OBJTOOL_CONTROL_FLOW
+ def_bool y
+ depends on OBJTOOL
+ depends on UNWINDER_ORC || STACK_VALIDATION || HAVE_UACCESS_VALIDATION
+
+# Objtool defers its work to the linked image (vmlinux.o or module.o) rather
+# than running on individual translation units.
config OBJTOOL_DEFERRED
def_bool y
depends on OBJTOOL
diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index 1ecaae7064d2a..61e8c86ef63be 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -110,7 +110,7 @@ config UBSAN_UNREACHABLE
bool "Perform checking for unreachable code"
# objtool already handles unreachable checking and gets angry about
# seeing UBSan instrumentation located in unreachable places.
- depends on !(OBJTOOL && (STACK_VALIDATION || UNWINDER_ORC || HAVE_UACCESS_VALIDATION))
+ depends on !OBJTOOL_CONTROL_FLOW
depends on $(cc-option,-fsanitize=unreachable)
help
This option enables -fsanitize=unreachable which checks for control
--
2.55.0