linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
@ 2018-09-16 20:47 Alexey Brodkin
  2018-10-17 14:33 ` Alexey Brodkin
  2019-05-23 19:02 ` Vineet Gupta
  0 siblings, 2 replies; 4+ messages in thread
From: Alexey Brodkin @ 2018-09-16 20:47 UTC (permalink / raw)
  To: linux-snps-arc
  Cc: linux-kernel, Vineet Gupta, Alexey Brodkin, Masahiro Yamada, Rob Herring

There's not much sense in doing that because if user or
his build-system didn't set CROSS_COMPILE we still may
very well make incorrect guess.

But as it turned out setting CROSS_COMPILE is not as harmless
as one may think: with recent changes that implemented automatic
discovery of __host__ gcc features unconditional setup of
CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
with absent cross-compiler, for more info see [1].

Set CROSS_COMPILE as well gets in the way if we want only to build
.dtb's (again with absent cross-compiler which is not really needed
for building .dtb's), see [2].

Note, we had to change LIBGCC assignment type from ":=" to "="
so that is is resolved on its usage, otherwise if it is resolved
at declaration time with missing CROSS_COMPILE we're getting this
error message from host GCC:
------------------------->8-------------------------
gcc: error: unrecognized command line option ‘-mmedium-calls’
gcc: error: unrecognized command line option ‘-mno-sdata’; did you mean ‘-fno-stats’?
------------------------->8-------------------------

