[PATCH] powerpc: Define and use PPC_ELF_ABI_v2
Naveen N. Rao
naveen.n.rao at linux.vnet.ibm.com
Sat Jun 4 20:31:14 AEST 2016
On 2016/04/28 07:38PM, Michael Ellerman 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.
>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> ---
> 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)
> /* PPC64 ABIv2 the global entry point is at the address */
> return (unsigned long)func;
> #else
> @@ -106,7 +106,7 @@ static inline unsigned long ppc_global_function_entry(void *func)
> */
>
> /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */
> -#if defined(_CALL_ELF) && _CALL_ELF == 2
> +#ifdef PPC_ELF_ABI_v2
> #define R2_STACK_OFFSET 24
> #else
> #define R2_STACK_OFFSET 40
> diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
> index 50ca7585abe2..0b0bfcaa587a 100644
> --- a/arch/powerpc/include/asm/ftrace.h
> +++ b/arch/powerpc/include/asm/ftrace.h
> @@ -66,7 +66,7 @@ struct dyn_arch_ftrace {
> #endif
>
> #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) && !defined(__ASSEMBLY__)
> -#if !defined(_CALL_ELF) || _CALL_ELF != 2
> +#ifdef PPC_ELF_ABI_v2
That should be #ifndef.
- Naveen
More information about the Linuxppc-dev
mailing list