[PATCH] powerpc: Fix stackprotector detection for non-glibc toolchains

Christophe LEROY christophe.leroy at c-s.fr
Sat Oct 13 18:32:19 AEDT 2018



Le 13/10/2018 à 00:58, Michael Ellerman a écrit :
> If GCC is not built with glibc support then we must explicitly tell it
> which register to use for TLS mode stack protector, otherwise it will
> error out and the cc-option check will fail.

Oh ? I didn't encounter such a problem with the nolibc GCC from 
https://mirrors.edge.kernel.org/pub/tools/crosstool/

I did all my tests with powerpc64-linux-gcc 8.1 on x86_64

Christophe

> 
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>

Reviewed-by: Christophe Leroy <christophe.leroy at c-s.fr>

> ---
>   arch/powerpc/Kconfig | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 1888636c9eb6..3d008115fe18 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -180,7 +180,8 @@ config PPC
>   	select HAVE_ARCH_SECCOMP_FILTER
>   	select HAVE_ARCH_TRACEHOOK
>   	select HAVE_CBPF_JIT			if !PPC64
> -	select HAVE_STACKPROTECTOR		if $(cc-option,-mstack-protector-guard=tls)
> +	select HAVE_STACKPROTECTOR		if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
> +	select HAVE_STACKPROTECTOR		if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
>   	select HAVE_CONTEXT_TRACKING		if PPC64
>   	select HAVE_DEBUG_KMEMLEAK
>   	select HAVE_DEBUG_STACKOVERFLOW
> 


More information about the Linuxppc-dev mailing list