2012-02-26 23:27:07

by Paul Gortmaker

[permalink] [raw]
Subject: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

Using the 64 bit toolchains from kernel.org[1], one finds that
you can't build the a500_defconfig, because the Makefile will
stomp whatever value you have in your env. for CROSS_COMPILE.

This shows up since the kernel.org toolchains for parisc-64
do not have the "-gnu" prefix, and so you run into it always
saying hppa64-linux-gnu-gcc not found, regardless of the fact
you've not got "-gnu" put anywhere into CROSS_COMPILE.

[1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/

Signed-off-by: Paul Gortmaker <[email protected]>

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1d..cefff6d 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -31,7 +31,9 @@ ifdef CONFIG_64BIT
UTS_MACHINE := parisc64
CHECKFLAGS += -D__LP64__=1 -m64
WIDTH := 64
-CROSS_COMPILE := hppa64-linux-gnu-
+ifndef CROSS_COMPILE
+ CROSS_COMPILE := hppa64-linux-gnu-
+endif
else # 32-bit
WIDTH :=
endif
--
1.7.9.1


2012-02-27 00:23:00

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Sunday 26 February 2012 18:26:53 Paul Gortmaker wrote:
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
>
> -CROSS_COMPILE := hppa64-linux-gnu-
> +ifndef CROSS_COMPILE
> + CROSS_COMPILE := hppa64-linux-gnu-
> +endif

this should accomplish the same thing in practice:
CROSS_COMPILE ?= hppa64-linux-gnu-
-mike


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part.

2012-02-27 00:31:49

by Paul Gortmaker

[permalink] [raw]
Subject: Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

[Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.] On 26/02/2012 (Sun 19:23) Mike Frysinger wrote:

> On Sunday 26 February 2012 18:26:53 Paul Gortmaker wrote:
> > --- a/arch/parisc/Makefile
> > +++ b/arch/parisc/Makefile
> >
> > -CROSS_COMPILE := hppa64-linux-gnu-
> > +ifndef CROSS_COMPILE
> > + CROSS_COMPILE := hppa64-linux-gnu-
> > +endif
>
> this should accomplish the same thing in practice:
> CROSS_COMPILE ?= hppa64-linux-gnu-

Good point, I'll wait for a bit in case I was missing something else
obvious, and then resend.

THanks,
P.

> -mike

2012-02-27 15:45:20

by John David Anglin

[permalink] [raw]
Subject: Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On 2/26/2012 6:26 PM, Paul Gortmaker wrote:
> Using the 64 bit toolchains from kernel.org[1], one finds that
> you can't build the a500_defconfig, because the Makefile will
> stomp whatever value you have in your env. for CROSS_COMPILE.
>
> This shows up since the kernel.org toolchains for parisc-64
> do not have the "-gnu" prefix, and so you run into it always
> saying hppa64-linux-gnu-gcc not found, regardless of the fact
> you've not got "-gnu" put anywhere into CROSS_COMPILE.
>
> [1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/
>
> Signed-off-by: Paul Gortmaker<[email protected]>
>
> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
> index 55cca1d..cefff6d 100644
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
> @@ -31,7 +31,9 @@ ifdef CONFIG_64BIT
> UTS_MACHINE := parisc64
> CHECKFLAGS += -D__LP64__=1 -m64
> WIDTH := 64
> -CROSS_COMPILE := hppa64-linux-gnu-
> +ifndef CROSS_COMPILE
> + CROSS_COMPILE := hppa64-linux-gnu-
> +endif
> else # 32-bit
> WIDTH :=
> endif
This change breaks native builds. So, I assume CROSS_COMPILE must be
previously defined.

I couldn't figure out where it is defined. CONFIG_CROSS_COMPILE in my
.config was an empty string and CROSS_COMPILE was not defined in my
build environment.

The default toolchain prefix on Debian systems contains "gnu-".

Given that users can use CONFIG_CROSS_COMPILE or set CROSS_COMPILE
in their build env, maybe setting CROSS_COMPILE in the Makefile is a
mistake.

Dave

--
John David Anglin [email protected]

2012-02-27 16:28:23

by Paul Gortmaker

[permalink] [raw]
Subject: Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On 12-02-27 10:14 AM, John David Anglin wrote:
> On 2/26/2012 6:26 PM, Paul Gortmaker wrote:
>> Using the 64 bit toolchains from kernel.org[1], one finds that
>> you can't build the a500_defconfig, because the Makefile will
>> stomp whatever value you have in your env. for CROSS_COMPILE.
>>
>> This shows up since the kernel.org toolchains for parisc-64
>> do not have the "-gnu" prefix, and so you run into it always
>> saying hppa64-linux-gnu-gcc not found, regardless of the fact
>> you've not got "-gnu" put anywhere into CROSS_COMPILE.
>>
>> [1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/
>>
>> Signed-off-by: Paul Gortmaker<[email protected]>
>>
>> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
>> index 55cca1d..cefff6d 100644
>> --- a/arch/parisc/Makefile
>> +++ b/arch/parisc/Makefile
>> @@ -31,7 +31,9 @@ ifdef CONFIG_64BIT
>> UTS_MACHINE := parisc64
>> CHECKFLAGS += -D__LP64__=1 -m64
>> WIDTH := 64
>> -CROSS_COMPILE := hppa64-linux-gnu-
>> +ifndef CROSS_COMPILE
>> + CROSS_COMPILE := hppa64-linux-gnu-
>> +endif
>> else # 32-bit
>> WIDTH :=
>> endif
> This change breaks native builds. So, I assume CROSS_COMPILE must be
> previously defined.

You lost me here. As in a native 32bit env. doing a build for the
64 bit case is setting CROSS_COMPILE?

>
> I couldn't figure out where it is defined. CONFIG_CROSS_COMPILE in my
> .config was an empty string and CROSS_COMPILE was not defined in my
> build environment.
>
> The default toolchain prefix on Debian systems contains "gnu-".
>
> Given that users can use CONFIG_CROSS_COMPILE or set CROSS_COMPILE
> in their build env, maybe setting CROSS_COMPILE in the Makefile is a
> mistake.

Yeah, I'd support a complete nuke-and-pave of the whole Makefile
chunk as well. It does seem redundant and causes more issues than
it solves.

Paul.

>
> Dave
>

2012-02-27 16:44:56

by John David Anglin

[permalink] [raw]
Subject: Re: [PATCH] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On 2/27/2012 11:28 AM, Paul Gortmaker wrote:
> On 12-02-27 10:14 AM, John David Anglin wrote:
>> > On 2/26/2012 6:26 PM, Paul Gortmaker wrote:
>>> >> Using the 64 bit toolchains from kernel.org[1], one finds that
>>> >> you can't build the a500_defconfig, because the Makefile will
>>> >> stomp whatever value you have in your env. for CROSS_COMPILE.
>>> >>
>>> >> This shows up since the kernel.org toolchains for parisc-64
>>> >> do not have the "-gnu" prefix, and so you run into it always
>>> >> saying hppa64-linux-gnu-gcc not found, regardless of the fact
>>> >> you've not got "-gnu" put anywhere into CROSS_COMPILE.
>>> >>
>>> >> [1]ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/
>>> >>
>>> >> Signed-off-by: Paul Gortmaker<[email protected]>
>>> >>
>>> >> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
>>> >> index 55cca1d..cefff6d 100644
>>> >> --- a/arch/parisc/Makefile
>>> >> +++ b/arch/parisc/Makefile
>>> >> @@ -31,7 +31,9 @@ ifdef CONFIG_64BIT
>>> >> UTS_MACHINE := parisc64
>>> >> CHECKFLAGS += -D__LP64__=1 -m64
>>> >> WIDTH := 64
>>> >> -CROSS_COMPILE := hppa64-linux-gnu-
>>> >> +ifndef CROSS_COMPILE
>>> >> + CROSS_COMPILE := hppa64-linux-gnu-
>>> >> +endif
>>> >> else # 32-bit
>>> >> WIDTH :=
>>> >> endif
>> > This change breaks native builds. So, I assume CROSS_COMPILE must be
>> > previously defined.
> You lost me here. As in a native 32bit env. doing a build for the
> 64 bit case is setting CROSS_COMPILE?
>
Yes, native hppa is 32 bit . Building a 64-bit kernel with CONFIG_64BIT
causes the
setting of CROSS_COMPILE and the selection of hppa64-linux-gnu-gcc, etc.
If CROSS_COMPILE wasn't previously defined, your change wouldn't have have
affected the 64-bit build.

Dave

--
John David Anglin [email protected]

2012-02-27 21:00:17

by Paul Gortmaker

[permalink] [raw]
Subject: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

Using the 64 bit toolchains from kernel.org[1], one finds that
you can't build the a500_defconfig, because the Makefile will
stomp whatever value you have in your env. for CROSS_COMPILE.

This shows up since the kernel.org toolchains for parisc-64
do not have the "-gnu" prefix, and so you run into it always
saying hppa64-linux-gnu-gcc not found, regardless of the fact
you've not got "-gnu" put anywhere into CROSS_COMPILE.

Since you can set CROSS_COMPILE from the environment and/or set
it in your .config file, there really is no need for it to be
poked at by the Makefile at all. So just delete it.

[1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/

Signed-off-by: Paul Gortmaker <[email protected]>
---

[v2: no ifdef/endif -- just delete the offending line.]

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1d..a533367 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -31,7 +31,6 @@ ifdef CONFIG_64BIT
UTS_MACHINE := parisc64
CHECKFLAGS += -D__LP64__=1 -m64
WIDTH := 64
-CROSS_COMPILE := hppa64-linux-gnu-
else # 32-bit
WIDTH :=
endif
--
1.7.9.1

2012-02-27 21:41:19

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Mon, 2012-02-27 at 15:59 -0500, Paul Gortmaker wrote:
> Using the 64 bit toolchains from kernel.org[1], one finds that
> you can't build the a500_defconfig, because the Makefile will
> stomp whatever value you have in your env. for CROSS_COMPILE.
>
> This shows up since the kernel.org toolchains for parisc-64
> do not have the "-gnu" prefix, and so you run into it always
> saying hppa64-linux-gnu-gcc not found, regardless of the fact
> you've not got "-gnu" put anywhere into CROSS_COMPILE.
>
> Since you can set CROSS_COMPILE from the environment and/or set
> it in your .config file, there really is no need for it to be
> poked at by the Makefile at all. So just delete it.
>
> [1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/
>
> Signed-off-by: Paul Gortmaker <[email protected]>
> ---
>
> [v2: no ifdef/endif -- just delete the offending line.]
>
> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
> index 55cca1d..a533367 100644
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
> @@ -31,7 +31,6 @@ ifdef CONFIG_64BIT
> UTS_MACHINE := parisc64
> CHECKFLAGS += -D__LP64__=1 -m64
> WIDTH := 64
> -CROSS_COMPILE := hppa64-linux-gnu-
> else # 32-bit
> WIDTH :=
> endif

We can't do that ... it crashes a standard build almost immediately
because it doesn't pick the 64 bit compiler (and we have no biarch
solution).

We need make on a 64 bit config to work out of the box. It breaks
with ?= as JDA pointed out because CROSS_COMPILE is always defined.
Does this satisfy everyone?

James

---

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1d..19ab7b2 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -31,7 +31,11 @@ ifdef CONFIG_64BIT
UTS_MACHINE := parisc64
CHECKFLAGS += -D__LP64__=1 -m64
WIDTH := 64
+
+# FIXME: if no default set, should really try to locate dynamically
+ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := hppa64-linux-gnu-
+endif
else # 32-bit
WIDTH :=
endif

????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2012-02-27 22:03:20

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Mon, 2012-02-27 at 21:41 +0000, James Bottomley wrote:
> On Mon, 2012-02-27 at 15:59 -0500, Paul Gortmaker wrote:
> > Using the 64 bit toolchains from kernel.org[1], one finds that
> > you can't build the a500_defconfig, because the Makefile will
> > stomp whatever value you have in your env. for CROSS_COMPILE.
> >
> > This shows up since the kernel.org toolchains for parisc-64
> > do not have the "-gnu" prefix, and so you run into it always
> > saying hppa64-linux-gnu-gcc not found, regardless of the fact
> > you've not got "-gnu" put anywhere into CROSS_COMPILE.
> >
> > Since you can set CROSS_COMPILE from the environment and/or set
> > it in your .config file, there really is no need for it to be
> > poked at by the Makefile at all. So just delete it.
> >
> > [1] ftp://ftp.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.5.2/
> >
> > Signed-off-by: Paul Gortmaker <[email protected]>
> > ---
> >
> > [v2: no ifdef/endif -- just delete the offending line.]
> >
> > diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
> > index 55cca1d..a533367 100644
> > --- a/arch/parisc/Makefile
> > +++ b/arch/parisc/Makefile
> > @@ -31,7 +31,6 @@ ifdef CONFIG_64BIT
> > UTS_MACHINE := parisc64
> > CHECKFLAGS += -D__LP64__=1 -m64
> > WIDTH := 64
> > -CROSS_COMPILE := hppa64-linux-gnu-
> > else # 32-bit
> > WIDTH :=
> > endif
>
> We can't do that ... it crashes a standard build almost immediately
> because it doesn't pick the 64 bit compiler (and we have no biarch
> solution).
>
> We need make on a 64 bit config to work out of the box. It breaks
> with ?= as JDA pointed out because CROSS_COMPILE is always defined.
> Does this satisfy everyone?
>
> James
>
> ---
>
> diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
> index 55cca1d..19ab7b2 100644
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
> @@ -31,7 +31,11 @@ ifdef CONFIG_64BIT
> UTS_MACHINE := parisc64
> CHECKFLAGS += -D__LP64__=1 -m64
> WIDTH := 64
> +
> +# FIXME: if no default set, should really try to locate dynamically
> +ifeq ($(CROSS_COMPILE),)
> CROSS_COMPILE := hppa64-linux-gnu-
> +endif
> else # 32-bit
> WIDTH :=
> endif

There's an awful lot more than just this wrong with that Makefile. For
instance, NATIVE can never be set because ifeq() isn't globbing in make
scripts ... So I think a final (and dynamically choosing if unset)
solution is this one.

I'll stop now before I find something else wrong ...

James

---

diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1d..c823f4a 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -23,24 +23,20 @@ NM = sh $(srctree)/arch/parisc/nm
CHECKFLAGS += -D__hppa__=1

MACHINE := $(shell uname -m)
-ifeq ($(MACHINE),parisc*)
-NATIVE := 1
-endif

ifdef CONFIG_64BIT
UTS_MACHINE := parisc64
CHECKFLAGS += -D__LP64__=1 -m64
WIDTH := 64
-CROSS_COMPILE := hppa64-linux-gnu-
+
+# if no default set, try to find the corresponding 64 bit compiler
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed s/hppa-\\\(.*\\\)/hppa64-\\1-/)
+endif
else # 32-bit
WIDTH :=
endif

-# attempt to help out folks who are cross-compiling
-ifeq ($(NATIVE),1)
-CROSS_COMPILE := hppa$(WIDTH)-linux-
-endif
-
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S

cflags-y := -pipe



????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2012-02-28 01:04:54

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> --- a/arch/parisc/Makefile
> +++ b/arch/parisc/Makefile
>
> -CROSS_COMPILE := hppa64-linux-gnu-
> +
> +# if no default set, try to find the corresponding 64 bit compiler
> +ifeq ($(CROSS_COMPILE),)
> +CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed s/hppa-\\\(.*\\\)/hppa64-\\1-/)
> +endif

fails when using "hppa2.0-xxx". perhaps:
CROSS_COMPILE ?= $(shell $(CC) -dumpmachine | sed 's/^hppa[^-]*-/hppa64-/')

don't even need the ifeq check then
-mike


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part.

2012-02-28 03:17:10

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Mon, 2012-02-27 at 20:04 -0500, Mike Frysinger wrote:
> On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> > --- a/arch/parisc/Makefile
> > +++ b/arch/parisc/Makefile
> >
> > -CROSS_COMPILE := hppa64-linux-gnu-
> > +
> > +# if no default set, try to find the corresponding 64 bit compiler
> > +ifeq ($(CROSS_COMPILE),)
> > +CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed s/hppa-\\\(.*\\\)/hppa64-\\1-/)
> > +endif
>
> fails when using "hppa2.0-xxx". perhaps:
> CROSS_COMPILE ?= $(shell $(CC) -dumpmachine | sed 's/^hppa[^-]*-/hppa64-/')
>
> don't even need the ifeq check then

