All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 00/18] Rework atomic handling
@ 2016-02-02 15:31 Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 01/18] icu: libatomic is only available starting from gcc 4.8 Thomas Petazzoni
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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 five options: BR2_TOOLCHAIN_HAS_SYNC_1,
BR2_TOOLCHAIN_HAS_SYNC_2, BR2_TOOLCHAIN_HAS_SYNC_4,
BR2_TOOLCHAIN_HAS_SYNC_8 (for __sync built-ins) and
BR2_TOOLCHAIN_HAS_ATOMIC (for __atomic built-ins), to indicate which
variants of atomic operations are available, depending on the
architecture/toolchain. The full details are explained in PATCH 1.

The overall direction of the series is:

 - PATCH 1 fixes an icu problem introduced by a patch present in an
   earlier version of this series.

 - PATCH 2 introduces the BR2_TOOLCHAIN_HAS_{SYNC_x,ATOMIC} options,
   and has all the explanations about why we're doing this.

 - PATCH 3 updates the manual about the
   BR2_TOOLCHAIN_HAS_{SYNC_x,ATOMIC} options.

 - PATCH 4-13 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 14 removes the BR2_ARCH_HAS_ATOMICS option, which has become
   no longer used.

 - PATCH 15-18 use the new BR2_TOOLCHAIN_HAS_{SYNC_x,ATOMIC} options
   to fix several outstanding build failures related to atomic
   operations.

Changes compared to v2:

 - Add patch to fix icu build failure caused by libatomic being not
   available on gcc 4.7, only in gcc 4.8.

 - Add a new BR2_TOOLCHAIN_HAS_ATOMIC option, which allows packages to
   know if __atomic_*() built-ins is available, since their
   availability is more compicated than thought in previous iterations
   of the series.

 - Fix the "json-c: needs __sync_val_compare_and_swap_4" patch to
   properly propagate the newly added BR2_TOOLCHAIN_HAS_SYNC_4
   dependency to comments of json-c reverse dependencies. Noticed by
   Yann.

 - Add Reviewed-by from Yann E. Morin on:

   pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency

 - Add Acked-by from Yann E. Morin on:

   apache, apr: fix atomic handling

 - Rework the openal patch, after the reports from Andr?
   Hentschel. openal can use either __atomic or __sync intrinsics.

Changes compared to v1:

 - Drop patches that have been merged:

    libftdi: C++ bindings need boost
    libftdi: remove BR2_ARCH_HAS_ATOMICS dependency
    icu: remove BR2_ARCH_HAS_ATOMICS dependency
    openocd: remove BR2_ARCH_HAS_ATOMICS dependency

 - Fix numerous english typos in the commit log of "toolchain: add
   BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans" as well as in the patch
   itself. Following the review from Yann E. Morin.

 - Introduced a BR2_TOOLCHAIN_X86_HAS_SYNC_8 in "toolchain: add
   BR2_TOOLCHAIN_HAS_SYNC_x hidden booleans" to simplify the
   expression of the availability of 8-byte intrinsics on 32 bits
   x86. Suggested by Yann E. Morin.

 - In the documentation patch, remove a stray paragraph from a
   previous write-up documenting the new BR2_TOOLCHAIN_HAS_SYNC_x
   options. Noticed by Yann E. Morin.

 - Fix minor typo and add Reviewed-by from Yann E. Morin on patch
   "json-c: needs __sync_val_compare_and_swap_4".

 - Explicitly pass --disable-nonportable-atomics to the apr package
   configure script when no appropriate atomic __sync functions are
   available. Suggested by Yann E. Morin.

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

    jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol
    gauche: disable on SPARC(64), remove atomics dependency
    msgpack: rework BR2_ARCH_HAS_ATOMICS dependency

 - Added Tested-by/Acked from Yann E. Morin on:

    libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
    thrift: remove BR2_ARCH_HAS_ATOMICS dependency

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

     squid: rework atomic handling
     arch: remove BR2_ARCH_HAS_ATOMICS option
     neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
     freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
     openal: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency

 - Fix a few typos in the commit log of "glog: fix atomic built-in
   problem" and added Reviewed-by from Yann E. Morin.

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 (18):
  icu: libatomic is only available starting from gcc 4.8
  toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x,ATOMIC} hidden booleans
  docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  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
  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: fix atomic handling
  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          | 15 +++-
 package/apache/apache.mk                           |  4 --
 package/apr/apr.mk                                 | 15 ++++
 package/cairo/Config.in                            |  1 -
 package/cairo/cairo.mk                             |  6 ++
 package/cairomm/Config.in                          |  2 -
 package/connman/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/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/icu.mk                                 |  6 +-
 package/jack2/Config.in                            |  4 +-
 package/json-c/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/libtorrent/Config.in                       |  4 +-
 package/mpd/Config.in                              |  6 +-
 package/msgpack/Config.in                          |  4 +-
 package/neard/Config.in                            |  2 +
 .../openal/0001-Fix-detection-of-C11-atomics.patch | 53 +++++++++++++++
 package/openal/Config.in                           | 17 +++++
 package/openal/openal.mk                           |  4 ++
 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/pulseaudio/Config.in                       |  4 +-
 package/pulseaudio/pulseaudio.mk                   |  7 +-
 package/python-msgpack/Config.in                   |  4 +-
 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                             |  2 +
 package/webkit/Config.in                           |  4 +-
 package/webkitgtk24/Config.in                      |  4 +-
 package/weston/Config.in                           |  4 +-
 package/xscreensaver/Config.in                     |  4 +-
 toolchain/toolchain-common.in                      | 79 ++++++++++++++++++++++
 76 files changed, 299 insertions(+), 142 deletions(-)
 create mode 100644 package/openal/0001-Fix-detection-of-C11-atomics.patch

