* [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
@ 2018-08-17 22:10 Fabrice Fontaine
2018-08-17 22:10 ` [Buildroot] [PATCH v2, 2/2] boost: thread needs atomic if GCC hasn't lock-free Fabrice Fontaine
2018-08-18 15:49 ` [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Thomas Petazzoni
0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Fontaine @ 2018-08-17 22:10 UTC (permalink / raw)
To: buildroot
Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS variable and use
it in BR2_TOOLCHAIN_HAS_GCC_BUG_64735
This new variable will be used to select boost atomic when lock-free
atomic ints are not available
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
toolchain/Config.in | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 3a53a32a6d..ed9b59df46 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -73,13 +73,19 @@ config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_19615
# exception_ptr, nested_exception, and future from libstdc++ are not
# available for architectures not supporting always lock-free atomic
# ints before GCC 7
+config BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
+ bool
+ default y
+ depends on !BR2_nios2
+ depends on !BR2_ARM_CPU_ARMV4
+ depends on !BR2_ARM_CPU_ARMV5
+ depends on !BR2_sparc_v8
+ depends on !BR2_m68k_cf5208
+
config BR2_TOOLCHAIN_HAS_GCC_BUG_64735
bool
- default y if BR2_nios2
- default y if BR2_ARM_CPU_ARMV4
- default y if BR2_ARM_CPU_ARMV5
- default y if BR2_sparc_v8
- default y if BR2_m68k_cf5208
+ default y
+ depends on !BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_7
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85180. This bug no
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2, 2/2] boost: thread needs atomic if GCC hasn't lock-free
2018-08-17 22:10 [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Fabrice Fontaine
@ 2018-08-17 22:10 ` Fabrice Fontaine
2018-08-18 15:49 ` [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Thomas Petazzoni
1 sibling, 0 replies; 6+ messages in thread
From: Fabrice Fontaine @ 2018-08-17 22:10 UTC (permalink / raw)
To: buildroot
When gcc has not always lock-free atomic ints:
- lockfree boost::atomic_flag : no
boost thread needs boost atomic:
output/host/usr/bin/nios2-linux-readelf -d output/staging/usr/lib/libboost_thread.so
Dynamic section at offset 0x2cee0 contains 32 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libboost_system.so.1.67.0]
0x00000001 (NEEDED) Shared library: [libboost_atomic.so.1.67.0]
Fixes:
- http://autobuild.buildroot.net/results/5a7db292f1365f27e32695527701d5b827f60092
- http://autobuild.buildroot.net/results/413dff87f5329d3c5180167a8711cdedea5dec67
- http://autobuild.buildroot.net/results/a7eb4cbcdbd9412c344f45336dec58c82e84dab9
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- issue was not related to bug 64735 but to lock-free atomic ints so
add a patch to toolchain/Config.in to get this information in a
dedicated variable and use it in boost
package/boost/Config.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/package/boost/Config.in b/package/boost/Config.in
index 97695e17b7..57e98c72e4 100644
--- a/package/boost/Config.in
+++ b/package/boost/Config.in
@@ -313,6 +313,7 @@ config BR2_PACKAGE_BOOST_TEST
config BR2_PACKAGE_BOOST_THREAD
bool "boost-thread"
+ select BR2_PACKAGE_BOOST_ATOMIC if !BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
select BR2_PACKAGE_BOOST_CHRONO
select BR2_PACKAGE_BOOST_SYSTEM
help
--
2.14.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
2018-08-17 22:10 [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Fabrice Fontaine
2018-08-17 22:10 ` [Buildroot] [PATCH v2, 2/2] boost: thread needs atomic if GCC hasn't lock-free Fabrice Fontaine
@ 2018-08-18 15:49 ` Thomas Petazzoni
2018-08-18 19:29 ` Thomas Petazzoni
1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-08-18 15:49 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 18 Aug 2018 00:10:13 +0200, Fabrice Fontaine wrote:
> Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS variable and use
> it in BR2_TOOLCHAIN_HAS_GCC_BUG_64735
> This new variable will be used to select boost atomic when lock-free
> atomic ints are not available
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> toolchain/Config.in | 16 +++++++++++-----
> 1 file changed, 11 insertions(+), 5 deletions(-)
Thanks a lot for this additional resarch. This time, I do agree with
your findings. I improved a bit the comments in toolchain/Config.in to
explain what was going on, feel free to have a look at the final
commits that I applied to master.
However, we still have an issue: when static linking, libboost_atomic.a
is produced even on platforms that do provide the "always lock-free
atomic ints".
Examples:
- Cortex-M4
http://autobuild.buildroot.net/results/212/212651b677cfb0763b34596d4f999103039d89bc/build-end.log
$ ./host/bin/arm-linux-gcc -dM -E - < /dev/null | grep
ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
- MIPS, statically linked
http://autobuild.buildroot.net/results/6d3/6d3db8a67a1de75920624b3e13e8110e783ddbd9/build-end.log
$ ./host/bin/mipsel-linux-gcc -dM -E - < /dev/null | grep
ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
Do you have any idea ?
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
2018-08-18 15:49 ` [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Thomas Petazzoni
@ 2018-08-18 19:29 ` Thomas Petazzoni
2018-08-18 20:09 ` Fabrice Fontaine
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-08-18 19:29 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 18 Aug 2018 17:49:00 +0200, Thomas Petazzoni wrote:
> However, we still have an issue: when static linking, libboost_atomic.a
> is produced even on platforms that do provide the "always lock-free
> atomic ints".
>
> Examples:
>
> - Cortex-M4
>
> http://autobuild.buildroot.net/results/212/212651b677cfb0763b34596d4f999103039d89bc/build-end.log
>
> $ ./host/bin/arm-linux-gcc -dM -E - < /dev/null | grep
> ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
>
> - MIPS, statically linked
>
> http://autobuild.buildroot.net/results/6d3/6d3db8a67a1de75920624b3e13e8110e783ddbd9/build-end.log
>
> $ ./host/bin/mipsel-linux-gcc -dM -E - < /dev/null | grep
> ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
And we have another situation here:
http://autobuild.buildroot.net/results/9c3/9c373d0b5a1a59e2271d71c480d55a90a67b84cb/build-end.log
This one is on PowerPC, and with dynamic linking. It is not going to be
solved by the BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS stuff.
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
2018-08-18 19:29 ` Thomas Petazzoni
@ 2018-08-18 20:09 ` Fabrice Fontaine
2018-08-18 20:20 ` Thomas Petazzoni
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Fontaine @ 2018-08-18 20:09 UTC (permalink / raw)
To: buildroot
Dear Thomas,
2018-08-18 21:29 GMT+02:00 Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
> Hello,
>
> On Sat, 18 Aug 2018 17:49:00 +0200, Thomas Petazzoni wrote:
>
> > However, we still have an issue: when static linking, libboost_atomic.a
> > is produced even on platforms that do provide the "always lock-free
> > atomic ints".
> >
> > Examples:
> >
> > - Cortex-M4
> >
> > http://autobuild.buildroot.net/results/212/212651b677cfb0763
> b34596d4f999103039d89bc/build-end.log
> >
> > $ ./host/bin/arm-linux-gcc -dM -E - < /dev/null | grep
> > ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
> >
> > - MIPS, statically linked
> >
> > http://autobuild.buildroot.net/results/6d3/6d3db8a67a1de7592
> 0624b3e13e8110e783ddbd9/build-end.log
> >
> > $ ./host/bin/mipsel-linux-gcc -dM -E - < /dev/null | grep
> > ATOMIC_BOOL_LOCK_FREE #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
>
> And we have another situation here:
>
> http://autobuild.buildroot.net/results/9c3/9c373d0b5a1a59e22
> 71d71c480d55a90a67b84cb/build-end.log
>
> This one is on PowerPC, and with dynamic linking. It is not going to be
> solved by the BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS stuff.
>
OK, this last one is easy, azmq selects BOOST_LOG but BOOST_LOG depends on
!(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC):
warning: (BR2_PACKAGE_AZMQ) selects BR2_PACKAGE_BOOST_LOG which has unmet
direct dependencies (BR2_PACKAGE_BOOST && BR2_TOOLCHAIN_HAS_THREADS_NPTL &&
(!BR2_powerpc || !BR2_TOOLCHAIN_USES_UCLIBC))
I will fix this by removing the dependency on !(BR2_powerpc &&
BR2_TOOLCHAIN_USES_UCLIBC) from BOOST_LOG as it seems that boost-log builds
fine on powerpc with uclibc nowadays.
>
> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
Best Regards,
Fabrice
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180818/cdc513c6/attachment.html>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
2018-08-18 20:09 ` Fabrice Fontaine
@ 2018-08-18 20:20 ` Thomas Petazzoni
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-08-18 20:20 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 18 Aug 2018 22:09:13 +0200, Fabrice Fontaine wrote:
> OK, this last one is easy, azmq selects BOOST_LOG but BOOST_LOG depends on
> !(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC):
>
> warning: (BR2_PACKAGE_AZMQ) selects BR2_PACKAGE_BOOST_LOG which has unmet
> direct dependencies (BR2_PACKAGE_BOOST && BR2_TOOLCHAIN_HAS_THREADS_NPTL &&
> (!BR2_powerpc || !BR2_TOOLCHAIN_USES_UCLIBC))
>
> I will fix this by removing the dependency on !(BR2_powerpc &&
> BR2_TOOLCHAIN_USES_UCLIBC) from BOOST_LOG as it seems that boost-log builds
> fine on powerpc with uclibc nowadays.
OK. This was added by me in commit
7aaa9bee2e6009c6c00fa2a356b8f014999e9a54. There was no clear
explanation of the problem, it was just "it doesn't build, and nobody
cares". And it was 3 years ago, so there are high chances that the
problem has been fixed either in uClibc or in Boost. So let's try to
remove this dependency indeed. Waiting for your patch!
(BTW, you still haven't joined IRC! :-))
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-18 20:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 22:10 [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Fabrice Fontaine
2018-08-17 22:10 ` [Buildroot] [PATCH v2, 2/2] boost: thread needs atomic if GCC hasn't lock-free Fabrice Fontaine
2018-08-18 15:49 ` [Buildroot] [PATCH v2, 1/2] Add BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS Thomas Petazzoni
2018-08-18 19:29 ` Thomas Petazzoni
2018-08-18 20:09 ` Fabrice Fontaine
2018-08-18 20:20 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox