objtool: Enable unreachable warnings for CLANG LTO
authorJosh Poimboeuf <jpoimboe@redhat.com>
Mon, 18 Apr 2022 16:50:20 +0000 (09:50 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 19 Apr 2022 19:58:48 +0000 (21:58 +0200)
With IBT support in, objtool is now fully capable of following vmlinux
code flow in LTO mode.  Start reporting unreachable warnings for Clang
LTO as well.

Fixes: ed53a0d97192 ("x86/alternative: Use .ibt_endbr_seal to seal indirect calls")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/7b12df54bceeb0761fe9fc8269ea0c00501214a9.1650300597.git.jpoimboe@redhat.com
scripts/Makefile.build
scripts/link-vmlinux.sh

index 9717e6f6fb31498aec1075220e346c769648decf..33c1ed58152294b3cdc82a980cdffeff97110687 100644 (file)
@@ -231,7 +231,7 @@ objtool_args =                                                              \
        $(if $(part-of-module), --module)                               \
        $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt)                     \
        $(if $(CONFIG_FRAME_POINTER),, --no-fp)                         \
-       $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\
+       $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)                   \
        $(if $(CONFIG_RETPOLINE), --retpoline)                          \
        $(if $(CONFIG_X86_SMAP), --uaccess)                             \
        $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)             \
index 20f44504a644b900eafebe483c2d2a6f14dbe46f..9361a1ef02c992afce8641c4296c90b2c0e12e54 100755 (executable)
@@ -140,7 +140,7 @@ objtool_link()
                if ! is_enabled CONFIG_FRAME_POINTER; then
                        objtoolopt="${objtoolopt} --no-fp"
                fi
-               if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then
+               if is_enabled CONFIG_GCOV_KERNEL; then
                        objtoolopt="${objtoolopt} --no-unreachable"
                fi
                if is_enabled CONFIG_RETPOLINE; then