From: Rob Landley <rob@landley.net>
Subject: Don't require a third ELF package to build.

In 2022 x86-64 became the only architecture that can't compile without an
extra ELF library installed on the host. (The kernel already has multiple
ELF parser implementations built-in, so requiring another one is questionable
at best.)

See https://lkml.iu.edu/hypermail/linux/kernel/2110.3/00402.html
and https://lkml.iu.edu/hypermail/linux/kernel/2110.3/00278.html

Commit f50b45626e05 added the same dependency to powerpc: revert it.

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 007bab9f2a0e..7c8ec16750dc 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -257,7 +257,9 @@ config X86
 	select HAVE_NOINSTR_HACK		if HAVE_OBJTOOL
 	select HAVE_NMI
 	select HAVE_NOINSTR_VALIDATION		if HAVE_OBJTOOL
-	select HAVE_OBJTOOL			if X86_64
+# This is what the line SHOULD look like, but since commit f1a785101d50
+# the dependency checker has bugged out, so we just delete the line instead.
+#       select HAVE_OBJTOOL                     if X86_64 && !UNWINDER_FRAME_POINTER
 	select HAVE_OPTPROBES
 	select HAVE_PAGE_SIZE_4KB
 	select HAVE_PCSPKR_PLATFORM
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 1b5be07f8669..949d1c2cdad2 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -84,6 +84,12 @@
  * with them due to bugs in both AMD and Intel CPUs.
  */
 
+#ifndef CONFIG_HAVE_RELIABLE_STACK_TRACE
+#define UNWIND_HINT_ENTRY
+#define UNWIND_HINT_IRET_ENTRY
+#define validate_unret_begin
+#endif
+
 SYM_CODE_START(entry_SYSCALL_64)
 	UNWIND_HINT_ENTRY
 	ENDBR
@@ -329,11 +335,10 @@ SYM_CODE_END(xen_error_entry)
 .macro idtentry vector asmsym cfunc has_error_code:req
 SYM_CODE_START(\asmsym)
 
+	UNWIND_HINT_IRET_ENTRY offset=\has_error_code*8
 	.if \vector == X86_TRAP_BP
 		/* #BP advances %rip to the next instruction */
-		UNWIND_HINT_IRET_ENTRY offset=\has_error_code*8 signal=0
-	.else
-		UNWIND_HINT_IRET_ENTRY offset=\has_error_code*8
+		UNWIND_HINT_IRET_ENTRY signal=0
 	.endif
 
 	ENDBR
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c3e0cc83f120..aa89f1d6f96b 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -289,7 +289,6 @@ config PPC
 	select HAVE_STACKPROTECTOR		if PPC32 && $(cc-option,$(m32-flag) -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 -mstack-protector-guard-offset=0)
 	select HAVE_STACKPROTECTOR		if PPC64 && $(cc-option,$(m64-flag) -mstack-protector-guard=tls -mstack-protector-guard-reg=r13 -mstack-protector-guard-offset=0)
 	select HAVE_STATIC_CALL			if PPC32
-	select HAVE_STATIC_CALL_INLINE		if PPC32
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_VIRT_CPU_ACCOUNTING
 	select HAVE_VIRT_CPU_ACCOUNTING_GEN