-- 
2.6.4

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

* [Buildroot] [PATCH v3 01/18] icu: libatomic is only available starting from gcc 4.8
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 02/18] toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x, ATOMIC} hidden booleans Thomas Petazzoni
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 UTC (permalink / raw)
  To: buildroot

Fixes:

  http://autobuild.buildroot.org/results/51b060bbdecdcaac89f764026693bf711e7145d5/

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

diff --git a/package/icu/icu.mk b/package/icu/icu.mk
index 7bc7f93..b4574e5 100644
--- a/package/icu/icu.mk
+++ b/package/icu/icu.mk
@@ -18,10 +18,10 @@ ICU_CONF_OPTS = \
 	--disable-samples \
 	--disable-tests
 
-# With gcc >= 4.7, icu prefers to use C++11 atomics, which rely on the
+# When available, 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)
+# with libatomic starting from gcc 4.8.
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_8),y)
 ICU_CONF_ENV += LIBS="-latomic"
 endif
 
-- 
2.6.4

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

* [Buildroot] [PATCH v3 02/18] toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x, ATOMIC} hidden booleans
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 01/18] icu: libatomic is only available starting from gcc 4.8 Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 03/18] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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 for a
     long time (probably gcc 4.1). They are available in variants
     operating on 1-byte, 2-byte, 4-byte and 8-byte integers. Some
     architectures implement a number of variants, some do not
     implement any, some 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. In gcc 4.8, 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). In gcc 4.7, the __atomic_*() intrinsics
     are only supported on certain architectures, since libatomic did
     not exist at the time.

For (1), a single BR2_ARCH_HAS_ATOMICS is not sufficient, because
depending on the architecture, some variants may or may not be
available. 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-byte, 4-byte
and 8-byte __sync_*() built-ins respectively.

For (2), we introduce a BR2_TOOLCHAIN_HAS_ATOMIC, which indicates if
the __atomic_*() built-ins are available. Note that it is up to the
package to link with -latomic when gcc is >= 4.8. Since __atomic_*()
intrinsics for all sizes are supported starting