How is that different from Carlos' suggestion? The reason it doesn't
work is the same ... CROSS_COMPILE is defined to be empty.

James

????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2012-02-28 06:06:21

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Monday 27 February 2012 22:17:01 James Bottomley wrote:
> On Mon, 2012-02-27 at 20:04 -0500, Mike Frysinger wrote:
> > On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> > > --- a/arch/parisc/Makefile
> > > +++ b/arch/parisc/Makefile
> > >
> > > -CROSS_COMPILE := hppa64-linux-gnu-
> > > +
> > > +# if no default set, try to find the corresponding 64 bit compiler
> > > +ifeq ($(CROSS_COMPILE),)
> > > +CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed
> > > s/hppa-\\\(.*\\\)/hppa64-\\1-/) +endif
> >
> > fails when using "hppa2.0-xxx". perhaps:
> > CROSS_COMPILE ?= $(shell $(CC) -dumpmachine | sed
> > 's/^hppa[^-]*-/hppa64-/')
> >
> > don't even need the ifeq check then
>
> How is that different from Carlos' suggestion?

sorry, but i'm not seeing any e-mails from Carlos in this thread. what is his
suggestion ?

> The reason it doesn't work is the same ... CROSS_COMPILE is defined to be
> empty.

my suggestion was purely an incremental improvement on the patch you posted.
it improves two things:
- detection when the default tuple is hppa2.0-xxx rather than hppa-xxx
- one line for set-variable-only-when-its-unset rather than three lines
-mike


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part.

