arch: allow passing compile flags (branch yem/arc-atomic)
cover arch: allow passing compile flags (branch yem/arc-atomic)
Hello All!
This series makes it so that architectures can set compilation flags, passed down via the wrapper.
This is then used by arc to enforce -matomic for those cores that need it, namely arc7x0, as reported by Alexey:
https://patchwork.ozlabs.org/patch/1087480/ https://patchwork.ozlabs.org/patch/1087471/
Regards,
Yann E. MORIN.
The following changes since commit a28c727bb77ce83a0c5c6b0d87d4e46374200371
package/network-manager: drop unrecognized --without-docs (2019-06-01 15:10:30 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 16241cb355b045ba585ba806f0f4c829f5aea9f8
arch/arc: arc7x0 always needs -matomic (2019-06-01 22:28:19 +0200)
----------------------------------------------------------------
Yann E. MORIN (2):
toolchain: allow architectures to enforce compilation flags arch/arc: arc7x0 always needs -matomic
arch/arch.mk.arc | 4 ++++ toolchain/toolchain-wrapper.mk | 1 + 2 files changed, 5 insertions(+) create mode 100644 arch/arch.mk.arc
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 toolchain: allow architectures to enforce compilation flags
--- toolchain/toolchain-wrapper.mk | 1 + 1 file changed, 1 insertion(+)
toolchain/toolchain-wrapper.mk +1 -0
@@ -17,6 +17,7 @@ TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' TOOLCHAIN_WRAPPER_OPTS = \ + $(ARCH_TOOLCHAIN_WRAPPER_OPTS) \ $(call qstrip,$(BR2_SSP_OPTION)) \ $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
Signature · 1 line
2.20.1
PATCH 2/2 arch/arc: arc7x0 always needs -matomic
In reply to Yann E. MORINAs reported by Alexey:
https://patchwork.ozlabs.org/patch/1087480/ https://patchwork.ozlabs.org/patch/1087471/
--- arch/arch.mk.arc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 arch/arch.mk.arc
arch/arch.mk.arc new file +4 -0
@@ -0,0 +1,4 @@ +# ARC7x0 needs -matomic, always +ifeq ($(BR2_arc750d)$(BR2_arc770d),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic +endif
Signature · 1 line
2.20.1
PATCH 2/2 arch/arc: arc7x0 always needs -matomic
arch/arch.mk.arc line 4
Quoted 10 lines · On Sat, 1 Jun 2019 22:33:51 +0200 "Yann E. MORIN" <[email protected]>…
arch/arch.mk.arc new file +4
-0@@ -0,0 +1,4 @@ +# ARC7x0 needs -matomic, always +ifeq ($(BR2_arc750d)$(BR2_arc770d),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic +endif
So can we drop
TARGET_ABI += -matomic
from package/Makefile.in ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/2 arch/arc: arc7x0 always needs -matomic
Thomas, All,
On 2019-06-01 22:37 +0200, Thomas Petazzoni spake thusly:
Quoted 15 lines
arch/arch.mk.arc line 4
Quoted 10 lines · On Sat, 1 Jun 2019 22:33:51 +0200 "Yann E. MORIN" <[email protected]>…
arch/arch.mk.arc new file +4
-0@@ -0,0 +1,4 @@ +# ARC7x0 needs -matomic, always +ifeq ($(BR2_arc750d)$(BR2_arc770d),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic +endifSo can we drop
TARGET_ABI+= -matomic
from package/Makefile.in ?
Ah, I see that the condition there is not the same as the one I wrote.
Alexey, last time I asked [0], you did not reply, so here goes again: what variants of ARC really require -matomic, as you reported on [2] [3].
From [1], I understood that only arc700 was impacted, but the existing condition to add -matomic for arc [4] is not the same.
So, quid?
[0] https://patchwork.ozlabs.org/comment/2169504/
[1] https://patchwork.ozlabs.org/comment/2159927/
[2] https://patchwork.ozlabs.org/patch/1087471/
[3] https://patchwork.ozlabs.org/patch/1087480/
[4] https://git.buildroot.org/buildroot/tree/package/Makefile.in#n106
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/2 arch/arc: arc7x0 always needs -matomic
Hi Yann, Thomas, all,
Quoted 28 lines
-----Original Message-----
From: Yann E. MORIN <[email protected]>
Sent: Saturday, June 1, 2019 11:51 PM
To: Thomas Petazzoni <[email protected]>; Alexey Brodkin <[email protected]>
Cc: Arnout Vandecappelle <[email protected]>; buildroot at buildroot.org
Subject: Re: [PATCH 2/2]arch/arc: arc7x0 always needs -matomicThomas, All,
On 2019-06-01 22:37 +0200, Thomas Petazzoni spake thusly:
Quoted 15 lines
arch/arch.mk.arc line 4
Quoted 10 lines · On Sat, 1 Jun 2019 22:33:51 +0200 "Yann E. MORIN" <[email protected]>…
arch/arch.mk.arc new file +4
-0@@ -0,0 +1,4 @@ +# ARC7x0 needs -matomic, always +ifeq ($(BR2_arc750d)$(BR2_arc770d),y) +ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic +endifSo can we drop
TARGET_ABI+= -matomic
from package/Makefile.in ?Ah, I see that the condition there is not the same as the one I wrote.
Quoted 7 lines
Alexey, last time I asked [0], you did not reply, so here goes again: what variants of ARC really require -matomic, as you reported on [2] [3].
From [1], I understood that only arc700 was impacted, but the existing condition to add -matomic for arc [4] is not the same.
So, quid?
That's indeed not super straight-forward.
As of today we have 2 families of cores capable of running full-scale OS, i.e. with MMU at least. These are ARC700 [1] and ARC HS [2].
And while all ARC HS cores have support of atomic instructions in their base configurations in case of ARC700 they were not included in base configs (I guess because back in the day in absence of SMP everybody was happy with compare-exchange). What's worse those atomic-less configurations really exist and that's why I'd still prefer to support them.
Speaking about atomics support in the toolchain we keep "-matomic" disabled for "-mcpu=arc700" and have it enabled for all ARC HS varieties (hs, hs38, hs38_linux etc), see:
| # arc-linux-gcc -mcpu=arc700 -Q --help=target | grep matomic | -matomic [disabled] | #?arc-linux-gcc -mcpu=archs -Q --help=target | grep matomic | -matomic [enabled]
I.e. passing "-matomic" for ARC HS makes not much sense - it's enabled already implicitly due to either "-mcpu" on GCC invocation or "--with-cpu" on GCC configuration.
Now answering your and Tomas' questions:
1. In theory ARC750 is exactly that legacy configuration w/o atomics so we may just depend on "BR2_arc750d".
2. In practice given atomics might be disabled (or enabled) during core configuration [while designing the chip based on ARC700 family] it might still be a better option to rely on "BR2_ARC_ATOMIC_EXT" which:
a) Gets pre-set of !BR2_arc750d
b) Might be changed by a user
That said I don't have a firm preference here.
If you feel that dropping BR2_ARC_ATOMIC_EXT and relying on "BR2_arc750d" for disabling atomics makes BR code cleaner let's go that way.
[1] https://www.synopsys.com/designware-ip/processor-solutions/arc-processors/arc-700-family.html
[2] https://www.synopsys.com/designware-ip/processor-solutions/arc-processors/arc-hs-family.html
-Alexey
P.S. BTW is there a chance to get our changes which add more flavors of ARC HS cores
reviewed?
PATCH 2/2 arch/arc: arc7x0 always needs -matomic
Alexey, All,
On 2019-06-03 05:42 +0000, Alexey Brodkin spake thusly:
Quoted 41 lines
Quoted 7 lines
Alexey, last time I asked [0], you did not reply, so here goes again: what variants of ARC really require -matomic, as you reported on [2] [3].
From [1], I understood that only arc700 was impacted, but the existing condition to add -matomic for arc [4] is not the same.
So, quid?
That's indeed not super straight-forward.
As of today we have 2 families of cores capable of running full-scale OS, i.e. with MMU at least. These are ARC700 [1] and ARC HS [2].
And while all ARC HS cores have support of atomic instructions in their base configurations in case of ARC700 they were not included in base configs (I guess because back in the day in absence of SMP everybody was happy with compare-exchange). What's worse those atomic-less configurations really exist and that's why I'd still prefer to support them.
Speaking about atomics support in the toolchain we keep "-matomic" disabled for "-mcpu=arc700" and have it enabled for all ARC HS varieties (hs, hs38,
hs38_linuxetc), see:| # arc-linux-gcc -mcpu=arc700 -Q --help=target | grep matomic | -matomic [disabled] | #?arc-linux-gcc -mcpu=archs -Q --help=target | grep matomic | -matomic [enabled]I.e. passing "-matomic" for ARC HS makes not much sense - it's enabled already implicitly due to either "-mcpu" on GCC invocation or "--with-cpu" on GCC configuration.
Now answering your and Tomas' questions:
1. In theory ARC750 is exactly that legacy configuration w/o atomics so we may just depend on "BR2_arc750d".
2. In practice given atomics might be disabled (or enabled) during core configuration [while designing the chip based on ARC700 family] it might still be a better option to rely on "BR2_ARC_ATOMIC_EXT" which:
a) Gets pre-set of !BR2_arc750d
b) Might be changed by a user
Quoted 4 lines
That said I don't have a firm preference here.
If you feel that dropping
BR2_ARC_ATOMIC_EXTand relying on "BR2_arc750d" for disabling atomics makes BR code cleaner let's go that way.
Thank you very much for these detailed explanations.
However, I am still unsure what to do, and under which conditions we want to force -matomic...
So, I'll respin this series with what I think I have understood. If I still messed things up, then you'll have to grab the patches and fix them.
Thanks again! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'