linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
       [not found] <20210817002109.2736222-1-ndesaulniers@google.com>
@ 2021-08-17  0:21 ` Nick Desaulniers
  2021-08-17  1:41   ` Nathan Chancellor
  2021-08-17  2:31   ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Desaulniers @ 2021-08-17  0:21 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Nick Desaulniers, clang-built-linux,
	Paul Mackerras, linuxppc-dev

cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)

Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)

This allows us to pursue removing cc-option-yn.

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/powerpc/Makefile      | 12 ++++++------
 arch/powerpc/boot/Makefile |  5 +----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 9aaf1abbc641..85e224536cf7 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -12,12 +12,12 @@
 # Rewritten by Cort Dougan and Paul Mackerras
 #
 
-HAS_BIARCH	:= $(call cc-option-yn, -m32)
+HAS_BIARCH	:= $(call cc-option,-m32)
 
 # Set default 32 bits cross compilers for vdso and boot wrapper
 CROSS32_COMPILE ?=
 
-ifeq ($(HAS_BIARCH),y)
+ifeq ($(HAS_BIARCH),-m32)
 ifeq ($(CROSS32_COMPILE),)
 ifdef CONFIG_PPC32
 # These options will be overridden by any -mcpu option that the CPU
@@ -107,7 +107,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
 aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
 aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
 
-ifeq ($(HAS_BIARCH),y)
+ifeq ($(HAS_BIARCH),-m32)
 KBUILD_CFLAGS	+= -m$(BITS)
 KBUILD_AFLAGS	+= -m$(BITS) -Wl,-a$(BITS)
 KBUILD_LDFLAGS	+= -m elf$(BITS)$(LDEMULATION)
@@ -125,7 +125,9 @@ LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
 LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
 
 ifdef CONFIG_PPC64
-ifeq ($(call cc-option-yn,-mcmodel=medium),y)
+ifeq ($(call cc-option,-mcmodel=medium),)
+	export NO_MINIMAL_TOC := -mno-minimal-toc
+else
 	# -mcmodel=medium breaks modules because it uses 32bit offsets from
 	# the TOC pointer to create pointers where possible. Pointers into the
 	# percpu data area are created by this method.
@@ -135,8 +137,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y)
 	# kernel percpu data space (starting with 0xc...). We need a full
 	# 64bit relocation for this to work, hence -mcmodel=large.
 	KBUILD_CFLAGS_MODULE += -mcmodel=large
-else
-	export NO_MINIMAL_TOC := -mno-minimal-toc
 endif
 endif
 
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 10c0fb306f15..33e1de5d1c95 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -66,10 +66,7 @@ ifdef CONFIG_DEBUG_INFO
 BOOTCFLAGS	+= -g
 endif
 
-ifeq ($(call cc-option-yn, -fstack-protector),y)
-BOOTCFLAGS	+= -fno-stack-protector
-endif
-
+BOOTCFLAGS	+= $(call cc-option,-fstack-protector)
 BOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
 
 DTC_FLAGS	?= -p 1024
-- 
2.33.0.rc1.237.g0d66db33f3-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
  2021-08-17  0:21 ` [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option Nick Desaulniers
@ 2021-08-17  1:41   ` Nathan Chancellor
  2021-08-17  2:31   ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2021-08-17  1:41 UTC (permalink / raw)
  To: Nick Desaulniers, Masahiro Yamada
  Cc: linux-kbuild, clang-built-linux, Paul Mackerras, linuxppc-dev