2012-02-28 14:10:53

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Tue, 2012-02-28 at 01:06 -0500, Mike Frysinger wrote:
> On Monday 27 February 2012 22:17:01 James Bottomley wrote:
> > On Mon, 2012-02-27 at 20:04 -0500, Mike Frysinger wrote:
> > > On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> > > > --- a/arch/parisc/Makefile
> > > > +++ b/arch/parisc/Makefile
> > > >
> > > > -CROSS_COMPILE := hppa64-linux-gnu-
> > > > +
> > > > +# if no default set, try to find the corresponding 64 bit compiler
> > > > +ifeq ($(CROSS_COMPILE),)
> > > > +CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed
> > > > s/hppa-\\\(.*\\\)/hppa64-\\1-/) +endif
> > >
> > > fails when using "hppa2.0-xxx". perhaps:

Is that a valid prefix? I was thinking hppa32 might be, but hppa2.0 is
supposed to be hppa-xxx with -mpa-risc-2-0.

But anyway, I think being clever and removing unused stuff is likely
orthogonal to the first patch which is just making it all work.

> > > CROSS_COMPILE ?= $(shell $(CC) -dumpmachine | sed
> > > 's/^hppa[^-]*-/hppa64-/')
> > >
> > > don't even need the ifeq check then
> >
> > How is that different from Carlos' suggestion?
>
> sorry, but i'm not seeing any e-mails from Carlos in this thread. what is his
> suggestion ?