We conducted a fairly large analysis about various architectures
supported by Buildroot, as well as with a number of different
toolchains, to check which combinations support 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

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 or BR2_TOOLCHAIN_HAS_ATOMIC
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 | 79 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 8408852..1b7b416 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -307,3 +307,82 @@ 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-byte types on ARM is somewhat
+# complicated:
+#
+#  - It appeared in gcc 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-byte __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-byte __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-byte intrinsics available on most x86 CPUs, except a few old ones
+config BR2_TOOLCHAIN_X86_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
+
+# 8-byte intrinsics available:
+#  - On all 64 bits architecture
+#  - On a certain combinations of ARM platforms
+#  - On certain x86 32 bits CPUs
+config BR2_TOOLCHAIN_HAS_SYNC_8
+	bool
+	default y if BR2_ARCH_IS_64
+	default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8
+	default y if BR2_TOOLCHAIN_X86_HAS_SYNC_8
+
+# __atomic intrinsics are available:
+# - with gcc 4.8, either through built-ins or libatomic, on all
+#   architectures
+# - with gcc 4.7, libatomic did not exist, so only built-ins are
+#   available. This means that __atomic can only be used in a subset
+#   of the architectures
+config BR2_TOOLCHAIN_HAS_ATOMIC
+	bool
+	default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+	default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_arm
+	default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_armeb
+	default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_xtensa
+	default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_ARCH_IS_64
-- 
2.6.4

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

* [Buildroot] [PATCH v3 03/18] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 01/18] icu: libatomic is only available starting from gcc 4.8 Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 02/18] toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x, ATOMIC} hidden booleans Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 04/18] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
index b9596a2..aa9f4e8 100644
--- a/docs/manual/adding-packages-directory.txt
+++ b/docs/manual/adding-packages-directory.txt
@@ -279,6 +279,20 @@ 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 2 bytes,
+   +BR2_TOOLCHAIN_HAS_SYNC_4+ for 4 bytes, +BR2_TOOLCHAIN_HAS_SYNC_8+
+   for 8 bytes.
+** Comment string: no comment to be added
+
+* Gcc +__atomic_*+ built-ins used for atomic operations.
+** Dependency symbol: +BR2_TOOLCHAIN_HAS_ATOMIC+.
+** Comment string: no comment to be added
+
 * 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] 20+ messages in thread

* [Buildroot] [PATCH v3 04/18] json-c: needs __sync_val_compare_and_swap_4
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 03/18] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 05/18] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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 will 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/efl/Config.in                          | 1 +
 package/espeak/Config.in                       | 1 +
 package/fastd/Config.in                        | 1 +
 package/gstreamer/gst-plugins-good/Config.in   | 2 ++
 package/gstreamer1/gst1-plugins-good/Config.in | 2 ++
 package/json-c/Config.in                       | 2 ++
 package/mpd/Config.in                          | 2 ++
 package/pulseaudio/Config.in                   | 2 ++
 package/rsyslog/Config.in                      | 2 ++
 package/ubus/Config.in                         | 2 ++
 10 files changed, 17 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..f169435 100644
--- a/package/gstreamer/gst-plugins-good/Config.in
+++ b/package/gstreamer/gst-plugins-good/Config.in
@@ -206,12 +206,14 @@ 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"
 
 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 a8cdde2..6855c4b 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
@@ -321,6 +322,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/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..4455795 100644
--- a/package/mpd/Config.in
+++ b/package/mpd/Config.in
@@ -248,11 +248,13 @@ 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.
 
 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 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..391fc8d 100644
--- a/package/ubus/Config.in
+++ b/package/ubus/Config.in
@@ -1,10 +1,12 @@
 comment "ubus needs a toolchain w/ dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_SYNC_4
         depends on BR2_STATIC_LIBS
 
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 05/18] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 04/18] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 06/18] apache, apr: fix atomic handling Thomas Petazzoni
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/efl/Config.in                          | 1 -
 package/espeak/Config.in                       | 1 -
 package/gstreamer/gst-plugins-good/Config.in   | 2 --
 package/gstreamer1/gst1-plugins-good/Config.in | 2 --
 package/mpd/Config.in                          | 1 -
 package/pulseaudio/Config.in                   | 2 --
 package/pulseaudio/pulseaudio.mk               | 7 ++++++-
 7 files changed, 6 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 f169435..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,6 @@ 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
 
diff --git a/package/gstreamer1/gst1-plugins-good/Config.in b/package/gstreamer1/gst1-plugins-good/Config.in
index 6855c4b..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,6 @@ 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
 
