All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 00/21] Rework atomic handling
@ 2016-01-24 23:07 Thomas Petazzoni
  2016-01-24 23:07 ` [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost Thomas Petazzoni
                   ` (21 more replies)
  0 siblings, 22 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

Hello,

As many of you are aware, we have a number of build failures related
to __sync_*() atomic operations, which we can't really solve properly
today with our single BR2_ARCH_HAS_ATOMICS boolean option.

This patch series aims at reworking our atomic operation handling, by
introducing four options: BR2_TOOLCHAIN_HAS_SYNC_1,
BR2_TOOLCHAIN_HAS_SYNC_2, BR2_TOOLCHAIN_HAS_SYNC_4,
BR2_TOOLCHAIN_HAS_SYNC_8, to indicate which variants of atomic
operations are available, depending on the architecture/toolchain. The
full details are explained in PATCH 3.

The overall direction of the series is:

 - PATCH 1 and 2 are preparation patches on libftdi, to remove the
   BR2_ARCH_HAS_ATOMICS dependency which is not needed.

 - PATCH 3 introduces the BR2_TOOLCHAIN_HAS_SYNC_x options, and has
   all the explanations about why we're doing this.

 - PATCH 4 updates the manual about the BR2_TOOLCHAIN_HAS_SYNC_x
   options.

 - PATCH 5-16 aim at replacing the BR2_ARCH_HAS_ATOMICS usage by the
   appropriate BR2_TOOLCHAIN_HAS_SYNC_x options. Note that in some
   cases, BR2_ARCH_HAS_ATOMICS can be removed completely.

   Along the way, we found that json-c was using some __sync_*()
   built-ins, so we added this dependency, which fixes some build
   failure.

 - PATCH 17 removes the BR2_ARCH_HAS_ATOMICS option, which has become
   no longer used.

 - PATCH 18-21 use the new BR2_TOOLCHAIN_HAS_SYNC_x options to fix
   numerous outstanding build failures related to atomic operations.

Those interested can also find this series in the Git branch at:

  http://git.free-electrons.com/users/thomas-petazzoni/buildroot/log/?h=atomic-rework

Thanks in advance for your review and comments!

Thomas

Thomas Petazzoni (21):
  libftdi: C++ bindings need boost
  libftdi: remove BR2_ARCH_HAS_ATOMICS dependency
  toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans
  docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  icu: remove BR2_ARCH_HAS_ATOMICS dependency
  json-c: needs __sync_val_compare_and_swap_4
  pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  apache, apr: fix atomic handling
  jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol
  libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  gauche: disable on SPARC(64), remove atomics dependency
  cairo, harfbuzz: rework atomic dependencies
  openocd: remove BR2_ARCH_HAS_ATOMICS dependency
  squid: rework atomic handling
  thrift: remove BR2_ARCH_HAS_ATOMICS dependency
  msgpack: rework BR2_ARCH_HAS_ATOMICS dependency
  arch: remove BR2_ARCH_HAS_ATOMICS option
  glog: fix atomic built-in problem
  openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency

 arch/Config.in                                 |  4 --
 arch/Config.in.aarch64                         |  3 --
 arch/Config.in.arc                             |  3 --
 arch/Config.in.arm                             |  3 --
 arch/Config.in.bfin                            |  3 --
 arch/Config.in.m68k                            |  3 --
 arch/Config.in.microblaze                      |  3 --
 arch/Config.in.mips                            |  3 --
 arch/Config.in.nios2                           |  3 --
 arch/Config.in.powerpc                         |  3 --
 arch/Config.in.sh                              |  3 --
 arch/Config.in.x86                             |  3 --
 arch/Config.in.xtensa                          |  3 --
 docs/manual/adding-packages-directory.txt      | 14 +++++--
 package/apache/apache.mk                       |  4 --
 package/apr/apr.mk                             | 17 ++++++++
 package/beecrypt/Config.in                     |  2 -
 package/cairo/Config.in                        |  1 -
 package/cairo/cairo.mk                         |  6 +++
 package/cairomm/Config.in                      |  2 -
 package/connman/Config.in                      |  1 +
 package/cppcms/Config.in                       |  1 -
 package/cwiid/Config.in                        |  2 +-
 package/directfb/Config.in                     |  5 +--
 package/efl/Config.in                          |  2 +-
 package/enlightenment/Config.in                |  6 +--
 package/espeak/Config.in                       |  2 +-
 package/fastd/Config.in                        |  1 +
 package/flashrom/Config.in                     |  2 -
 package/freerdp/Config.in                      |  2 +
 package/gauche/Config.in                       |  5 +--
 package/glog/glog.mk                           | 11 ++++++
 package/gstreamer/gst-plugins-bad/Config.in    |  4 +-
 package/gstreamer/gst-plugins-base/Config.in   |  4 +-
 package/gstreamer/gst-plugins-good/Config.in   |  5 +--
 package/gstreamer1/gst1-plugins-bad/Config.in  |  6 ++-
 package/gstreamer1/gst1-plugins-base/Config.in |  4 +-
 package/gstreamer1/gst1-plugins-good/Config.in |  5 +--
 package/gtkmm3/Config.in                       |  4 +-
 package/harfbuzz/Config.in                     |  2 +
 package/icu/Config.in                          |  2 -
 package/icu/icu.mk                             |  8 ++++
 package/jack2/Config.in                        |  4 +-
 package/json-c/Config.in                       |  2 +
 package/libevas-generic-loaders/Config.in      |  4 +-
 package/libfm/Config.in                        |  4 +-
 package/libftdi/Config.in                      | 11 ++++--
 package/libftdi/libftdi.mk                     |  1 +
 package/libgail/Config.in                      |  4 +-
 package/libgdiplus/Config.in                   |  2 -
 package/libgtk2/Config.in                      |  4 +-
 package/libgtk3/Config.in                      |  4 +-
 package/librsvg/Config.in                      |  4 +-
 package/libsvg-cairo/Config.in                 |  1 -
 package/libtorrent/Config.in                   |  4 +-
 package/mpd/Config.in                          |  6 ++-
 package/msgpack/Config.in                      |  4 +-
 package/neard/Config.in                        |  2 +
 package/openal/Config.in                       |  2 +
 package/openbox/Config.in                      |  4 +-
 package/opencv/Config.in                       |  2 +-
 package/opencv3/Config.in                      |  4 +-
 package/openocd/Config.in                      |  4 --
 package/pango/Config.in                        |  4 +-
 package/pangomm/Config.in                      |  4 +-
 package/pcmanfm/Config.in                      |  4 +-
 package/php/Config.ext                         |  2 -
 package/pinentry/Config.in                     |  4 +-
 package/pulseaudio/Config.in                   |  4 +-
 package/pulseaudio/pulseaudio.mk               |  7 +++-
 package/python-msgpack/Config.in               |  4 +-
 package/qt-webkit-kiosk/Config.in              |  1 -
 package/qt5/qt5base/Config.in                  |  1 -
 package/qt5/qt5webkit/Config.in                |  1 -
 package/rrdtool/Config.in                      |  2 +-
 package/rsyslog/Config.in                      |  2 +
 package/rtorrent/Config.in                     |  4 +-
 package/squid/squid.mk                         | 10 ++---
 package/thrift/Config.in                       |  2 -
 package/ubus/Config.in                         |  1 +
 package/webkit/Config.in                       |  4 +-
 package/webkitgtk24/Config.in                  |  4 +-
 package/weston/Config.in                       |  4 +-
 package/xscreensaver/Config.in                 |  4 +-
 toolchain/toolchain-common.in                  | 54 ++++++++++++++++++++++++++
 85 files changed, 216 insertions(+), 158 deletions(-)

-- 
2.6.4

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

* [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 17:04   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

According to libftdi configure.in:

"""
dnl libftdi C++ wrapper. Needs boost.
[...]
        if test "x$HAVE_BOOST" != "xyes"; then
            AC_MSG_ERROR(Sorry, we need the boost library for the C++ wrapper)
        fi
"""

And indeed, if you enable BR2_PACKAGE_LIBTFDI_CPP but don't have Boost
enabled, the libfdipp library is not built. To fix this, this commit
changes BR2_PACKAGE_LIBTFDI_CPP to select Boost.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/libftdi/Config.in  | 9 ++++++++-
 package/libftdi/libftdi.mk | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/package/libftdi/Config.in b/package/libftdi/Config.in
index 76b30b1..c0ab0f2 100644
--- a/package/libftdi/Config.in
+++ b/package/libftdi/Config.in
@@ -12,11 +12,18 @@ config BR2_PACKAGE_LIBFTDI
 if BR2_PACKAGE_LIBFTDI
 
 config BR2_PACKAGE_LIBTFDI_CPP
-	depends on BR2_INSTALL_LIBSTDCPP
 	bool "C++ bindings"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
+	depends on BR2_USE_WCHAR
+	select BR2_PACKAGE_BOOST
 	help
 	  C++ bindings for libftdi
 
+comment "libftdi C++ bindings need a toolchain w/ wchar, C++"
+	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
+	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP
+
 endif # BR2_PACKAGE_LIBFTDI
 
 comment "libftdi needs a toolchain w/ threads"
diff --git a/package/libftdi/libftdi.mk b/package/libftdi/libftdi.mk
index 8370b0a..28f20e3 100644
--- a/package/libftdi/libftdi.mk
+++ b/package/libftdi/libftdi.mk
@@ -15,6 +15,7 @@ LIBFDTI_CONF_OPTS = --without-examples
 
 # configure detect it automaticaly so we need to force it
 ifeq ($(BR2_PACKAGE_LIBTFDI_CPP),y)
+LIBFTDI_DEPENDENCIES += boost
 LIBFDTI_CONF_OPTS += --enable-libftdipp
 else
 LIBFDTI_CONF_OPTS += --disable-libftdipp
-- 
2.6.4

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

* [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
  2016-01-24 23:07 ` [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 17:15   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans Thomas Petazzoni
                   ` (19 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

In commit 669ce8c75eb4c76cef81f279fb6b4f95d1472f51 ("libftdi: add
dependency on atomic operations"), a dependency on
BR2_ARCH_HAS_ATOMICS was added to the libftdi package to fix a build
failure occuring on the ARC architecture due to the missing
__sync_fetch_and_add_4 function:

../ftdipp/.libs/libftdipp.so: undefined reference to `__sync_fetch_and_add_4'

However, today, even on the SPARC architecture that does not implement
any of the __sync built-ins, libftdi and its C++ binding libftdipp
build fine. ARC was also tested and builds fine.

Therefore, we remove the BR2_ARCH_HAS_ATOMICS dependency from libftdi,
and also from flashrom, in which it was only present due to the
selection of libftdi. Note that anyway flashrom is available only for
i386 and x86_64, both of which implement all the __sync built-ins.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/flashrom/Config.in | 2 --
 package/libftdi/Config.in  | 2 --
 2 files changed, 4 deletions(-)

diff --git a/package/flashrom/Config.in b/package/flashrom/Config.in
index 9420cc6..adc068c 100644
--- a/package/flashrom/Config.in
+++ b/package/flashrom/Config.in
@@ -8,7 +8,6 @@ config BR2_PACKAGE_FLASHROM
 	select BR2_PACKAGE_DMIDECODE
 	depends on BR2_i386 || BR2_x86_64
 	depends on BR2_TOOLCHAIN_HAS_THREADS 	# libusb
-	depends on BR2_ARCH_HAS_ATOMICS 	# libftdi
 	help
 	  flashrom is a utility for identifying, reading, writing,
 	  verifying and erasing flash chips. It is designed to flash
@@ -20,5 +19,4 @@ config BR2_PACKAGE_FLASHROM
 
 comment "flashrom needs a toolchain w/ threads"
 	depends on BR2_i386 || BR2_x86_64
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/libftdi/Config.in b/package/libftdi/Config.in
index c0ab0f2..8e02cb9 100644
--- a/package/libftdi/Config.in
+++ b/package/libftdi/Config.in
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_LIBFTDI
 	bool "libftdi"
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
-	depends on BR2_ARCH_HAS_ATOMICS
 	select BR2_PACKAGE_LIBUSB
 	select BR2_PACKAGE_LIBUSB_COMPAT
 	help
@@ -27,5 +26,4 @@ comment "libftdi C++ bindings need a toolchain w/ wchar, C++"
 endif # BR2_PACKAGE_LIBFTDI
 
 comment "libftdi needs a toolchain w/ threads"
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS
-- 
2.6.4

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

* [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
  2016-01-24 23:07 ` [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost Thomas Petazzoni
  2016-01-24 23:07 ` [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 18:27   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
                   ` (18 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

Currently, Buildroot provides one BR2_ARCH_HAS_ATOMICS boolean option
to indicate whether the architecture supports atomic operations or
not. However, the reality of atomic operations support is much more
complicated and requires more than one option to be expressed
properly.

There are in fact two types of atomic built-ins provided by gcc:

 (1) The __sync_*() family of functions, which have been in gcc since
     a long time (probably gcc 4.1). They are available in variants
     operating on 1 byte, 2 bytes, 4 bytes and 8 bytes
     integers. Certain architectures implement certain variants,
     certain do not implement any, certain architectures implement all
     of them.

     They are now considered "legacy" by the gcc developers but are
     nonetheless still being used by a significant number of userspace
     libraries and applications.

     https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html

 (2) The __atomic_*() family of functions, which have been introduced
     in gcc 4.7. They have been introduced in order to support C++11
     atomic operations. They are available on all architectures,
     either built-in, or in the libatomic library part of the gcc
     runtime (in which case the application needs to be linked with
     -latomic).

Since (2) are available on all architectures starting gcc 4.7, we do
not need to add any new option for them: packages using them should
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 and link with libatomic.

However, for (1), a single BR2_ARCH_HAS_ATOMICS is not sufficient,
because depending on the architecture, certain variants are available
or not. Setting BR2_ARCH_HAS_ATOMICS to false as soon as one of the
variant is missing would cause a large number of packages to become
unavailable, even if they in fact use only more common variants
available on a large number of architectures. For this reason, we've
chosen to introduce four new Config.in options:

 - BR2_TOOLCHAIN_HAS_SYNC_1
 - BR2_TOOLCHAIN_HAS_SYNC_2
 - BR2_TOOLCHAIN_HAS_SYNC_3
 - BR2_TOOLCHAIN_HAS_SYNC_4

Which indicate whether the toolchain support 1 byte, 2 bytes, 4 bytes
and 8 bytes __sync_*() built-ins respectively.

We conducted a fairly large analysis on various architectures
supported by Buildroot, as well as a number of different toolchains,
to check which combinations supported which variant. To do, we linked
the following program with various toolchains:

int main(void)
{
	uint8_t a;
	uint16_t b;
	uint32_t c;
	uint64_t d;

	__sync_fetch_and_add(&a, 3);
	__sync_fetch_and_add(&b, 3);
	__sync_fetch_and_add(&c, 3);
	__sync_fetch_and_add(&d, 3);

	__sync_val_compare_and_swap(&a, 1, 2);
	__sync_val_compare_and_swap(&b, 1, 2);
	__sync_val_compare_and_swap(&c, 1, 2);
	__sync_val_compare_and_swap(&d, 1, 2);

	__atomic_add_fetch(&a, 3, __ATOMIC_RELAXED);
	__atomic_add_fetch(&b, 3, __ATOMIC_RELAXED);
	__atomic_add_fetch(&c, 3, __ATOMIC_RELAXED);
	__atomic_add_fetch(&d, 3, __ATOMIC_RELAXED);

	__atomic_compare_exchange_n(&a, &a, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
	__atomic_compare_exchange_n(&b, &b, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
	__atomic_compare_exchange_n(&c, &c, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
	__atomic_compare_exchange_n(&d, &d, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);

	return 0;
}

And looked at which symbols were unresolved. For the __atomic_*()
ones, we tested with and without -latomic to see which variants are
built-in, which variants require libatomic. This testing effort has
led to the following results:

                __sync       __atomic    gcc
               1  2  4  8    1  2  4  8
ARC            Y  Y  Y  -    Y  Y  Y  L   4.8 [with BR2_ARC_ATOMIC_EXT]
ARC            -  -  -  -    L  L  L  L   4.8 [without BR2_ARC_ATOMIC_EXT]
ARM            Y  Y  Y  X    Y  Y  Y  Y   4.8, 4.7
ARM            Y  Y  Y  -                 4.5
AArch64        Y  Y  Y  Y    Y  Y  Y  Y   4.9, 5.1
Bfin           -  -  Y  -                 4.3
i386 (i386)    -  -  -  -    L  L  L  L   4.9
i386 (i486..)  Y  Y  Y  -    L  L  L  L   4.9 [i486, c3, winchip2, winchip-c6]
i386 (> i586)  Y  Y  Y  Y    L  L  L  L   4.9
Microblaze     -  -  Y  -    L  L  Y  L   4.9
MIPS           Y  Y  Y  -    Y  Y  Y  L   4.9
MIPS64         Y  Y  Y  Y    Y  Y  Y  Y   4.9
NIOS 2         Y  Y  Y  -    Y  Y  Y  L   4.9, 5.2
PowerPC        Y  Y  Y  -    Y  Y  Y  L   4.9
SuperH         Y  Y  Y  -    Y  Y  Y  L   4.9
SPARC          -  -  -  -    L  L  L  L   4.9
SPARC64        Y  Y  Y  Y    Y  Y  Y  Y   4.9
x86_64         Y  Y  Y  Y    Y  Y  Y  Y   4.7, 4.9
Xtensa         Y  Y  Y  -    Y  Y  Y  Y   4.9

Notes:

 * __atomic built-ins appeared in gcc 4.7, so for toolchais older than
   that, the __atomic column is empty.

 * Y means 'supported built-in'

 * L means 'supported via linking to libatomic' (only for __atomic
   functions)

 * X indicates a very special case for 8 bytes __sync built-ins on
   ARM. On ARMv7, there is no problem, starting from gcc 4.7, the
   __sync built-in for 8 bytes integers is implemented, fully in
   userspace. For cores < ARMv7, doing a 8 bytes atomic operation
   requires help from the kernel. Unfortunately, the libgcc code
   implementing this uses the __write() function to display an error,
   and this function is internal to glibc. Therefore, if you're using
   glibc everything is fine, but if you're using uClibc or musl, you
   cannot link an application that uses 8 bytes __sync
   operations. This has been fixed as part of gcc PR68095, merged in
   the gcc 5 branch but not yet part of any gcc release.

 * - means not supported

As said above:

 * For the __atomic_*() built-ins, we do not add any new Config.in
   option, since they are all available on all architectures as long
   as you link with libatomic.

 * For the __sync_*() built-ins, we add one option for each size,
   encoding on which architectures they are available or not. There is
   only one case where the gcc version/C library comes into play: on
   ARM, where the situation is a bit complicated for 8 bytes atomics.

This commit only introduces the new options. Follow-up commits will
progressively change the packages using BR2_ARCH_HAS_ATOMICS to use
the appropriate BR2_TOOLCHAIN_HAS_SYNC_x, until the point where
BR2_ARCH_HAS_ATOMICS can be removed.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/toolchain-common.in | 54 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 014a23d..273afab 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -313,3 +313,57 @@ config BR2_TOOLCHAIN_GCC_AT_LEAST
 	default "4.5"	if BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
 	default "4.4"	if BR2_TOOLCHAIN_GCC_AT_LEAST_4_4
 	default "4.3"	if BR2_TOOLCHAIN_GCC_AT_LEAST_4_3
+
+config BR2_TOOLCHAIN_HAS_SYNC_1
+	bool
+	default y
+	depends on !BR2_x86_i386
+	depends on !BR2_bfin
+	depends on !BR2_microblaze
+	depends on !BR2_sparc
+	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
+
+config BR2_TOOLCHAIN_HAS_SYNC_2
+	bool
+	default y if BR2_TOOLCHAIN_HAS_SYNC_1
+
+config BR2_TOOLCHAIN_HAS_SYNC_4
+	bool
+	default y
+	depends on !BR2_sparc
+	depends on !BR2_x86_i386
+	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
+
+# The availability of __sync for 8 bytes types on ARM is somewhat
+# complicated:
+#
+#  - It appeared in gcc starting from gcc 4.7.
+#
+#  - On ARMv7, there is no problem, it can be directly implemented in
+#    userspace.
+#
+#  - On < ARMv7, it requires help from the kernel. Unfortunately, the
+#    libgcc code implementing 8 bytes __sync with the help from the
+#    kernel calls __write() when a failure occurs, which is a function
+#    internal to glibc, not available in uClibc and musl. This means
+#    that the 8 bytes __sync operations are not available on < ARMv7
+#    with uClibc and musl. This problem was fixed as part of gcc
+#    PR68059, which was backported to the gcc 5 branch, but isn't yet
+#    part of any gcc 5.x release.
+#
+config BR2_TOOLCHAIN_ARM_HAS_SYNC_8
+	bool
+	default y
+	depends on BR2_arm || BR2_armeb
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
+	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A
+
+# 8 bytes intrinsics available:
+#  - On all 64 bits architecture
+#  - On a certain combinations of ARM platforms
+#  - On i386, except some really old processors
+config BR2_TOOLCHAIN_HAS_SYNC_8
+	bool
+	default y if BR2_ARCH_IS_64 || BR2_TOOLCHAIN_ARM_HAS_SYNC_8 || \
+		(BR2_i386 && !BR2_x86_i386 && !BR2_x86_i486 && !BR2_x86_c3 && \
+		 !BR2_x86_winchip_c6 && !BR2_x86_winchip2)
-- 
2.6.4

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

* [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 18:38   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

This commit updates the documentation to detail when and how to use
the BR2_TOOLCHAIN_HAS_SYNC_x dependency. Note that we chose to not add
a comment about this dependency, because it is mainly tied to
architecture capabilities (except in very specific cases, which would
be way too complicated to explain in a Config.in comment).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 docs/manual/adding-packages-directory.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
index b9596a2..cd78390 100644
--- a/docs/manual/adding-packages-directory.txt
+++ b/docs/manual/adding-packages-directory.txt
@@ -279,6 +279,19 @@ use in the comment.
 ** Dependency symbol: +BR2_ARCH_HAS_ATOMICS+
 ** Comment string: no comment to be added
 
+* Gcc +__sync_*+ built-ins used for atomic operations. They are
+  available in variants operating on 1 byte, 2 bytes, 4 bytes and 8
+  bytes. Since different architectures support atomic operations on
+  different sizes, one dependency symbol is available for each size:
+** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+ for 1 byte,
+   +BR2_TOOLCHAIN_HAS_SYNC_2+ for two bytes,
+   +BR2_TOOLCHAIN_HAS_SYNC_4+ for 4 bytes, +BR2_TOOLCHAIN_HAS_SYNC_8+
+   for 8 bytes.
+** Comment string: no comment to be added
+
+* One byte +__sync_*+ gcc built-in for atomic instructions
+** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+
+
 * Kernel headers
 ** Dependency symbol: +BR2_TOOLCHAIN_HEADERS_AT_LEAST_X_Y+, (replace
    +X_Y+ with the proper version, see +toolchain/toolchain-common.in+)
-- 
2.6.4

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

* [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 18:42   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
                   ` (16 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

The BR2_ARCH_HAS_ATOMICS was added because on ARC, atomic instructions
may not be provided by the architecture and therefore the compiler
does not provide the __sync_*() built-ins.

However, since then, icu was changed and is now able to use C++11
atomics, or even no atomic operations at all. In fact, icu will:

 * If possible, it will use C++11 atomics, which internally rely on
   the __atomic built-ins. These are available since gcc 4.7, and all
   architectures provide it. On some architectures, you *must* link
   with libatomic, on some other architectures, they are available
   built-in, but in all cases, linking against libatomic does not
   harm. Thanks to this, even ARC with no atomic support (which was
   the original reason for adding the BR2_ARCH_HAS_ATOMICS) dependency
   builds fine, provided -latomic is added to LIBS.

 * If C++11 atomics are not available, then it falls back to
   __sync_*() built-ins, which allows compilers older than 4.7 to be
   supported.

 * If really no atomic mechanism is available, then it falls back to a
   basic implementation based on a mutex.

Conclusion:

 - The BR2_ARCH_HAS_ATOMICS dependency is no longer needed.

 - We need to link with -latomic when gcc >= 4.7 is used.

Note that reverse dependencies of icu are also changed accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/beecrypt/Config.in        | 2 --
 package/cppcms/Config.in          | 1 -
 package/icu/Config.in             | 2 --
 package/icu/icu.mk                | 8 ++++++++
 package/php/Config.ext            | 2 --
 package/qt-webkit-kiosk/Config.in | 1 -
 package/qt5/qt5base/Config.in     | 1 -
 package/qt5/qt5webkit/Config.in   | 1 -
 8 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/package/beecrypt/Config.in b/package/beecrypt/Config.in
index fc93a77..069f3d5 100644
--- a/package/beecrypt/Config.in
+++ b/package/beecrypt/Config.in
@@ -16,7 +16,6 @@ config BR2_PACKAGE_BEECRYPT_CPP
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR # icu
 	depends on !BR2_BINFMT_FLAT # icu
-	depends on BR2_ARCH_HAS_ATOMICS # icu
 	depends on !BR2_STATIC_LIBS
 	select BR2_PACKAGE_ICU
 	help
@@ -24,7 +23,6 @@ config BR2_PACKAGE_BEECRYPT_CPP
 
 comment "C++ support needs a toolchain w/ C++, wchar, dynamic libraries"
 	depends on !BR2_BINFMT_FLAT
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR \
 		|| BR2_STATIC_LIBS
 
diff --git a/package/cppcms/Config.in b/package/cppcms/Config.in
index 85ba118..79f5474 100644
--- a/package/cppcms/Config.in
+++ b/package/cppcms/Config.in
@@ -26,7 +26,6 @@ if BR2_PACKAGE_CPPCMS
 config BR2_PACKAGE_CPPCMS_ICU
 	bool "enable icu support"
 	depends on !BR2_BINFMT_FLAT # icu
-	depends on BR2_ARCH_HAS_ATOMICS # icu
 	select BR2_PACKAGE_ICU
 	help
 	  Using ICU allows advanced localization features into CppCMS,
diff --git a/package/icu/Config.in b/package/icu/Config.in
index 4d47c32..d31c1fa 100644
--- a/package/icu/Config.in
+++ b/package/icu/Config.in
@@ -7,7 +7,6 @@ config BR2_PACKAGE_ICU
 	# file, and it cannot easily be changed to generate FLAT
 	# format.
 	depends on !BR2_BINFMT_FLAT
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  International Components for Unicode.
 
@@ -28,6 +27,5 @@ endif
 
 comment "icu needs a toolchain w/ C++, wchar, threads"
 	depends on !BR2_BINFMT_FLAT
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
 		!BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/icu/icu.mk b/package/icu/icu.mk
index 5604504..7bc7f93 100644
--- a/package/icu/icu.mk
+++ b/package/icu/icu.mk
@@ -17,6 +17,14 @@ ICU_CONF_OPTS = \
 	--with-cross-build=$(HOST_ICU_DIR)/source \
 	--disable-samples \
 	--disable-tests
+
+# With gcc >= 4.7, icu prefers to use C++11 atomics, which rely on the
+# __atomic builtins. On certain architectures, this requires linking
+# with libatomic.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
+ICU_CONF_ENV += LIBS="-latomic"
+endif
+
 HOST_ICU_CONF_OPTS = \
 	--disable-samples \
 	--disable-tests \
diff --git a/package/php/Config.ext b/package/php/Config.ext
index c044e45..ee51030 100644
--- a/package/php/Config.ext
+++ b/package/php/Config.ext
@@ -207,13 +207,11 @@ config BR2_PACKAGE_PHP_EXT_INTL
 	depends on BR2_USE_WCHAR
 	depends on !BR2_BINFMT_FLAT # icu
 	depends on BR2_TOOLCHAIN_HAS_THREADS # icu
-	depends on BR2_ARCH_HAS_ATOMICS # icu
 	help
 	  Internationalization support
 
 comment "intl support needs a toolchain w/ C++, wchar, threads"
 	depends on !BR2_BINFMT_FLAT
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_PACKAGE_PHP_EXT_MBSTRING
diff --git a/package/qt-webkit-kiosk/Config.in b/package/qt-webkit-kiosk/Config.in
index 51383f0..32952d7 100644
--- a/package/qt-webkit-kiosk/Config.in
+++ b/package/qt-webkit-kiosk/Config.in
@@ -8,7 +8,6 @@ config BR2_PACKAGE_QT_WEBKIT_KIOSK
 	select BR2_PACKAGE_QT5MULTIMEDIA
 	depends on !BR2_STATIC_LIBS # qt5webkit
 	depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE # qt5webkit
-	depends on BR2_ARCH_HAS_ATOMICS # qt5webkit
 	depends on !BR2_BINFMT_FLAT # qt5webkit
 	help
 	  Simple kiosk-mode browser powered by Qt5Webkit
diff --git a/package/qt5/qt5base/Config.in b/package/qt5/qt5base/Config.in
index 7cadcb2..64a7f65 100644
--- a/package/qt5/qt5base/Config.in
+++ b/package/qt5/qt5base/Config.in
@@ -259,7 +259,6 @@ config BR2_PACKAGE_QT5BASE_DBUS
 config BR2_PACKAGE_QT5BASE_ICU
 	bool "Enable ICU support"
 	select BR2_PACKAGE_ICU
-	depends on BR2_ARCH_HAS_ATOMICS # icu
 	depends on !BR2_BINFMT_FLAT # icu
 	help
 	  This option enables ICU support in Qt5. This is for example
diff --git a/package/qt5/qt5webkit/Config.in b/package/qt5/qt5webkit/Config.in
index eee82e8..96d97cc 100644
--- a/package/qt5/qt5webkit/Config.in
+++ b/package/qt5/qt5webkit/Config.in
@@ -9,7 +9,6 @@ config BR2_PACKAGE_QT5WEBKIT
 	# This module does not support static linking
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
-	depends on BR2_ARCH_HAS_ATOMICS # icu
 	depends on !BR2_BINFMT_FLAT # icu
 	help
 	  Qt is a cross-platform application and UI framework for
-- 
2.6.4

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

* [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 18:47   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (15 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

While json-c itself builds fine on platforms that don't provide the
__sync atomic built-ins, it does use them. json-c doesn't fail to
build because only a library is built, so such function calls are left
unresolved. But as soon as it gets used in another package linked in a
program, linking with fail due to the missing
__sync_val_compare_and_swap_4() function.

To fix this, we make json-c depend on BR2_TOOLCHAIN_HAS_SYNC_4, and
propagate to the reverse dependencies:

 - json-c
   - fastd
   - pulseaudio
     - efl
     - espeak
     - gst-plugins-good
     - gst1-plugins-good
     - mpd
   - rsyslog
   - ubus

Note that pulseaudio already had a BR2_ARCH_HAS_ATOMICS dependency,
which we are keeping for the moment, and will clean-up in a subsequent
commit.

This commit will also fix packages that could optionally use json-c,
and therefore fixes build failures like:

  http://autobuild.buildroot.org/results/4fe/4feaa9089ee9a183c5086b791bea35c0156945af/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/efl/Config.in                          | 1 +
 package/espeak/Config.in                       | 1 +
 package/fastd/Config.in                        | 1 +
 package/gstreamer/gst-plugins-good/Config.in   | 1 +
 package/gstreamer1/gst1-plugins-good/Config.in | 1 +
 package/json-c/Config.in                       | 2 ++
 package/mpd/Config.in                          | 1 +
 package/pulseaudio/Config.in                   | 2 ++
 package/rsyslog/Config.in                      | 2 ++
 package/ubus/Config.in                         | 1 +
 10 files changed, 13 insertions(+)

diff --git a/package/efl/Config.in b/package/efl/Config.in
index 85e46b1..21cbf5f 100644
--- a/package/efl/Config.in
+++ b/package/efl/Config.in
@@ -82,6 +82,7 @@ config BR2_PACKAGE_EFL_LIBSNDFILE
 config BR2_PACKAGE_EFL_PULSEAUDIO
 	bool "Enable pulseaudio support (recommended)"
 	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 	default y
 	help
diff --git a/package/espeak/Config.in b/package/espeak/Config.in
index 94e2816..eebaf6f 100644
--- a/package/espeak/Config.in
+++ b/package/espeak/Config.in
@@ -33,6 +33,7 @@ config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_ALSA
 config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_PULSEAUDIO
 	bool "pulseaudio"
 	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 
 endchoice
diff --git a/package/fastd/Config.in b/package/fastd/Config.in
index f753ce4..55bdbd6 100644
--- a/package/fastd/Config.in
+++ b/package/fastd/Config.in
@@ -18,6 +18,7 @@ config BR2_PACKAGE_FASTD_STATUS_SOCKET
 	bool "status socket support"
 	default y
 	select BR2_PACKAGE_JSON_C
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
 	help
 	  Enable support for a socket to get fastd's status.
 
diff --git a/package/gstreamer/gst-plugins-good/Config.in b/package/gstreamer/gst-plugins-good/Config.in
index 0544b7c..c2ec5b0 100644
--- a/package/gstreamer/gst-plugins-good/Config.in
+++ b/package/gstreamer/gst-plugins-good/Config.in
@@ -206,6 +206,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
 	depends on BR2_USE_MMU # pulseaudio
 	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 	bool "pulseaudio"
 
diff --git a/package/gstreamer1/gst1-plugins-good/Config.in b/package/gstreamer1/gst1-plugins-good/Config.in
index a8cdde2..6cb9732 100644
--- a/package/gstreamer1/gst1-plugins-good/Config.in
+++ b/package/gstreamer1/gst1-plugins-good/Config.in
@@ -313,6 +313,7 @@ config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_PULSE
 	depends on BR2_USE_MMU # pulseaudio
 	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 	bool "pulseaudio"
 	help
diff --git a/package/json-c/Config.in b/package/json-c/Config.in
index 67348fb..4df44a9 100644
--- a/package/json-c/Config.in
+++ b/package/json-c/Config.in
@@ -1,5 +1,7 @@
 config BR2_PACKAGE_JSON_C
 	bool "json-c"
+	# uses __sync_val_compare_and_swap_4
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	help
 	  JSON-C - A JSON implementation in C
 
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index be0843f..643e7ba 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -248,6 +248,7 @@ config BR2_PACKAGE_MPD_PULSEAUDIO
 	bool "pulseaudio"
 	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 	help
 	  Enable pulseaudio output support.
diff --git a/package/pulseaudio/Config.in b/package/pulseaudio/Config.in
index 63c8ca4..4583d22 100644
--- a/package/pulseaudio/Config.in
+++ b/package/pulseaudio/Config.in
@@ -3,6 +3,7 @@ config BR2_PACKAGE_PULSEAUDIO
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
 	select BR2_PACKAGE_LIBTOOL
 	select BR2_PACKAGE_JSON_C
 	select BR2_PACKAGE_LIBSNDFILE
@@ -34,4 +35,5 @@ endif
 comment "pulseaudio needs a toolchain w/ wchar, threads, dynamic library"
 	depends on BR2_USE_MMU
 	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
diff --git a/package/rsyslog/Config.in b/package/rsyslog/Config.in
index d66132f..3599207 100644
--- a/package/rsyslog/Config.in
+++ b/package/rsyslog/Config.in
@@ -7,6 +7,7 @@ config BR2_PACKAGE_RSYSLOG
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU # fork()
 	depends on !BR2_STATIC_LIBS # modules
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
 	help
 	  Rsyslog is a powerful and flexible syslog implementation
 
@@ -14,4 +15,5 @@ config BR2_PACKAGE_RSYSLOG
 
 comment "rsyslog needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
diff --git a/package/ubus/Config.in b/package/ubus/Config.in
index 8567321..d63357a 100644
--- a/package/ubus/Config.in
+++ b/package/ubus/Config.in
@@ -5,6 +5,7 @@ config BR2_PACKAGE_UBUS
 	bool "ubus"
 	select BR2_PACKAGE_LIBUBOX
 	select BR2_PACKAGE_JSON_C
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
 	depends on !BR2_STATIC_LIBS # libubox
 	help
 	  IPC/RPC bus that allows communication between processes.
-- 
2.6.4

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

* [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 18:52   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling Thomas Petazzoni
                   ` (14 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

pulseaudio is able to either use the atomic __sync builtins from the
compiler, or to rely on libatomic_ops for atomic operations. However,
since it anyway selects json-c which requires the __sync built-ins, it
means using libatomic_ops is useless: even if you use libatomic_ops
for pulseaudio, you'd still get a link error in pulseaudio due to the
missing __sync built-in for the json-c library.

Also, since pulseaudio now inherits the BR2_TOOLCHAIN_HAS_SYNC_4 from
json-c, which matches the __sync built-in from pulseaudio, this
commit:

 - Drops the BR2_ARCH_HAS_ATOMICS dependency
 - Forces pulseaudio to not detect libatomic_ops
 - Propagates the removal of BR2_ARCH_HAS_ATOMICS dependency to
   pulseaudio's reverse dependencies.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/efl/Config.in                          | 1 -
 package/espeak/Config.in                       | 1 -
 package/gstreamer/gst-plugins-good/Config.in   | 3 +--
 package/gstreamer1/gst1-plugins-good/Config.in | 3 +--
 package/mpd/Config.in                          | 2 +-
 package/pulseaudio/Config.in                   | 2 --
 package/pulseaudio/pulseaudio.mk               | 7 ++++++-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/package/efl/Config.in b/package/efl/Config.in
index 21cbf5f..418f41e 100644
--- a/package/efl/Config.in
+++ b/package/efl/Config.in
@@ -81,7 +81,6 @@ config BR2_PACKAGE_EFL_LIBSNDFILE
 
 config BR2_PACKAGE_EFL_PULSEAUDIO
 	bool "Enable pulseaudio support (recommended)"
-	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 	default y
diff --git a/package/espeak/Config.in b/package/espeak/Config.in
index eebaf6f..aed627a 100644
--- a/package/espeak/Config.in
+++ b/package/espeak/Config.in
@@ -32,7 +32,6 @@ config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_ALSA
 
 config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_PULSEAUDIO
 	bool "pulseaudio"
-	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
 
diff --git a/package/gstreamer/gst-plugins-good/Config.in b/package/gstreamer/gst-plugins-good/Config.in
index c2ec5b0..36ab6cb 100644
--- a/package/gstreamer/gst-plugins-good/Config.in
+++ b/package/gstreamer/gst-plugins-good/Config.in
@@ -204,7 +204,6 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_OSS4
 config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
 	depends on BR2_TOOLCHAIN_HAS_THREADS # pulseaudio
 	depends on BR2_USE_MMU # pulseaudio
-	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
@@ -212,7 +211,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
 
 comment "pulseaudio support needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
 
 config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_SOUPHTTPSRC
diff --git a/package/gstreamer1/gst1-plugins-good/Config.in b/package/gstreamer1/gst1-plugins-good/Config.in
index 6cb9732..2606b86 100644
--- a/package/gstreamer1/gst1-plugins-good/Config.in
+++ b/package/gstreamer1/gst1-plugins-good/Config.in
@@ -311,7 +311,6 @@ comment "gdkpixbuf needs a toolchain w/ wchar, threads"
 config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_PULSE
 	depends on BR2_TOOLCHAIN_HAS_THREADS # pulseaudio
 	depends on BR2_USE_MMU # pulseaudio
-	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
@@ -321,7 +320,7 @@ config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_PULSE
 
 comment "pulseaudio support needs a toolchain w/ threads, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
 
 config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_SOUPHTTPSRC
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index 643e7ba..618bea9 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -246,7 +246,6 @@ config BR2_PACKAGE_MPD_OSS
 
 config BR2_PACKAGE_MPD_PULSEAUDIO
 	bool "pulseaudio"
-	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
 	depends on !BR2_STATIC_LIBS # pulseaudio
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
 	select BR2_PACKAGE_PULSEAUDIO
@@ -254,6 +253,7 @@ config BR2_PACKAGE_MPD_PULSEAUDIO
 	  Enable pulseaudio output support.
 
 comment "pulseaudio support needs a toolchain w/ dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_STATIC_LIBS
 
 comment "Miscellaneous plugins"
diff --git a/package/pulseaudio/Config.in b/package/pulseaudio/Config.in
index 4583d22..20aa374 100644
--- a/package/pulseaudio/Config.in
+++ b/package/pulseaudio/Config.in
@@ -9,7 +9,6 @@ config BR2_PACKAGE_PULSEAUDIO
 	select BR2_PACKAGE_LIBSNDFILE
 	select BR2_PACKAGE_SPEEX
 	depends on BR2_USE_MMU # fork()
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  PulseAudio is a sound system for POSIX OSes, meaning that it
 	  is a proxy for your sound applications. It allows you to do
@@ -34,6 +33,5 @@ endif
 
 comment "pulseaudio needs a toolchain w/ wchar, threads, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
diff --git a/package/pulseaudio/pulseaudio.mk b/package/pulseaudio/pulseaudio.mk
index a59a6c5..3976093 100644
--- a/package/pulseaudio/pulseaudio.mk
+++ b/package/pulseaudio/pulseaudio.mk
@@ -15,9 +15,14 @@ PULSEAUDIO_CONF_OPTS = \
 	--disable-legacy-database-entry-format \
 	--disable-manpages
 
+# Make sure we don't detect libatomic_ops. Indeed, since pulseaudio
+# requires json-c, which needs 4 bytes __sync builtins, there should
+# be no need for pulseaudio to rely on libatomic_ops.
+PULSE_AUDIO_CONF_ENV += \
+	ac_cv_header_atomic_ops_h=no
+
 PULSEAUDIO_DEPENDENCIES = \
 	host-pkgconf libtool json-c libsndfile speex host-intltool \
-	$(if $(BR2_PACKAGE_LIBATOMIC_OPS),libatomic_ops) \
 	$(if $(BR2_PACKAGE_LIBSAMPLERATE),libsamplerate) \
 	$(if $(BR2_PACKAGE_ALSA_LIB),alsa-lib) \
 	$(if $(BR2_PACKAGE_LIBGLIB2),libglib2) \
-- 
2.6.4

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

* [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 20:59   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
                   ` (13 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

Since the apache package was introduced,
--enable-nonportable-atomics=yes was passed when
BR2_ARCH_HAS_ATOMICS. However, Apache doesn't take this option: it
only passes it down when building the APR library. But since we're
building APR separately, this statement had no effect.

So this commit removes the useless code from the Apache package, and
instead adds the appropriate logic to the apr package, using the new
BR2_TOOLCHAIN_HAS_SYNC_x symbols rather than BR2_ARCH_HAS_ATOMICS.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/apache/apache.mk |  4 ----
 package/apr/apr.mk       | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/package/apache/apache.mk b/package/apache/apache.mk
index 8e7b6be..e752fcc 100644
--- a/package/apache/apache.mk
+++ b/package/apache/apache.mk
@@ -35,10 +35,6 @@ APACHE_CONF_OPTS = \
 	--disable-lua \
 	--disable-luajit
 
-ifeq ($(BR2_ARCH_HAS_ATOMICS),y)
-APACHE_CONF_OPTS += --enable-nonportable-atomics=yes
-endif
-
 ifeq ($(BR2_PACKAGE_LIBXML2),y)
 APACHE_DEPENDENCIES += libxml2
 # Apache wants the path to the header file, where it can find
diff --git a/package/apr/apr.mk b/package/apr/apr.mk
index 0fed19c..33873a0 100644
--- a/package/apr/apr.mk
+++ b/package/apr/apr.mk
@@ -35,6 +35,23 @@ endif
 # Fix lfs detection when cross compiling
 APR_CONF_ENV += apr_cv_use_lfs64=yes
 
+# Use non-portable atomics when available: 8 bytes atomics are used on
+# 64-bits architectures, 4 bytes atomics on 32-bits architectures. We
+# have to override ap_cv_atomic_builtins because the test used to
+# check for atomic builtins uses AC_TRY_RUN, which doesn't work when
+# cross-compiling.
+ifeq ($(BR2_ARCH_IS_64),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_8),y)
+APR_CONF_OPTS += --enable-nonportable-atomics
+APR_CONF_ENV += ap_cv_atomic_builtins=yes
+endif
+else
+ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),y)
+APR_CONF_OPTS += --enable-nonportable-atomics
+APR_CONF_ENV += ap_cv_atomic_builtins=yes
+endif
+endif
+
 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
 APR_DEPENDENCIES += util-linux
 endif
-- 
2.6.4

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

* [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 21:12   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
                   ` (12 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

Move away from BR2_ARCH_HAS_ATOMICS and use BR2_TOOLCHAIN_HAS_SYNC_4
instead for the jack2 package and its reverse dependency.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/jack2/Config.in | 4 ++--
 package/mpd/Config.in   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/jack2/Config.in b/package/jack2/Config.in
index 350a342..94cb7e0 100644
--- a/package/jack2/Config.in
+++ b/package/jack2/Config.in
@@ -3,8 +3,8 @@ config BR2_PACKAGE_JACK2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # alsa-lib
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_STATIC_LIBS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_LIBSAMPLERATE
 	select BR2_PACKAGE_LIBSNDFILE
 	select BR2_PACKAGE_ALSA_LIB
@@ -23,6 +23,6 @@ config BR2_PACKAGE_JACK2
 
 comment "jack2 needs a toolchain w/ threads, C++, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
 		BR2_STATIC_LIBS
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index 618bea9..6480a08 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -230,13 +230,14 @@ config BR2_PACKAGE_MPD_HTTPD_OUTPUT
 
 config BR2_PACKAGE_MPD_JACK2
 	bool "jack2"
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_STATIC_LIBS # jack2
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_JACK2
 	help
 	  Enable jack output support.
 
 comment "jack support needs a toolchain w/ dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_STATIC_LIBS
 
 config BR2_PACKAGE_MPD_OSS
-- 
2.6.4

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 21:45   ` Yann E. MORIN
  2016-01-26 22:13   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
                   ` (11 subsequent siblings)
  21 siblings, 2 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

libtorrent uses 1 bytes and 4 bytes __sync built-ins, so let's use the
appropriate BR2_TOOLCHAIN_HAS_SYNC_x symbols instead of
BR2_ARCH_HAS_ATOMICS. The rtorrent package, which is a reverse
dependency of libtorrent, gets fixed as well.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/libtorrent/Config.in | 4 ++--
 package/rtorrent/Config.in   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/libtorrent/Config.in b/package/libtorrent/Config.in
index 17a1f23..4787f9c 100644
--- a/package/libtorrent/Config.in
+++ b/package/libtorrent/Config.in
@@ -2,7 +2,7 @@ config BR2_PACKAGE_LIBTORRENT
 	bool "libtorrent"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_ZLIB
 	help
 	  BitTorrent library written in C++ for *nix
@@ -10,5 +10,5 @@ config BR2_PACKAGE_LIBTORRENT
 	  https://github.com/rakshasa/libtorrent
 
 comment "libtorrent needs a toolchain w/ C++, threads"
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/rtorrent/Config.in b/package/rtorrent/Config.in
index 0583152..190e50f 100644
--- a/package/rtorrent/Config.in
+++ b/package/rtorrent/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_RTORRENT
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU # fork()
-	depends on BR2_ARCH_HAS_ATOMICS # libtorrent
+	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_LIBCURL
 	select BR2_PACKAGE_LIBTORRENT
 	select BR2_PACKAGE_NCURSES
@@ -16,5 +16,5 @@ config BR2_PACKAGE_RTORRENT
 
 comment "rtorrent needs a toolchain w/ C++, threads, wchar"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_USE_WCHAR && BR2_TOOLCHAIN_HAS_THREADS)
-- 
2.6.4

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

* [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 21:52   ` Yann E. MORIN
  2016-01-24 23:07 ` [Buildroot] [PATCH 12/21] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
                   ` (10 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

gauche does not build on sparc64, it fails with:

  No rule to make target 'sparc_mach_dep.lo', needed by 'libgc.la'

On Sparc, it first fails with the usual "membar" assembler issue which
comes from gauche's internal version of libatomic_ops. However, even
passing -DAO_NO_SPARC_V9 like we do for libatomic_ops is not
sufficient, as we fall into the same build problem as on sparc64.

Consequently, this commit disables the gauche package on the sparc and
sparc64 architectures.

Since it uses its own libatomic_ops copy, and libatomic_ops does not
have any dependency on atomic built-ins, we also remove the
BR2_ARCH_HAS_ATOMICS dependency. It was originally added to prevent
gauche from being built on sparc, but this will no longer happen.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gauche/Config.in | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/package/gauche/Config.in b/package/gauche/Config.in
index fd0617a..3ca012d 100644
--- a/package/gauche/Config.in
+++ b/package/gauche/Config.in
@@ -4,14 +4,12 @@ config BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
 	default y if BR2_arm || BR2_armeb || BR2_i386 || BR2_m68k || \
 		BR2_mips || BR2_mipsel || BR2_mips64 || \
 		BR2_mips64el || BR2_powerpc || BR2_powerpc64 || \
-		BR2_powerpc64le || BR2_sh || BR2_sh64 || BR2_sparc || \
-		BR2_sparc64 || BR2_x86_64
+		BR2_powerpc64le || BR2_sh || BR2_sh64 || BR2_x86_64
 
 config BR2_PACKAGE_GAUCHE
 	bool "gauche"
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_USE_MMU # fork()
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
 	depends on !BR2_STATIC_LIBS
 	help
@@ -26,6 +24,5 @@ config BR2_PACKAGE_GAUCHE
 
 comment "gauche needs a toolchain w/ NPTL, dynamic library"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS
-- 
2.6.4

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

* [Buildroot] [PATCH 12/21] cairo, harfbuzz: rework atomic dependencies
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (10 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-24 23:07 ` [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

This commit handles the reverse dependency tree of cairo in terms of
atomic dependencies. There are two main changes:

 - cairo in fact no longer needs atomic operations. It can perfectly
   build without any __sync built-in, as was tested using an ARC
   toolchain without atomics, and a SPARC toolchain. Optionally, Cairo
   can use the __atomic builtins provided by gcc >= 4.7, so support
   for this is added as well. Thanks to this change, the
   BR2_ARCH_HAS_ATOMICS dependency is removed from cairo and all its
   reverse dependencies.

 - harfbuzz does require the __sync built-in for 4 bytes integers, so
   we add a dependency on BR2_TOOLCHAIN_HAS_SYNC_4 to harfbuzz and all
   its reverse dependency, the main one being the pango package. Due
   to this, the vast majority of gtk-related packages are moved to a
   dependency on BR2_ARCH_HAS_ATOMICS (which used to be due to cairo)
   to a dependency on BR2_TOOLCHAIN_HAS_SYNC_4 (due to pango ->
   harfbuzz).

In detail:

 - cairo

   Remove BR2_ARCH_HAS_ATOMICS dependency, link against -latomic when
   gcc >= 4.7 in order to use the __atomic functions.

 - harfbuzz

   Add dependency on BR2_TOOLCHAIN_HAS_SYNC_4

 - cairomm, gst-plugins-good, gst1-plugins-good, libgdiplus,
   libsvg-cairo, weston

   Remove BR2_ARCH_HAS_ATOMICS dependency (since cairo no longer needs
   atomics)

 - enlightenment, cwiid, gst-plugins-bad, gst-plugins-base,
   gst1-plugins-bad, gst1-plugins-base, gtkmm3,
   libevas-generic-loaders, libfm, libgail, libgtk2, libgtk3, librsvg,
   openbox, opencv, opencv3, pango, pangomm, pcmanfm, pinentry,
   rrdtool, webkit, webkitgtk24, xscreensaver

   Switch from a BR2_ARCH_HAS_ATOMICS dependency to a
   BR2_TOOLCHAIN_HAS_SYNC_4 (they depend on pango, harfbuzz, gtk, or
   some other related package)

 - directfb

   Remove BR2_ARCH_ATOMICS dependency of the BR2_PACKAGE_DIRECTFB_SVG
   (since cairo can build without atomics), but add a
   BR2_TOOLCHAIN_HAS_SYNC_4 dependency on BR2_PACKAGE_DIRECTFB itself
   since it does use __sync built-ins. This replaces the !BR2_sparc
   dependency.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/cairo/Config.in                        | 1 -
 package/cairo/cairo.mk                         | 6 ++++++
 package/cairomm/Config.in                      | 2 --
 package/cwiid/Config.in                        | 2 +-
 package/directfb/Config.in                     | 5 ++---
 package/enlightenment/Config.in                | 6 +++---
 package/gstreamer/gst-plugins-bad/Config.in    | 4 ++--
 package/gstreamer/gst-plugins-base/Config.in   | 4 ++--
 package/gstreamer/gst-plugins-good/Config.in   | 1 -
 package/gstreamer1/gst1-plugins-bad/Config.in  | 4 ++--
 package/gstreamer1/gst1-plugins-base/Config.in | 4 ++--
 package/gstreamer1/gst1-plugins-good/Config.in | 1 -
 package/gtkmm3/Config.in                       | 4 ++--
 package/harfbuzz/Config.in                     | 2 ++
 package/libevas-generic-loaders/Config.in      | 4 ++--
 package/libfm/Config.in                        | 4 ++--
 package/libgail/Config.in                      | 4 ++--
 package/libgdiplus/Config.in                   | 2 --
 package/libgtk2/Config.in                      | 4 ++--
 package/libgtk3/Config.in                      | 4 ++--
 package/librsvg/Config.in                      | 4 ++--
 package/libsvg-cairo/Config.in                 | 1 -
 package/openbox/Config.in                      | 4 ++--
 package/opencv/Config.in                       | 2 +-
 package/opencv3/Config.in                      | 4 ++--
 package/pango/Config.in                        | 4 ++--
 package/pangomm/Config.in                      | 4 ++--
 package/pcmanfm/Config.in                      | 4 ++--
 package/pinentry/Config.in                     | 4 ++--
 package/rrdtool/Config.in                      | 2 +-
 package/webkit/Config.in                       | 4 ++--
 package/webkitgtk24/Config.in                  | 4 ++--
 package/weston/Config.in                       | 2 --
 package/xscreensaver/Config.in                 | 4 ++--
 34 files changed, 56 insertions(+), 59 deletions(-)

diff --git a/package/cairo/Config.in b/package/cairo/Config.in
index 38570d6..0c87a29 100644
--- a/package/cairo/Config.in
+++ b/package/cairo/Config.in
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_CAIRO
 	bool "cairo"
-	depends on BR2_ARCH_HAS_ATOMICS
 	select BR2_PACKAGE_PIXMAN
 	select BR2_PACKAGE_FONTCONFIG
 	select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7
diff --git a/package/cairo/cairo.mk b/package/cairo/cairo.mk
index d80d068..5e48546 100644
--- a/package/cairo/cairo.mk
+++ b/package/cairo/cairo.mk
@@ -16,6 +16,12 @@ ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
 CAIRO_CONF_ENV += CPPFLAGS="$(TARGET_CPPFLAGS) -DCAIRO_NO_MUTEX=1"
 endif
 
+# cairo can use C++11 atomics when available, so we need to link with
+# libatomic for the architectures who need libatomic.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
+CAIRO_CONF_ENV += LIBS="-latomic"
+endif
+
 CAIRO_CONF_OPTS = \
 	--enable-trace=no \
 	--enable-interpreter=no
diff --git a/package/cairomm/Config.in b/package/cairomm/Config.in
index 4477b37..c0d5ccd 100644
--- a/package/cairomm/Config.in
+++ b/package/cairomm/Config.in
@@ -3,7 +3,6 @@ config BR2_PACKAGE_CAIROMM
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_LIBSIGC
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
 	depends on BR2_USE_WCHAR # libglib2
@@ -16,6 +15,5 @@ config BR2_PACKAGE_CAIROMM
 
 comment "cairomm needs a toolchain w/ C++, wchar, threads, gcc >= 4.8"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 || !BR2_USE_WCHAR \
 		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/cwiid/Config.in b/package/cwiid/Config.in
index 1b64f0a..03b7dbb 100644
--- a/package/cwiid/Config.in
+++ b/package/cwiid/Config.in
@@ -14,7 +14,7 @@ config BR2_PACKAGE_CWIID
 if BR2_PACKAGE_CWIID
 config BR2_PACKAGE_CWIID_WMGUI
 	bool "wmgui"
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk3 -> pango -> harfbuzz
 	depends on BR2_PACKAGE_XORG7 # libgtk2
 	depends on BR2_USE_WCHAR # libgtk2 -> libglib2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> libglib2
diff --git a/package/directfb/Config.in b/package/directfb/Config.in
index 73425d3..7c5f66b 100644
--- a/package/directfb/Config.in
+++ b/package/directfb/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_DIRECTFB
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
 	depends on !BR2_TOOLCHAIN_USES_MUSL # sigval_t issue
-	depends on !BR2_sparc # needs atomic operation __sync_fetch_and_add
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_FREETYPE
 	select BR2_PACKAGE_ZLIB
 	help
@@ -141,7 +141,6 @@ config BR2_PACKAGE_DIRECTFB_PNG
 
 config BR2_PACKAGE_DIRECTFB_SVG
 	bool "enable SVG support"
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	default y
 	select BR2_PACKAGE_LIBSVG_CAIRO
 
@@ -157,6 +156,6 @@ config BR2_PACKAGE_DIRECTFB_TESTS
 endif # BR2_PACKAGE_DIRECTFB
 
 comment "directfb needs a (e)glibc or uClibc toolchain w/ C++, threads, gcc >= 4.5"
-	depends on !BR2_sparc # needs atomic operation __sync_fetch_and_add
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || BR2_TOOLCHAIN_USES_MUSL
diff --git a/package/enlightenment/Config.in b/package/enlightenment/Config.in
index fc1f469..05ee6fc 100644
--- a/package/enlightenment/Config.in
+++ b/package/enlightenment/Config.in
@@ -10,8 +10,8 @@ config BR2_PACKAGE_ENLIGHTENMENT
 	depends on BR2_USE_MMU
 	depends on BR2_PACKAGE_EFL
 	depends on BR2_PACKAGE_XORG7
-	# libevas-generic-loaders-svg -> librsvg -> pango -> cairo
-	depends on BR2_ARCH_HAS_ATOMICS
+	# libevas-generic-loaders-svg -> librsvg -> pango -> harfbuzz
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_EFL_X_XLIB
 	select BR2_PACKAGE_EFL_JPEG # needed at runtime by enlightenment_start
 	select BR2_PACKAGE_EFL_PNG # needed at runtime by enlightenment_start
@@ -31,4 +31,4 @@ config BR2_PACKAGE_ENLIGHTENMENT
 comment "enlightenment needs a toolchain w/ wchar, C++, threads"
 	depends on BR2_PACKAGE_EFL && BR2_PACKAGE_XORG7 && BR2_USE_MMU
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
diff --git a/package/gstreamer/gst-plugins-bad/Config.in b/package/gstreamer/gst-plugins-bad/Config.in
index 43849e2..d95edaa 100644
--- a/package/gstreamer/gst-plugins-bad/Config.in
+++ b/package/gstreamer/gst-plugins-bad/Config.in
@@ -298,12 +298,12 @@ config BR2_PACKAGE_GST_PLUGINS_BAD_PLUGIN_OPUS
 config BR2_PACKAGE_GST_PLUGINS_BAD_PLUGIN_RSVG
 	bool "rsvg"
 	depends on BR2_INSTALL_LIBSTDCPP # librsvg -> pango
-	depends on BR2_ARCH_HAS_ATOMICS # librsvg -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # librsvg -> pango -> harfbuzz
 	select BR2_PACKAGE_LIBRSVG
 
 comment "rsvg plugin needs a toolchain w/ C++"
 	depends on !BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 
 config BR2_PACKAGE_GST_PLUGINS_BAD_PLUGIN_SDL
 	bool "sdl"
diff --git a/package/gstreamer/gst-plugins-base/Config.in b/package/gstreamer/gst-plugins-base/Config.in
index 8ececea..8ad9a8e 100644
--- a/package/gstreamer/gst-plugins-base/Config.in
+++ b/package/gstreamer/gst-plugins-base/Config.in
@@ -85,12 +85,12 @@ config BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_OGG
 config BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_PANGO
 	bool "pango font renderer"
 	depends on BR2_INSTALL_LIBSTDCPP # pango -> freetype
-	depends on BR2_ARCH_HAS_ATOMICS # pango -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	select BR2_PACKAGE_PANGO
 
 comment "pango plugin needs a toolchain w/ C++"
 	depends on !BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 
 config BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_THEORA
 	bool "theora (*.ogg video)"
diff --git a/package/gstreamer/gst-plugins-good/Config.in b/package/gstreamer/gst-plugins-good/Config.in
index 36ab6cb..65f74e8 100644
--- a/package/gstreamer/gst-plugins-good/Config.in
+++ b/package/gstreamer/gst-plugins-good/Config.in
@@ -174,7 +174,6 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_ANNODEX
 
 config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_CAIRO
 	bool "cairo"
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_PNG
 
diff --git a/package/gstreamer1/gst1-plugins-bad/Config.in b/package/gstreamer1/gst1-plugins-bad/Config.in
index 0aafea0..f02be34 100644
--- a/package/gstreamer1/gst1-plugins-bad/Config.in
+++ b/package/gstreamer1/gst1-plugins-bad/Config.in
@@ -623,14 +623,14 @@ config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_OPUS
 config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_RSVG
 	bool "rsvg"
 	depends on BR2_INSTALL_LIBSTDCPP # librsvg -> pango
-	depends on BR2_ARCH_HAS_ATOMICS # librsvg -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # librsvg -> pango -> harfbuzz
 	select BR2_PACKAGE_LIBRSVG
 	help
 	  RSVG plugin library
 
 comment "rsvg plugin needs a toolchain w/ C++"
 	depends on !BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 
 config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_GL
 	bool "gl"
diff --git a/package/gstreamer1/gst1-plugins-base/Config.in b/package/gstreamer1/gst1-plugins-base/Config.in
index 44367eb..b19fa59 100644
--- a/package/gstreamer1/gst1-plugins-base/Config.in
+++ b/package/gstreamer1/gst1-plugins-base/Config.in
@@ -129,14 +129,14 @@ config BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_OGG
 config BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_PANGO
 	bool "pango font renderer"
 	depends on BR2_INSTALL_LIBSTDCPP # pango -> freetype
-	depends on BR2_ARCH_HAS_ATOMICS # pango -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	select BR2_PACKAGE_PANGO
 	help
 	  Pango-based text rendering and overlay
 
 comment "pango plugin needs a toolchain w/ C++"
 	depends on !BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 
 config BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_THEORA
 	bool "theora (*.ogg video)"
diff --git a/package/gstreamer1/gst1-plugins-good/Config.in b/package/gstreamer1/gst1-plugins-good/Config.in
index 2606b86..a59033a 100644
--- a/package/gstreamer1/gst1-plugins-good/Config.in
+++ b/package/gstreamer1/gst1-plugins-good/Config.in
@@ -281,7 +281,6 @@ comment "v4l2 needs a toolchain w/ headers >= 3.0"
 
 config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_CAIRO
 	bool "cairo"
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_PNG
 	help
diff --git a/package/gtkmm3/Config.in b/package/gtkmm3/Config.in
index 80dbbde..238a8cd 100644
--- a/package/gtkmm3/Config.in
+++ b/package/gtkmm3/Config.in
@@ -5,7 +5,7 @@ config BR2_PACKAGE_GTKMM3
 	# and GCC >= 5.3.
 	# https://sourceware.org/bugzilla/show_bug.cgi?id=19405
 	depends on !BR2_nios2
-	depends on BR2_ARCH_HAS_ATOMICS # libcairomm/libgtk3/libpangomm -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pangomm, libgtk3 -> pango -> harfbuzz
 	depends on BR2_INSTALL_LIBSTDCPP # glibmm, libpangomm -> glibmm/pango
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	depends on BR2_TOOLCHAIN_HAS_THREADS # *mm/libgtk3 -> libglib2
@@ -24,6 +24,6 @@ config BR2_PACKAGE_GTKMM3
 
 comment "gtkmm3 needs a toolchain w/ C++, wchar, threads, gcc >= 4.8"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 || !BR2_USE_WCHAR \
 		|| !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/harfbuzz/Config.in b/package/harfbuzz/Config.in
index 7a864e9..a6db984 100644
--- a/package/harfbuzz/Config.in
+++ b/package/harfbuzz/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_HARFBUZZ
 	bool "harfbuzz"
 	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	help
 	  HarfBuzz is an OpenType text shaping engine
 
@@ -10,4 +11,5 @@ config BR2_PACKAGE_HARFBUZZ
 	  glib2 and icu packages if they are selected.
 
 comment "harfbuzz needs a toolchain w/ C++"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/libevas-generic-loaders/Config.in b/package/libevas-generic-loaders/Config.in
index 1d5b717..c171d47 100644
--- a/package/libevas-generic-loaders/Config.in
+++ b/package/libevas-generic-loaders/Config.in
@@ -27,14 +27,14 @@ config BR2_PACKAGE_LIBEVAS_GENERIC_LOADERS_SVG
 	depends on BR2_USE_WCHAR # librsvg -> glib2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # librsvg -> glib2
 	depends on BR2_INSTALL_LIBSTDCPP # librsvg -> pango
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # librsvg -> pango -> harfbuzz
 	select BR2_PACKAGE_LIBRSVG
 	select BR2_PACKAGE_CAIRO
 	help
 	  This option enables the Evas generic SVG loader
 
 comment "SVG loader needs a toolchain w/ wchar, threads, C++"
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
 
diff --git a/package/libfm/Config.in b/package/libfm/Config.in
index c6cfcf6..603b4d5 100644
--- a/package/libfm/Config.in
+++ b/package/libfm/Config.in
@@ -9,7 +9,7 @@ config BR2_PACKAGE_LIBFM
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
 	depends on BR2_USE_MMU # libglib2
 	depends on BR2_INSTALL_LIBSTDCPP # libgtk2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk2 -> pango -> harfbuzz
 	help
 	  A glib/gio-based library providing some file management
 	  utilities and related-widgets missing in gtk+/glib. This is
@@ -23,6 +23,6 @@ config BR2_PACKAGE_LIBFM
 
 comment "libfm needs X.org and a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_PACKAGE_XORG7
diff --git a/package/libgail/Config.in b/package/libgail/Config.in
index 5e4f03b..821a922 100644
--- a/package/libgail/Config.in
+++ b/package/libgail/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBGAIL
 	depends on BR2_TOOLCHAIN_HAS_THREADS # pango -> libglib2
 	depends on BR2_USE_MMU # pango -> libglib2
 	depends on BR2_INSTALL_LIBSTDCPP # pango -> freetype
-	depends on BR2_ARCH_HAS_ATOMICS # pango -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	depends on BR2_PACKAGE_LIBGTK2
 	depends on BR2_DEPRECATED_SINCE_2015_08
 	select BR2_PACKAGE_PANGO
@@ -27,5 +27,5 @@ comment "libgail needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_PACKAGE_LIBGTK2
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_DEPRECATED_SINCE_2015_08
diff --git a/package/libgdiplus/Config.in b/package/libgdiplus/Config.in
index f860ab3..6862503 100644
--- a/package/libgdiplus/Config.in
+++ b/package/libgdiplus/Config.in
@@ -8,7 +8,6 @@ config BR2_PACKAGE_LIBGDIPLUS
 	depends on BR2_USE_WCHAR # libglib2 -> gettext
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
 	depends on BR2_USE_MMU # libglib2
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	help
 	  An Open Source implementation of the GDI+ API.
 
@@ -16,6 +15,5 @@ config BR2_PACKAGE_LIBGDIPLUS
 
 comment "libgdiplus needs a toolchain w/ wchar, threads"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_PACKAGE_XORG7
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/libgtk2/Config.in b/package/libgtk2/Config.in
index 9326f44..b6cf37e 100644
--- a/package/libgtk2/Config.in
+++ b/package/libgtk2/Config.in
@@ -17,7 +17,7 @@ config BR2_PACKAGE_LIBGTK2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
 	depends on BR2_INSTALL_LIBSTDCPP # pango
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	help
 	  The GTK+ version 2 graphical user interface library
 
@@ -35,7 +35,7 @@ endif
 
 comment "libgtk2 needs a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_PACKAGE_XORG7
 	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/libgtk3/Config.in b/package/libgtk3/Config.in
index 02c7aaf..ac56b85 100644
--- a/package/libgtk3/Config.in
+++ b/package/libgtk3/Config.in
@@ -15,7 +15,7 @@ config BR2_PACKAGE_LIBGTK3
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
 	depends on BR2_INSTALL_LIBSTDCPP # pango
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	help
 	  The GTK+ version 3 graphical user interface library
 
@@ -84,6 +84,6 @@ endif
 
 comment "libgtk3 needs a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
index 03e5cf3..7ce9d06 100644
--- a/package/librsvg/Config.in
+++ b/package/librsvg/Config.in
@@ -11,7 +11,7 @@ config BR2_PACKAGE_LIBRSVG
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
 	depends on BR2_INSTALL_LIBSTDCPP # pango
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	help
 	  The rsvg library is an efficient renderer for Scalable
 	  Vector Graphics (SVG) pictures.
@@ -20,5 +20,5 @@ config BR2_PACKAGE_LIBRSVG
 
 comment "librsvg needs a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/libsvg-cairo/Config.in b/package/libsvg-cairo/Config.in
index d69a6b9..9577c69 100644
--- a/package/libsvg-cairo/Config.in
+++ b/package/libsvg-cairo/Config.in
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_LIBSVG_CAIRO
 	bool "libsvg-cairo"
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_SVG
 	select BR2_PACKAGE_LIBSVG
diff --git a/package/openbox/Config.in b/package/openbox/Config.in
index f5475bf..3ddd376 100644
--- a/package/openbox/Config.in
+++ b/package/openbox/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_OPENBOX
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
 	depends on BR2_USE_WCHAR # glib2
-	depends on BR2_ARCH_HAS_ATOMICS # pango -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	depends on BR2_INSTALL_LIBSTDCPP # pango -> freetype
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_LIBXML2
@@ -21,7 +21,7 @@ config BR2_PACKAGE_OPENBOX
 
 comment "openbox needs a toolchain w/ C++, threads, wchar"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
 		!BR2_INSTALL_LIBSTDCPP
 	depends on BR2_PACKAGE_XORG7
diff --git a/package/opencv/Config.in b/package/opencv/Config.in
index 679ce6f..8bc6c34 100644
--- a/package/opencv/Config.in
+++ b/package/opencv/Config.in
@@ -179,7 +179,7 @@ config BR2_PACKAGE_OPENCV_WITH_GTK
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> libglib2
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_MMU # libgtk2 -> glib2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk2 -> pango -> harfbuzz
 	depends on BR2_PACKAGE_OPENCV_LIB_HIGHGUI
 	select BR2_PACKAGE_LIBGTK2
 
diff --git a/package/opencv3/Config.in b/package/opencv3/Config.in
index 8736805..3a185d6 100644
--- a/package/opencv3/Config.in
+++ b/package/opencv3/Config.in
@@ -69,7 +69,7 @@ config BR2_PACKAGE_OPENCV3_WITH_GTK
 
 comment "gtk2 support needs libgtk2"
 	depends on BR2_USE_MMU # libgtk2 -> glib2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_PACKAGE_LIBGTK2
 
 config BR2_PACKAGE_OPENCV3_WITH_GTK3
@@ -78,7 +78,7 @@ config BR2_PACKAGE_OPENCV3_WITH_GTK3
 
 comment "gtk3 support needs libgtk3"
 	depends on BR2_USE_MMU # libgtk3 -> glib2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk3 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_PACKAGE_LIBGTK3
 
 config BR2_PACKAGE_OPENCV3_WITH_QT
diff --git a/package/pango/Config.in b/package/pango/Config.in
index e9c3040..7813c4e 100644
--- a/package/pango/Config.in
+++ b/package/pango/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_PANGO
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
 	depends on BR2_INSTALL_LIBSTDCPP # freetype support
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_EXPAT
 	select BR2_PACKAGE_CAIRO
@@ -24,6 +24,6 @@ config BR2_PACKAGE_PANGO
 
 comment "pango needs a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/pangomm/Config.in b/package/pangomm/Config.in
index 6a84c42..a7c41a0 100644
--- a/package/pangomm/Config.in
+++ b/package/pangomm/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_PANGOMM
 	select BR2_PACKAGE_GLIBMM
 	select BR2_PACKAGE_PANGO
 	select BR2_PACKAGE_LIBSIGC
-	depends on BR2_ARCH_HAS_ATOMICS # libcairomm/pango -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	depends on BR2_INSTALL_LIBSTDCPP # glibmm/pango
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11
 	depends on BR2_TOOLCHAIN_HAS_THREADS # *mm/pango -> libglib2
@@ -17,6 +17,6 @@ config BR2_PACKAGE_PANGOMM
 
 comment "pangomm needs a toolchain w/ C++, wchar, threads, gcc >= 4.8"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 || !BR2_USE_WCHAR \
 		|| !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/pcmanfm/Config.in b/package/pcmanfm/Config.in
index 4289785..149a595 100644
--- a/package/pcmanfm/Config.in
+++ b/package/pcmanfm/Config.in
@@ -9,7 +9,7 @@ config BR2_PACKAGE_PCMANFM
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
 	depends on BR2_USE_MMU # libglib2
 	depends on BR2_INSTALL_LIBSTDCPP # libgtk2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk2 -> pango -> harfbuzz
 	help
 	  PCMan File Manager (PCManFM) is a file manager application developed
 	  by Hong Jen Yee from Taiwan which is meant to be a replacement for
@@ -19,6 +19,6 @@ config BR2_PACKAGE_PCMANFM
 
 comment "pcmanfm needs X.org and a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_PACKAGE_XORG7
diff --git a/package/pinentry/Config.in b/package/pinentry/Config.in
index edf3316..f5a8159 100644
--- a/package/pinentry/Config.in
+++ b/package/pinentry/Config.in
@@ -23,7 +23,7 @@ config BR2_PACKAGE_PINENTRY_GTK2
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk2 -> pango -> harfbuzz
 	select BR2_PACKAGE_LIBGTK2
 	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
 	help
@@ -31,7 +31,7 @@ config BR2_PACKAGE_PINENTRY_GTK2
 
 comment "pinentry-gtk2 needs X and a toolchain w/ wchar, threads, C++"
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_PACKAGE_XORG7 || !BR2_USE_WCHAR || \
 		!BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
 
diff --git a/package/rrdtool/Config.in b/package/rrdtool/Config.in
index b07c446..631ed32 100644
--- a/package/rrdtool/Config.in
+++ b/package/rrdtool/Config.in
@@ -15,7 +15,7 @@ if BR2_PACKAGE_RRDTOOL
 config BR2_PACKAGE_RRDTOOL_RRDGRAPH
 	bool "rrd_graph"
 	default y
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	depends on BR2_INSTALL_LIBSTDCPP # freetype support from pango
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_PDF
diff --git a/package/webkit/Config.in b/package/webkit/Config.in
index 7f0d1e4..c139f52 100644
--- a/package/webkit/Config.in
+++ b/package/webkit/Config.in
@@ -18,7 +18,7 @@ config BR2_PACKAGE_WEBKIT
 	depends on BR2_PACKAGE_LIBGTK2
 	depends on BR2_PACKAGE_WEBKIT_ARCH_SUPPORTS
 	depends on !BR2_BINFMT_FLAT # icu
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_PNG
 	select BR2_PACKAGE_ENCHANT
@@ -47,7 +47,7 @@ config BR2_PACKAGE_WEBKIT
 comment "webkit needs libgtk2 and a toolchain w/ C++, wchar, threads"
 	depends on BR2_DEPRECATED_SINCE_2015_08
 	depends on BR2_PACKAGE_WEBKIT_ARCH_SUPPORTS
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_PACKAGE_LIBGTK2 || !BR2_INSTALL_LIBSTDCPP || \
 		!BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU
diff --git a/package/webkitgtk24/Config.in b/package/webkitgtk24/Config.in
index 0a30bac..3c7c330 100644
--- a/package/webkitgtk24/Config.in
+++ b/package/webkitgtk24/Config.in
@@ -11,7 +11,7 @@ config BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS
 
 comment "webkitgtk24 needs libgtk2 and a toolchain w/ C++, wchar, NPTL, gcc >=4.8"
 	depends on BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_PACKAGE_LIBGTK2 || !BR2_PACKAGE_XORG7 || \
 		!BR2_TOOLCHAIN_HAS_THREADS_NPTL || !BR2_INSTALL_LIBSTDCPP \
 		|| !BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
@@ -25,7 +25,7 @@ config BR2_PACKAGE_WEBKITGTK24
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
 	depends on (BR2_PACKAGE_LIBGTK2 && BR2_PACKAGE_XORG7)
 	depends on BR2_PACKAGE_WEBKITGTK24_ARCH_SUPPORTS
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_CAIRO_PNG
 	select BR2_PACKAGE_ENCHANT
diff --git a/package/weston/Config.in b/package/weston/Config.in
index 3fd7981..c5525e1 100644
--- a/package/weston/Config.in
+++ b/package/weston/Config.in
@@ -1,5 +1,4 @@
 comment "weston needs udev and a toolchain w/ locale, threads, dynamic library, headers >= 3.0"
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_PACKAGE_HAS_UDEV || !BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 || BR2_STATIC_LIBS || \
 		!BR2_ENABLE_LOCALE
@@ -19,7 +18,6 @@ config BR2_PACKAGE_WESTON
 	depends on !BR2_STATIC_LIBS # wayland
 	depends on BR2_TOOLCHAIN_HAS_THREADS # wayland
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
-	depends on BR2_ARCH_HAS_ATOMICS # cairo
 	# Runtime dependency
 	select BR2_PACKAGE_XKEYBOARD_CONFIG
 	# Make sure at least one compositor is selected.
diff --git a/package/xscreensaver/Config.in b/package/xscreensaver/Config.in
index 59b19c5..5213ce3 100644
--- a/package/xscreensaver/Config.in
+++ b/package/xscreensaver/Config.in
@@ -5,7 +5,7 @@ config BR2_PACKAGE_XSCREENSAVER
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libgtk2 -> glib2
 	depends on BR2_USE_WCHAR # libgtk2 -> glib2
 	depends on BR2_USE_MMU # libgtk2 -> glib2
-	depends on BR2_ARCH_HAS_ATOMICS # libgtk2 -> cairo
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libgtk2 -> pango -> harfbuzz
 	select BR2_PACKAGE_LIBGTK2
 	select BR2_PACKAGE_LIBGLADE
 	select BR2_PACKAGE_JPEG
@@ -25,6 +25,6 @@ config BR2_PACKAGE_XSCREENSAVER
 comment "xscreensaver needs a toolchain w/ wchar, C++, threads"
 	depends on BR2_PACKAGE_XORG7
 	depends on BR2_USE_MMU
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_USE_WCHAR
-- 
2.6.4

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

* [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (11 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 12/21] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
@ 2016-01-24 23:07 ` Thomas Petazzoni
  2016-01-25 23:05   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 14/21] squid: rework atomic handling Thomas Petazzoni
                   ` (8 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:07 UTC (permalink / raw)
  To: buildroot

For some reason, since when openocd was introduced, it was using a
BR2_ARCH_HAS_ATOMICS dependency for all sub-options that selected
BR2_PACKAGE_LIBFTDI1, even if the libftdi1 package did not have any
atomics dependency. Maybe it was confused with the libftdi package,
which did have a BR2_ARCH_HAS_ATOMICS dependency ?

Regardless, openocd with all four sub-options that currently depend on
BR2_ARCH_HAS_ATOMICS builds perfectly fine with a toolchain that does
not implement any of the __sync atomic built-ins, so we can remove the
BR2_ARCH_HAS_ATOMICS dependency.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/openocd/Config.in | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/package/openocd/Config.in b/package/openocd/Config.in
index a35bd27..2313671 100644
--- a/package/openocd/Config.in
+++ b/package/openocd/Config.in
@@ -127,7 +127,6 @@ config BR2_PACKAGE_OPENOCD_FT2XXX
 	bool "FT2232 based devices (DEPRECATED)"
 	select BR2_PACKAGE_LIBFTDI1
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  (DEPRECATED) Enable building support for FT2232
 	  based devices using the libftdi library
@@ -141,7 +140,6 @@ config BR2_PACKAGE_OPENOCD_UBLASTER
 	bool "Altera USB-Blaster"
 	select BR2_PACKAGE_LIBFTDI1
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  Enable building support for the Altera USB-Blaster
 	  using the libftdi driver, opensource alternate of
@@ -182,7 +180,6 @@ config BR2_PACKAGE_OPENOCD_PRESTO
 	bool "ASIX Presto Programmer"
 	select BR2_PACKAGE_LIBFTDI1
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  Enable building support for ASIX Presto Programmer
 	  using the libftdi driver
@@ -193,7 +190,6 @@ config BR2_PACKAGE_OPENOCD_OPENJTAG
 	select BR2_PACKAGE_LIBUSB
 	select BR2_PACKAGE_LIBUSB_COMPAT # needs usb.h
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
-	depends on BR2_ARCH_HAS_ATOMICS
 	help
 	  Enable building support for the OpenJTAG Programmer
 	  with ftdi driver
-- 
2.6.4

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

* [Buildroot] [PATCH 14/21] squid: rework atomic handling
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (12 preceding siblings ...)
  2016-01-24 23:07 ` [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-25 22:53   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (7 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

squid can use the __sync built-ins when available, but uses an
AC_TRY_RUN autoconf tests to check their availability, which isn't
compatible with cross-compilation. Due to this, squid.mk is already
hinting the configure script about this by passing
squid_cv_gnu_atomics=yes/no depending on the availability of atomic
operations.

So far, squid.mk was assuming that BR2_ARCH_HAS_ATOMICS &&
BR2_ARCH_IS_64 was needed, since 8 bytes __sync built-ins are
used. However, this was a bit too restrictive, since certain 32 bits
architectures (ARM, x86) do provide 8 bytes __sync built-ins.

So, instead of using BR2_ARCH_HAS_ATOMICS, we now rely on
BR2_TOOLCHAIN_HAS_SYNC_4 and BR2_TOOLCHAIN_HAS_SYNC_8, since both 4
bytes and 8 bytes __sync built-ins are tested by the autoconf test.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/squid/squid.mk | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/package/squid/squid.mk b/package/squid/squid.mk
index 3110573..f205da2 100644
--- a/package/squid/squid.mk
+++ b/package/squid/squid.mk
@@ -41,12 +41,10 @@ SQUID_CONF_OPTS = \
 	--with-swapdir=/var/cache/squid/ \
 	--with-default-user=squid
 
-# Atomics in Squid use __sync_add_and_fetch_8, i.e a 64 bits atomic
-# operation. This atomic intrinsic is only available natively on
-# 64-bit architectures that have atomic operations. On 32-bit
-# architectures, it would be provided by libatomic, but Buildroot
-# typically doesn't provide it.
-ifeq ($(BR2_ARCH_HAS_ATOMICS)$(BR2_ARCH_IS_64),yy)
+# Atomics in Squid use __sync built-ins on 4 and 8 bytes. However, the
+# configure script tests them using AC_TRY_RUN, so we have to give
+# some hints.
+ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4)$(BR2_TOOLCHAIN_HAS_SYNC_8),yy)
 SQUID_CONF_ENV += squid_cv_gnu_atomics=yes
 else
 SQUID_CONF_ENV += squid_cv_gnu_atomics=no
-- 
2.6.4

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

* [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (13 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 14/21] squid: rework atomic handling Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:31   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 16/21] msgpack: rework " Thomas Petazzoni
                   ` (6 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

thrift builds perfectly fine on SPARC, which doesn't implement any of
the __sync built-ins, so we can get rid of the BR2_ARCH_HAS_ATOMICS
dependency.

The dependency on atomic operations originated in commit
1aaa14d84f1c920423ed0286b78f64a2b4b2b575 ("thrift: disable for ARC"),
but there was no reference to any autobuilder failure. Our testing
with an ARC toolchain that doesn't have atomics shows that thrift
builds just fine, and code inspection also shows no usage of
__sync_*() built-ins. At the time of the commit, the thrift version
was 0.9.1, which also did not contain any __sync_*() call.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/thrift/Config.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/package/thrift/Config.in b/package/thrift/Config.in
index b9960f8..54ca9b8 100644
--- a/package/thrift/Config.in
+++ b/package/thrift/Config.in
@@ -3,7 +3,6 @@ config BR2_PACKAGE_THRIFT
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
 	select BR2_PACKAGE_BOOST
 	select BR2_PACKAGE_LIBEVENT
@@ -20,7 +19,6 @@ config BR2_PACKAGE_THRIFT
 	  http://thrift.apache.org/
 
 comment "thrift needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
 	depends on !BR2_USE_WCHAR || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
-- 
2.6.4

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

* [Buildroot] [PATCH 16/21] msgpack: rework BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (14 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:17   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
                   ` (5 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

The msgpack source code indeed checks for the 4 bytes __sync built-in,
so this commit switches the package from a BR2_ARCH_HAS_ATOMICS
dependency to a BR2_TOOLCHAIN_HAS_SYNC_4 dependency.

python-msgpack, a reverse dependency of msgpack, is changed in the
same way.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/msgpack/Config.in        | 4 ++--
 package/python-msgpack/Config.in | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/msgpack/Config.in b/package/msgpack/Config.in
index a57a378..b8e8213 100644
--- a/package/msgpack/Config.in
+++ b/package/msgpack/Config.in
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_MSGPACK
 	bool "msgpack"
 	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	help
 	  MessagePack is an efficient binary serialization format.
 
@@ -11,5 +11,5 @@ config BR2_PACKAGE_MSGPACK
 	  http://msgpack.org/
 
 comment "msgpack needs a toolchain w/ C++"
-	depends on BR2_ARCH_HAS_ATOMICS
 	depends on !BR2_INSTALL_LIBSTDCPP
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
diff --git a/package/python-msgpack/Config.in b/package/python-msgpack/Config.in
index ed0b432..cba3b51 100644
--- a/package/python-msgpack/Config.in
+++ b/package/python-msgpack/Config.in
@@ -3,7 +3,7 @@ config BR2_PACKAGE_PYTHON_MSGPACK
 	depends on BR2_PACKAGE_PYTHON
 	select BR2_PACKAGE_MSGPACK
 	depends on BR2_INSTALL_LIBSTDCPP # msgpack
-	depends on BR2_ARCH_HAS_ATOMICS # msgpack
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # msgpack
 	help
 	  MessagePack (http://msgpack.org/) is a fast, compact binary
 	  serialization format, suitable for similar data to JSON.
@@ -13,6 +13,6 @@ config BR2_PACKAGE_PYTHON_MSGPACK
 	  https://pypi.python.org/pypi/msgpack-python/
 
 comment "python-msgpack needs a toolchain w/ C++"
-	depends on BR2_ARCH_HAS_ATOMICS
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on BR2_PACKAGE_PYTHON
 	depends on !BR2_INSTALL_LIBSTDCPP
-- 
2.6.4

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

* [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (15 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 16/21] msgpack: rework " Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:22   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem Thomas Petazzoni
                   ` (4 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

Now that BR2_ARCH_HAS_ATOMICS is no longer used anywhere, we can
remove it from arch/Config.in*, as well as from the documentation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/Config.in                            | 4 ----
 arch/Config.in.aarch64                    | 3 ---
 arch/Config.in.arc                        | 3 ---
 arch/Config.in.arm                        | 3 ---
 arch/Config.in.bfin                       | 3 ---
 arch/Config.in.m68k                       | 3 ---
 arch/Config.in.microblaze                 | 3 ---
 arch/Config.in.mips                       | 3 ---
 arch/Config.in.nios2                      | 3 ---
 arch/Config.in.powerpc                    | 3 ---
 arch/Config.in.sh                         | 3 ---
 arch/Config.in.x86                        | 3 ---
 arch/Config.in.xtensa                     | 3 ---
 docs/manual/adding-packages-directory.txt | 5 -----
 14 files changed, 45 deletions(-)

diff --git a/arch/Config.in b/arch/Config.in
index 4cdd54e..401bd28 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -284,10 +284,6 @@ config BR2_GCC_TARGET_FLOAT_ABI
 config BR2_GCC_TARGET_MODE
 	string
 
-# If the architecture has atomic operations, select this:
-config BR2_ARCH_HAS_ATOMICS
-	bool
-
 # Must be selected by binary formats that support shared libraries.
 config BR2_BINFMT_SUPPORTS_SHARED
 	bool
diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
index 325bccc..34cd409 100644
--- a/arch/Config.in.aarch64
+++ b/arch/Config.in.aarch64
@@ -5,6 +5,3 @@ config BR2_ARCH
 config BR2_ENDIAN
 	default "LITTLE" if BR2_aarch64
 	default "BIG"	 if BR2_aarch64_be
-
-config BR2_ARCH_HAS_ATOMICS
-	default y
diff --git a/arch/Config.in.arc b/arch/Config.in.arc
index 7e0ad08..7d341f3 100644
--- a/arch/Config.in.arc
+++ b/arch/Config.in.arc
@@ -21,9 +21,6 @@ config BR2_ARC_ATOMIC_EXT
 	bool "Atomic extension (LLOCK/SCOND instructions)"
 	default y if BR2_arc770d || BR2_archs38
 
-config BR2_ARCH_HAS_ATOMICS
-	default y if BR2_ARC_ATOMIC_EXT
-
 config BR2_ARCH
 	default "arc"	if BR2_arcle
 	default "arceb"	if BR2_arceb
diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index 60cd3a7..2b34f42 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -426,9 +426,6 @@ config BR2_ENDIAN
 	default "LITTLE" if BR2_arm
 	default "BIG"	 if BR2_armeb
 
-config BR2_ARCH_HAS_ATOMICS
-	default y
-
 config BR2_GCC_TARGET_CPU
 	default "arm920t"	if BR2_arm920t
 	default "arm922t"	if BR2_arm922t
diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin
index 0783969..415fc89 100644
--- a/arch/Config.in.bfin
+++ b/arch/Config.in.bfin
@@ -68,9 +68,6 @@ config BR2_ARCH
 config BR2_ENDIAN
 	default "LITTLE"
 
-config BR2_ARCH_HAS_ATOMICS
-	default y
-
 config BR2_GCC_TARGET_CPU
 	default bf606		if BR2_bf606
 	default bf607		if BR2_bf607
diff --git a/arch/Config.in.m68k b/arch/Config.in.m68k
index 6b868a1..f40f97c 100644
--- a/arch/Config.in.m68k
+++ b/arch/Config.in.m68k
@@ -4,9 +4,6 @@ config BR2_ARCH
 config BR2_ENDIAN
 	default "BIG"
 
-config BR2_ARCH_HAS_ATOMICS
-	default y
-
 config BR2_GCC_TARGET_ARCH
 	default "68000"		if BR2_m68k_68000
 	default "68010"		if BR2_m68k_68010
diff --git a/arch/Config.in.microblaze b/arch/Config.in.microblaze
index 7c21dfc..2d4c1fe 100644
--- a/arch/Config.in.microblaze
+++ b/arch/Config.in.microblaze
@@ -9,6 +9,3 @@ config BR2_ENDIAN
 config BR2_microblaze
 	bool
 	default y if BR2_microblazeel || BR2_microblazebe
-
-config BR2_ARCH_HAS_ATOMICS
-	default y
diff --git a/arch/Config.in.mips b/arch/Config.in.mips
index 1e5d24d..fda1a1d 100644
--- a/arch/Config.in.mips
+++ b/arch/Config.in.mips
@@ -67,9 +67,6 @@ config BR2_ENDIAN
 	default "LITTLE"	if BR2_mipsel || BR2_mips64el
 	default "BIG" 	    	if BR2_mips || BR2_mips64
 
-config BR2_ARCH_HAS_ATOMICS
-	default y
-
 config BR2_GCC_TARGET_ARCH
 	default "mips32"	if BR2_mips_32
 	default "mips32r2"	if BR2_mips_32r2
diff --git a/arch/Config.in.nios2 b/arch/Config.in.nios2
index 7807769..ed63898 100644
--- a/arch/Config.in.nios2
+++ b/arch/Config.in.nios2
@@ -3,6 +3,3 @@ config BR2_ARCH
 
 config BR2_ENDIAN
 	default "LITTLE"
-
-config BR2_ARCH_HAS_ATOMICS
-	default y
diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
index 8581a4d..09ac794 100644
--- a/arch/Config.in.powerpc
+++ b/arch/Config.in.powerpc
@@ -164,9 +164,6 @@ config BR2_ENDIAN
 	default "BIG"    if BR2_powerpc || BR2_powerpc64
 	default "LITTLE" if BR2_powerpc64le
 
-config BR2_ARCH_HAS_ATOMICS
-	default y
-
 config BR2_GCC_TARGET_CPU
 	default "401"		if BR2_powerpc_401
 	default "403"		if BR2_powerpc_403
diff --git a/arch/Config.in.sh b/arch/Config.in.sh
index 9f8f79c..1bdea37 100644
--- a/arch/Config.in.sh
+++ b/arch/Config.in.sh
@@ -28,6 +28,3 @@ config BR2_ARCH
 config BR2_ENDIAN
 	default "LITTLE"	if BR2_sh4 || BR2_sh4a || BR2_sh64
 	default "BIG"		if BR2_sh2a || BR2_sh4eb || BR2_sh4aeb
-
-config BR2_ARCH_HAS_ATOMICS
-	default y
diff --git a/arch/Config.in.x86 b/arch/Config.in.x86
index 771c20f..7be814b 100644
--- a/arch/Config.in.x86
+++ b/arch/Config.in.x86
@@ -245,9 +245,6 @@ config BR2_ARCH
 config BR2_ENDIAN
 	default "LITTLE"
 
-config BR2_ARCH_HAS_ATOMICS
-	default y if !BR2_x86_i386
-
 config BR2_GCC_TARGET_ARCH
 	default "i386"		if BR2_x86_i386
 	default "i486"		if BR2_x86_i486
diff --git a/arch/Config.in.xtensa b/arch/Config.in.xtensa
index a0e18f1..fcb3dc9 100644
--- a/arch/Config.in.xtensa
+++ b/arch/Config.in.xtensa
@@ -54,6 +54,3 @@ config BR2_ENDIAN
 
 config BR2_ARCH
 	default "xtensa"	if BR2_xtensa
-
-config BR2_ARCH_HAS_ATOMICS
-	default y
diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
index cd78390..dac6275 100644
--- a/docs/manual/adding-packages-directory.txt
+++ b/docs/manual/adding-packages-directory.txt
@@ -274,11 +274,6 @@ use in the comment.
 ** Dependency symbol: +BR2_USE_MMU+
 ** Comment string: no comment to be added
 
-* Atomic instructions (whereby the architecture has instructions to
-  perform some operations atomically, like LOCKCMPXCHG on x86)
-** Dependency symbol: +BR2_ARCH_HAS_ATOMICS+
-** Comment string: no comment to be added
-
 * Gcc +__sync_*+ built-ins used for atomic operations. They are
   available in variants operating on 1 byte, 2 bytes, 4 bytes and 8
   bytes. Since different architectures support atomic operations on
-- 
2.6.4

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

* [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (16 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:25   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
                   ` (3 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

glog can optionally use atomic __sync built-ins. However, its
configure script only checks for the availability of the 4 bytes
version, but the code also uses the 1 byte version. While this works
on most architectures, it does not on architectures that implement
only the 4 bytes version, such as Microblaze. So if the architecture
does not implement the 1 byte version, we hint the configure script
that atomic built-ins should not be used.

Fixes:

  http://autobuild.buildroot.org/results/bedebd594c283adf39374c9a9f44432e5d6cbff7/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/glog/glog.mk | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/package/glog/glog.mk b/package/glog/glog.mk
index 8a84094..aa7cacb 100644
--- a/package/glog/glog.mk
+++ b/package/glog/glog.mk
@@ -14,4 +14,15 @@ ifeq ($(BR2_PACKAGE_GFLAGS),y)
 GLOG_DEPENDENCIES = gflags
 endif
 
+# glog can optionally use atomic __sync built-ins. However, its
+# configure script only checks for the availability of the 4 bytes
+# version, but the code also uses the 1 byte version. While this works
+# on most architectures, it does not on architectures that implement
+# only the 4 bytes version, such as Microblaze. So if the architecture
+# does not implement the 1 byte version, we hint the configure script
+# that atomic built-ins should not be used.
+ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_1),)
+GLOG_CONF_ENV += ac_cv___sync_val_compare_and_swap=no
+endif
+
 $(eval $(autotools-package))
-- 
2.6.4

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

* [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (17 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:32   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 20/21] freerdp: " Thomas Petazzoni
                   ` (2 subsequent siblings)
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

Fixes:

  http://autobuild.buildroot.org/results/314fb8da3ca87984e9240d67ff233e2f999ae89e/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/gstreamer1/gst1-plugins-bad/Config.in | 2 ++
 package/openal/Config.in                      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/package/gstreamer1/gst1-plugins-bad/Config.in b/package/gstreamer1/gst1-plugins-bad/Config.in
index f02be34..0dc217e 100644
--- a/package/gstreamer1/gst1-plugins-bad/Config.in
+++ b/package/gstreamer1/gst1-plugins-bad/Config.in
@@ -566,9 +566,11 @@ config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_OPENAL
 	bool "openal"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_OPENAL
 
 comment "openal plugin needs a toolchain w/ NPTL, C++"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
 		|| !BR2_INSTALL_LIBSTDCPP
 
diff --git a/package/openal/Config.in b/package/openal/Config.in
index 4a73f45..b497e26 100644
--- a/package/openal/Config.in
+++ b/package/openal/Config.in
@@ -2,6 +2,7 @@ config BR2_PACKAGE_OPENAL
 	bool "openal"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	help
 	  OpenAL provides capabilities for playing audio in a virtual
 	  3D environment. Distance attenuation, doppler shift, and
@@ -11,5 +12,6 @@ config BR2_PACKAGE_OPENAL
 	  http://kcat.strangesoft.net/openal.html
 
 comment "openal needs a toolchain w/ NPTL, C++"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
 		|| !BR2_INSTALL_LIBSTDCPP
-- 
2.6.4

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

* [Buildroot] [PATCH 20/21] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (18 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:33   ` Yann E. MORIN
  2016-01-24 23:08 ` [Buildroot] [PATCH 21/21] neard: " Thomas Petazzoni
  2016-01-26 20:28 ` [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

Fixes:

  http://autobuild.buildroot.org/results/0501e63cbebe4cda4012ace6f7ec5f43342be5c5/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/freerdp/Config.in | 2 ++
 package/weston/Config.in  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/package/freerdp/Config.in b/package/freerdp/Config.in
index f8dbb68..9dd2505 100644
--- a/package/freerdp/Config.in
+++ b/package/freerdp/Config.in
@@ -8,6 +8,7 @@ config BR2_PACKAGE_FREERDP
 	depends on !BR2_STATIC_LIBS # uses dlfcn.h
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_USE_MMU # libglib2
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_ZLIB
 	select BR2_PACKAGE_LIBGLIB2
@@ -84,5 +85,6 @@ config BR2_PACKAGE_FREERDP_CLIENT_WL
 endif
 
 comment "freerdp needs a toolchain w/ wchar, dynamic library, threads, C++"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
 		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/weston/Config.in b/package/weston/Config.in
index c5525e1..4c820e9 100644
--- a/package/weston/Config.in
+++ b/package/weston/Config.in
@@ -44,6 +44,7 @@ config BR2_PACKAGE_WESTON_RDP
 	bool "RDP compositor"
 	depends on BR2_USE_WCHAR # freerdp
 	depends on BR2_USE_MMU # freerdp, libglib2
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_FREERDP
 	select BR2_PACKAGE_WESTON_HAS_COMPOSITOR
 	help
@@ -61,6 +62,7 @@ config BR2_PACKAGE_WESTON_RDP
 
 comment "RDP compositor needs a toolchain w/ wchar"
 	depends on BROKEN # needs FreeRDP master
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR
 
 # rpi-userland is an EGL/GLES provider, so we can't select it
-- 
2.6.4

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

* [Buildroot] [PATCH 21/21] neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (19 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 20/21] freerdp: " Thomas Petazzoni
@ 2016-01-24 23:08 ` Thomas Petazzoni
  2016-01-26 22:35   ` Yann E. MORIN
  2016-01-26 20:28 ` [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
  21 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-24 23:08 UTC (permalink / raw)
  To: buildroot

Fixes:

  http://autobuild.buildroot.org/results/b8bf7be2efd8e8e369abdde0a5bec564e8cd6f23/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/connman/Config.in | 1 +
 package/neard/Config.in   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/package/connman/Config.in b/package/connman/Config.in
index 655db86..556de48 100644
--- a/package/connman/Config.in
+++ b/package/connman/Config.in
@@ -50,6 +50,7 @@ config BR2_PACKAGE_CONNMAN_LOOPBACK
 config BR2_PACKAGE_CONNMAN_NEARD
 	bool "enable neard support"
 	select BR2_PACKAGE_NEARD
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # neard
 
 config BR2_PACKAGE_CONNMAN_OFONO
 	bool "enable ofono support"
diff --git a/package/neard/Config.in b/package/neard/Config.in
index 353d1af..8571e7c 100644
--- a/package/neard/Config.in
+++ b/package/neard/Config.in
@@ -4,6 +4,7 @@ config BR2_PACKAGE_NEARD
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl, dbus, libglib2
 	depends on BR2_USE_MMU # dbus, libglib2
 	depends on !BR2_STATIC_LIBS # dlopen
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	select BR2_PACKAGE_DBUS
 	select BR2_PACKAGE_LIBGLIB2
 	select BR2_PACKAGE_LIBNL
@@ -26,4 +27,5 @@ endif
 
 comment "neard needs a toolchain w/ wchar, threads, dynamic library"
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
-- 
2.6.4

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

* [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost
  2016-01-24 23:07 ` [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost Thomas Petazzoni
@ 2016-01-25 17:04   ` Yann E. MORIN
  2016-01-25 20:04     ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 17:04 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> According to libftdi configure.in:
> 
> """
> dnl libftdi C++ wrapper. Needs boost.
> [...]
>         if test "x$HAVE_BOOST" != "xyes"; then
>             AC_MSG_ERROR(Sorry, we need the boost library for the C++ wrapper)
>         fi
> """
> 
> And indeed, if you enable BR2_PACKAGE_LIBTFDI_CPP but don't have Boost
> enabled, the libfdipp library is not built. To fix this, this commit
> changes BR2_PACKAGE_LIBTFDI_CPP to select Boost.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Still, a few comments below...

> ---
>  package/libftdi/Config.in  | 9 ++++++++-
>  package/libftdi/libftdi.mk | 1 +
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/package/libftdi/Config.in b/package/libftdi/Config.in
> index 76b30b1..c0ab0f2 100644
> --- a/package/libftdi/Config.in
> +++ b/package/libftdi/Config.in
> @@ -12,11 +12,18 @@ config BR2_PACKAGE_LIBFTDI
>  if BR2_PACKAGE_LIBFTDI
>  
>  config BR2_PACKAGE_LIBTFDI_CPP
> -	depends on BR2_INSTALL_LIBSTDCPP
>  	bool "C++ bindings"
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
> +	depends on BR2_USE_WCHAR
> +	select BR2_PACKAGE_BOOST

boost also has a threads dependency, but that is covered by the main
symbol, because of libusb.

I wonder if we should duplicate the dependency here, with another
comment, like:

    depends on BR2_TOOLCHAIN_HAS_THREADS # Boost

Or at least state it in a comment:

    # Boost depends on threads, but that's already accounted for
    # in the main symbol because of libusb.

>  	help
>  	  C++ bindings for libftdi
>  
> +comment "libftdi C++ bindings need a toolchain w/ wchar, C++"
> +	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
> +	depends on !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP

Ditto the threads dependency.

I'm not sure if we really want to do that, hence my reved-by tag.

Regards,
Yann E. MORIN.

>  endif # BR2_PACKAGE_LIBFTDI
>  
>  comment "libftdi needs a toolchain w/ threads"
> diff --git a/package/libftdi/libftdi.mk b/package/libftdi/libftdi.mk
> index 8370b0a..28f20e3 100644
> --- a/package/libftdi/libftdi.mk
> +++ b/package/libftdi/libftdi.mk
> @@ -15,6 +15,7 @@ LIBFDTI_CONF_OPTS = --without-examples
>  
>  # configure detect it automaticaly so we need to force it
>  ifeq ($(BR2_PACKAGE_LIBTFDI_CPP),y)
> +LIBFTDI_DEPENDENCIES += boost
>  LIBFDTI_CONF_OPTS += --enable-libftdipp
>  else
>  LIBFDTI_CONF_OPTS += --disable-libftdipp
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 ` [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-25 17:15   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 17:15 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> In commit 669ce8c75eb4c76cef81f279fb6b4f95d1472f51 ("libftdi: add
> dependency on atomic operations"), a dependency on
> BR2_ARCH_HAS_ATOMICS was added to the libftdi package to fix a build
> failure occuring on the ARC architecture due to the missing
> __sync_fetch_and_add_4 function:
> 
> ../ftdipp/.libs/libftdipp.so: undefined reference to `__sync_fetch_and_add_4'
> 
> However, today, even on the SPARC architecture that does not implement
> any of the __sync built-ins, libftdi and its C++ binding libftdipp
> build fine. ARC was also tested and builds fine.
> 
> Therefore, we remove the BR2_ARCH_HAS_ATOMICS dependency from libftdi,
> and also from flashrom, in which it was only present due to the
> selection of libftdi. Note that anyway flashrom is available only for
> i386 and x86_64, both of which implement all the __sync built-ins.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998 at free.fr: build-tested for sparc-v8]
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/flashrom/Config.in | 2 --
>  package/libftdi/Config.in  | 2 --
>  2 files changed, 4 deletions(-)
> 
> diff --git a/package/flashrom/Config.in b/package/flashrom/Config.in
> index 9420cc6..adc068c 100644
> --- a/package/flashrom/Config.in
> +++ b/package/flashrom/Config.in
> @@ -8,7 +8,6 @@ config BR2_PACKAGE_FLASHROM
>  	select BR2_PACKAGE_DMIDECODE
>  	depends on BR2_i386 || BR2_x86_64
>  	depends on BR2_TOOLCHAIN_HAS_THREADS 	# libusb
> -	depends on BR2_ARCH_HAS_ATOMICS 	# libftdi
>  	help
>  	  flashrom is a utility for identifying, reading, writing,
>  	  verifying and erasing flash chips. It is designed to flash
> @@ -20,5 +19,4 @@ config BR2_PACKAGE_FLASHROM
>  
>  comment "flashrom needs a toolchain w/ threads"
>  	depends on BR2_i386 || BR2_x86_64
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/libftdi/Config.in b/package/libftdi/Config.in
> index c0ab0f2..8e02cb9 100644
> --- a/package/libftdi/Config.in
> +++ b/package/libftdi/Config.in
> @@ -1,7 +1,6 @@
>  config BR2_PACKAGE_LIBFTDI
>  	bool "libftdi"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	select BR2_PACKAGE_LIBUSB
>  	select BR2_PACKAGE_LIBUSB_COMPAT
>  	help
> @@ -27,5 +26,4 @@ comment "libftdi C++ bindings need a toolchain w/ wchar, C++"
>  endif # BR2_PACKAGE_LIBFTDI
>  
>  comment "libftdi needs a toolchain w/ threads"
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans
  2016-01-24 23:07 ` [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans Thomas Petazzoni
@ 2016-01-25 18:27   ` Yann E. MORIN
  2016-01-27 21:46     ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 18:27 UTC (permalink / raw)
  To: buildroot

Thomas, All,

[Warning: pedantic-english mode engaged. ;-) But with real, interesting
 comments, too! ]

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> Currently, Buildroot provides one BR2_ARCH_HAS_ATOMICS boolean option
> to indicate whether the architecture supports atomic operations or
> not. However, the reality of atomic operations support is much more
> complicated and requires more than one option to be expressed
> properly.
> 
> There are in fact two types of atomic built-ins provided by gcc:
> 
>  (1) The __sync_*() family of functions, which have been in gcc since
>      a long time (probably gcc 4.1). They are available in variants

    "for a long time", "for ages"
or
    "since January 1970", "since I was born (and even before)"

>      operating on 1 byte, 2 bytes, 4 bytes and 8 bytes

    1-byte, 2-byte, 4-byte or 8-byte integers

(no plural to a noun when it is prefixed with a numeral as they are then
considered an adjective, and adjectives in english have no plural.)

>      integers. Certain architectures implement certain variants,

s/certain/some/

'certain' is a false-friend for french natives. ;-)

>      certain do not implement any, certain architectures implement all
>      of them.
> 
>      They are now considered "legacy" by the gcc developers but are
>      nonetheless still being used by a significant number of userspace
>      libraries and applications.
> 
>      https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
> 
>  (2) The __atomic_*() family of functions, which have been introduced
>      in gcc 4.7. They have been introduced in order to support C++11
>      atomic operations. They are available on all architectures,
>      either built-in, or in the libatomic library part of the gcc
>      runtime (in which case the application needs to be linked with
>      -latomic).
> 
> Since (2) are available on all architectures starting gcc 4.7, we do
> not need to add any new option for them: packages using them should
> depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 and link with libatomic.
> 
> However, for (1), a single BR2_ARCH_HAS_ATOMICS is not sufficient,
> because depending on the architecture, certain variants are available
> or not. Setting BR2_ARCH_HAS_ATOMICS to false as soon as one of the

    ... some variants may or may not be available.

> variant is missing would cause a large number of packages to become
> unavailable, even if they in fact use only more common variants
> available on a large number of architectures. For this reason, we've
> chosen to introduce four new Config.in options:
> 
>  - BR2_TOOLCHAIN_HAS_SYNC_1
>  - BR2_TOOLCHAIN_HAS_SYNC_2
>  - BR2_TOOLCHAIN_HAS_SYNC_3
>  - BR2_TOOLCHAIN_HAS_SYNC_4
> 
> Which indicate whether the toolchain support 1 byte, 2 bytes, 4 bytes
> and 8 bytes __sync_*() built-ins respectively.

Ditto:
    1-byte, 2-byte, 4-byte or 8-byte __sync_*() built-ins

> We conducted a fairly large analysis on various architectures
> supported by Buildroot, as well as a number of different toolchains,

    analysis _about_ architectures
    analysis _with_ toolchains

So:

    a fairly large analysis about various architectures [...], and with
    a number of different toolchains,

> to check which combinations supported which variant. To do, we linked

    ... which combinations support which variant.

(it's an immutable fact: it was true, is still true, and will be true.)

> the following program with various toolchains:
> 
> int main(void)
> {
> 	uint8_t a;
> 	uint16_t b;
> 	uint32_t c;
> 	uint64_t d;
> 
> 	__sync_fetch_and_add(&a, 3);
> 	__sync_fetch_and_add(&b, 3);
> 	__sync_fetch_and_add(&c, 3);
> 	__sync_fetch_and_add(&d, 3);
> 
> 	__sync_val_compare_and_swap(&a, 1, 2);
> 	__sync_val_compare_and_swap(&b, 1, 2);
> 	__sync_val_compare_and_swap(&c, 1, 2);
> 	__sync_val_compare_and_swap(&d, 1, 2);
> 
> 	__atomic_add_fetch(&a, 3, __ATOMIC_RELAXED);
> 	__atomic_add_fetch(&b, 3, __ATOMIC_RELAXED);
> 	__atomic_add_fetch(&c, 3, __ATOMIC_RELAXED);
> 	__atomic_add_fetch(&d, 3, __ATOMIC_RELAXED);
> 
> 	__atomic_compare_exchange_n(&a, &a, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
> 	__atomic_compare_exchange_n(&b, &b, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
> 	__atomic_compare_exchange_n(&c, &c, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
> 	__atomic_compare_exchange_n(&d, &d, 2, 1,  __ATOMIC_RELAXED,  __ATOMIC_RELAXED);
> 
> 	return 0;
> }
> 
> And looked at which symbols were unresolved. For the __atomic_*()
> ones, we tested with and without -latomic to see which variants are
> built-in, which variants require libatomic. This testing effort has
> led to the following results:
> 
>                 __sync       __atomic    gcc
>                1  2  4  8    1  2  4  8
> ARC            Y  Y  Y  -    Y  Y  Y  L   4.8 [with BR2_ARC_ATOMIC_EXT]
> ARC            -  -  -  -    L  L  L  L   4.8 [without BR2_ARC_ATOMIC_EXT]
> ARM            Y  Y  Y  X    Y  Y  Y  Y   4.8, 4.7
> ARM            Y  Y  Y  -                 4.5
> AArch64        Y  Y  Y  Y    Y  Y  Y  Y   4.9, 5.1
> Bfin           -  -  Y  -                 4.3
> i386 (i386)    -  -  -  -    L  L  L  L   4.9
> i386 (i486..)  Y  Y  Y  -    L  L  L  L   4.9 [i486, c3, winchip2, winchip-c6]
> i386 (> i586)  Y  Y  Y  Y    L  L  L  L   4.9
> Microblaze     -  -  Y  -    L  L  Y  L   4.9
> MIPS           Y  Y  Y  -    Y  Y  Y  L   4.9
> MIPS64         Y  Y  Y  Y    Y  Y  Y  Y   4.9
> NIOS 2         Y  Y  Y  -    Y  Y  Y  L   4.9, 5.2
> PowerPC        Y  Y  Y  -    Y  Y  Y  L   4.9
> SuperH         Y  Y  Y  -    Y  Y  Y  L   4.9
> SPARC          -  -  -  -    L  L  L  L   4.9
> SPARC64        Y  Y  Y  Y    Y  Y  Y  Y   4.9
> x86_64         Y  Y  Y  Y    Y  Y  Y  Y   4.7, 4.9
> Xtensa         Y  Y  Y  -    Y  Y  Y  Y   4.9
> 
> Notes:
> 
>  * __atomic built-ins appeared in gcc 4.7, so for toolchais older than
>    that, the __atomic column is empty.
> 
>  * Y means 'supported built-in'
> 
>  * L means 'supported via linking to libatomic' (only for __atomic
>    functions)
> 
>  * X indicates a very special case for 8 bytes __sync built-ins on
>    ARM. On ARMv7, there is no problem, starting from gcc 4.7, the
>    __sync built-in for 8 bytes integers is implemented, fully in
>    userspace. For cores < ARMv7, doing a 8 bytes atomic operation
>    requires help from the kernel. Unfortunately, the libgcc code
>    implementing this uses the __write() function to display an error,
>    and this function is internal to glibc. Therefore, if you're using
>    glibc everything is fine, but if you're using uClibc or musl, you
>    cannot link an application that uses 8 bytes __sync
>    operations. This has been fixed as part of gcc PR68095, merged in
>    the gcc 5 branch but not yet part of any gcc release.
> 
>  * - means not supported

Just... Woo... Impressive! :-)

> As said above:
> 
>  * For the __atomic_*() built-ins, we do not add any new Config.in
>    option, since they are all available on all architectures as long
>    as you link with libatomic.

   ... and depend on gcc >= 4.7

>  * For the __sync_*() built-ins, we add one option for each size,
>    encoding on which architectures they are available or not. There is
>    only one case where the gcc version/C library comes into play: on
>    ARM, where the situation is a bit complicated for 8 bytes atomics.
> 
> This commit only introduces the new options. Follow-up commits will
> progressively change the packages using BR2_ARCH_HAS_ATOMICS to use
> the appropriate BR2_TOOLCHAIN_HAS_SYNC_x, until the point where
> BR2_ARCH_HAS_ATOMICS can be removed.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  toolchain/toolchain-common.in | 54 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
> index 014a23d..273afab 100644
> --- a/toolchain/toolchain-common.in
> +++ b/toolchain/toolchain-common.in
> @@ -313,3 +313,57 @@ config BR2_TOOLCHAIN_GCC_AT_LEAST
[--SNIP sync_{1,2,4}--]
> +# The availability of __sync for 8 bytes types on ARM is somewhat
> +# complicated:
> +#
> +#  - It appeared in gcc starting from gcc 4.7.

... starting with gcc 4.7.

> +#  - On ARMv7, there is no problem, it can be directly implemented in
> +#    userspace.
> +#
> +#  - On < ARMv7, it requires help from the kernel. Unfortunately, the
> +#    libgcc code implementing 8 bytes __sync with the help from the
> +#    kernel calls __write() when a failure occurs, which is a function
> +#    internal to glibc, not available in uClibc and musl. This means
> +#    that the 8 bytes __sync operations are not available on < ARMv7
> +#    with uClibc and musl. This problem was fixed as part of gcc
> +#    PR68059, which was backported to the gcc 5 branch, but isn't yet
> +#    part of any gcc 5.x release.
> +#
> +config BR2_TOOLCHAIN_ARM_HAS_SYNC_8
> +	bool
> +	default y
> +	depends on BR2_arm || BR2_armeb
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
> +	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A

I had a bit of difficulty parsing that one. It was not obvious from the
commit log that gcc >= 4.7 was required, while the comment above makes
it really explicit. Here's how I understood the commit log:

  - for armv7, with gcc-4.7+, it's OK
  - for armv6-, it needs glibc and there is no gcc condition.

But the comment here states it differently, and matches the code.

Can you just confirm that I misunderstand the commit log?

> +# 8 bytes intrinsics available:
> +#  - On all 64 bits architecture
> +#  - On a certain combinations of ARM platforms
> +#  - On i386, except some really old processors
> +config BR2_TOOLCHAIN_HAS_SYNC_8
> +	bool
> +	default y if BR2_ARCH_IS_64 || BR2_TOOLCHAIN_ARM_HAS_SYNC_8 || \
> +		(BR2_i386 && !BR2_x86_i386 && !BR2_x86_i486 && !BR2_x86_c3 && \
> +		 !BR2_x86_winchip_c6 && !BR2_x86_winchip2)

Well, I'd prefer we have a simpler conditional block, maybe something
like:

    config BR2_TOOLCHAIN_i386_HAS_SYNC_8
        bool
        default y
        depends on BR2_i386
        depends on !BR2_x86_i386
        depends on !BR2_x86_i486
        depends on !BR2_x86_c3
        depends on !BR2_x86_winchip_c6
        depends on !BR2_x86_winchip2

    config BR2_TOOLCHAIN_HAS_SYNC_8
        bool
        default y if BR2_ARCH_IS_64
        default y if BR2_TOOLCHAIN_i386_HAS_SYNC_8
        default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8

(check the conditions, I may have barfed a bit on the copy-paste)

Also, I'm not sure about the 'default y if BR2_ARCH_IS_64' and I think
we should just list those architectures (4 of them: AArch64, mips64,
sparc64 and x86_64, with that last one already covered with i386).

Otherwise, I'm pretty impressed with that. It must have been totally
time-consuming, and I'm happy to read such a detailed report and
summary. :-)

Thanks!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  2016-01-24 23:07 ` [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
@ 2016-01-25 18:38   ` Yann E. MORIN
  2016-01-25 20:07     ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 18:38 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> This commit updates the documentation to detail when and how to use
> the BR2_TOOLCHAIN_HAS_SYNC_x dependency. Note that we chose to not add
> a comment about this dependency, because it is mainly tied to
> architecture capabilities (except in very specific cases, which would
> be way too complicated to explain in a Config.in comment).
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  docs/manual/adding-packages-directory.txt | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
> index b9596a2..cd78390 100644
> --- a/docs/manual/adding-packages-directory.txt
> +++ b/docs/manual/adding-packages-directory.txt
> @@ -279,6 +279,19 @@ use in the comment.
>  ** Dependency symbol: +BR2_ARCH_HAS_ATOMICS+
>  ** Comment string: no comment to be added
>  
> +* Gcc +__sync_*+ built-ins used for atomic operations. They are
> +  available in variants operating on 1 byte, 2 bytes, 4 bytes and 8
> +  bytes. Since different architectures support atomic operations on
> +  different sizes, one dependency symbol is available for each size:
> +** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+ for 1 byte,
> +   +BR2_TOOLCHAIN_HAS_SYNC_2+ for two bytes,
> +   +BR2_TOOLCHAIN_HAS_SYNC_4+ for 4 bytes, +BR2_TOOLCHAIN_HAS_SYNC_8+
> +   for 8 bytes.
> +** Comment string: no comment to be added
> +
> +* One byte +__sync_*+ gcc built-in for atomic instructions
> +** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+

I don't see why you specifically documment BR2_TOOLCHAIN_HAS_SYNC_1
separately. Did I miss something, or is it a stray attempt?

Regards,
Yann E. MORIN.

>  * Kernel headers
>  ** Dependency symbol: +BR2_TOOLCHAIN_HEADERS_AT_LEAST_X_Y+, (replace
>     +X_Y+ with the proper version, see +toolchain/toolchain-common.in+)
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 ` [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-25 18:42   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 18:42 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> The BR2_ARCH_HAS_ATOMICS was added because on ARC, atomic instructions
> may not be provided by the architecture and therefore the compiler
> does not provide the __sync_*() built-ins.
> 
> However, since then, icu was changed and is now able to use C++11
> atomics, or even no atomic operations at all. In fact, icu will:
> 
>  * If possible, it will use C++11 atomics, which internally rely on
>    the __atomic built-ins. These are available since gcc 4.7, and all
>    architectures provide it. On some architectures, you *must* link
>    with libatomic, on some other architectures, they are available
>    built-in, but in all cases, linking against libatomic does not
>    harm. Thanks to this, even ARC with no atomic support (which was
>    the original reason for adding the BR2_ARCH_HAS_ATOMICS) dependency
>    builds fine, provided -latomic is added to LIBS.
> 
>  * If C++11 atomics are not available, then it falls back to
>    __sync_*() built-ins, which allows compilers older than 4.7 to be
>    supported.
> 
>  * If really no atomic mechanism is available, then it falls back to a
>    basic implementation based on a mutex.
> 
> Conclusion:
> 
>  - The BR2_ARCH_HAS_ATOMICS dependency is no longer needed.
> 
>  - We need to link with -latomic when gcc >= 4.7 is used.
> 
> Note that reverse dependencies of icu are also changed accordingly.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/beecrypt/Config.in        | 2 --
>  package/cppcms/Config.in          | 1 -
>  package/icu/Config.in             | 2 --
>  package/icu/icu.mk                | 8 ++++++++
>  package/php/Config.ext            | 2 --
>  package/qt-webkit-kiosk/Config.in | 1 -
>  package/qt5/qt5base/Config.in     | 1 -
>  package/qt5/qt5webkit/Config.in   | 1 -
>  8 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/package/beecrypt/Config.in b/package/beecrypt/Config.in
> index fc93a77..069f3d5 100644
> --- a/package/beecrypt/Config.in
> +++ b/package/beecrypt/Config.in
> @@ -16,7 +16,6 @@ config BR2_PACKAGE_BEECRYPT_CPP
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_USE_WCHAR # icu
>  	depends on !BR2_BINFMT_FLAT # icu
> -	depends on BR2_ARCH_HAS_ATOMICS # icu
>  	depends on !BR2_STATIC_LIBS
>  	select BR2_PACKAGE_ICU
>  	help
> @@ -24,7 +23,6 @@ config BR2_PACKAGE_BEECRYPT_CPP
>  
>  comment "C++ support needs a toolchain w/ C++, wchar, dynamic libraries"
>  	depends on !BR2_BINFMT_FLAT
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR \
>  		|| BR2_STATIC_LIBS
>  
> diff --git a/package/cppcms/Config.in b/package/cppcms/Config.in
> index 85ba118..79f5474 100644
> --- a/package/cppcms/Config.in
> +++ b/package/cppcms/Config.in
> @@ -26,7 +26,6 @@ if BR2_PACKAGE_CPPCMS
>  config BR2_PACKAGE_CPPCMS_ICU
>  	bool "enable icu support"
>  	depends on !BR2_BINFMT_FLAT # icu
> -	depends on BR2_ARCH_HAS_ATOMICS # icu
>  	select BR2_PACKAGE_ICU
>  	help
>  	  Using ICU allows advanced localization features into CppCMS,
> diff --git a/package/icu/Config.in b/package/icu/Config.in
> index 4d47c32..d31c1fa 100644
> --- a/package/icu/Config.in
> +++ b/package/icu/Config.in
> @@ -7,7 +7,6 @@ config BR2_PACKAGE_ICU
>  	# file, and it cannot easily be changed to generate FLAT
>  	# format.
>  	depends on !BR2_BINFMT_FLAT
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	help
>  	  International Components for Unicode.
>  
> @@ -28,6 +27,5 @@ endif
>  
>  comment "icu needs a toolchain w/ C++, wchar, threads"
>  	depends on !BR2_BINFMT_FLAT
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
>  		!BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/icu/icu.mk b/package/icu/icu.mk
> index 5604504..7bc7f93 100644
> --- a/package/icu/icu.mk
> +++ b/package/icu/icu.mk
> @@ -17,6 +17,14 @@ ICU_CONF_OPTS = \
>  	--with-cross-build=$(HOST_ICU_DIR)/source \
>  	--disable-samples \
>  	--disable-tests
> +
> +# With gcc >= 4.7, icu prefers to use C++11 atomics, which rely on the
> +# __atomic builtins. On certain architectures, this requires linking
> +# with libatomic.
> +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
> +ICU_CONF_ENV += LIBS="-latomic"
> +endif
> +
>  HOST_ICU_CONF_OPTS = \
>  	--disable-samples \
>  	--disable-tests \
> diff --git a/package/php/Config.ext b/package/php/Config.ext
> index c044e45..ee51030 100644
> --- a/package/php/Config.ext
> +++ b/package/php/Config.ext
> @@ -207,13 +207,11 @@ config BR2_PACKAGE_PHP_EXT_INTL
>  	depends on BR2_USE_WCHAR
>  	depends on !BR2_BINFMT_FLAT # icu
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # icu
> -	depends on BR2_ARCH_HAS_ATOMICS # icu
>  	help
>  	  Internationalization support
>  
>  comment "intl support needs a toolchain w/ C++, wchar, threads"
>  	depends on !BR2_BINFMT_FLAT
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
>  
>  config BR2_PACKAGE_PHP_EXT_MBSTRING
> diff --git a/package/qt-webkit-kiosk/Config.in b/package/qt-webkit-kiosk/Config.in
> index 51383f0..32952d7 100644
> --- a/package/qt-webkit-kiosk/Config.in
> +++ b/package/qt-webkit-kiosk/Config.in
> @@ -8,7 +8,6 @@ config BR2_PACKAGE_QT_WEBKIT_KIOSK
>  	select BR2_PACKAGE_QT5MULTIMEDIA
>  	depends on !BR2_STATIC_LIBS # qt5webkit
>  	depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE # qt5webkit
> -	depends on BR2_ARCH_HAS_ATOMICS # qt5webkit
>  	depends on !BR2_BINFMT_FLAT # qt5webkit
>  	help
>  	  Simple kiosk-mode browser powered by Qt5Webkit
> diff --git a/package/qt5/qt5base/Config.in b/package/qt5/qt5base/Config.in
> index 7cadcb2..64a7f65 100644
> --- a/package/qt5/qt5base/Config.in
> +++ b/package/qt5/qt5base/Config.in
> @@ -259,7 +259,6 @@ config BR2_PACKAGE_QT5BASE_DBUS
>  config BR2_PACKAGE_QT5BASE_ICU
>  	bool "Enable ICU support"
>  	select BR2_PACKAGE_ICU
> -	depends on BR2_ARCH_HAS_ATOMICS # icu
>  	depends on !BR2_BINFMT_FLAT # icu
>  	help
>  	  This option enables ICU support in Qt5. This is for example
> diff --git a/package/qt5/qt5webkit/Config.in b/package/qt5/qt5webkit/Config.in
> index eee82e8..96d97cc 100644
> --- a/package/qt5/qt5webkit/Config.in
> +++ b/package/qt5/qt5webkit/Config.in
> @@ -9,7 +9,6 @@ config BR2_PACKAGE_QT5WEBKIT
>  	# This module does not support static linking
>  	depends on !BR2_STATIC_LIBS
>  	depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE
> -	depends on BR2_ARCH_HAS_ATOMICS # icu
>  	depends on !BR2_BINFMT_FLAT # icu
>  	help
>  	  Qt is a cross-platform application and UI framework for
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4
  2016-01-24 23:07 ` [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
@ 2016-01-25 18:47   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 18:47 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> While json-c itself builds fine on platforms that don't provide the
> __sync atomic built-ins, it does use them. json-c doesn't fail to
> build because only a library is built, so such function calls are left
> unresolved. But as soon as it gets used in another package linked in a
> program, linking with fail due to the missing

    ...linking will fail...

> __sync_val_compare_and_swap_4() function.
> 
> To fix this, we make json-c depend on BR2_TOOLCHAIN_HAS_SYNC_4, and
> propagate to the reverse dependencies:
> 
>  - json-c
>    - fastd
>    - pulseaudio
>      - efl
>      - espeak
>      - gst-plugins-good
>      - gst1-plugins-good
>      - mpd
>    - rsyslog
>    - ubus
> 
> Note that pulseaudio already had a BR2_ARCH_HAS_ATOMICS dependency,
> which we are keeping for the moment, and will clean-up in a subsequent
> commit.
> 
> This commit will also fix packages that could optionally use json-c,
> and therefore fixes build failures like:
> 
>   http://autobuild.buildroot.org/results/4fe/4feaa9089ee9a183c5086b791bea35c0156945af/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Otherwise:

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/efl/Config.in                          | 1 +
>  package/espeak/Config.in                       | 1 +
>  package/fastd/Config.in                        | 1 +
>  package/gstreamer/gst-plugins-good/Config.in   | 1 +
>  package/gstreamer1/gst1-plugins-good/Config.in | 1 +
>  package/json-c/Config.in                       | 2 ++
>  package/mpd/Config.in                          | 1 +
>  package/pulseaudio/Config.in                   | 2 ++
>  package/rsyslog/Config.in                      | 2 ++
>  package/ubus/Config.in                         | 1 +
>  10 files changed, 13 insertions(+)
> 
> diff --git a/package/efl/Config.in b/package/efl/Config.in
> index 85e46b1..21cbf5f 100644
> --- a/package/efl/Config.in
> +++ b/package/efl/Config.in
> @@ -82,6 +82,7 @@ config BR2_PACKAGE_EFL_LIBSNDFILE
>  config BR2_PACKAGE_EFL_PULSEAUDIO
>  	bool "Enable pulseaudio support (recommended)"
>  	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
>  	default y
>  	help
> diff --git a/package/espeak/Config.in b/package/espeak/Config.in
> index 94e2816..eebaf6f 100644
> --- a/package/espeak/Config.in
> +++ b/package/espeak/Config.in
> @@ -33,6 +33,7 @@ config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_ALSA
>  config BR2_PACKAGE_ESPEAK_AUDIO_BACKEND_PULSEAUDIO
>  	bool "pulseaudio"
>  	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
>  
>  endchoice
> diff --git a/package/fastd/Config.in b/package/fastd/Config.in
> index f753ce4..55bdbd6 100644
> --- a/package/fastd/Config.in
> +++ b/package/fastd/Config.in
> @@ -18,6 +18,7 @@ config BR2_PACKAGE_FASTD_STATUS_SOCKET
>  	bool "status socket support"
>  	default y
>  	select BR2_PACKAGE_JSON_C
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
>  	help
>  	  Enable support for a socket to get fastd's status.
>  
> diff --git a/package/gstreamer/gst-plugins-good/Config.in b/package/gstreamer/gst-plugins-good/Config.in
> index 0544b7c..c2ec5b0 100644
> --- a/package/gstreamer/gst-plugins-good/Config.in
> +++ b/package/gstreamer/gst-plugins-good/Config.in
> @@ -206,6 +206,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
>  	depends on BR2_USE_MMU # pulseaudio
>  	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
>  	depends on !BR2_STATIC_LIBS # pulseaudio
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
>  	bool "pulseaudio"
>  
> diff --git a/package/gstreamer1/gst1-plugins-good/Config.in b/package/gstreamer1/gst1-plugins-good/Config.in
> index a8cdde2..6cb9732 100644
> --- a/package/gstreamer1/gst1-plugins-good/Config.in
> +++ b/package/gstreamer1/gst1-plugins-good/Config.in
> @@ -313,6 +313,7 @@ config BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_PULSE
>  	depends on BR2_USE_MMU # pulseaudio
>  	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
>  	depends on !BR2_STATIC_LIBS # pulseaudio
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
>  	bool "pulseaudio"
>  	help
> diff --git a/package/json-c/Config.in b/package/json-c/Config.in
> index 67348fb..4df44a9 100644
> --- a/package/json-c/Config.in
> +++ b/package/json-c/Config.in
> @@ -1,5 +1,7 @@
>  config BR2_PACKAGE_JSON_C
>  	bool "json-c"
> +	# uses __sync_val_compare_and_swap_4
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	help
>  	  JSON-C - A JSON implementation in C
>  
> diff --git a/package/mpd/Config.in b/package/mpd/Config.in
> index be0843f..643e7ba 100644
> --- a/package/mpd/Config.in
> +++ b/package/mpd/Config.in
> @@ -248,6 +248,7 @@ config BR2_PACKAGE_MPD_PULSEAUDIO
>  	bool "pulseaudio"
>  	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
>  	depends on !BR2_STATIC_LIBS # pulseaudio
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
>  	help
>  	  Enable pulseaudio output support.
> diff --git a/package/pulseaudio/Config.in b/package/pulseaudio/Config.in
> index 63c8ca4..4583d22 100644
> --- a/package/pulseaudio/Config.in
> +++ b/package/pulseaudio/Config.in
> @@ -3,6 +3,7 @@ config BR2_PACKAGE_PULSEAUDIO
>  	depends on BR2_USE_WCHAR
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on !BR2_STATIC_LIBS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
>  	select BR2_PACKAGE_LIBTOOL
>  	select BR2_PACKAGE_JSON_C
>  	select BR2_PACKAGE_LIBSNDFILE
> @@ -34,4 +35,5 @@ endif
>  comment "pulseaudio needs a toolchain w/ wchar, threads, dynamic library"
>  	depends on BR2_USE_MMU
>  	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
> diff --git a/package/rsyslog/Config.in b/package/rsyslog/Config.in
> index d66132f..3599207 100644
> --- a/package/rsyslog/Config.in
> +++ b/package/rsyslog/Config.in
> @@ -7,6 +7,7 @@ config BR2_PACKAGE_RSYSLOG
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on BR2_USE_MMU # fork()
>  	depends on !BR2_STATIC_LIBS # modules
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
>  	help
>  	  Rsyslog is a powerful and flexible syslog implementation
>  
> @@ -14,4 +15,5 @@ config BR2_PACKAGE_RSYSLOG
>  
>  comment "rsyslog needs a toolchain w/ threads, dynamic library"
>  	depends on BR2_USE_MMU
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
> diff --git a/package/ubus/Config.in b/package/ubus/Config.in
> index 8567321..d63357a 100644
> --- a/package/ubus/Config.in
> +++ b/package/ubus/Config.in
> @@ -5,6 +5,7 @@ config BR2_PACKAGE_UBUS
>  	bool "ubus"
>  	select BR2_PACKAGE_LIBUBOX
>  	select BR2_PACKAGE_JSON_C
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # json-c
>  	depends on !BR2_STATIC_LIBS # libubox
>  	help
>  	  IPC/RPC bus that allows communication between processes.
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 ` [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-25 18:52   ` Yann E. MORIN
  2016-01-27 21:56     ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 18:52 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> pulseaudio is able to either use the atomic __sync builtins from the
> compiler, or to rely on libatomic_ops for atomic operations. However,
> since it anyway selects json-c which requires the __sync built-ins, it
> means using libatomic_ops is useless: even if you use libatomic_ops
> for pulseaudio, you'd still get a link error in pulseaudio due to the
> missing __sync built-in for the json-c library.
> 
> Also, since pulseaudio now inherits the BR2_TOOLCHAIN_HAS_SYNC_4 from
> json-c, which matches the __sync built-in from pulseaudio, this
> commit:
> 
>  - Drops the BR2_ARCH_HAS_ATOMICS dependency
>  - Forces pulseaudio to not detect libatomic_ops
>  - Propagates the removal of BR2_ARCH_HAS_ATOMICS dependency to
>    pulseaudio's reverse dependencies.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[--SNIP--]
> diff --git a/package/gstreamer/gst-plugins-good/Config.in b/package/gstreamer/gst-plugins-good/Config.in
> index c2ec5b0..36ab6cb 100644
> --- a/package/gstreamer/gst-plugins-good/Config.in
> +++ b/package/gstreamer/gst-plugins-good/Config.in
> @@ -204,7 +204,6 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_OSS4
>  config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # pulseaudio
>  	depends on BR2_USE_MMU # pulseaudio
> -	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
>  	depends on !BR2_STATIC_LIBS # pulseaudio
>  	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
>  	select BR2_PACKAGE_PULSEAUDIO
> @@ -212,7 +211,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
>  
>  comment "pulseaudio support needs a toolchain w/ threads, dynamic library"
>  	depends on BR2_USE_MMU
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4

In retrospect, I think this dependency should be added in the previous
patch.

Yes, BR2_ARCH_HAS_ATOMICS is a superset of BR2_TOOLCHAIN_HAS_SYNC_4,
still it would be more logical to add it at the time the depednency on
_SYNC_4 is added.

Ditto for all comments, of course.

[--SNIP--]
> diff --git a/package/pulseaudio/pulseaudio.mk b/package/pulseaudio/pulseaudio.mk
> index a59a6c5..3976093 100644
> --- a/package/pulseaudio/pulseaudio.mk
> +++ b/package/pulseaudio/pulseaudio.mk
> @@ -15,9 +15,14 @@ PULSEAUDIO_CONF_OPTS = \
>  	--disable-legacy-database-entry-format \
>  	--disable-manpages
>  
> +# Make sure we don't detect libatomic_ops. Indeed, since pulseaudio
> +# requires json-c, which needs 4 bytes __sync builtins, there should
> +# be no need for pulseaudio to rely on libatomic_ops.
> +PULSE_AUDIO_CONF_ENV += \
> +	ac_cv_header_atomic_ops_h=no

What happens if pulseaudio detects libatomic_ops? Is it "bad" or just
merely "harmless"?

Regards,
Yann E. MORIN.

>  PULSEAUDIO_DEPENDENCIES = \
>  	host-pkgconf libtool json-c libsndfile speex host-intltool \
> -	$(if $(BR2_PACKAGE_LIBATOMIC_OPS),libatomic_ops) \
>  	$(if $(BR2_PACKAGE_LIBSAMPLERATE),libsamplerate) \
>  	$(if $(BR2_PACKAGE_ALSA_LIB),alsa-lib) \
>  	$(if $(BR2_PACKAGE_LIBGLIB2),libglib2) \
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost
  2016-01-25 17:04   ` Yann E. MORIN
@ 2016-01-25 20:04     ` Thomas Petazzoni
  0 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-25 20:04 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 25 Jan 2016 18:04:38 +0100, Yann E. MORIN wrote:

> >  config BR2_PACKAGE_LIBTFDI_CPP
> > -	depends on BR2_INSTALL_LIBSTDCPP
> >  	bool "C++ bindings"
> > +	depends on BR2_INSTALL_LIBSTDCPP
> > +	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
> > +	depends on BR2_USE_WCHAR
> > +	select BR2_PACKAGE_BOOST
> 
> boost also has a threads dependency, but that is covered by the main
> symbol, because of libusb.
> 
> I wonder if we should duplicate the dependency here, with another
> comment, like:
> 
>     depends on BR2_TOOLCHAIN_HAS_THREADS # Boost
> 
> Or at least state it in a comment:
> 
>     # Boost depends on threads, but that's already accounted for
>     # in the main symbol because of libusb.

We don't have clear rules about what to do in such situations. We
sometimes say to duplicate the dependencies, but sometimes it looks
really really annoying to duplicate all those dependencies when you
*know* that the top-level package can anyway not be enabled in this or
that situation.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  2016-01-25 18:38   ` Yann E. MORIN
@ 2016-01-25 20:07     ` Thomas Petazzoni
  0 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-25 20:07 UTC (permalink / raw)
  To: buildroot

Yann,

On Mon, 25 Jan 2016 19:38:37 +0100, Yann E. MORIN wrote:

> > +* Gcc +__sync_*+ built-ins used for atomic operations. They are
> > +  available in variants operating on 1 byte, 2 bytes, 4 bytes and 8
> > +  bytes. Since different architectures support atomic operations on
> > +  different sizes, one dependency symbol is available for each size:
> > +** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+ for 1 byte,
> > +   +BR2_TOOLCHAIN_HAS_SYNC_2+ for two bytes,
> > +   +BR2_TOOLCHAIN_HAS_SYNC_4+ for 4 bytes, +BR2_TOOLCHAIN_HAS_SYNC_8+
> > +   for 8 bytes.
> > +** Comment string: no comment to be added
> > +
> > +* One byte +__sync_*+ gcc built-in for atomic instructions
> > +** Dependency symbol: +BR2_TOOLCHAIN_HAS_SYNC_1+
> 
> I don't see why you specifically documment BR2_TOOLCHAIN_HAS_SYNC_1
> separately. Did I miss something, or is it a stray attempt?

It's a stray attempt :-/ Will fix in v2, thanks for spotting!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling
  2016-01-24 23:07 ` [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling Thomas Petazzoni
@ 2016-01-25 20:59   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 20:59 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> Since the apache package was introduced,
> --enable-nonportable-atomics=yes was passed when
> BR2_ARCH_HAS_ATOMICS. However, Apache doesn't take this option: it
> only passes it down when building the APR library. But since we're
> building APR separately, this statement had no effect.
> 
> So this commit removes the useless code from the Apache package, and
> instead adds the appropriate logic to the apr package, using the new
> BR2_TOOLCHAIN_HAS_SYNC_x symbols rather than BR2_ARCH_HAS_ATOMICS.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/apache/apache.mk |  4 ----
>  package/apr/apr.mk       | 17 +++++++++++++++++
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/package/apache/apache.mk b/package/apache/apache.mk
> index 8e7b6be..e752fcc 100644
> --- a/package/apache/apache.mk
> +++ b/package/apache/apache.mk
> @@ -35,10 +35,6 @@ APACHE_CONF_OPTS = \
>  	--disable-lua \
>  	--disable-luajit
>  
> -ifeq ($(BR2_ARCH_HAS_ATOMICS),y)
> -APACHE_CONF_OPTS += --enable-nonportable-atomics=yes
> -endif
> -
>  ifeq ($(BR2_PACKAGE_LIBXML2),y)
>  APACHE_DEPENDENCIES += libxml2
>  # Apache wants the path to the header file, where it can find
> diff --git a/package/apr/apr.mk b/package/apr/apr.mk
> index 0fed19c..33873a0 100644
> --- a/package/apr/apr.mk
> +++ b/package/apr/apr.mk
> @@ -35,6 +35,23 @@ endif
>  # Fix lfs detection when cross compiling
>  APR_CONF_ENV += apr_cv_use_lfs64=yes
>  
> +# Use non-portable atomics when available: 8 bytes atomics are used on
> +# 64-bits architectures, 4 bytes atomics on 32-bits architectures. We
> +# have to override ap_cv_atomic_builtins because the test used to
> +# check for atomic builtins uses AC_TRY_RUN, which doesn't work when
> +# cross-compiling.
> +ifeq ($(BR2_ARCH_IS_64),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_8),y)
> +APR_CONF_OPTS += --enable-nonportable-atomics
> +APR_CONF_ENV += ap_cv_atomic_builtins=yes
> +endif
> +else
> +ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4),y)
> +APR_CONF_OPTS += --enable-nonportable-atomics
> +APR_CONF_ENV += ap_cv_atomic_builtins=yes
> +endif
> +endif

What about forcing --disable-nonportable-atomics ?

The code does:

   643 AC_ARG_ENABLE(nonportable-atomics,
   644 [  --enable-nonportable-atomics  Use optimized atomic code which may produce nonportable binaries],
   645 [if test $enableval = yes; then
   646    force_generic_atomics=no
   647  else
   648    force_generic_atomics=yes
   649  fi
   650 ],
   651 [case $host_cpu in
   652    i[[456]]86) force_generic_atomics=yes ;;
   653    *) force_generic_atomics=no ;;
   654 esac
   655 ])
 
So, it looks like, if one does not provide any of --enable/disable, it
will try to decide based on the CPU.

Regards,
Yann E. MORIN.

>  ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
>  APR_DEPENDENCIES += util-linux
>  endif
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol
  2016-01-24 23:07 ` [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
@ 2016-01-25 21:12   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 21:12 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> Move away from BR2_ARCH_HAS_ATOMICS and use BR2_TOOLCHAIN_HAS_SYNC_4
> instead for the jack2 package and its reverse dependency.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

The original build issue that prompted adding the atomics dependency is:
    http://autobuild.buildroot.net/results/c218be876d3abf7a8e212b6d526595bfd835e1c5/

with:
    common/libjackserver.so: undefined reference to `__sync_bool_compare_and_swap_4'

Regards,
Yann E. MORIN.

> ---
>  package/jack2/Config.in | 4 ++--
>  package/mpd/Config.in   | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/package/jack2/Config.in b/package/jack2/Config.in
> index 350a342..94cb7e0 100644
> --- a/package/jack2/Config.in
> +++ b/package/jack2/Config.in
> @@ -3,8 +3,8 @@ config BR2_PACKAGE_JACK2
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # alsa-lib
>  	depends on BR2_USE_MMU # fork()
>  	depends on BR2_INSTALL_LIBSTDCPP
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_STATIC_LIBS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_LIBSAMPLERATE
>  	select BR2_PACKAGE_LIBSNDFILE
>  	select BR2_PACKAGE_ALSA_LIB
> @@ -23,6 +23,6 @@ config BR2_PACKAGE_JACK2
>  
>  comment "jack2 needs a toolchain w/ threads, C++, dynamic library"
>  	depends on BR2_USE_MMU
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
>  		BR2_STATIC_LIBS
> diff --git a/package/mpd/Config.in b/package/mpd/Config.in
> index 618bea9..6480a08 100644
> --- a/package/mpd/Config.in
> +++ b/package/mpd/Config.in
> @@ -230,13 +230,14 @@ config BR2_PACKAGE_MPD_HTTPD_OUTPUT
>  
>  config BR2_PACKAGE_MPD_JACK2
>  	bool "jack2"
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_STATIC_LIBS # jack2
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_JACK2
>  	help
>  	  Enable jack output support.
>  
>  comment "jack support needs a toolchain w/ dynamic library"
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on BR2_STATIC_LIBS
>  
>  config BR2_PACKAGE_MPD_OSS
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-24 23:07 ` [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
@ 2016-01-25 21:45   ` Yann E. MORIN
  2016-01-25 22:07     ` Thomas Petazzoni
  2016-01-26 22:13   ` Yann E. MORIN
  1 sibling, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 21:45 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> libtorrent uses 1 bytes and 4 bytes __sync built-ins, so let's use the
> appropriate BR2_TOOLCHAIN_HAS_SYNC_x symbols instead of
> BR2_ARCH_HAS_ATOMICS. The rtorrent package, which is a reverse
> dependency of libtorrent, gets fixed as well.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/libtorrent/Config.in | 4 ++--
>  package/rtorrent/Config.in   | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/libtorrent/Config.in b/package/libtorrent/Config.in
> index 17a1f23..4787f9c 100644
> --- a/package/libtorrent/Config.in
> +++ b/package/libtorrent/Config.in
> @@ -2,7 +2,7 @@ config BR2_PACKAGE_LIBTORRENT
>  	bool "libtorrent"
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4

The original build failure that prompted adding the atomics dependency
only reported errors about the __sunc_*_4() functions, but libtorrent
has been bumped sinc ethen.

I was not able to easily reproduce a failure so far, but I will try with
an arc toolchain (which is lacking __sync_*_1() functions...

Regards,
Yann E. MORIN.

>  	select BR2_PACKAGE_ZLIB
>  	help
>  	  BitTorrent library written in C++ for *nix
> @@ -10,5 +10,5 @@ config BR2_PACKAGE_LIBTORRENT
>  	  https://github.com/rakshasa/libtorrent
>  
>  comment "libtorrent needs a toolchain w/ C++, threads"
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/rtorrent/Config.in b/package/rtorrent/Config.in
> index 0583152..190e50f 100644
> --- a/package/rtorrent/Config.in
> +++ b/package/rtorrent/Config.in
> @@ -4,7 +4,7 @@ config BR2_PACKAGE_RTORRENT
>  	depends on BR2_USE_WCHAR
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on BR2_USE_MMU # fork()
> -	depends on BR2_ARCH_HAS_ATOMICS # libtorrent
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_LIBCURL
>  	select BR2_PACKAGE_LIBTORRENT
>  	select BR2_PACKAGE_NCURSES
> @@ -16,5 +16,5 @@ config BR2_PACKAGE_RTORRENT
>  
>  comment "rtorrent needs a toolchain w/ C++, threads, wchar"
>  	depends on BR2_USE_MMU
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_USE_WCHAR && BR2_TOOLCHAIN_HAS_THREADS)
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency
  2016-01-24 23:07 ` [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
@ 2016-01-25 21:52   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 21:52 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> gauche does not build on sparc64, it fails with:
> 
>   No rule to make target 'sparc_mach_dep.lo', needed by 'libgc.la'
> 
> On Sparc, it first fails with the usual "membar" assembler issue which
> comes from gauche's internal version of libatomic_ops. However, even
> passing -DAO_NO_SPARC_V9 like we do for libatomic_ops is not
> sufficient, as we fall into the same build problem as on sparc64.
> 
> Consequently, this commit disables the gauche package on the sparc and
> sparc64 architectures.
> 
> Since it uses its own libatomic_ops copy, and libatomic_ops does not
> have any dependency on atomic built-ins, we also remove the
> BR2_ARCH_HAS_ATOMICS dependency. It was originally added to prevent
> gauche from being built on sparc, but this will no longer happen.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/gauche/Config.in | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/package/gauche/Config.in b/package/gauche/Config.in
> index fd0617a..3ca012d 100644
> --- a/package/gauche/Config.in
> +++ b/package/gauche/Config.in
> @@ -4,14 +4,12 @@ config BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
>  	default y if BR2_arm || BR2_armeb || BR2_i386 || BR2_m68k || \
>  		BR2_mips || BR2_mipsel || BR2_mips64 || \
>  		BR2_mips64el || BR2_powerpc || BR2_powerpc64 || \
> -		BR2_powerpc64le || BR2_sh || BR2_sh64 || BR2_sparc || \
> -		BR2_sparc64 || BR2_x86_64
> +		BR2_powerpc64le || BR2_sh || BR2_sh64 || BR2_x86_64
>  
>  config BR2_PACKAGE_GAUCHE
>  	bool "gauche"
>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
>  	depends on BR2_USE_MMU # fork()
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
>  	depends on !BR2_STATIC_LIBS
>  	help
> @@ -26,6 +24,5 @@ config BR2_PACKAGE_GAUCHE
>  
>  comment "gauche needs a toolchain w/ NPTL, dynamic library"
>  	depends on BR2_USE_MMU
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on BR2_PACKAGE_GAUCHE_ARCH_SUPPORTS
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-25 21:45   ` Yann E. MORIN
@ 2016-01-25 22:07     ` Thomas Petazzoni
  2016-01-25 22:14       ` Yann E. MORIN
  0 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-25 22:07 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 25 Jan 2016 22:45:29 +0100, Yann E. MORIN wrote:

> On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> > libtorrent uses 1 bytes and 4 bytes __sync built-ins, so let's use the
> > appropriate BR2_TOOLCHAIN_HAS_SYNC_x symbols instead of
> > BR2_ARCH_HAS_ATOMICS. The rtorrent package, which is a reverse
> > dependency of libtorrent, gets fixed as well.
> > 
> > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > ---
> >  package/libtorrent/Config.in | 4 ++--
> >  package/rtorrent/Config.in   | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/package/libtorrent/Config.in b/package/libtorrent/Config.in
> > index 17a1f23..4787f9c 100644
> > --- a/package/libtorrent/Config.in
> > +++ b/package/libtorrent/Config.in
> > @@ -2,7 +2,7 @@ config BR2_PACKAGE_LIBTORRENT
> >  	bool "libtorrent"
> >  	depends on BR2_INSTALL_LIBSTDCPP
> >  	depends on BR2_TOOLCHAIN_HAS_THREADS
> > -	depends on BR2_ARCH_HAS_ATOMICS
> > +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
> 
> The original build failure that prompted adding the atomics dependency
> only reported errors about the __sunc_*_4() functions, but libtorrent
> has been bumped sinc ethen.
> 
> I was not able to easily reproduce a failure so far, but I will try with
> an arc toolchain (which is lacking __sync_*_1() functions...

Beware with ARC: you need to have a toolchain with BR2_ARC_ATOMIC_EXT
disabled, otherwise the __sync built-ins are provided. And by default,
BR2_ARC_ATOMIC_EXT is enabled.

You should rather try with the SPARC toolchain at
http://autobuild.buildroot.org/toolchains/configs/br-sparc-glibc.config.

Or I can provide you an external ARC toolchain without atomics.

Regarding libtorrent, if you want to test:

 1/ Remove the dependency on BR2_TOOLCHAIN_HAS_SYNC_<x> (or
    BR2_ARCH_HAS_ATOMICS in the current Buildroot)

 2/ Build it with the br-sparc-glibc.config pointed above.

 3/ Test the following:

$ echo "int main(void) { return 0; }" >> foo.c
$ ./output/host/usr/bin/sparc-linux-gcc -o foo foo.c -ltorrent -lpthread

You get:

/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_sub_and_fetch_4'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_1'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_or_and_fetch_4'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_4'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_add_and_fetch_4'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_fetch_and_or_4'
/home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_fetch_and_and_4'
collect2: error: ld returned 1 exit status

See the __sync_bool_compare_and_swap_1() ?

And now, you can test it with a Microblaze toolchain, which implements
the 4-byte __sync builtins, but not the 1-byte builtins. And you get:

$ ./output/host/usr/bin/microblazeel-linux-gcc -o foo foo.c -ltorrent -lpthread
/home/thomas/projets/buildroot/output/host/usr/microblazeel-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_1'
collect2: error: ld returned 1 exit status

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-25 22:07     ` Thomas Petazzoni
@ 2016-01-25 22:14       ` Yann E. MORIN
  2016-01-25 22:22         ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 22:14 UTC (permalink / raw)
  To: buildroot

thomas, All,

On 2016-01-25 23:07 +0100, Thomas Petazzoni spake thusly:
> On Mon, 25 Jan 2016 22:45:29 +0100, Yann E. MORIN wrote:
> 
> > On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> > > libtorrent uses 1 bytes and 4 bytes __sync built-ins, so let's use the
> > > appropriate BR2_TOOLCHAIN_HAS_SYNC_x symbols instead of
> > > BR2_ARCH_HAS_ATOMICS. The rtorrent package, which is a reverse
> > > dependency of libtorrent, gets fixed as well.
> > > 
> > > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > > ---
> > >  package/libtorrent/Config.in | 4 ++--
> > >  package/rtorrent/Config.in   | 4 ++--
> > >  2 files changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/package/libtorrent/Config.in b/package/libtorrent/Config.in
> > > index 17a1f23..4787f9c 100644
> > > --- a/package/libtorrent/Config.in
> > > +++ b/package/libtorrent/Config.in
> > > @@ -2,7 +2,7 @@ config BR2_PACKAGE_LIBTORRENT
> > >  	bool "libtorrent"
> > >  	depends on BR2_INSTALL_LIBSTDCPP
> > >  	depends on BR2_TOOLCHAIN_HAS_THREADS
> > > -	depends on BR2_ARCH_HAS_ATOMICS
> > > +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
> > 
> > The original build failure that prompted adding the atomics dependency
> > only reported errors about the __sunc_*_4() functions, but libtorrent
> > has been bumped sinc ethen.
> > 
> > I was not able to easily reproduce a failure so far, but I will try with
> > an arc toolchain (which is lacking __sync_*_1() functions...
> 
> Beware with ARC: you need to have a toolchain with BR2_ARC_ATOMIC_EXT
> disabled, otherwise the __sync built-ins are provided. And by default,
> BR2_ARC_ATOMIC_EXT is enabled.

Yep, I know and the toolchain I built does not have them.

Thanks for the hint anyway. :-)

> Regarding libtorrent, if you want to test:
> 
>  1/ Remove the dependency on BR2_TOOLCHAIN_HAS_SYNC_<x> (or
>     BR2_ARCH_HAS_ATOMICS in the current Buildroot)

What I did.

>  2/ Build it with the br-sparc-glibc.config pointed above.

Doing so for ARC...

>  3/ Test the following:
> 
> $ echo "int main(void) { return 0; }" >> foo.c
> $ ./output/host/usr/bin/sparc-linux-gcc -o foo foo.c -ltorrent -lpthread
> 
> You get:
> 
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_sub_and_fetch_4'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_1'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_or_and_fetch_4'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_4'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_add_and_fetch_4'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_fetch_and_or_4'
> /home/thomas/projets/buildroot/output/host/usr/sparc-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_fetch_and_and_4'
> collect2: error: ld returned 1 exit status
> 
> See the __sync_bool_compare_and_swap_1() ?
> 
> And now, you can test it with a Microblaze toolchain, which implements
> the 4-byte __sync builtins, but not the 1-byte builtins. And you get:
> 
> $ ./output/host/usr/bin/microblazeel-linux-gcc -o foo foo.c -ltorrent -lpthread
> /home/thomas/projets/buildroot/output/host/usr/microblazeel-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_1'
> collect2: error: ld returned 1 exit status

Ah, I see my tests are no longer needed! Thanks for that!

(Note: I was not trying to turn your patch down, I was just trying to
confirm the _1 stuff).

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-25 22:14       ` Yann E. MORIN
@ 2016-01-25 22:22         ` Thomas Petazzoni
  0 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-25 22:22 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 25 Jan 2016 23:14:40 +0100, Yann E. MORIN wrote:

> > $ ./output/host/usr/bin/microblazeel-linux-gcc -o foo foo.c -ltorrent -lpthread
> > /home/thomas/projets/buildroot/output/host/usr/microblazeel-buildroot-linux-gnu/sysroot/usr/lib/libtorrent.so: undefined reference to `__sync_bool_compare_and_swap_1'
> > collect2: error: ld returned 1 exit status
> 
> Ah, I see my tests are no longer needed! Thanks for that!
> 
> (Note: I was not trying to turn your patch down, I was just trying to
> confirm the _1 stuff).

Sure, no problem at all. It's perfectly good to have someone double
checking all this stuff, and I took your question as a perfectly valid
question, and not in any way a mean turn the patch down.

Cheers!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 14/21] squid: rework atomic handling
  2016-01-24 23:08 ` [Buildroot] [PATCH 14/21] squid: rework atomic handling Thomas Petazzoni
@ 2016-01-25 22:53   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 22:53 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> squid can use the __sync built-ins when available, but uses an
> AC_TRY_RUN autoconf tests to check their availability, which isn't
> compatible with cross-compilation. Due to this, squid.mk is already
> hinting the configure script about this by passing
> squid_cv_gnu_atomics=yes/no depending on the availability of atomic
> operations.
> 
> So far, squid.mk was assuming that BR2_ARCH_HAS_ATOMICS &&
> BR2_ARCH_IS_64 was needed, since 8 bytes __sync built-ins are
> used. However, this was a bit too restrictive, since certain 32 bits
> architectures (ARM, x86) do provide 8 bytes __sync built-ins.
> 
> So, instead of using BR2_ARCH_HAS_ATOMICS, we now rely on
> BR2_TOOLCHAIN_HAS_SYNC_4 and BR2_TOOLCHAIN_HAS_SYNC_8, since both 4
> bytes and 8 bytes __sync built-ins are tested by the autoconf test.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/squid/squid.mk | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/package/squid/squid.mk b/package/squid/squid.mk
> index 3110573..f205da2 100644
> --- a/package/squid/squid.mk
> +++ b/package/squid/squid.mk
> @@ -41,12 +41,10 @@ SQUID_CONF_OPTS = \
>  	--with-swapdir=/var/cache/squid/ \
>  	--with-default-user=squid
>  
> -# Atomics in Squid use __sync_add_and_fetch_8, i.e a 64 bits atomic
> -# operation. This atomic intrinsic is only available natively on
> -# 64-bit architectures that have atomic operations. On 32-bit
> -# architectures, it would be provided by libatomic, but Buildroot
> -# typically doesn't provide it.
> -ifeq ($(BR2_ARCH_HAS_ATOMICS)$(BR2_ARCH_IS_64),yy)
> +# Atomics in Squid use __sync built-ins on 4 and 8 bytes. However, the
> +# configure script tests them using AC_TRY_RUN, so we have to give
> +# some hints.
> +ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_4)$(BR2_TOOLCHAIN_HAS_SYNC_8),yy)
>  SQUID_CONF_ENV += squid_cv_gnu_atomics=yes
>  else
>  SQUID_CONF_ENV += squid_cv_gnu_atomics=no
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:07 ` [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-25 23:05   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-25 23:05 UTC (permalink / raw)
  To: buildroot

Thomas, All,

[it seems my previous mail got stuck in some pipes between me and the
list. Resending. Sorry for the dupe if the previous mail is evenutally
delivered...]

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> For some reason, since when openocd was introduced, it was using a
> BR2_ARCH_HAS_ATOMICS dependency for all sub-options that selected
> BR2_PACKAGE_LIBFTDI1, even if the libftdi1 package did not have any
> atomics dependency. Maybe it was confused with the libftdi package,
> which did have a BR2_ARCH_HAS_ATOMICS dependency ?
> 
> Regardless, openocd with all four sub-options that currently depend on
> BR2_ARCH_HAS_ATOMICS builds perfectly fine with a toolchain that does
> not implement any of the __sync atomic built-ins, so we can remove the
> BR2_ARCH_HAS_ATOMICS dependency.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

This can go in regardless of the rest of the series, feel free to apply
as you wish! ;-)

Regards,
Yann E. MORIN.

> ---
>  package/openocd/Config.in | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/package/openocd/Config.in b/package/openocd/Config.in
> index a35bd27..2313671 100644
> --- a/package/openocd/Config.in
> +++ b/package/openocd/Config.in
> @@ -127,7 +127,6 @@ config BR2_PACKAGE_OPENOCD_FT2XXX
>  	bool "FT2232 based devices (DEPRECATED)"
>  	select BR2_PACKAGE_LIBFTDI1
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	help
>  	  (DEPRECATED) Enable building support for FT2232
>  	  based devices using the libftdi library
> @@ -141,7 +140,6 @@ config BR2_PACKAGE_OPENOCD_UBLASTER
>  	bool "Altera USB-Blaster"
>  	select BR2_PACKAGE_LIBFTDI1
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	help
>  	  Enable building support for the Altera USB-Blaster
>  	  using the libftdi driver, opensource alternate of
> @@ -182,7 +180,6 @@ config BR2_PACKAGE_OPENOCD_PRESTO
>  	bool "ASIX Presto Programmer"
>  	select BR2_PACKAGE_LIBFTDI1
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	help
>  	  Enable building support for ASIX Presto Programmer
>  	  using the libftdi driver
> @@ -193,7 +190,6 @@ config BR2_PACKAGE_OPENOCD_OPENJTAG
>  	select BR2_PACKAGE_LIBUSB
>  	select BR2_PACKAGE_LIBUSB_COMPAT # needs usb.h
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libftdi -> libusb
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	help
>  	  Enable building support for the OpenJTAG Programmer
>  	  with ftdi driver
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 00/21] Rework atomic handling
  2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
                   ` (20 preceding siblings ...)
  2016-01-24 23:08 ` [Buildroot] [PATCH 21/21] neard: " Thomas Petazzoni
@ 2016-01-26 20:28 ` Thomas Petazzoni
  21 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-26 20:28 UTC (permalink / raw)
  To: buildroot

Hello,

Following the reviews, I've applied:

On Mon, 25 Jan 2016 00:07:46 +0100, Thomas Petazzoni wrote:

>   libftdi: C++ bindings need boost
>   libftdi: remove BR2_ARCH_HAS_ATOMICS dependency

[...]

>   icu: remove BR2_ARCH_HAS_ATOMICS dependency

[...]

All other patches have received comments, or depend on patches that have
comments.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-01-24 23:07 ` [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
  2016-01-25 21:45   ` Yann E. MORIN
@ 2016-01-26 22:13   ` Yann E. MORIN
  1 sibling, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:13 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:07 +0100, Thomas Petazzoni spake thusly:
> libtorrent uses 1 bytes and 4 bytes __sync built-ins, so let's use the
> appropriate BR2_TOOLCHAIN_HAS_SYNC_x symbols instead of
> BR2_ARCH_HAS_ATOMICS. The rtorrent package, which is a reverse
> dependency of libtorrent, gets fixed as well.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998 at free.fr: build-tested on an ARC toolchain without
 atomics, with CPU 770D]
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/libtorrent/Config.in | 4 ++--
>  package/rtorrent/Config.in   | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/libtorrent/Config.in b/package/libtorrent/Config.in
> index 17a1f23..4787f9c 100644
> --- a/package/libtorrent/Config.in
> +++ b/package/libtorrent/Config.in
> @@ -2,7 +2,7 @@ config BR2_PACKAGE_LIBTORRENT
>  	bool "libtorrent"
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_ZLIB
>  	help
>  	  BitTorrent library written in C++ for *nix
> @@ -10,5 +10,5 @@ config BR2_PACKAGE_LIBTORRENT
>  	  https://github.com/rakshasa/libtorrent
>  
>  comment "libtorrent needs a toolchain w/ C++, threads"
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
> diff --git a/package/rtorrent/Config.in b/package/rtorrent/Config.in
> index 0583152..190e50f 100644
> --- a/package/rtorrent/Config.in
> +++ b/package/rtorrent/Config.in
> @@ -4,7 +4,7 @@ config BR2_PACKAGE_RTORRENT
>  	depends on BR2_USE_WCHAR
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on BR2_USE_MMU # fork()
> -	depends on BR2_ARCH_HAS_ATOMICS # libtorrent
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_LIBCURL
>  	select BR2_PACKAGE_LIBTORRENT
>  	select BR2_PACKAGE_NCURSES
> @@ -16,5 +16,5 @@ config BR2_PACKAGE_RTORRENT
>  
>  comment "rtorrent needs a toolchain w/ C++, threads, wchar"
>  	depends on BR2_USE_MMU
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_1 && BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !(BR2_INSTALL_LIBSTDCPP && BR2_USE_WCHAR && BR2_TOOLCHAIN_HAS_THREADS)
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 16/21] msgpack: rework BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:08 ` [Buildroot] [PATCH 16/21] msgpack: rework " Thomas Petazzoni
@ 2016-01-26 22:17   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:17 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> The msgpack source code indeed checks for the 4 bytes __sync built-in,
> so this commit switches the package from a BR2_ARCH_HAS_ATOMICS
> dependency to a BR2_TOOLCHAIN_HAS_SYNC_4 dependency.
> 
> python-msgpack, a reverse dependency of msgpack, is changed in the
> same way.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/msgpack/Config.in        | 4 ++--
>  package/python-msgpack/Config.in | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/msgpack/Config.in b/package/msgpack/Config.in
> index a57a378..b8e8213 100644
> --- a/package/msgpack/Config.in
> +++ b/package/msgpack/Config.in
> @@ -1,7 +1,7 @@
>  config BR2_PACKAGE_MSGPACK
>  	bool "msgpack"
>  	depends on BR2_INSTALL_LIBSTDCPP
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	help
>  	  MessagePack is an efficient binary serialization format.
>  
> @@ -11,5 +11,5 @@ config BR2_PACKAGE_MSGPACK
>  	  http://msgpack.org/
>  
>  comment "msgpack needs a toolchain w/ C++"
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on !BR2_INSTALL_LIBSTDCPP
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
> diff --git a/package/python-msgpack/Config.in b/package/python-msgpack/Config.in
> index ed0b432..cba3b51 100644
> --- a/package/python-msgpack/Config.in
> +++ b/package/python-msgpack/Config.in
> @@ -3,7 +3,7 @@ config BR2_PACKAGE_PYTHON_MSGPACK
>  	depends on BR2_PACKAGE_PYTHON
>  	select BR2_PACKAGE_MSGPACK
>  	depends on BR2_INSTALL_LIBSTDCPP # msgpack
> -	depends on BR2_ARCH_HAS_ATOMICS # msgpack
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # msgpack
>  	help
>  	  MessagePack (http://msgpack.org/) is a fast, compact binary
>  	  serialization format, suitable for similar data to JSON.
> @@ -13,6 +13,6 @@ config BR2_PACKAGE_PYTHON_MSGPACK
>  	  https://pypi.python.org/pypi/msgpack-python/
>  
>  comment "python-msgpack needs a toolchain w/ C++"
> -	depends on BR2_ARCH_HAS_ATOMICS
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on BR2_PACKAGE_PYTHON
>  	depends on !BR2_INSTALL_LIBSTDCPP
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option
  2016-01-24 23:08 ` [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
@ 2016-01-26 22:22   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:22 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> Now that BR2_ARCH_HAS_ATOMICS is no longer used anywhere, we can
> remove it from arch/Config.in*, as well as from the documentation.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  arch/Config.in                            | 4 ----
>  arch/Config.in.aarch64                    | 3 ---
>  arch/Config.in.arc                        | 3 ---
>  arch/Config.in.arm                        | 3 ---
>  arch/Config.in.bfin                       | 3 ---
>  arch/Config.in.m68k                       | 3 ---
>  arch/Config.in.microblaze                 | 3 ---
>  arch/Config.in.mips                       | 3 ---
>  arch/Config.in.nios2                      | 3 ---
>  arch/Config.in.powerpc                    | 3 ---
>  arch/Config.in.sh                         | 3 ---
>  arch/Config.in.x86                        | 3 ---
>  arch/Config.in.xtensa                     | 3 ---
>  docs/manual/adding-packages-directory.txt | 5 -----
>  14 files changed, 45 deletions(-)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index 4cdd54e..401bd28 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -284,10 +284,6 @@ config BR2_GCC_TARGET_FLOAT_ABI
>  config BR2_GCC_TARGET_MODE
>  	string
>  
> -# If the architecture has atomic operations, select this:
> -config BR2_ARCH_HAS_ATOMICS
> -	bool
> -
>  # Must be selected by binary formats that support shared libraries.
>  config BR2_BINFMT_SUPPORTS_SHARED
>  	bool
> diff --git a/arch/Config.in.aarch64 b/arch/Config.in.aarch64
> index 325bccc..34cd409 100644
> --- a/arch/Config.in.aarch64
> +++ b/arch/Config.in.aarch64
> @@ -5,6 +5,3 @@ config BR2_ARCH
>  config BR2_ENDIAN
>  	default "LITTLE" if BR2_aarch64
>  	default "BIG"	 if BR2_aarch64_be
> -
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> diff --git a/arch/Config.in.arc b/arch/Config.in.arc
> index 7e0ad08..7d341f3 100644
> --- a/arch/Config.in.arc
> +++ b/arch/Config.in.arc
> @@ -21,9 +21,6 @@ config BR2_ARC_ATOMIC_EXT
>  	bool "Atomic extension (LLOCK/SCOND instructions)"
>  	default y if BR2_arc770d || BR2_archs38
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y if BR2_ARC_ATOMIC_EXT
> -
>  config BR2_ARCH
>  	default "arc"	if BR2_arcle
>  	default "arceb"	if BR2_arceb
> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
> index 60cd3a7..2b34f42 100644
> --- a/arch/Config.in.arm
> +++ b/arch/Config.in.arm
> @@ -426,9 +426,6 @@ config BR2_ENDIAN
>  	default "LITTLE" if BR2_arm
>  	default "BIG"	 if BR2_armeb
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> -
>  config BR2_GCC_TARGET_CPU
>  	default "arm920t"	if BR2_arm920t
>  	default "arm922t"	if BR2_arm922t
> diff --git a/arch/Config.in.bfin b/arch/Config.in.bfin
> index 0783969..415fc89 100644
> --- a/arch/Config.in.bfin
> +++ b/arch/Config.in.bfin
> @@ -68,9 +68,6 @@ config BR2_ARCH
>  config BR2_ENDIAN
>  	default "LITTLE"
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> -
>  config BR2_GCC_TARGET_CPU
>  	default bf606		if BR2_bf606
>  	default bf607		if BR2_bf607
> diff --git a/arch/Config.in.m68k b/arch/Config.in.m68k
> index 6b868a1..f40f97c 100644
> --- a/arch/Config.in.m68k
> +++ b/arch/Config.in.m68k
> @@ -4,9 +4,6 @@ config BR2_ARCH
>  config BR2_ENDIAN
>  	default "BIG"
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> -
>  config BR2_GCC_TARGET_ARCH
>  	default "68000"		if BR2_m68k_68000
>  	default "68010"		if BR2_m68k_68010
> diff --git a/arch/Config.in.microblaze b/arch/Config.in.microblaze
> index 7c21dfc..2d4c1fe 100644
> --- a/arch/Config.in.microblaze
> +++ b/arch/Config.in.microblaze
> @@ -9,6 +9,3 @@ config BR2_ENDIAN
>  config BR2_microblaze
>  	bool
>  	default y if BR2_microblazeel || BR2_microblazebe
> -
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> diff --git a/arch/Config.in.mips b/arch/Config.in.mips
> index 1e5d24d..fda1a1d 100644
> --- a/arch/Config.in.mips
> +++ b/arch/Config.in.mips
> @@ -67,9 +67,6 @@ config BR2_ENDIAN
>  	default "LITTLE"	if BR2_mipsel || BR2_mips64el
>  	default "BIG" 	    	if BR2_mips || BR2_mips64
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> -
>  config BR2_GCC_TARGET_ARCH
>  	default "mips32"	if BR2_mips_32
>  	default "mips32r2"	if BR2_mips_32r2
> diff --git a/arch/Config.in.nios2 b/arch/Config.in.nios2
> index 7807769..ed63898 100644
> --- a/arch/Config.in.nios2
> +++ b/arch/Config.in.nios2
> @@ -3,6 +3,3 @@ config BR2_ARCH
>  
>  config BR2_ENDIAN
>  	default "LITTLE"
> -
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
> index 8581a4d..09ac794 100644
> --- a/arch/Config.in.powerpc
> +++ b/arch/Config.in.powerpc
> @@ -164,9 +164,6 @@ config BR2_ENDIAN
>  	default "BIG"    if BR2_powerpc || BR2_powerpc64
>  	default "LITTLE" if BR2_powerpc64le
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> -
>  config BR2_GCC_TARGET_CPU
>  	default "401"		if BR2_powerpc_401
>  	default "403"		if BR2_powerpc_403
> diff --git a/arch/Config.in.sh b/arch/Config.in.sh
> index 9f8f79c..1bdea37 100644
> --- a/arch/Config.in.sh
> +++ b/arch/Config.in.sh
> @@ -28,6 +28,3 @@ config BR2_ARCH
>  config BR2_ENDIAN
>  	default "LITTLE"	if BR2_sh4 || BR2_sh4a || BR2_sh64
>  	default "BIG"		if BR2_sh2a || BR2_sh4eb || BR2_sh4aeb
> -
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> diff --git a/arch/Config.in.x86 b/arch/Config.in.x86
> index 771c20f..7be814b 100644
> --- a/arch/Config.in.x86
> +++ b/arch/Config.in.x86
> @@ -245,9 +245,6 @@ config BR2_ARCH
>  config BR2_ENDIAN
>  	default "LITTLE"
>  
> -config BR2_ARCH_HAS_ATOMICS
> -	default y if !BR2_x86_i386
> -
>  config BR2_GCC_TARGET_ARCH
>  	default "i386"		if BR2_x86_i386
>  	default "i486"		if BR2_x86_i486
> diff --git a/arch/Config.in.xtensa b/arch/Config.in.xtensa
> index a0e18f1..fcb3dc9 100644
> --- a/arch/Config.in.xtensa
> +++ b/arch/Config.in.xtensa
> @@ -54,6 +54,3 @@ config BR2_ENDIAN
>  
>  config BR2_ARCH
>  	default "xtensa"	if BR2_xtensa
> -
> -config BR2_ARCH_HAS_ATOMICS
> -	default y
> diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
> index cd78390..dac6275 100644
> --- a/docs/manual/adding-packages-directory.txt
> +++ b/docs/manual/adding-packages-directory.txt
> @@ -274,11 +274,6 @@ use in the comment.
>  ** Dependency symbol: +BR2_USE_MMU+
>  ** Comment string: no comment to be added
>  
> -* Atomic instructions (whereby the architecture has instructions to
> -  perform some operations atomically, like LOCKCMPXCHG on x86)
> -** Dependency symbol: +BR2_ARCH_HAS_ATOMICS+
> -** Comment string: no comment to be added
> -
>  * Gcc +__sync_*+ built-ins used for atomic operations. They are
>    available in variants operating on 1 byte, 2 bytes, 4 bytes and 8
>    bytes. Since different architectures support atomic operations on
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem
  2016-01-24 23:08 ` [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem Thomas Petazzoni
@ 2016-01-26 22:25   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:25 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> glog can optionally use atomic __sync built-ins. However, its
> configure script only checks for the availability of the 4 bytes
> version, but the code also uses the 1 byte version. While this works

s/version/variant/ as it seems more appropriate. Applicable in the other
places you used 'version'.

Also, the usual '4-byte' adjective! ;-)

Otherwise;

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> on most architectures, it does not on architectures that implement
> only the 4 bytes version, such as Microblaze. So if the architecture
> does not implement the 1 byte version, we hint the configure script
> that atomic built-ins should not be used.
> 
> Fixes:
> 
>   http://autobuild.buildroot.org/results/bedebd594c283adf39374c9a9f44432e5d6cbff7/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/glog/glog.mk | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/package/glog/glog.mk b/package/glog/glog.mk
> index 8a84094..aa7cacb 100644
> --- a/package/glog/glog.mk
> +++ b/package/glog/glog.mk
> @@ -14,4 +14,15 @@ ifeq ($(BR2_PACKAGE_GFLAGS),y)
>  GLOG_DEPENDENCIES = gflags
>  endif
>  
> +# glog can optionally use atomic __sync built-ins. However, its
> +# configure script only checks for the availability of the 4 bytes
> +# version, but the code also uses the 1 byte version. While this works
> +# on most architectures, it does not on architectures that implement
> +# only the 4 bytes version, such as Microblaze. So if the architecture
> +# does not implement the 1 byte version, we hint the configure script
> +# that atomic built-ins should not be used.
> +ifeq ($(BR2_TOOLCHAIN_HAS_SYNC_1),)
> +GLOG_CONF_ENV += ac_cv___sync_val_compare_and_swap=no
> +endif
> +
>  $(eval $(autotools-package))
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-24 23:08 ` [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-01-26 22:31   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:31 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> thrift builds perfectly fine on SPARC, which doesn't implement any of
> the __sync built-ins, so we can get rid of the BR2_ARCH_HAS_ATOMICS
> dependency.
> 
> The dependency on atomic operations originated in commit
> 1aaa14d84f1c920423ed0286b78f64a2b4b2b575 ("thrift: disable for ARC"),
> but there was no reference to any autobuilder failure. Our testing
> with an ARC toolchain that doesn't have atomics shows that thrift
> builds just fine, and code inspection also shows no usage of
> __sync_*() built-ins. At the time of the commit, the thrift version
> was 0.9.1, which also did not contain any __sync_*() call.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[yann.morin.1998 at free.fr: build-tested on an ARC toolchain without
 atomics, with CPU 770D]
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/thrift/Config.in | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/package/thrift/Config.in b/package/thrift/Config.in
> index b9960f8..54ca9b8 100644
> --- a/package/thrift/Config.in
> +++ b/package/thrift/Config.in
> @@ -3,7 +3,6 @@ config BR2_PACKAGE_THRIFT
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_USE_WCHAR
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
>  	select BR2_PACKAGE_BOOST
>  	select BR2_PACKAGE_LIBEVENT
> @@ -20,7 +19,6 @@ config BR2_PACKAGE_THRIFT
>  	  http://thrift.apache.org/
>  
>  comment "thrift needs a toolchain w/ C++, wchar, threads"
> -	depends on BR2_ARCH_HAS_ATOMICS
>  	depends on BR2_PACKAGE_BOOST_ARCH_SUPPORTS
>  	depends on !BR2_USE_WCHAR || \
>  		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:08 ` [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
@ 2016-01-26 22:32   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:32 UTC (permalink / raw)
  To: buildroot

Thomas, all,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> Fixes:
> 
>   http://autobuild.buildroot.org/results/314fb8da3ca87984e9240d67ff233e2f999ae89e/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/gstreamer1/gst1-plugins-bad/Config.in | 2 ++
>  package/openal/Config.in                      | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/package/gstreamer1/gst1-plugins-bad/Config.in b/package/gstreamer1/gst1-plugins-bad/Config.in
> index f02be34..0dc217e 100644
> --- a/package/gstreamer1/gst1-plugins-bad/Config.in
> +++ b/package/gstreamer1/gst1-plugins-bad/Config.in
> @@ -566,9 +566,11 @@ config BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_OPENAL
>  	bool "openal"
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_OPENAL
>  
>  comment "openal plugin needs a toolchain w/ NPTL, C++"
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
>  		|| !BR2_INSTALL_LIBSTDCPP
>  
> diff --git a/package/openal/Config.in b/package/openal/Config.in
> index 4a73f45..b497e26 100644
> --- a/package/openal/Config.in
> +++ b/package/openal/Config.in
> @@ -2,6 +2,7 @@ config BR2_PACKAGE_OPENAL
>  	bool "openal"
>  	depends on BR2_INSTALL_LIBSTDCPP
>  	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	help
>  	  OpenAL provides capabilities for playing audio in a virtual
>  	  3D environment. Distance attenuation, doppler shift, and
> @@ -11,5 +12,6 @@ config BR2_PACKAGE_OPENAL
>  	  http://kcat.strangesoft.net/openal.html
>  
>  comment "openal needs a toolchain w/ NPTL, C++"
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
>  		|| !BR2_INSTALL_LIBSTDCPP
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 20/21] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:08 ` [Buildroot] [PATCH 20/21] freerdp: " Thomas Petazzoni
@ 2016-01-26 22:33   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:33 UTC (permalink / raw)
  To: buildroot

Thomas, all,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> Fixes:
> 
>   http://autobuild.buildroot.org/results/0501e63cbebe4cda4012ace6f7ec5f43342be5c5/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/freerdp/Config.in | 2 ++
>  package/weston/Config.in  | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/package/freerdp/Config.in b/package/freerdp/Config.in
> index f8dbb68..9dd2505 100644
> --- a/package/freerdp/Config.in
> +++ b/package/freerdp/Config.in
> @@ -8,6 +8,7 @@ config BR2_PACKAGE_FREERDP
>  	depends on !BR2_STATIC_LIBS # uses dlfcn.h
>  	depends on BR2_TOOLCHAIN_HAS_THREADS
>  	depends on BR2_USE_MMU # libglib2
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_OPENSSL
>  	select BR2_PACKAGE_ZLIB
>  	select BR2_PACKAGE_LIBGLIB2
> @@ -84,5 +85,6 @@ config BR2_PACKAGE_FREERDP_CLIENT_WL
>  endif
>  
>  comment "freerdp needs a toolchain w/ wchar, dynamic library, threads, C++"
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
>  		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/weston/Config.in b/package/weston/Config.in
> index c5525e1..4c820e9 100644
> --- a/package/weston/Config.in
> +++ b/package/weston/Config.in
> @@ -44,6 +44,7 @@ config BR2_PACKAGE_WESTON_RDP
>  	bool "RDP compositor"
>  	depends on BR2_USE_WCHAR # freerdp
>  	depends on BR2_USE_MMU # freerdp, libglib2
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_FREERDP
>  	select BR2_PACKAGE_WESTON_HAS_COMPOSITOR
>  	help
> @@ -61,6 +62,7 @@ config BR2_PACKAGE_WESTON_RDP
>  
>  comment "RDP compositor needs a toolchain w/ wchar"
>  	depends on BROKEN # needs FreeRDP master
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_USE_WCHAR
>  
>  # rpi-userland is an EGL/GLES provider, so we can't select it
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 21/21] neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-01-24 23:08 ` [Buildroot] [PATCH 21/21] neard: " Thomas Petazzoni
@ 2016-01-26 22:35   ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-26 22:35 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-25 00:08 +0100, Thomas Petazzoni spake thusly:
> Fixes:
> 
>   http://autobuild.buildroot.org/results/b8bf7be2efd8e8e369abdde0a5bec564e8cd6f23/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/connman/Config.in | 1 +
>  package/neard/Config.in   | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/package/connman/Config.in b/package/connman/Config.in
> index 655db86..556de48 100644
> --- a/package/connman/Config.in
> +++ b/package/connman/Config.in
> @@ -50,6 +50,7 @@ config BR2_PACKAGE_CONNMAN_LOOPBACK
>  config BR2_PACKAGE_CONNMAN_NEARD
>  	bool "enable neard support"
>  	select BR2_PACKAGE_NEARD
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # neard
>  
>  config BR2_PACKAGE_CONNMAN_OFONO
>  	bool "enable ofono support"
> diff --git a/package/neard/Config.in b/package/neard/Config.in
> index 353d1af..8571e7c 100644
> --- a/package/neard/Config.in
> +++ b/package/neard/Config.in
> @@ -4,6 +4,7 @@ config BR2_PACKAGE_NEARD
>  	depends on BR2_TOOLCHAIN_HAS_THREADS # libnl, dbus, libglib2
>  	depends on BR2_USE_MMU # dbus, libglib2
>  	depends on !BR2_STATIC_LIBS # dlopen
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	select BR2_PACKAGE_DBUS
>  	select BR2_PACKAGE_LIBGLIB2
>  	select BR2_PACKAGE_LIBNL
> @@ -26,4 +27,5 @@ endif
>  
>  comment "neard needs a toolchain w/ wchar, threads, dynamic library"
>  	depends on BR2_USE_MMU
> +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
>  	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
> -- 
> 2.6.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans
  2016-01-25 18:27   ` Yann E. MORIN
@ 2016-01-27 21:46     ` Thomas Petazzoni
  2016-01-27 22:47       ` Yann E. MORIN
  0 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 21:46 UTC (permalink / raw)
  To: buildroot

Yann,

On Mon, 25 Jan 2016 19:27:37 +0100, Yann E. MORIN wrote:
> Thomas, All,
> 
> [Warning: pedantic-english mode engaged. ;-) But with real, interesting
>  comments, too! ]

Thanks for the detailed review! I'll skip over the english related
comments (which I've taken into account, of course!) and focus on the
cases where some additional reply is needed.

> > +#  - On ARMv7, there is no problem, it can be directly implemented in
> > +#    userspace.
> > +#
> > +#  - On < ARMv7, it requires help from the kernel. Unfortunately, the
> > +#    libgcc code implementing 8 bytes __sync with the help from the
> > +#    kernel calls __write() when a failure occurs, which is a function
> > +#    internal to glibc, not available in uClibc and musl. This means
> > +#    that the 8 bytes __sync operations are not available on < ARMv7
> > +#    with uClibc and musl. This problem was fixed as part of gcc
> > +#    PR68059, which was backported to the gcc 5 branch, but isn't yet
> > +#    part of any gcc 5.x release.
> > +#
> > +config BR2_TOOLCHAIN_ARM_HAS_SYNC_8
> > +	bool
> > +	default y
> > +	depends on BR2_arm || BR2_armeb
> > +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
> > +	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A
> 
> I had a bit of difficulty parsing that one. It was not obvious from the
> commit log that gcc >= 4.7 was required, while the comment above makes
> it really explicit. Here's how I understood the commit log:
> 
>   - for armv7, with gcc-4.7+, it's OK
>   - for armv6-, it needs glibc and there is no gcc condition.
> 
> But the comment here states it differently, and matches the code.
> 
> Can you just confirm that I misunderstand the commit log?

Well, the commit log has:

                    __sync       __atomic    gcc

    ARM            Y  Y  Y  X    Y  Y  Y  Y   4.8, 4.7
    ARM            Y  Y  Y  -                 4.5

So, as you can see:

 - With a gcc 4.5 toolchain, there is no __sync for 8-byte types at all.

 - Starting with gcc 4.7, there *might* be a __sync for 8-byte types,
   but only if you're using glibc *or* if you're using ARMv7.

Hence the conditions:

	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A

So I believe the code, the comment and the commit log are matching
here. Am I missing something ?


> Well, I'd prefer we have a simpler conditional block, maybe something
> like:
> 
>     config BR2_TOOLCHAIN_i386_HAS_SYNC_8
>         bool
>         default y
>         depends on BR2_i386
>         depends on !BR2_x86_i386
>         depends on !BR2_x86_i486
>         depends on !BR2_x86_c3
>         depends on !BR2_x86_winchip_c6
>         depends on !BR2_x86_winchip2
> 
>     config BR2_TOOLCHAIN_HAS_SYNC_8
>         bool
>         default y if BR2_ARCH_IS_64
>         default y if BR2_TOOLCHAIN_i386_HAS_SYNC_8
>         default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8

Adopted.

> Also, I'm not sure about the 'default y if BR2_ARCH_IS_64' and I think
> we should just list those architectures (4 of them: AArch64, mips64,
> sparc64 and x86_64, with that last one already covered with i386).

I beg to disagree here. I don't see why a 64 bits architecture would
not provide the 8-byte intrinsics. I would like to suggest to keep it
as is for now, and revisit when/if we get a 64 bits architecture that
doesn't provide those 8-byte intrinsics.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-25 18:52   ` Yann E. MORIN
@ 2016-01-27 21:56     ` Thomas Petazzoni
  2016-01-27 22:51       ` Yann E. MORIN
  0 siblings, 1 reply; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 21:56 UTC (permalink / raw)
  To: buildroot

Yann,

On Mon, 25 Jan 2016 19:52:38 +0100, Yann E. MORIN wrote:

> >  config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
> >  	depends on BR2_TOOLCHAIN_HAS_THREADS # pulseaudio
> >  	depends on BR2_USE_MMU # pulseaudio
> > -	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
> >  	depends on !BR2_STATIC_LIBS # pulseaudio
> >  	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
> >  	select BR2_PACKAGE_PULSEAUDIO
> > @@ -212,7 +211,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
> >  
> >  comment "pulseaudio support needs a toolchain w/ threads, dynamic library"
> >  	depends on BR2_USE_MMU
> > -	depends on BR2_ARCH_HAS_ATOMICS
> > +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
> 
> In retrospect, I think this dependency should be added in the previous
> patch.
> 
> Yes, BR2_ARCH_HAS_ATOMICS is a superset of BR2_TOOLCHAIN_HAS_SYNC_4,
> still it would be more logical to add it at the time the depednency on
> _SYNC_4 is added.
> 
> Ditto for all comments, of course.

I intentionally kept the json-c and pulseaudio patches separate. The
json-c patch only adds the additional BR2_TOOLCHAIN_HAS_SYNC_4
dependency to json-c and all its reverse dependencies, keeping the
BR2_ARCH_HAS_ATOMICS when they existed.

This patch then removes the BR2_ARCH_HAS_ATOMICS where they are no
longer needed.

I think it remains bisectable, and allows to kept the patches somewhat
saner in size than the cairo one.

> > +# Make sure we don't detect libatomic_ops. Indeed, since pulseaudio
> > +# requires json-c, which needs 4 bytes __sync builtins, there should
> > +# be no need for pulseaudio to rely on libatomic_ops.
> > +PULSE_AUDIO_CONF_ENV += \
> > +	ac_cv_header_atomic_ops_h=no
> 
> What happens if pulseaudio detects libatomic_ops? Is it "bad" or just
> merely "harmless"?

I don't think it's bad, but since it's not needed (as explained in the
comment), I prefer to be sure that it doesn't get detected/used if
libatomic_ops happens to be built before.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans
  2016-01-27 21:46     ` Thomas Petazzoni
@ 2016-01-27 22:47       ` Yann E. MORIN
  0 siblings, 0 replies; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-27 22:47 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-27 22:46 +0100, Thomas Petazzoni spake thusly:
> On Mon, 25 Jan 2016 19:27:37 +0100, Yann E. MORIN wrote:
> > > +#  - On ARMv7, there is no problem, it can be directly implemented in
> > > +#    userspace.
> > > +#
> > > +#  - On < ARMv7, it requires help from the kernel. Unfortunately, the
> > > +#    libgcc code implementing 8 bytes __sync with the help from the
> > > +#    kernel calls __write() when a failure occurs, which is a function
> > > +#    internal to glibc, not available in uClibc and musl. This means
> > > +#    that the 8 bytes __sync operations are not available on < ARMv7
> > > +#    with uClibc and musl. This problem was fixed as part of gcc
> > > +#    PR68059, which was backported to the gcc 5 branch, but isn't yet
> > > +#    part of any gcc 5.x release.
> > > +#
> > > +config BR2_TOOLCHAIN_ARM_HAS_SYNC_8
> > > +	bool
> > > +	default y
> > > +	depends on BR2_arm || BR2_armeb
> > > +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
> > > +	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A
> > 
> > I had a bit of difficulty parsing that one. It was not obvious from the
> > commit log that gcc >= 4.7 was required, while the comment above makes
> > it really explicit. Here's how I understood the commit log:
> > 
> >   - for armv7, with gcc-4.7+, it's OK
> >   - for armv6-, it needs glibc and there is no gcc condition.
> > 
> > But the comment here states it differently, and matches the code.
> > 
> > Can you just confirm that I misunderstand the commit log?
> 
> Well, the commit log has:
> 
>                     __sync       __atomic    gcc
> 
>     ARM            Y  Y  Y  X    Y  Y  Y  Y   4.8, 4.7
>     ARM            Y  Y  Y  -                 4.5
> 
> So, as you can see:
> 
>  - With a gcc 4.5 toolchain, there is no __sync for 8-byte types at all.
> 
>  - Starting with gcc 4.7, there *might* be a __sync for 8-byte types,
>    but only if you're using glibc *or* if you're using ARMv7.
> 
> Hence the conditions:
> 
> 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7
> 	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_ARM_CPU_ARMV7A
> 
> So I believe the code, the comment and the commit log are matching
> here. Am I missing something ?

What I meant, is that I had some problem matching this part of the commit
log:

>  * X indicates a very special case for 8 bytes __sync built-ins on
>    ARM. On ARMv7, there is no problem, starting from gcc 4.7, the
>    __sync built-in for 8 bytes integers is implemented, fully in
>    userspace. For cores < ARMv7, doing a 8 bytes atomic operation
>    requires help from the kernel. Unfortunately, the libgcc code
>    implementing this uses the __write() function to display an error,
>    and this function is internal to glibc. Therefore, if you're using
>    glibc everything is fine, but if you're using uClibc or musl, you
>    cannot link an application that uses 8 bytes __sync
>    operations. This has been fixed as part of gcc PR68095, merged in
>    the gcc 5 branch but not yet part of any gcc release.

... with the actual dependencies you wrote.

But reading the blurb above again, it looks OK now. It's just a little
bit complex enough to need a second^Wthird^Wfourth read to fully grasp.
;-)

> > Well, I'd prefer we have a simpler conditional block, maybe something
> > like:
> > 
> >     config BR2_TOOLCHAIN_i386_HAS_SYNC_8
> >         bool
> >         default y
> >         depends on BR2_i386
> >         depends on !BR2_x86_i386
> >         depends on !BR2_x86_i486
> >         depends on !BR2_x86_c3
> >         depends on !BR2_x86_winchip_c6
> >         depends on !BR2_x86_winchip2
> > 
> >     config BR2_TOOLCHAIN_HAS_SYNC_8
> >         bool
> >         default y if BR2_ARCH_IS_64
> >         default y if BR2_TOOLCHAIN_i386_HAS_SYNC_8
> >         default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8
> 
> Adopted.
> 
> > Also, I'm not sure about the 'default y if BR2_ARCH_IS_64' and I think
> > we should just list those architectures (4 of them: AArch64, mips64,
> > sparc64 and x86_64, with that last one already covered with i386).
> 
> I beg to disagree here. I don't see why a 64 bits architecture would
> not provide the 8-byte intrinsics. I would like to suggest to keep it
> as is for now, and revisit when/if we get a 64 bits architecture that
> doesn't provide those 8-byte intrinsics.

I was not implying 64-bit archictectures would not provide them. I
suggested we use the actual architectures just to get a similar
condition as we have for the other _SYNC_X options, for which we only
use the architecture names (or an intermediate option derived from the
architecture).

But indeed, a 64-bit arch that does not provide _SYNC_8 woudl be really
weird (and broken).

So, OK.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-27 21:56     ` Thomas Petazzoni
@ 2016-01-27 22:51       ` Yann E. MORIN
  2016-01-27 23:01         ` Thomas Petazzoni
  0 siblings, 1 reply; 54+ messages in thread
From: Yann E. MORIN @ 2016-01-27 22:51 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2016-01-27 22:56 +0100, Thomas Petazzoni spake thusly:
> On Mon, 25 Jan 2016 19:52:38 +0100, Yann E. MORIN wrote:
> > >  config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
> > >  	depends on BR2_TOOLCHAIN_HAS_THREADS # pulseaudio
> > >  	depends on BR2_USE_MMU # pulseaudio
> > > -	depends on BR2_ARCH_HAS_ATOMICS # pulseaudio
> > >  	depends on !BR2_STATIC_LIBS # pulseaudio
> > >  	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pulseaudio -> json-c
> > >  	select BR2_PACKAGE_PULSEAUDIO
> > > @@ -212,7 +211,7 @@ config BR2_PACKAGE_GST_PLUGINS_GOOD_PLUGIN_PULSE
> > >  
> > >  comment "pulseaudio support needs a toolchain w/ threads, dynamic library"
> > >  	depends on BR2_USE_MMU
> > > -	depends on BR2_ARCH_HAS_ATOMICS
> > > +	depends on BR2_TOOLCHAIN_HAS_SYNC_4
> > 
> > In retrospect, I think this dependency should be added in the previous
> > patch.
> > 
> > Yes, BR2_ARCH_HAS_ATOMICS is a superset of BR2_TOOLCHAIN_HAS_SYNC_4,
> > still it would be more logical to add it at the time the depednency on
> > _SYNC_4 is added.
> > 
> > Ditto for all comments, of course.
> 
> I intentionally kept the json-c and pulseaudio patches separate. The
> json-c patch only adds the additional BR2_TOOLCHAIN_HAS_SYNC_4
> dependency to json-c and all its reverse dependencies, keeping the
> BR2_ARCH_HAS_ATOMICS when they existed.
> 
> This patch then removes the BR2_ARCH_HAS_ATOMICS where they are no
> longer needed.
> 
> I think it remains bisectable, and allows to kept the patches somewhat
> saner in size than the cairo one.

Sorry, what I meant was that the 'depends on BR2_TOOLCHAIN_HAS_SYNC_4'
on the comment should have been added in the previous commit, i.e. at
the time json-c gains the _SYNC_4 dependency.

Then in this very commit, you can indeed 'just' remove the _HAS_ATOMICS
dependency.

> > > +# Make sure we don't detect libatomic_ops. Indeed, since pulseaudio
> > > +# requires json-c, which needs 4 bytes __sync builtins, there should
> > > +# be no need for pulseaudio to rely on libatomic_ops.
> > > +PULSE_AUDIO_CONF_ENV += \
> > > +	ac_cv_header_atomic_ops_h=no
> > 
> > What happens if pulseaudio detects libatomic_ops? Is it "bad" or just
> > merely "harmless"?
> 
> I don't think it's bad, but since it's not needed (as explained in the
> comment), I prefer to be sure that it doesn't get detected/used if
> libatomic_ops happens to be built before.

Yes, perfectly valid. It was just an inquiry out of curiosity.

Thanks!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-01-27 22:51       ` Yann E. MORIN
@ 2016-01-27 23:01         ` Thomas Petazzoni
  0 siblings, 0 replies; 54+ messages in thread
From: Thomas Petazzoni @ 2016-01-27 23:01 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 27 Jan 2016 23:51:06 +0100, Yann E. MORIN wrote:

> > I intentionally kept the json-c and pulseaudio patches separate. The
> > json-c patch only adds the additional BR2_TOOLCHAIN_HAS_SYNC_4
> > dependency to json-c and all its reverse dependencies, keeping the
> > BR2_ARCH_HAS_ATOMICS when they existed.
> > 
> > This patch then removes the BR2_ARCH_HAS_ATOMICS where they are no
> > longer needed.
> > 
> > I think it remains bisectable, and allows to kept the patches somewhat
> > saner in size than the cairo one.
> 
> Sorry, what I meant was that the 'depends on BR2_TOOLCHAIN_HAS_SYNC_4'
> on the comment should have been added in the previous commit, i.e. at
> the time json-c gains the _SYNC_4 dependency.
> 
> Then in this very commit, you can indeed 'just' remove the _HAS_ATOMICS
> dependency.

Hum, right, I see what you mean. Indeed, I should fix that, it's not
consistent. I'll wait for some other review on the v2, and I'll respin.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2016-01-27 23:01 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24 23:07 [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni
2016-01-24 23:07 ` [Buildroot] [PATCH 01/21] libftdi: C++ bindings need boost Thomas Petazzoni
2016-01-25 17:04   ` Yann E. MORIN
2016-01-25 20:04     ` Thomas Petazzoni
2016-01-24 23:07 ` [Buildroot] [PATCH 02/21] libftdi: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-01-25 17:15   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 03/21] toolchain: add BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans Thomas Petazzoni
2016-01-25 18:27   ` Yann E. MORIN
2016-01-27 21:46     ` Thomas Petazzoni
2016-01-27 22:47       ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 04/21] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
2016-01-25 18:38   ` Yann E. MORIN
2016-01-25 20:07     ` Thomas Petazzoni
2016-01-24 23:07 ` [Buildroot] [PATCH 05/21] icu: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-01-25 18:42   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 06/21] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
2016-01-25 18:47   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 07/21] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-01-25 18:52   ` Yann E. MORIN
2016-01-27 21:56     ` Thomas Petazzoni
2016-01-27 22:51       ` Yann E. MORIN
2016-01-27 23:01         ` Thomas Petazzoni
2016-01-24 23:07 ` [Buildroot] [PATCH 08/21] apache, apr: fix atomic handling Thomas Petazzoni
2016-01-25 20:59   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 09/21] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
2016-01-25 21:12   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 10/21] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
2016-01-25 21:45   ` Yann E. MORIN
2016-01-25 22:07     ` Thomas Petazzoni
2016-01-25 22:14       ` Yann E. MORIN
2016-01-25 22:22         ` Thomas Petazzoni
2016-01-26 22:13   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 11/21] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
2016-01-25 21:52   ` Yann E. MORIN
2016-01-24 23:07 ` [Buildroot] [PATCH 12/21] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
2016-01-24 23:07 ` [Buildroot] [PATCH 13/21] openocd: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-01-25 23:05   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 14/21] squid: rework atomic handling Thomas Petazzoni
2016-01-25 22:53   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 15/21] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-01-26 22:31   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 16/21] msgpack: rework " Thomas Petazzoni
2016-01-26 22:17   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 17/21] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
2016-01-26 22:22   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 18/21] glog: fix atomic built-in problem Thomas Petazzoni
2016-01-26 22:25   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 19/21] openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
2016-01-26 22:32   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 20/21] freerdp: " Thomas Petazzoni
2016-01-26 22:33   ` Yann E. MORIN
2016-01-24 23:08 ` [Buildroot] [PATCH 21/21] neard: " Thomas Petazzoni
2016-01-26 22:35   ` Yann E. MORIN
2016-01-26 20:28 ` [Buildroot] [PATCH 00/21] Rework atomic handling Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.