Actually, I misspoke, it was your suggestion in the first thread.

> > The reason it doesn't work is the same ... CROSS_COMPILE is defined to be
> > empty.
>
> my suggestion was purely an incremental improvement on the patch you posted.
> it improves two things:
> - detection when the default tuple is hppa2.0-xxx rather than hppa-xxx
> - one line for set-variable-only-when-its-unset rather than three lines
> -mike

It can't be done ... defined but empty is different from not defined in
makefiles (ifdef or ?= only checks for not defined). CROSS_COMPILE gets
automatically defined by the top level Makefile ... that's why we need a
check for empty not a check for not defined.

James

2012-02-28 15:21:09

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Tuesday 28 February 2012 09:10:45 James Bottomley wrote:
> On Tue, 2012-02-28 at 01:06 -0500, Mike Frysinger wrote:
> > On Monday 27 February 2012 22:17:01 James Bottomley wrote:
> > > On Mon, 2012-02-27 at 20:04 -0500, Mike Frysinger wrote:
> > > > On Monday 27 February 2012 17:03:10 James Bottomley wrote:
> > > > > --- a/arch/parisc/Makefile
> > > > > +++ b/arch/parisc/Makefile
> > > > >
> > > > > -CROSS_COMPILE := hppa64-linux-gnu-
> > > > > +
> > > > > +# if no default set, try to find the corresponding 64 bit compiler
> > > > > +ifeq ($(CROSS_COMPILE),)
> > > > > +CROSS_COMPILE := $(shell $(CC) -dumpmachine | sed
> > > > > s/hppa-\\\(.*\\\)/hppa64-\\1-/) +endif
> > > >
> > > > fails when using "hppa2.0-xxx". perhaps:
>
> Is that a valid prefix? I was thinking hppa32 might be, but hppa2.0 is
> supposed to be hppa-xxx with -mpa-risc-2-0.