diff --git a/package/mpd/Config.in b/package/mpd/Config.in
index 4455795..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
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 8450090..86bbb2f 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] 20+ messages in thread

* [Buildroot] [PATCH v3 06/18] apache, apr: fix atomic handling
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 05/18] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 07/18] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 package/apache/apache.mk |  4 ----
 package/apr/apr.mk       | 15 +++++++++++++++
 2 files changed, 15 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..361a79f 100644
--- a/package/apr/apr.mk
+++ b/package/apr/apr.mk
@@ -35,6 +35,21 @@ 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):$(BR2_TOOLCHAIN_HAS_SYNC_8),y:y)
+APR_CONF_OPTS += --enable-nonportable-atomics
+APR_CONF_ENV += ap_cv_atomic_builtins=yes
+else ifeq ($(BR2_ARCH_IS_64):$(BR2_TOOLCHAIN_HAS_SYNC_4),:y)
+APR_CONF_OPTS += --enable-nonportable-atomics
+APR_CONF_ENV += ap_cv_atomic_builtins=yes
+else
+APR_CONF_OPTS += --disable-nonportable-atomics
+endif
+
 ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBUUID),y)
 APR_DEPENDENCIES += util-linux
 endif
-- 
2.6.4

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

* [Buildroot] [PATCH v3 07/18] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 06/18] apache, apr: fix atomic handling Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 08/18] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 08/18] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 07/18] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 09/18] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
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>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 09/18] gauche: disable on SPARC(64), remove atomics dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 08/18] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 10/18] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 10/18] cairo, harfbuzz: rework atomic dependencies
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 09/18] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 11/18] squid: rework atomic handling Thomas Petazzoni
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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.8 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..205250d 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_8),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 638e4e1..2aed63f 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
@@ -147,7 +147,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
 
@@ -163,6 +162,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] 20+ messages in thread

* [Buildroot] [PATCH v3 11/18] squid: rework atomic handling
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 10/18] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 12/18] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 12/18] thrift: remove BR2_ARCH_HAS_ATOMICS dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (10 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 11/18] squid: rework atomic handling Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 13/18] msgpack: rework " Thomas Petazzoni
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
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>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 13/18] msgpack: rework BR2_ARCH_HAS_ATOMICS dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (11 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 12/18] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 14/18] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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 e740835..7206c22 100644
--- a/package/python-msgpack/Config.in
+++ b/package/python-msgpack/Config.in
@@ -2,7 +2,7 @@ config BR2_PACKAGE_PYTHON_MSGPACK
 	bool "python-msgpack"
 	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.
@@ -12,6 +12,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] 20+ messages in thread

* [Buildroot] [PATCH v3 14/18] arch: remove BR2_ARCH_HAS_ATOMICS option
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (12 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 13/18] msgpack: rework " Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 15/18] glog: fix atomic built-in problem Thomas Petazzoni
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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 aa9f4e8..5537032 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] 20+ messages in thread

* [Buildroot] [PATCH v3 15/18] glog: fix atomic built-in problem
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (13 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 14/18] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 16/18] openal: fix atomic handling Thomas Petazzoni
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 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-byte
variant, but the code also uses the 1-byte variant. While this works
on most architectures, it does not on architectures that implement
only the 4-byte variant, such as Microblaze. So if the architecture
does not implement the 1-byte variant, 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>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 16/18] openal: fix atomic handling
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (14 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 15/18] glog: fix atomic built-in problem Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 17/18] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 UTC (permalink / raw)
  To: buildroot

openal can uses __atomic_*() intrinsics when available, or fall-back
on __sync_*() built-ins. This commit adjusts the package to take into
account for those dependencies, and makes sure we link against
libatomic when gcc >= 4.8 so that the __atomic_*() intrinsics can be
used on all architectures.

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>
---
 package/gstreamer1/gst1-plugins-bad/Config.in      |  2 +
 .../openal/0001-Fix-detection-of-C11-atomics.patch | 53 ++++++++++++++++++++++
 package/openal/Config.in                           | 17 +++++++
 package/openal/openal.mk                           |  4 ++
 4 files changed, 76 insertions(+)
 create mode 100644 package/openal/0001-Fix-detection-of-C11-atomics.patch

