* [PATCH] ARM: fix BE8 module loading
@ 2015-05-18 12:36 Arnd Bergmann
2015-05-18 13:01 ` Ard Biesheuvel
2015-05-18 14:22 ` Robin Murphy
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2015-05-18 12:36 UTC (permalink / raw)
To: linux-arm-kernel
The new veneer support for loadable modules on ARM uses the
__opcode_to_mem_thumb32() function to count R_ARM_THM_CALL
and R_ARM_THM_JUMP24 relocations.
However, this function is not defined for big-endian kernels
on ARMv5 or before, causing a compile-time error:
arch/arm/kernel/module-plts.c: In function 'count_plts':
arch/arm/kernel/module-plts.c:124:9: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
__opcode_to_mem_thumb32(0x07ff2fff)))
^
As we know that this part of the function is only needed for
Thumb2 kernels, and that those can never happen with BE8,
we can avoid the error by enclosing the code in an #ifdef.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 7d485f647c1 ("ARM: 8220/1: allow modules outside of bl range")
---
Found with the randconfig builder on linux-next.
diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c
index 71a65c49871d..097e2e201b9f 100644
--- a/arch/arm/kernel/module-plts.c
+++ b/arch/arm/kernel/module-plts.c
@@ -118,11 +118,13 @@ static unsigned int count_plts(Elf32_Addr base, const Elf32_Rel *rel, int num)
__opcode_to_mem_arm(0x00ffffff)))
ret++;
break;
+#ifdef CONFIG_THUMB2_KERNEL
case R_ARM_THM_CALL:
case R_ARM_THM_JUMP24:
if (!duplicate_rel(base, rel, i,
__opcode_to_mem_thumb32(0x07ff2fff)))
ret++;
+#endif
}
return ret;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: fix BE8 module loading
2015-05-18 12:36 [PATCH] ARM: fix BE8 module loading Arnd Bergmann
@ 2015-05-18 13:01 ` Ard Biesheuvel
2015-05-18 14:22 ` Robin Murphy
1 sibling, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2015-05-18 13:01 UTC (permalink / raw)
To: linux-arm-kernel
On 18 May 2015 at 14:36, Arnd Bergmann <arnd@arndb.de> wrote:
> The new veneer support for loadable modules on ARM uses the
> __opcode_to_mem_thumb32() function to count R_ARM_THM_CALL
> and R_ARM_THM_JUMP24 relocations.
>
> However, this function is not defined for big-endian kernels
> on ARMv5 or before, causing a compile-time error:
>
> arch/arm/kernel/module-plts.c: In function 'count_plts':
> arch/arm/kernel/module-plts.c:124:9: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
> __opcode_to_mem_thumb32(0x07ff2fff)))
> ^
>
> As we know that this part of the function is only needed for
> Thumb2 kernels, and that those can never happen with BE8,
> we can avoid the error by enclosing the code in an #ifdef.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 7d485f647c1 ("ARM: 8220/1: allow modules outside of bl range")
> ---
> Found with the randconfig builder on linux-next.
>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c
> index 71a65c49871d..097e2e201b9f 100644
> --- a/arch/arm/kernel/module-plts.c
> +++ b/arch/arm/kernel/module-plts.c
> @@ -118,11 +118,13 @@ static unsigned int count_plts(Elf32_Addr base, const Elf32_Rel *rel, int num)
> __opcode_to_mem_arm(0x00ffffff)))
> ret++;
> break;
> +#ifdef CONFIG_THUMB2_KERNEL
> case R_ARM_THM_CALL:
> case R_ARM_THM_JUMP24:
> if (!duplicate_rel(base, rel, i,
> __opcode_to_mem_thumb32(0x07ff2fff)))
> ret++;
> +#endif
> }
> return ret;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: fix BE8 module loading
2015-05-18 12:36 [PATCH] ARM: fix BE8 module loading Arnd Bergmann
2015-05-18 13:01 ` Ard Biesheuvel
@ 2015-05-18 14:22 ` Robin Murphy
2015-05-18 14:24 ` Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2015-05-18 14:22 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnd,
On 18/05/15 13:36, Arnd Bergmann wrote:
> The new veneer support for loadable modules on ARM uses the
> __opcode_to_mem_thumb32() function to count R_ARM_THM_CALL
> and R_ARM_THM_JUMP24 relocations.
>
> However, this function is not defined for big-endian kernels
> on ARMv5 or before, causing a compile-time error:
>
> arch/arm/kernel/module-plts.c: In function 'count_plts':
> arch/arm/kernel/module-plts.c:124:9: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
> __opcode_to_mem_thumb32(0x07ff2fff)))
> ^
>
> As we know that this part of the function is only needed for
> Thumb2 kernels, and that those can never happen with BE8,
Do you mean BE-32 here (and in the title)? That's the obsolete wacky
word-invariant one, BE-8 is the sensible* one that modern CPUs support.
Robin.
*as sensible as big-endian could ever be, at any rate :P
> we can avoid the error by enclosing the code in an #ifdef.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 7d485f647c1 ("ARM: 8220/1: allow modules outside of bl range")
> ---
> Found with the randconfig builder on linux-next.
>
> diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c
> index 71a65c49871d..097e2e201b9f 100644
> --- a/arch/arm/kernel/module-plts.c
> +++ b/arch/arm/kernel/module-plts.c
> @@ -118,11 +118,13 @@ static unsigned int count_plts(Elf32_Addr base, const Elf32_Rel *rel, int num)
> __opcode_to_mem_arm(0x00ffffff)))
> ret++;
> break;
> +#ifdef CONFIG_THUMB2_KERNEL
> case R_ARM_THM_CALL:
> case R_ARM_THM_JUMP24:
> if (!duplicate_rel(base, rel, i,
> __opcode_to_mem_thumb32(0x07ff2fff)))
> ret++;
> +#endif
> }
> return ret;
> }
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: fix BE8 module loading
2015-05-18 14:22 ` Robin Murphy
@ 2015-05-18 14:24 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2015-05-18 14:24 UTC (permalink / raw)
To: linux-arm-kernel
On Monday 18 May 2015 15:22:44 Robin Murphy wrote:
>
> Do you mean BE-32 here (and in the title)? That's the obsolete wacky
> word-invariant one, BE-8 is the sensible* one that modern CPUs support.
>
> Robin.
>
> *as sensible as big-endian could ever be, at any rate
>
You are absolutely right, I've fixed up the changelog accordingly now.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-18 14:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 12:36 [PATCH] ARM: fix BE8 module loading Arnd Bergmann
2015-05-18 13:01 ` Ard Biesheuvel
2015-05-18 14:22 ` Robin Murphy
2015-05-18 14:24 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).