we've been using hppa2.0 for years. gnuconfig certainly recognizes it:
$ grep hppa /usr/share/gnuconfig/config.sub
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \

and i've seen diff projects key off of the hppa2.0* to enable newer features by
default.

> But anyway, I think being clever and removing unused stuff is likely
> orthogonal to the first patch which is just making it all work.

sure, but your new patch added the sed :)

> > > The reason it doesn't work is the same ... CROSS_COMPILE is defined to
> > > be empty.
> >
> > my suggestion was purely an incremental improvement on the patch you
> > posted.
> >
> > it improves two things:
> > - detection when the default tuple is hppa2.0-xxx rather than hppa-xxx
> > - one line for set-variable-only-when-its-unset rather than three lines
>
> It can't be done ... defined but empty is different from not defined in
> makefiles (ifdef or ?= only checks for not defined). CROSS_COMPILE gets
> automatically defined by the top level Makefile ... that's why we need a
> check for empty not a check for not defined.

yeah, OK ... this behavior changed from what i was remembering. ?= used to
work until the top level Makefile was improved.
-mike


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part.

2012-02-28 15:33:51

by John David Anglin

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On 2/28/2012 10:21 AM, Mike Frysinger wrote:
> we've been using hppa2.0 for years. gnuconfig certainly recognizes it:
> $ grep hppa /usr/share/gnuconfig/config.sub
> | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
> | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
>
> and i've seen diff projects key off of the hppa2.0* to enable newer features by
> default.
Some of the above are specific to HP-UX, but hppa1.1, hppa2.0, hppa and
hppa64 are
valid for Linux based on config.guess.