diff --git a/package/gstreamer1/gst1-plugins-bad/Config.in b/package/gstreamer1/gst1-plugins-bad/Config.in
index f02be34..6e7d21d 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_PAKCAGE_OPENAL_ARCH_SUPPORTS
 	select BR2_PACKAGE_OPENAL
 
 comment "openal plugin needs a toolchain w/ NPTL, C++"
+	depends on BR2_PAKCAGE_OPENAL_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
 		|| !BR2_INSTALL_LIBSTDCPP
 
diff --git a/package/openal/0001-Fix-detection-of-C11-atomics.patch b/package/openal/0001-Fix-detection-of-C11-atomics.patch
new file mode 100644
index 0000000..c6b9840
--- /dev/null
+++ b/package/openal/0001-Fix-detection-of-C11-atomics.patch
@@ -0,0 +1,53 @@
+From 10fee6d71a1f7d6e6319005196562b4a30b4e8ff Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Tue, 2 Feb 2016 14:58:52 +0100
+Subject: [PATCH] Fix detection of C11 atomics
+
+Currently, the CMakeLists.txt logic to detect the availability of C11
+atomics is based on building a small program that uses the
+atomic_load().
+
+However, atomic_load() does not need to use any function from
+libatomic (part of the gcc runtime). So even if libatomic is missing,
+this test concludes that C11 atomic support is available. For example
+on SPARC, the example program builds fine without linking to
+libatomic, but calling other functions of the atomic_*() APIs fail
+without linking to libatomic.
+
+So, this patch adjusts the CMakeLists.txt test to use a function that
+is known to require the libatomic run-time library (on architectures
+where it is needed). This way, openal will only use the __atomic_*()
+built-ins when they are actually functional.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ CMakeLists.txt | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5784d35..a53f996 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -209,14 +209,17 @@ CHECK_C_SOURCE_COMPILES(
+ HAVE_C11_ALIGNAS)
+ 
+ # Check if we have C11 _Atomic
++set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
++set(CMAKE_REQUIRED_LIBRARIES ${EXTRA_LIBS})
+ CHECK_C_SOURCE_COMPILES(
+ "#include <stdatomic.h>
+- const int _Atomic foo = ATOMIC_VAR_INIT(~0);
++ int _Atomic foo = ATOMIC_VAR_INIT(~0);
+  int main()
+  {
+-     return atomic_load(&foo);
++     return atomic_fetch_add(&foo, 2);
+  }"
+ HAVE_C11_ATOMIC)
++set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
+ 
+ # Add definitions, compiler switches, etc.
+ INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}")
+-- 
+2.6.4
+
diff --git a/package/openal/Config.in b/package/openal/Config.in
index 4a73f45..a564156 100644
--- a/package/openal/Config.in
+++ b/package/openal/Config.in
@@ -1,7 +1,23 @@
+# openal can:
+# - use __atomic_*() intrinsics when available
+# - otherwise use __sync_*() intrinsics when available. It needs the
+#   4-byte ones on 32 bits architectures, and the 4-byte and 8-byte
+#   one on 64 bits architecture
+# - it also provides its one implementation of atomic operations on
+#   x86 and x86_64, but we dont take those into account since in most
+#   situations __atomic_*() or __sync_*() will be available, and not
+#   all x86 CPUs provide the necessary assembly instructions.
+config BR2_PACKAGE_OPENAL_ARCH_SUPPORTS
+	bool
+	default y if BR2_TOOLCHAIN_HAS_ATOMIC
+	default y if BR2_TOOLCHAIN_HAS_SYNC_4 && !BR2_ARCH_IS_64
+	default y if BR2_TOOLCHAIN_HAS_SYNC_4 && BR2_TOOLCHAIN_HAS_SYNC_8 && BR2_ARCH_IS_64
+
 config BR2_PACKAGE_OPENAL
 	bool "openal"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
+	depends on BR2_PACKAGE_OPENAL_ARCH_SUPPORTS
 	help
 	  OpenAL provides capabilities for playing audio in a virtual
 	  3D environment. Distance attenuation, doppler shift, and