[1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
[2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Rob Herring <robh@kernel.org>
---
 arch/arc/Makefile | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 99cce77ab98f..5f6b67917dc2 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -6,14 +6,6 @@
 # published by the Free Software Foundation.
 #
 
-ifeq ($(CROSS_COMPILE),)
-ifndef CONFIG_CPU_BIG_ENDIAN
-CROSS_COMPILE := arc-linux-
-else
-CROSS_COMPILE := arceb-linux-
-endif
-endif
-
 KBUILD_DEFCONFIG := nsim_700_defconfig
 
 cflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
@@ -79,7 +71,7 @@ cflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
 cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
 ldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
 
-LIBGCC	:= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
+LIBGCC	= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
 
 # Modules with short calls might break for calls into builtin-kernel
 KBUILD_CFLAGS_MODULE	+= -mlong-calls -mno-millicode
-- 
2.17.1


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

* RE: [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
  2018-09-16 20:47 [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile Alexey Brodkin
@ 2018-10-17 14:33 ` Alexey Brodkin
  2018-10-18 12:44   ` gregkh
  2019-05-23 19:02 ` Vineet Gupta
  1 sibling, 1 reply; 4+ messages in thread
From: Alexey Brodkin @ 2018-10-17 14:33 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Vineet Gupta, Masahiro Yamada, Rob Herring, gregkh,
	linux-snps-arc

Hello,

> -----Original Message-----
> From: Alexey Brodkin [mailto:abrodkin@synopsys.com]
> Sent: Sunday, September 16, 2018 11:48 PM
> To: linux-snps-arc@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org; Vineet Gupta <vgupta@synopsys.com>; Alexey Brodkin <abrodkin@synopsys.com>; Masahiro
> Yamada <yamada.masahiro@socionext.com>; Rob Herring <robh@kernel.org>
> Subject: [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
> 
> There's not much sense in doing that because if user or
> his build-system didn't set CROSS_COMPILE we still may
> very well make incorrect guess.
> 
> But as it turned out setting CROSS_COMPILE is not as harmless
> as one may think: with recent changes that implemented automatic
> discovery of __host__ gcc features unconditional setup of
> CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
> with absent cross-compiler, for more info see [1].
> 
> Set CROSS_COMPILE as well gets in the way if we want only to build
> .dtb's (again with absent cross-compiler which is not really needed
> for building .dtb's), see [2].
> 
> Note, we had to change LIBGCC assignment type from ":=" to "="
> so that is is resolved on its usage, otherwise if it is resolved
> at declaration time with missing CROSS_COMPILE we're getting this
> error message from host GCC:
> ------------------------->8-------------------------
> gcc: error: unrecognized command line option ‘-mmedium-calls’
> gcc: error: unrecognized command line option ‘-mno-sdata’; did you mean ‘-fno-stats’?
> ------------------------->8-------------------------
> 
> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Rob Herring <robh@kernel.org>
> ---
>  arch/arc/Makefile | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> index 99cce77ab98f..5f6b67917dc2 100644
> --- a/arch/arc/Makefile
> +++ b/arch/arc/Makefile
> @@ -6,14 +6,6 @@
>  # published by the Free Software Foundation.
>  #
> 
> -ifeq ($(CROSS_COMPILE),)
> -ifndef CONFIG_CPU_BIG_ENDIAN
> -CROSS_COMPILE := arc-linux-
> -else
> -CROSS_COMPILE := arceb-linux-
> -endif
> -endif
> -
>  KBUILD_DEFCONFIG := nsim_700_defconfig
> 
>  cflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
> @@ -79,7 +71,7 @@ cflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
>  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
>  ldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
> 
> -LIBGCC	:= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
> +LIBGCC	= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
> 
>  # Modules with short calls might break for calls into builtin-kernel
>  KBUILD_CFLAGS_MODULE	+= -mlong-calls -mno-millicode
> --
> 2.17.1

May we have this one back-ported to stable branches?

Upstream commit in Linus' tree is:
40660f1fcee8 ("ARC: build: Don't set CROSS_COMPILE in arch's Makefile").

Regards,
Alexey


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

* Re: [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
  2018-10-17 14:33 ` Alexey Brodkin
@ 2018-10-18 12:44   ` gregkh
  0 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2018-10-18 12:44 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: stable, linux-kernel, Vineet Gupta, Masahiro Yamada, Rob Herring,
	linux-snps-arc

On Wed, Oct 17, 2018 at 02:33:02PM +0000, Alexey Brodkin wrote:
> Hello,
> 
> > -----Original Message-----
> > From: Alexey Brodkin [mailto:abrodkin@synopsys.com]
> > Sent: Sunday, September 16, 2018 11:48 PM
> > To: linux-snps-arc@lists.infradead.org
> > Cc: linux-kernel@vger.kernel.org; Vineet Gupta <vgupta@synopsys.com>; Alexey Brodkin <abrodkin@synopsys.com>; Masahiro
> > Yamada <yamada.masahiro@socionext.com>; Rob Herring <robh@kernel.org>
> > Subject: [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
> > 
> > There's not much sense in doing that because if user or
> > his build-system didn't set CROSS_COMPILE we still may
> > very well make incorrect guess.
> > 
> > But as it turned out setting CROSS_COMPILE is not as harmless
> > as one may think: with recent changes that implemented automatic
> > discovery of __host__ gcc features unconditional setup of
> > CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
> > with absent cross-compiler, for more info see [1].
> > 
> > Set CROSS_COMPILE as well gets in the way if we want only to build
> > .dtb's (again with absent cross-compiler which is not really needed
> > for building .dtb's), see [2].
> > 
> > Note, we had to change LIBGCC assignment type from ":=" to "="
> > so that is is resolved on its usage, otherwise if it is resolved
> > at declaration time with missing CROSS_COMPILE we're getting this
> > error message from host GCC:
> > ------------------------->8-------------------------
> > gcc: error: unrecognized command line option ‘-mmedium-calls’
> > gcc: error: unrecognized command line option ‘-mno-sdata’; did you mean ‘-fno-stats’?
> > ------------------------->8-------------------------
> > 
> > [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
> > [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Cc: Rob Herring <robh@kernel.org>
> > ---
> >  arch/arc/Makefile | 10 +---------
> >  1 file changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> > index 99cce77ab98f..5f6b67917dc2 100644
> > --- a/arch/arc/Makefile
> > +++ b/arch/arc/Makefile
> > @@ -6,14 +6,6 @@
> >  # published by the Free Software Foundation.
> >  #
> > 
> > -ifeq ($(CROSS_COMPILE),)
> > -ifndef CONFIG_CPU_BIG_ENDIAN
> > -CROSS_COMPILE := arc-linux-
> > -else
> > -CROSS_COMPILE := arceb-linux-
> > -endif
> > -endif
> > -
> >  KBUILD_DEFCONFIG := nsim_700_defconfig
> > 
> >  cflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
> > @@ -79,7 +71,7 @@ cflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
> >  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
> >  ldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
> > 
> > -LIBGCC	:= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
> > +LIBGCC	= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
> > 
> >  # Modules with short calls might break for calls into builtin-kernel
> >  KBUILD_CFLAGS_MODULE	+= -mlong-calls -mno-millicode
> > --
> > 2.17.1
> 
> May we have this one back-ported to stable branches?
> 
> Upstream commit in Linus' tree is:
> 40660f1fcee8 ("ARC: build: Don't set CROSS_COMPILE in arch's Makefile").

Applied to 4.9.y, 4.14.y, and 4.18.y, thanks.

greg k-h

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

* Re: [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile
  2018-09-16 20:47 [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile Alexey Brodkin
  2018-10-17 14:33 ` Alexey Brodkin
@ 2019-05-23 19:02 ` Vineet Gupta
  1 sibling, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2019-05-23 19:02 UTC (permalink / raw)
  To: Alexey Brodkin, linux-snps-arc; +Cc: linux-kernel, Masahiro Yamada, Rob Herring

On 9/16/18 1:47 PM, Alexey Brodkin wrote:
> There's not much sense in doing that because if user or
> his build-system didn't set CROSS_COMPILE we still may
> very well make incorrect guess.
> 
> But as it turned out setting CROSS_COMPILE is not as harmless
> as one may think: with recent changes that implemented automatic
> discovery of __host__ gcc features unconditional setup of
> CROSS_COMPILE leads to failures on execution of "make xxx_defconfig"
> with absent cross-compiler, for more info see [1].
> 
> Set CROSS_COMPILE as well gets in the way if we want only to build
> .dtb's (again with absent cross-compiler which is not really needed
> for building .dtb's), see [2].

@Alexey, can we revisit this (revert back partially). I'm getting sick of having
to specify the CROSS_COMPILE in my cmdline.

Will something along the lines fc2b47b55f17fd996f7a019 ("h8300: use
cc-cross-prefix instead of hardcoding h8300-unknown-linux-") work ?

---->
+ifeq ($(CROSS_COMPILE),)
+CROSS_COMPILE := $(call cc-cross-prefix, arc-linux-)
+endif



> 
> Note, we had to change LIBGCC assignment type from ":=" to "="
> so that is is resolved on its usage, otherwise if it is resolved
> at declaration time with missing CROSS_COMPILE we're getting this
> error message from host GCC:
> ------------------------->8-------------------------
> gcc: error: unrecognized command line option ‘-mmedium-calls’
> gcc: error: unrecognized command line option ‘-mno-sdata’; did you mean ‘-fno-stats’?
> ------------------------->8-------------------------
> 
> [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004308.html
> [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-September/004320.html
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Rob Herring <robh@kernel.org>
> ---
>  arch/arc/Makefile | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> index 99cce77ab98f..5f6b67917dc2 100644
> --- a/arch/arc/Makefile
> +++ b/arch/arc/Makefile
> @@ -6,14 +6,6 @@
>  # published by the Free Software Foundation.
>  #
>  
> -ifeq ($(CROSS_COMPILE),)
> -ifndef CONFIG_CPU_BIG_ENDIAN
> -CROSS_COMPILE := arc-linux-
> -else
> -CROSS_COMPILE := arceb-linux-
> -endif
> -endif
> -
>  KBUILD_DEFCONFIG := nsim_700_defconfig
>  
>  cflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
> @@ -79,7 +71,7 @@ cflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
>  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
>  ldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
>  
> -LIBGCC	:= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
> +LIBGCC	= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
>  
>  # Modules with short calls might break for calls into builtin-kernel
>  KBUILD_CFLAGS_MODULE	+= -mlong-calls -mno-millicode
> 


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

end of thread, other threads:[~2019-05-23 19:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-16 20:47 [PATCH] ARC: Don't set CROSS_COMPILE in arch's Makefile Alexey Brodkin
2018-10-17 14:33 ` Alexey Brodkin
2018-10-18 12:44   ` gregkh
2019-05-23 19:02 ` Vineet Gupta

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