ARC: build: Try to guess CROSS_COMPILE with cc-cross-prefix
PATCH 1/1 ARC: build: Try to guess CROSS_COMPILE with cc-cross-prefix
For a long time we used to hard-code CROSS_COMPILE prefix
for ARC until it started to cause problems, so we decided to solely rely on CROSS_COMPILE externally set by a user:
commit 40660f1fcee8 ("ARC: build: Don't set CROSS_COMPILE in arch's Makefile").
While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arc
Inspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17
A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'
--- arch/arc/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
arch/arc/Makefile +4 -0
@@ -8,6 +8,10 @@ KBUILD_DEFCONFIG := nsim_hs_defconfig +ifeq ($(CROSS_COMPILE),) +CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) +endif + cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
Signature · 1 line
2.16.2
Hi Alexey,
Quoted 20 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17
Quoted 6 lines
A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'
Oh really?
masahiro at pug:~$ which arc-linux-gcc/home/masahiro/tools/arc/bin/arc-linux-gcc
masahiro at pug:~$ which dummy-linux-gcc
masahiro at pug:~$ echo $?
1
When 'which' cannot find the given command,
it does not print anything to stderr.
Does it work differently on your machine?
Signature · 2 lines
Best Regards Masahiro Yamada
Hi Masahiro-san,
Quoted 12 lines
-----Original Message-----
From: Masahiro Yamada <yamada.masahiro at socionext.com>
Sent: Monday, June 3, 2019 11:18 AM
To: Alexey Brodkin <abrodkin at synopsys.com>
Cc: arcml <linux-snps-arc at lists.infradead.org>; Linux Kernel Mailing List <linux- kernel at vger.kernel.org>; Vineet Gupta <Vineet.Gupta1 at synopsys.com>
Subject: Re: [PATCH] ARC: build: Try to guessCROSS_COMPILEwith cc-cross-prefixHi Alexey,
On Mon, Jun 3, 2019 at 3:42 PM Alexey Brodkin
<[email protected]> wrote:
[snip]
Quoted 17 lines
Quoted 6 lines
A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'Oh really?
masahiro at pug:~$ which arc-linux-gcc
/home/masahiro/tools/arc/bin/arc-linux-gcc
masahiro at pug:~$ which dummy-linux-gcc
masahiro at pug:~$ echo $?
1
Quoted 4 lines
When 'which' cannot find the given command,
it does not print anything to stderr.Does it work differently on your machine?
Well on Ubuntu 18.04 indeed which doesn't show anything
but on my build-server with CentOS 7 I'm getting mentioned verbose output:
| #?cat /etc/redhat-release
| CentOS Linux release 7.3.1611 (Core)
| #?/usr/bin/which -v | GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood. | GNU which comes with ABSOLUTELY NO WARRANTY; | This program is free software; your freedom to use, change | and distribute this program is protected by the GPL.
-Alexey
Hi Alexey,
Quoted 45 lines · Alexey Brodkin
Hi Masahiro-san,
Quoted 12 lines
-----Original Message-----
From: Masahiro Yamada <yamada.masahiro at socionext.com>
Sent: Monday, June 3, 2019 11:18 AM
To: Alexey Brodkin <abrodkin at synopsys.com>
Cc: arcml <linux-snps-arc at lists.infradead.org>; Linux Kernel Mailing List <linux- kernel at vger.kernel.org>; Vineet Gupta <Vineet.Gupta1 at synopsys.com>
Subject: Re: [PATCH] ARC: build: Try to guessCROSS_COMPILEwith cc-cross-prefixHi Alexey,
On Mon, Jun 3, 2019 at 3:42 PM Alexey Brodkin
<[email protected]> wrote:[snip]
Quoted 17 lines
Quoted 6 lines
A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'Oh really?
masahiro at pug:~$ which arc-linux-gcc
/home/masahiro/tools/arc/bin/arc-linux-gcc
masahiro at pug:~$ which dummy-linux-gcc
masahiro at pug:~$ echo $?
1Quoted 4 lines
When 'which' cannot find the given command,
it does not print anything to stderr.Does it work differently on your machine?
Well on Ubuntu 18.04 indeed which doesn't show anything
but on my build-server with CentOS 7 I'm getting mentioned verbose output:
| # cat/etc/redhat-release
| CentOS Linux release 7.3.1611 (Core)
Quoted 5 lines
| # /usr/bin/which -v | GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood. | GNU which comes with ABSOLUTELY NO WARRANTY; | This program is free software; your freedom to use, change | and distribute this program is protected by the GPL.
OK, confirmed.
Probably using 'which' is a bad idea
since this is not portable.
I will send a fix-up patch soon.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 22 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
Quoted 7 lines
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>Cc Masahiro Yamada <yamada.masahiro at socionext.com>Cc Vineet Gupta <vgupta at synopsys.com>
Not a big deal but I'd propose we add "Suggested-by: vgupta" since that is where it came from.
@Masahiro san I suppose you are OK with this, so perhaps an Ack etc would be nice to have.
Thx,
-Vineet
Quoted 19 lines
--- arch/arc/Makefile | 4 ++++ 1 file changed, 4 insertions(+)arch/arc/Makefile +4
-0@@ -8,6 +8,10 @@ KBUILD_DEFCONFIG := nsim_hs_defconfig +ifeq ($(CROSS_COMPILE),) +CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) +endif + cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
Hi Vineet,
Quoted 34 lines
-----Original Message-----
From: Vineet Gupta <vgupta at synopsys.com>
Sent: Monday, June 3, 2019 7:25 PM
To: Alexey Brodkin <abrodkin at synopsys.com>; linux-snps-arc at lists.infradead.org
Cc: linux-kernel at vger.kernel.org; Masahiro Yamada <yamada.masahiro at socionext.com>
Subject: Re: [PATCH] ARC: build: Try to guessCROSS_COMPILEwith cc-cross-prefixQuoted 26 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'
Quoted 6 lines
Quoted 3 lines
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>Cc Masahiro Yamada <yamada.masahiro at socionext.com>Cc Vineet Gupta <vgupta at synopsys.com>Not a big deal but I'd propose we add "Suggested-by: vgupta" since that is where it came from.
Ooops, indeed that should have been added, but instead I just mentioned your earlier email in the mailing list.
Care to add yourself on patch application?
-Alexey
Hi.
Quoted 36 lines · Alexey Brodkin
Hi Vineet,
Quoted 33 lines
-----Original Message-----
From: Vineet Gupta <vgupta at synopsys.com>
Sent: Monday, June 3, 2019 7:25 PM
To: Alexey Brodkin <abrodkin at synopsys.com>; linux-snps-arc at lists.infradead.org
Cc: linux-kernel at vger.kernel.org; Masahiro Yamada <yamada.masahiro at socionext.com>
Subject: Re: [PATCH] ARC: build: Try to guessCROSS_COMPILEwith cc-cross-prefixQuoted 25 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'
I just noticed this patch is queued on top of v5.2-rc4. (2bc42bfba9b247abd)
This 'side note' is no longer needed or reproducible because -rc4 contains my fix-up (913ab9780fc0212).
I do not know if the ARC maitainer is happy to rebase.
Just for your information.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 42 lines · Masahiro Yamada
Hi.
Quoted 36 lines · Alexey Brodkin
Hi Vineet,
Quoted 33 lines
-----Original Message-----
From: Vineet Gupta <vgupta at synopsys.com>
Sent: Monday, June 3, 2019 7:25 PM
To: Alexey Brodkin <abrodkin at synopsys.com>; linux-snps-arc at lists.infradead.org
Cc: linux-kernel at vger.kernel.org; Masahiro Yamada <yamada.masahiro at socionext.com>
Subject: Re: [PATCH] ARC: build: Try to guessCROSS_COMPILEwith cc-cross-prefixQuoted 25 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'
Quoted 5 lines
I just noticed this patch is queued on top of v5.2-rc4. (
2bc42bfba9b247abd)This 'side note' is no longer needed or reproducible because -rc4 contains my fix-up (
913ab9780fc0212).
But 2bc42bfba9b247abd was to address my complaint that we need to specify CROSS_COMPILE prefix on cmdline.
When doing the needful Alexey found the "noise" when a prefix didn't exist, which 913ab9780fc0212 address.
So these seem like orthogonal to me - that is unless I got the wired crossed somewhow.
Quoted 2 lines
I do not know if the ARC maitainer is happy to rebase.
I would happily do that on next rc if that is infact needed.
Masahiro Yamada
Reviewed-byQuoted 32 lines · Vineet Gupta
Quoted 22 lines · Alexey Brodkin
For a long time we used to hard-code
CROSS_COMPILEprefix
for ARC until it started to cause problems, so we decided to solely rely onCROSS_COMPILEexternally set by a user:
commit40660f1fcee8("ARC: build: Don't setCROSS_COMPILEin arch'sMakefile").While it works perfectly fine for build-systems where the prefix gets defined anyways for us human beings it's quite an annoying requirement especially given most of time the same one prefix "arc-linux-" is all what we need.
It looks like finally we're getting the best of both worlds:
1. W/o cross-toolchain we still may install headers, build .dtb etc
2. W/ cross-toolchain get the kerne built with only ARCH=arcInspired by [1] & [2].
[1] http://lists.infradead.org/pipermail/linux-snps-arc/2019-May/005788.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc2b47b55f17A side note: even though "cc-cross-prefix" does its job it pollutes console with output of "which" for all the prefixes it didn't manage to find a matching cross-compiler for like that:
Quoted 7 lines
| # ARCH=arc make defconfig | which: no arceb-linux-gcc in (~/.local/bin:~/bin:/usr/bin:/usr/sbin) | *** Default configuration is based on 'nsim_hs_defconfig'Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>Cc Masahiro Yamada <yamada.masahiro at socionext.com>Cc Vineet Gupta <vgupta at synopsys.com>
Quoted 5 lines
Not a big deal but I'd propose we add "Suggested-by: vgupta" since that is where it came from.
@Masahiro san I suppose you are OK with this, so perhaps an Ack etc would be nice to have.
FWIW,
Reviewed-by: Masahiro Yamada <yamada.masahiro at socionext.com>
Signature · 2 lines
Best Regards Masahiro Yamada
I wish we could just set CROSS_COMPILE and ARCH in .config. That would make everyones life compile testing on multiple architectures so much easier.