Dave

--
John David Anglin [email protected]

2012-02-28 18:37:16

by Mike Frysinger

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Tuesday 28 February 2012 13:22:50 Grant Grundler wrote:
> On Tue, Feb 28, 2012 at 7:33 AM, John David Anglin wrote:
> > On 2/28/2012 10:21 AM, Mike Frysinger wrote:
> >> we've been using hppa2.0 for years. gnuconfig certainly recognizes it:
> >> $ grep hppa /usr/share/gnuconfig/config.**sub
> >>
> >> | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] |
> >>
> >> hppa64 \
> >>
> >> | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
> >>
> >> and i've seen diff projects key off of the hppa2.0* to enable newer
> >> features by
> >> default.
> >
> > Some of the above are specific to HP-UX, but hppa1.1, hppa2.0, hppa and
> > hppa64 are
> > valid for Linux based on config.guess.
>
> Mike, et al,
> I'd suggest NOT using hppa2.0 as a surrogate for 64-bit build. I'd prefer
> hppa64 if 64-bit is meant.
>
> hppa2.0 can also mean PA2.0 compliant binary compiled using ILP32 model.
> right?

i don't think that's what the proposed change does. James' patch runs $(CC)
to find the active tuple, then replaces the first part with "hppa64" to get a
64bit toolchain automatically. but that magic only works when the tuple is
"hppa-xxx" and so will fail when the system is using "hppa2.0-xxx".

