- Unconditionally build objtool on powerpc - Select ARCH_VMLINUX_NEEDS_RELOCS, so that relocations are kept in vmlinux.unstriped file - Add vmlinux.unstripped rule in Makefile.postlink that runs objtool with --alt-fixup --link option on 64-bit Book3S.
Co-developed-by: Nicholas Piggin <[email protected]> Signed-off-by: Nicholas Piggin <[email protected]> Co-developed-by: Sathvika Vasireddy <[email protected]> Signed-off-by: Sathvika Vasireddy <[email protected]> Signed-off-by: Shivang Upadhyay <[email protected]> --- arch/powerpc/Kconfig | 1 + arch/powerpc/Makefile | 2 +- arch/powerpc/Makefile.postlink | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c3b6cd655606..a759392ea855 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -273,6 +273,7 @@ config PPC select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S) select HAVE_OPTPROBES select HAVE_OBJTOOL if ARCH_USING_PATCHABLE_FUNCTION_ENTRY || MPROFILE_KERNEL || PPC32 + select ARCH_VMLINUX_NEEDS_RELOCS select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI if PPC64 diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 9385db478c59..b246e5ab8ba4 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -398,7 +398,7 @@ vdso_prepare: prepare0 $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) endif -archprepare: checkbin +archprepare: tools/objtool checkbin archheaders: $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all diff --git a/arch/powerpc/Makefile.postlink b/arch/powerpc/Makefile.postlink index bb601be36173..5a1f6493581c 100644 --- a/arch/powerpc/Makefile.postlink +++ b/arch/powerpc/Makefile.postlink @@ -43,6 +43,10 @@ ifndef CONFIG_PPC64_ELF_ABI_V1 endif endif +# Fix branches in __ftr_fixup segment, with help of objtool +vmlinux.unstripped: FORCE + $(objtree)/tools/objtool/objtool --alt-fixup --link "$@" + clean: rm -f .tmp_symbols.txt -- 2.56.1