@@ -11,5 +27,6 @@ config BR2_PACKAGE_OPENAL
 	  http://kcat.strangesoft.net/openal.html
 
 comment "openal needs a toolchain w/ NPTL, C++"
+	depends on BR2_PACKAGE_OPENAL_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL \
 		|| !BR2_INSTALL_LIBSTDCPP
diff --git a/package/openal/openal.mk b/package/openal/openal.mk
index 4c9a2b6..2916aa6 100644
--- a/package/openal/openal.mk
+++ b/package/openal/openal.mk
@@ -14,6 +14,10 @@ OPENAL_INSTALL_STAGING = YES
 # We don't need the utilities, Distros don't ship them either
 OPENAL_CONF_OPTS += -DALSOFT_UTILS=OFF
 
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_8),y)
+OPENAL_CONF_OPTS += -DEXTRA_LIBS=atomic
+endif
+
 ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
 OPENAL_DEPENDENCIES += alsa-lib
 OPENAL_CONF_OPTS += -DALSOFT_REQUIRE_ALSA=ON
-- 
2.6.4

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

* [Buildroot] [PATCH v3 17/18] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (15 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 16/18] openal: fix atomic handling Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 18/18] neard: " Thomas Petazzoni
  2016-02-06 10:18 ` [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 UTC (permalink / raw)
  To: buildroot

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>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 18/18] neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (16 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 17/18] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
@ 2016-02-02 15:31 ` Thomas Petazzoni
  2016-02-06 10:18 ` [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-02 15:31 UTC (permalink / raw)
  To: buildroot

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>
---
 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] 20+ messages in thread

* [Buildroot] [PATCH v3 00/18] Rework atomic handling
  2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
                   ` (17 preceding siblings ...)
  2016-02-02 15:31 ` [Buildroot] [PATCH v3 18/18] neard: " Thomas Petazzoni
@ 2016-02-06 10:18 ` Thomas Petazzoni
  18 siblings, 0 replies; 20+ messages in thread
From: Thomas Petazzoni @ 2016-02-06 10:18 UTC (permalink / raw)
  To: buildroot

Hello all,

On Tue,  2 Feb 2016 16:31:18 +0100, Thomas Petazzoni wrote:

> Thomas Petazzoni (18):
>   icu: libatomic is only available starting from gcc 4.8
>   toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x,ATOMIC} hidden booleans
>   docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x
>   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
>   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: fix atomic handling
>   freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency
>   neard: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency

Since this series is needed to fix a number of build failures, I've
applied it so it gets part of 2016.02-rc1, and we can continue to fix
atomic related build issues throughout the 2016.02 debug period.

Thanks!

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

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

end of thread, other threads:[~2016-02-06 10:18 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 15:31 [Buildroot] [PATCH v3 00/18] Rework atomic handling Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 01/18] icu: libatomic is only available starting from gcc 4.8 Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 02/18] toolchain: add BR2_TOOLCHAIN_HAS_{SYNC_x, ATOMIC} hidden booleans Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 03/18] docs/manual: document usage of BR2_TOOLCHAIN_HAS_SYNC_x Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 04/18] json-c: needs __sync_val_compare_and_swap_4 Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 05/18] pulseaudio: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 06/18] apache, apr: fix atomic handling Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 07/18] jack2: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbol Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 08/18] libtorrent: use the proper BR2_TOOLCHAIN_HAS_SYNC_x symbols Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 09/18] gauche: disable on SPARC(64), remove atomics dependency Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 10/18] cairo, harfbuzz: rework atomic dependencies Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 11/18] squid: rework atomic handling Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 12/18] thrift: remove BR2_ARCH_HAS_ATOMICS dependency Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 13/18] msgpack: rework " Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 14/18] arch: remove BR2_ARCH_HAS_ATOMICS option Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 15/18] glog: fix atomic built-in problem Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 16/18] openal: fix atomic handling Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 17/18] freerdp: add missing BR2_TOOLCHAIN_HAS_SYNC_4 dependency Thomas Petazzoni
2016-02-02 15:31 ` [Buildroot] [PATCH v3 18/18] neard: " Thomas Petazzoni
2016-02-06 10:18 ` [Buildroot] [PATCH v3 00/18] 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.