short story: the proposed change will additionally support turning "hppa2.0-
linux-gnu" into "hppa64-linux-gnu" rather than the existing "only turns hppa-
linux-gnu" into "hppa64-linux-gnu".
-mike


Attachments:
signature.asc (836.00 B)
This is a digitally signed message part.

2012-02-28 19:54:55

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v2] parisc: dont unconditionally override CROSS_COMPILE for 64 bit.

On Tue, Feb 28, 2012 at 01:37:10PM -0500, Mike Frysinger wrote:
> On Tuesday 28 February 2012 13:22:50 Grant Grundler wrote:
> > On Tue, Feb 28, 2012 at 7:33 AM, John David Anglin wrote:
> > > On 2/28/2012 10:21 AM, Mike Frysinger wrote:
> > >> we've been using hppa2.0 for years. gnuconfig certainly recognizes it:
> > >> $ grep hppa /usr/share/gnuconfig/config.**sub
> > >>
> > >> | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] |
> > >>
> > >> hppa64 \
> > >>
> > >> | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
> > >>
> > >> and i've seen diff projects key off of the hppa2.0* to enable newer
> > >> features by
> > >> default.
> > >
> > > Some of the above are specific to HP-UX, but hppa1.1, hppa2.0, hppa and
> > > hppa64 are
> > > valid for Linux based on config.guess.
> >
> > Mike, et al,
> > I'd suggest NOT using hppa2.0 as a surrogate for 64-bit build. I'd prefer
> > hppa64 if 64-bit is meant.
> >
> > hppa2.0 can also mean PA2.0 compliant binary compiled using ILP32 model.
> > right?
>
> i don't think that's what the proposed change does. James' patch runs $(CC)
> to find the active tuple, then replaces the first part with "hppa64" to get a
> 64bit toolchain automatically. but that magic only works when the tuple is
> "hppa-xxx" and so will fail when the system is using "hppa2.0-xxx".
>
> short story: the proposed change will additionally support turning "hppa2.0-
> linux-gnu" into "hppa64-linux-gnu" rather than the existing "only turns hppa-
> linux-gnu" into "hppa64-linux-gnu".

There is a small helper:

cc-cross-prefix

Which may be used ifyou have two or mroe candidated for CROSS_COMPILE.

>From mips:
CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)

Dunno if this would help parisc in this case..

Sam