linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler
@ 2018-12-26 14:15 Ben Hutchings
  2018-12-26 23:45 ` Segher Boessenkool
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2018-12-26 14:15 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: debian-kernel

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

GCC for Debian's "powerpcspe" architecture only supports 32-bit
SPE targets, and using -mcpu=powerpc or -mcpu=powerpc64 is a fatal
error.

* Change the test for a biarch compiler to pass both the -m32 and -m64
  options, so that it doesn't catch 32-bit-only compilers
* Add an ifdef CONFIG_PPC64 around the 64-bit CPU option definitions

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 488c9edffa58..c2e815863500 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -12,7 +12,7 @@
 # Rewritten by Cort Dougan and Paul Mackerras
 #
 
-HAS_BIARCH	:= $(call cc-option-yn, -m32)
+HAS_BIARCH	:= $(call cc-option-yn, -m32 -m64)
 
 # Set default 32 bits cross compilers for vdso and boot wrapper
 CROSS32_COMPILE ?=
@@ -166,6 +166,7 @@ CFLAGS-$(CONFIG_PPC32)	+= $(call cc-option, $(MULTIPLEWORD))
 
 CFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
 
+ifdef CONFIG_PPC64
 ifdef CONFIG_PPC_BOOK3S_64
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
@@ -177,6 +178,7 @@ endif
 else
 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
 endif
+endif
 
 ifdef CONFIG_FUNCTION_TRACER
 CC_FLAGS_FTRACE := -pg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler
  2018-12-26 14:15 [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler Ben Hutchings
@ 2018-12-26 23:45 ` Segher Boessenkool
  2018-12-27  2:32   ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2018-12-26 23:45 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linuxppc-dev, debian-kernel

Hi!

On Wed, Dec 26, 2018 at 02:15:11PM +0000, Ben Hutchings wrote:
> GCC for Debian's "powerpcspe" architecture only supports 32-bit
> SPE targets, and using -mcpu=powerpc or -mcpu=powerpc64 is a fatal
> error.

I don't see where your patch touches -mcpu=powerpc, and I don't see how
it would make a difference either?

> +ifdef CONFIG_PPC64
>  ifdef CONFIG_PPC_BOOK3S_64
>  ifdef CONFIG_CPU_LITTLE_ENDIAN
>  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
> @@ -177,6 +178,7 @@ endif
>  else
>  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
>  endif
> +endif

How can CONFIG_PPC_BOOK3S_64 be true while CONFIG_PPC64 is fals?  That
does not make a lot of sense.


Segher

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

* Re: [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler
  2018-12-26 23:45 ` Segher Boessenkool
@ 2018-12-27  2:32   ` Ben Hutchings
  2018-12-29 11:40     ` Segher Boessenkool
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2018-12-27  2:32 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, debian-kernel

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

On Wed, 2018-12-26 at 17:45 -0600, Segher Boessenkool wrote:
> Hi!
> 
> On Wed, Dec 26, 2018 at 02:15:11PM +0000, Ben Hutchings wrote:
> > GCC for Debian's "powerpcspe" architecture only supports 32-bit
> > SPE targets, and using -mcpu=powerpc or -mcpu=powerpc64 is a fatal
> > error.
> 
> I don't see where your patch touches -mcpu=powerpc, and I don't see how
> it would make a difference either?

Look at the assignments that are conditional on HAS_BIARCH.

> > +ifdef CONFIG_PPC64
> >  ifdef CONFIG_PPC_BOOK3S_64
> >  ifdef CONFIG_CPU_LITTLE_ENDIAN
> >  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
> > @@ -177,6 +178,7 @@ endif
> >  else
> >  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
> >  endif
> > +endif
> 
> How can CONFIG_PPC_BOOK3S_64 be true while CONFIG_PPC64 is fals?  That
> does not make a lot of sense.

But there is an "else" part here.

Ben.

-- 
Ben Hutchings
Life is what happens to you while you're busy making other plans.
                                                          - John Lennon



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler
  2018-12-27  2:32   ` Ben Hutchings
@ 2018-12-29 11:40     ` Segher Boessenkool
  0 siblings, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2018-12-29 11:40 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linuxppc-dev, debian-kernel

On Thu, Dec 27, 2018 at 02:32:07AM +0000, Ben Hutchings wrote:
> On Wed, 2018-12-26 at 17:45 -0600, Segher Boessenkool wrote:
> > Hi!
> > 
> > On Wed, Dec 26, 2018 at 02:15:11PM +0000, Ben Hutchings wrote:
> > > GCC for Debian's "powerpcspe" architecture only supports 32-bit
> > > SPE targets, and using -mcpu=powerpc or -mcpu=powerpc64 is a fatal
> > > error.
> > 
> > I don't see where your patch touches -mcpu=powerpc, and I don't see how
> > it would make a difference either?

[ I now see that error fwiw.  Yuck. ]

> Look at the assignments that are conditional on HAS_BIARCH.

Sure, you change how HAS_BIARCH is set.  That has more effects than just
not using -mcpu=powerpc (which is fine, but the message is confusing).

> > > +ifdef CONFIG_PPC64
> > >  ifdef CONFIG_PPC_BOOK3S_64
> > >  ifdef CONFIG_CPU_LITTLE_ENDIAN
> > >  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
> > > @@ -177,6 +178,7 @@ endif
> > >  else
> > >  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
> > >  endif
> > > +endif
> > 
> > How can CONFIG_PPC_BOOK3S_64 be true while CONFIG_PPC64 is fals?  That
> > does not make a lot of sense.
> 
> But there is an "else" part here.

Yeah I see.  It would be better to have fewer nested conditionals here
instead of more...


Segher

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

end of thread, other threads:[~2018-12-29 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-26 14:15 [PATCH] powerpc: Fix -mcpu= options for SPE-only compiler Ben Hutchings
2018-12-26 23:45 ` Segher Boessenkool
2018-12-27  2:32   ` Ben Hutchings
2018-12-29 11:40     ` Segher Boessenkool

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