* [Buildroot] [PATCH 2/2] cairo, icu, webkitgtk24: use BR2_TOOLCHAIN_HAS_LIBATOMIC
2016-03-06 20:47 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
@ 2016-03-06 20:47 ` Thomas Petazzoni
2016-03-07 20:43 ` Yann E. MORIN
2016-03-07 20:41 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC Yann E. MORIN
2016-03-20 22:41 ` Thomas Petazzoni
2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2016-03-06 20:47 UTC (permalink / raw)
To: buildroot
This commit modifies the cairo, icu and webkitgtk24 packages to use
BR2_TOOLCHAIN_HAS_LIBATOMIC when appropriate.
Fixes:
http://autobuild.buildroot.net/results/ec4/ec4e48c0e4b8fa72d8bb7ef4ad67a166699c0b62/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/cairo/cairo.mk | 2 +-
package/icu/icu.mk | 2 +-
package/webkitgtk24/webkitgtk24.mk | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/cairo/cairo.mk b/package/cairo/cairo.mk
index 6b54b28..b6ab54e 100644
--- a/package/cairo/cairo.mk
+++ b/package/cairo/cairo.mk
@@ -18,7 +18,7 @@ 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)
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
CAIRO_CONF_ENV += LIBS="-latomic"
endif
diff --git a/package/icu/icu.mk b/package/icu/icu.mk
index b4574e5..f245da2 100644
--- a/package/icu/icu.mk
+++ b/package/icu/icu.mk
@@ -21,7 +21,7 @@ ICU_CONF_OPTS = \
# When available, icu prefers to use C++11 atomics, which rely on the
# __atomic builtins. On certain architectures, this requires linking
# with libatomic starting from gcc 4.8.
-ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_8),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
ICU_CONF_ENV += LIBS="-latomic"
endif
diff --git a/package/webkitgtk24/webkitgtk24.mk b/package/webkitgtk24/webkitgtk24.mk
index d8e41b9..0438ceb 100644
--- a/package/webkitgtk24/webkitgtk24.mk
+++ b/package/webkitgtk24/webkitgtk24.mk
@@ -29,7 +29,7 @@ endif
WEBKITGTK24_CONF_ENV = ac_cv_path_icu_config=$(STAGING_DIR)/usr/bin/icu-config
# Some 32-bit architectures need libatomic support for 64-bit ops
-ifeq ($(BR2_i386)$(BR2_mips)$(BR2_mipsel)$(BR2_sh),y)
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
WEBKITGTK24_CONF_ENV += LIBS="-latomic"
endif
--
2.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/2] cairo, icu, webkitgtk24: use BR2_TOOLCHAIN_HAS_LIBATOMIC
2016-03-06 20:47 ` [Buildroot] [PATCH 2/2] cairo, icu, webkitgtk24: use BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
@ 2016-03-07 20:43 ` Yann E. MORIN
0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2016-03-07 20:43 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2016-03-06 21:47 +0100, Thomas Petazzoni spake thusly:
> This commit modifies the cairo, icu and webkitgtk24 packages to use
> BR2_TOOLCHAIN_HAS_LIBATOMIC when appropriate.
>
> Fixes:
>
> http://autobuild.buildroot.net/results/ec4/ec4e48c0e4b8fa72d8bb7ef4ad67a166699c0b62/
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> package/cairo/cairo.mk | 2 +-
> package/icu/icu.mk | 2 +-
> package/webkitgtk24/webkitgtk24.mk | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/package/cairo/cairo.mk b/package/cairo/cairo.mk
> index 6b54b28..b6ab54e 100644
> --- a/package/cairo/cairo.mk
> +++ b/package/cairo/cairo.mk
> @@ -18,7 +18,7 @@ endif
>
> # cairo can use C++11 atomics when available, so we need to link with
> # libatomic for the architectures who need libatomic.
Not from this patch, but: s/who/which/ (an architecture is not a person.)
otherwise:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> -ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_8),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> CAIRO_CONF_ENV += LIBS="-latomic"
> endif
>
> diff --git a/package/icu/icu.mk b/package/icu/icu.mk
> index b4574e5..f245da2 100644
> --- a/package/icu/icu.mk
> +++ b/package/icu/icu.mk
> @@ -21,7 +21,7 @@ ICU_CONF_OPTS = \
> # When available, icu prefers to use C++11 atomics, which rely on the
> # __atomic builtins. On certain architectures, this requires linking
> # with libatomic starting from gcc 4.8.
> -ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_8),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> ICU_CONF_ENV += LIBS="-latomic"
> endif
>
> diff --git a/package/webkitgtk24/webkitgtk24.mk b/package/webkitgtk24/webkitgtk24.mk
> index d8e41b9..0438ceb 100644
> --- a/package/webkitgtk24/webkitgtk24.mk
> +++ b/package/webkitgtk24/webkitgtk24.mk
> @@ -29,7 +29,7 @@ endif
> WEBKITGTK24_CONF_ENV = ac_cv_path_icu_config=$(STAGING_DIR)/usr/bin/icu-config
>
> # Some 32-bit architectures need libatomic support for 64-bit ops
> -ifeq ($(BR2_i386)$(BR2_mips)$(BR2_mipsel)$(BR2_sh),y)
> +ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
> WEBKITGTK24_CONF_ENV += LIBS="-latomic"
> endif
>
> --
> 2.6.4
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC
2016-03-06 20:47 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
2016-03-06 20:47 ` [Buildroot] [PATCH 2/2] cairo, icu, webkitgtk24: use BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
@ 2016-03-07 20:41 ` Yann E. MORIN
2016-03-20 22:41 ` Thomas Petazzoni
2 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2016-03-07 20:41 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2016-03-06 21:47 +0100, Thomas Petazzoni spake thusly:
> Until now, we were assuming that whenever you have gcc 4.8, libatomic
> is available. It turns out that this is not correct, since libatomic
> will not be available if thread support is disabled in the toolchain.
>
> Therefore, __atomic_*() intrinsics may not be available even if the
> toolchain uses gcc 4.8.
>
> To solve this problem, we introduce a BR2_TOOLCHAIN_HAS_LIBATOMIC
> boolean, which indicates whether the toolchain has libatomic. It is
> the case when you are using gcc >= 4.8 *and* thread support is
> enabled. We then use this new BR2_TOOLCHAIN_HAS_LIBATOMIC to define
> BR2_TOOLCHAIN_HAS_ATOMIC.
>
> As explained in the comment, on certain architectures, libatomic is
> technically not needed to provide the __atomic_*() intrinsics since
> they might be all built-in. However, since libatomic is only absent in
> non-thread capable toolchains, it is not worth making things more
> complex for such seldomly used configuration.
>
> Note that we are introducing the intermediate
> BR2_TOOLCHAIN_HAS_LIBATOMIC option because it will be useful on its
> own for certain packages.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> toolchain/toolchain-common.in | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
> index 1b7b416..596d1eb 100644
> --- a/toolchain/toolchain-common.in
> +++ b/toolchain/toolchain-common.in
> @@ -373,15 +373,28 @@ config BR2_TOOLCHAIN_HAS_SYNC_8
> default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8
> default y if BR2_TOOLCHAIN_X86_HAS_SYNC_8
>
> +# libatomic is available since gcc 4.8, when thread support is
> +# enabled.
> +config BR2_TOOLCHAIN_HAS_LIBATOMIC
> + bool
> + default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 && \
> + BR2_TOOLCHAIN_HAS_THREADS
> +
> # __atomic intrinsics are available:
> # - with gcc 4.8, either through built-ins or libatomic, on all
> -# architectures
> +# architectures. Since we don't want to separate the cases where
> +# libatomic is needed vs. not needed, we simplify thing and only
> +# support situations where libatomic is available, even if on some
> +# architectures libatomic is not strictly needed as all __atomic
> +# intrinsics might be built-in. But the only case where libatomic is
> +# not available is when thread support is disabled, which is pretty
> +# unlikely.
That last sentence got me confused for a while, and your explanations on
IRC were really necessary to me to understand it.
What about:
The only case where libatomic is missing entirely is when the
toolchain does nto have support for threads. However, a package
that does not need threads but still uses atomics is quite a
corner case, which does not warrant the added complexity.
Otherwise, I'm fine with this:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> # - 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_HAS_LIBATOMIC
> 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
> --
> 2.6.4
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 5+ messages in thread* [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC
2016-03-06 20:47 [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
2016-03-06 20:47 ` [Buildroot] [PATCH 2/2] cairo, icu, webkitgtk24: use BR2_TOOLCHAIN_HAS_LIBATOMIC Thomas Petazzoni
2016-03-07 20:41 ` [Buildroot] [PATCH 1/2] toolchain: introduce BR2_TOOLCHAIN_HAS_LIBATOMIC Yann E. MORIN
@ 2016-03-20 22:41 ` Thomas Petazzoni
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-03-20 22:41 UTC (permalink / raw)
To: buildroot
Hello,
On Sun, 6 Mar 2016 21:47:16 +0100, Thomas Petazzoni wrote:
> Until now, we were assuming that whenever you have gcc 4.8, libatomic
> is available. It turns out that this is not correct, since libatomic
> will not be available if thread support is disabled in the toolchain.
>
> Therefore, __atomic_*() intrinsics may not be available even if the
> toolchain uses gcc 4.8.
>
> To solve this problem, we introduce a BR2_TOOLCHAIN_HAS_LIBATOMIC
> boolean, which indicates whether the toolchain has libatomic. It is
> the case when you are using gcc >= 4.8 *and* thread support is
> enabled. We then use this new BR2_TOOLCHAIN_HAS_LIBATOMIC to define
> BR2_TOOLCHAIN_HAS_ATOMIC.
>
> As explained in the comment, on certain architectures, libatomic is
> technically not needed to provide the __atomic_*() intrinsics since
> they might be all built-in. However, since libatomic is only absent in
> non-thread capable toolchains, it is not worth making things more
> complex for such seldomly used configuration.
>
> Note that we are introducing the intermediate
> BR2_TOOLCHAIN_HAS_LIBATOMIC option because it will be useful on its
> own for certain packages.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> toolchain/toolchain-common.in | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
I've applied, after modifying the Config.in comment as suggested by
Yann. I've also applied PATCH 2/2, which had Yann's Reviewed-by.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread