[PATCH v3 03/28] kbuild: Add CONFIG_OBJTOOL_CONTROL_FLOW

From
Josh Poimboeuf <jpoimboe@kernel.org>
Date
2026-09-21 22:31:38
Also in
linux-kbuild, lkml
Reply to
Josh Poimboeuf, 2026-09-21
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@kernel.org>
---
 lib/Kconfig.debug | 6 ++++++
 lib/Kconfig.ubsan | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 55732323dc16e..798a10ded19fd 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -577,6 +577,12 @@ config OBJTOOL_DEFERRED
 	depends on OBJTOOL
 	depends on LTO_CLANG || X86_KERNEL_IBT || KLP_BUILD
 
+# 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
+
 config STACK_VALIDATION
 	bool "Compile-time stack metadata validation"
 	depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER
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
Thread (34 messages) 34 messages, 2 authors, last reply 2026-09-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help