On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
> cc-option-yn can be replaced with cc-option. ie.
> Checking for support:
> ifeq ($(call cc-option-yn,$(FLAG)),y)
> becomes:
> ifneq ($(call cc-option,$(FLAG)),)
> 
> Checking for lack of support:
> ifeq ($(call cc-option-yn,$(FLAG)),n)
> becomes:
> ifeq ($(call cc-option,$(FLAG)),)
> 
> This allows us to pursue removing cc-option-yn.
> 
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>   arch/powerpc/Makefile      | 12 ++++++------
>   arch/powerpc/boot/Makefile |  5 +----
>   2 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 9aaf1abbc641..85e224536cf7 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -12,12 +12,12 @@
>   # Rewritten by Cort Dougan and Paul Mackerras
>   #
>   
> -HAS_BIARCH	:= $(call cc-option-yn, -m32)
> +HAS_BIARCH	:= $(call cc-option,-m32)
>   
>   # Set default 32 bits cross compilers for vdso and boot wrapper
>   CROSS32_COMPILE ?=
>   
> -ifeq ($(HAS_BIARCH),y)
> +ifeq ($(HAS_BIARCH),-m32)
>   ifeq ($(CROSS32_COMPILE),)
>   ifdef CONFIG_PPC32
>   # These options will be overridden by any -mcpu option that the CPU
> @@ -107,7 +107,7 @@ cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
>   aflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
>   aflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
>   
> -ifeq ($(HAS_BIARCH),y)
> +ifeq ($(HAS_BIARCH),-m32)
>   KBUILD_CFLAGS	+= -m$(BITS)
>   KBUILD_AFLAGS	+= -m$(BITS) -Wl,-a$(BITS)
>   KBUILD_LDFLAGS	+= -m elf$(BITS)$(LDEMULATION)
> @@ -125,7 +125,9 @@ LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
>   LDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
>   
>   ifdef CONFIG_PPC64
> -ifeq ($(call cc-option-yn,-mcmodel=medium),y)
> +ifeq ($(call cc-option,-mcmodel=medium),)
> +	export NO_MINIMAL_TOC := -mno-minimal-toc
> +else
>   	# -mcmodel=medium breaks modules because it uses 32bit offsets from
>   	# the TOC pointer to create pointers where possible. Pointers into the
>   	# percpu data area are created by this method.
> @@ -135,8 +137,6 @@ ifeq ($(call cc-option-yn,-mcmodel=medium),y)
>   	# kernel percpu data space (starting with 0xc...). We need a full
>   	# 64bit relocation for this to work, hence -mcmodel=large.
>   	KBUILD_CFLAGS_MODULE += -mcmodel=large
> -else
> -	export NO_MINIMAL_TOC := -mno-minimal-toc
>   endif
>   endif
>   
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 10c0fb306f15..33e1de5d1c95 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -66,10 +66,7 @@ ifdef CONFIG_DEBUG_INFO
>   BOOTCFLAGS	+= -g
>   endif
>   
> -ifeq ($(call cc-option-yn, -fstack-protector),y)
> -BOOTCFLAGS	+= -fno-stack-protector
> -endif
> -
> +BOOTCFLAGS	+= $(call cc-option,-fstack-protector)

This was previously disabling the stack protector but now it is enabling 
it. Just remove the ifeq conditional altogether as the kernel assumes 
-fno-stack-protector is always supported after commit 893ab00439a4 
("kbuild: remove cc-option test of -fno-stack-protector").

>   BOOTCFLAGS	+= -I$(objtree)/$(obj) -I$(srctree)/$(obj)
>   
>   DTC_FLAGS	?= -p 1024
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
  2021-08-17  0:21 ` [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option Nick Desaulniers
  2021-08-17  1:41   ` Nathan Chancellor
@ 2021-08-17  2:31   ` Michael Ellerman
  2021-08-19 20:04     ` Masahiro Yamada
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2021-08-17  2:31 UTC (permalink / raw)
  To: Nick Desaulniers, Masahiro Yamada
  Cc: linux-kbuild, Nick Desaulniers, clang-built-linux,
	Paul Mackerras, linuxppc-dev

Nick Desaulniers <ndesaulniers@google.com> writes:
> cc-option-yn can be replaced with cc-option. ie.
> Checking for support:
> ifeq ($(call cc-option-yn,$(FLAG)),y)
> becomes:
> ifneq ($(call cc-option,$(FLAG)),)
>
> Checking for lack of support:
> ifeq ($(call cc-option-yn,$(FLAG)),n)
> becomes:
> ifeq ($(call cc-option,$(FLAG)),)
>
> This allows us to pursue removing cc-option-yn.
>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/powerpc/Makefile      | 12 ++++++------
>  arch/powerpc/boot/Makefile |  5 +----
>  2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 9aaf1abbc641..85e224536cf7 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -12,12 +12,12 @@
>  # Rewritten by Cort Dougan and Paul Mackerras
>  #
>  
> -HAS_BIARCH	:= $(call cc-option-yn, -m32)
> +HAS_BIARCH	:= $(call cc-option,-m32)
>  
>  # Set default 32 bits cross compilers for vdso and boot wrapper
>  CROSS32_COMPILE ?=
>  
> -ifeq ($(HAS_BIARCH),y)
> +ifeq ($(HAS_BIARCH),-m32)

I don't love that we have to repeat "-m32" in each check.

I'm pretty sure you can use ifdef here, because HAS_BIARCH is a simple
variable (assigned with ":=").

ie, this can be:

  ifdef HAS_BIARCH


And that avoids having to spell out "-m32" everywhere.

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option
  2021-08-17  2:31   ` Michael Ellerman
@ 2021-08-19 20:04     ` Masahiro Yamada
  0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2021-08-19 20:04 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Linux Kbuild mailing list, Nick Desaulniers, clang-built-linux,
	Paul Mackerras, linuxppc-dev

On Tue, Aug 17, 2021 at 11:31 AM Michael Ellerman <mpe@ellerman.id.au> wrote:
>
> Nick Desaulniers <ndesaulniers@google.com> writes:
> > cc-option-yn can be replaced with cc-option. ie.
> > Checking for support:
> > ifeq ($(call cc-option-yn,$(FLAG)),y)
> > becomes:
> > ifneq ($(call cc-option,$(FLAG)),)
> >
> > Checking for lack of support:
> > ifeq ($(call cc-option-yn,$(FLAG)),n)
> > becomes:
> > ifeq ($(call cc-option,$(FLAG)),)
> >
> > This allows us to pursue removing cc-option-yn.
> >
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: linuxppc-dev@lists.ozlabs.org
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> >  arch/powerpc/Makefile      | 12 ++++++------
> >  arch/powerpc/boot/Makefile |  5 +----
> >  2 files changed, 7 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > index 9aaf1abbc641..85e224536cf7 100644
> > --- a/arch/powerpc/Makefile
> > +++ b/arch/powerpc/Makefile
> > @@ -12,12 +12,12 @@
> >  # Rewritten by Cort Dougan and Paul Mackerras
> >  #
> >
> > -HAS_BIARCH   := $(call cc-option-yn, -m32)
> > +HAS_BIARCH   := $(call cc-option,-m32)
> >
> >  # Set default 32 bits cross compilers for vdso and boot wrapper
> >  CROSS32_COMPILE ?=
> >
> > -ifeq ($(HAS_BIARCH),y)
> > +ifeq ($(HAS_BIARCH),-m32)
>
> I don't love that we have to repeat "-m32" in each check.
>
> I'm pretty sure you can use ifdef here, because HAS_BIARCH is a simple
> variable (assigned with ":=").
>
> ie, this can be:
>
>   ifdef HAS_BIARCH
>
>
> And that avoids having to spell out "-m32" everywhere.
>
> cheers


Yes.

Comments from Nathan and Michael
both sound good.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-19 20:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210817002109.2736222-1-ndesaulniers@google.com>
2021-08-17  0:21 ` [PATCH 3/7] powerpc: replace cc-option-yn uses with cc-option Nick Desaulniers
2021-08-17  1:41   ` Nathan Chancellor
2021-08-17  2:31   ` Michael Ellerman
2021-08-19 20:04     ` Masahiro Yamada

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).