Merge tag 'objtool-core-2022-05-23' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 May 2022 17:36:38 +0000 (10:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 May 2022 17:36:38 +0000 (10:36 -0700)
Pull objtool updates from Ingo Molnar:

 - Comprehensive interface overhaul:
   =================================

   Objtool's interface has some issues:

     - Several features are done unconditionally, without any way to
       turn them off. Some of them might be surprising. This makes
       objtool tricky to use, and prevents porting individual features
       to other arches.

     - The config dependencies are too coarse-grained. Objtool
       enablement is tied to CONFIG_STACK_VALIDATION, but it has several
       other features independent of that.

     - The objtool subcmds ("check" and "orc") are clumsy: "check" is
       really a subset of "orc", so it has all the same options.

       The subcmd model has never really worked for objtool, as it only
       has a single purpose: "do some combination of things on an object
       file".

     - The '--lto' and '--vmlinux' options are nonsensical and have
       surprising behavior.

   Overhaul the interface:

      - get rid of subcmds

      - make all features individually selectable

      - remove and/or clarify confusing/obsolete options

      - update the documentation

      - fix some bugs found along the way

 - Fix x32 regression

 - Fix Kbuild cleanup bugs

 - Add scripts/objdump-func helper script to disassemble a single
   function from an object file.

 - Rewrite scripts/faddr2line to be section-aware, by basing it on
   'readelf', moving it away from 'nm', which doesn't handle multiple
   sections well, which can result in decoding failure.

 - Rewrite & fix symbol handling - which had a number of bugs wrt.
   object files that don't have global symbols - which is rare but
   possible. Also fix a bunch of symbol handling bugs found along the
   way.

* tag 'objtool-core-2022-05-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
  objtool: Fix objtool regression on x32 systems
  objtool: Fix symbol creation
  scripts/faddr2line: Fix overlapping text section failures
  scripts: Create objdump-func helper script
  objtool: Remove libsubcmd.a when make clean
  objtool: Remove inat-tables.c when make clean
  objtool: Update documentation
  objtool: Remove --lto and --vmlinux in favor of --link
  objtool: Add HAVE_NOINSTR_VALIDATION
  objtool: Rename "VMLINUX_VALIDATION" -> "NOINSTR_VALIDATION"
  objtool: Make noinstr hacks optional
  objtool: Make jump label hack optional
  objtool: Make static call annotation optional
  objtool: Make stack validation frame-pointer-specific
  objtool: Add CONFIG_OBJTOOL
  objtool: Extricate sls from stack validation
  objtool: Rework ibt and extricate from stack validation
  objtool: Make stack validation optional
  objtool: Add option to print section addresses
  objtool: Don't print parentheses in function addresses
  ...

1  2 
Makefile
arch/Kconfig
arch/x86/Kconfig
include/linux/objtool.h
kernel/trace/Kconfig
scripts/Makefile.build
scripts/link-vmlinux.sh
tools/include/linux/objtool.h

diff --cc Makefile
Simple merge
diff --cc arch/Kconfig
Simple merge
Simple merge
@@@ -38,10 -38,8 +38,10 @@@ struct unwind_hint 
  #define UNWIND_HINT_TYPE_REGS_PARTIAL 2
  #define UNWIND_HINT_TYPE_FUNC         3
  
- #ifdef CONFIG_STACK_VALIDATION
+ #ifdef CONFIG_OBJTOOL
  
 +#include <asm/asm.h>
 +
  #ifndef __ASSEMBLY__
  
  #define UNWIND_HINT(sp_reg, sp_offset, type, end)             \
Simple merge
@@@ -227,15 -227,19 +227,19 @@@ ifdef CONFIG_OBJTOO
  objtool := $(objtree)/tools/objtool/objtool
  
  objtool_args =                                                                \
-       $(if $(CONFIG_UNWINDER_ORC),orc generate,check)                 \
-       $(if $(part-of-module), --module)                               \
-       $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt)                     \
-       $(if $(CONFIG_FRAME_POINTER),, --no-fp)                         \
-       $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)                   \
+       $(if $(CONFIG_HAVE_JUMP_LABEL_HACK), --hacks=jump_label)        \
+       $(if $(CONFIG_HAVE_NOINSTR_HACK), --hacks=noinstr)              \
+       $(if $(CONFIG_X86_KERNEL_IBT), --ibt)                           \
+       $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)             \
+       $(if $(CONFIG_UNWINDER_ORC), --orc)                             \
        $(if $(CONFIG_RETPOLINE), --retpoline)                          \
 -      $(if $(CONFIG_X86_SMAP), --uaccess)                             \
+       $(if $(CONFIG_SLS), --sls)                                      \
+       $(if $(CONFIG_STACK_VALIDATION), --stackval)                    \
+       $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call)          \
-       $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)             \
-       $(if $(CONFIG_SLS), --sls)
 +      --uaccess                                                       \
+       $(if $(linked-object), --link)                                  \
+       $(if $(part-of-module), --module)                               \
+       $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
  
  cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
  cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
@@@ -126,9 -132,33 +132,31 @@@ objtool_link(
                if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then
                        objtoolopt="${objtoolopt} --mcount"
                fi
 -              if is_enabled CONFIG_X86_SMAP; then
 -                      objtoolopt="${objtoolopt} --uaccess"
 -              fi
+               if is_enabled CONFIG_UNWINDER_ORC; then
+                       objtoolopt="${objtoolopt} --orc"
+               fi
+               if is_enabled CONFIG_RETPOLINE; then
+                       objtoolopt="${objtoolopt} --retpoline"
+               fi
+               if is_enabled CONFIG_SLS; then
+                       objtoolopt="${objtoolopt} --sls"
+               fi
+               if is_enabled CONFIG_STACK_VALIDATION; then
+                       objtoolopt="${objtoolopt} --stackval"
+               fi
+               if is_enabled CONFIG_HAVE_STATIC_CALL_INLINE; then
+                       objtoolopt="${objtoolopt} --static-call"
+               fi
++              objtoolopt="${objtoolopt} --uaccess"
        fi
  
-       if is_enabled CONFIG_VMLINUX_VALIDATION; then
+       if is_enabled CONFIG_NOINSTR_VALIDATION; then
                objtoolopt="${objtoolopt} --noinstr"
        fi
  
@@@ -38,10 -38,8 +38,10 @@@ struct unwind_hint 
  #define UNWIND_HINT_TYPE_REGS_PARTIAL 2
  #define UNWIND_HINT_TYPE_FUNC         3
  
- #ifdef CONFIG_STACK_VALIDATION
+ #ifdef CONFIG_OBJTOOL
  
 +#include <asm/asm.h>
 +
  #ifndef __ASSEMBLY__
  
  #define UNWIND_HINT(sp_reg, sp_offset, type, end)             \