Re: [PATCH] powerpc: Define and use PPC_ELF_ABI_v2
From: Joel Stanley <joel@jms.id.au>
Date: 2016-04-29 06:29:57
On Thu, Apr 28, 2016 at 7:08 PM, Michael Ellerman [off-list ref] wrote:
We're approaching 20 locations where we need to check for ELF ABI v2. That's fine, except the logic is a bit awkward, because we have to check that _CALL_ELF is defined and then what its value is. So check it once in asm/types.h and define PPC_ELF_ABI_v2 when ELF ABI v2 is detected. We don't add explicit includes of asm/types.h because it's included basically everywhere via compiler.h.
Thank you! I always wondered why we didn't do this.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
quoted hunk ↗ jump to hunk
--- arch/powerpc/include/asm/code-patching.h | 6 +++--- arch/powerpc/include/asm/ftrace.h | 2 +- arch/powerpc/include/asm/kprobes.h | 4 ++-- arch/powerpc/include/asm/linkage.h | 2 +- arch/powerpc/include/asm/ppc_asm.h | 4 ++-- arch/powerpc/include/asm/ptrace.h | 2 +- arch/powerpc/include/asm/sections.h | 2 +- arch/powerpc/include/asm/types.h | 4 ++++ arch/powerpc/kernel/entry_64.S | 2 +- arch/powerpc/kernel/head_64.S | 2 +- arch/powerpc/kernel/kprobes.c | 2 +- arch/powerpc/kernel/misc_64.S | 2 +- arch/powerpc/kernel/module_64.c | 4 ++-- arch/powerpc/kvm/book3s_interrupts.S | 2 +- arch/powerpc/kvm/book3s_rmhandlers.S | 2 +- 15 files changed, 23 insertions(+), 19 deletions(-)diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h index 994c60a857ce..d325b35315d3 100644 --- a/arch/powerpc/include/asm/code-patching.h +++ b/arch/powerpc/include/asm/code-patching.h@@ -50,7 +50,7 @@ void __patch_exception(int exc, unsigned long addr); static inline unsigned long ppc_function_entry(void *func) { #if defined(CONFIG_PPC64) -#if defined(_CALL_ELF) && _CALL_ELF == 2 +#ifdef PPC_ELF_ABI_v2 u32 *insn = func; /*@@ -90,7 +90,7 @@ static inline unsigned long ppc_function_entry(void *func) static inline unsigned long ppc_global_function_entry(void *func) { -#if defined(CONFIG_PPC64) && defined(_CALL_ELF) && _CALL_ELF == 2 +#if defined(CONFIG_PPC64) && defined(PPC_ELF_ABI_v2)
The CONFIG_PPC64 is redundant?
/* PPC64 ABIv2 the global entry point is at the address */
return (unsigned long)func;
#else