icu: remove BR2_ARCH_HAS_ATOMICS dependency

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

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

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

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

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

Conclusion:

 - The BR2_ARCH_HAS_ATOMICS dependency is no longer needed.

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

Note that reverse dependencies of icu are also changed accordingly.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
Thomas Petazzoni
2016-01-25 00:07:51 +01:00
parent 1e1333fd8f
commit 9f99ec21e5
8 changed files with 8 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ config BR2_PACKAGE_ICU
# file, and it cannot easily be changed to generate FLAT
# format.
depends on !BR2_BINFMT_FLAT
depends on BR2_ARCH_HAS_ATOMICS
help
International Components for Unicode.
@@ -28,6 +27,5 @@ endif
comment "icu needs a toolchain w/ C++, wchar, threads"
depends on !BR2_BINFMT_FLAT
depends on BR2_ARCH_HAS_ATOMICS
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
!BR2_TOOLCHAIN_HAS_THREADS

View File

@@ -17,6 +17,14 @@ ICU_CONF_OPTS = \
--with-cross-build=$(HOST_ICU_DIR)/source \
--disable-samples \
--disable-tests
# With gcc >= 4.7, icu prefers to use C++11 atomics, which rely on the
# __atomic builtins. On certain architectures, this requires linking
# with libatomic.
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
ICU_CONF_ENV += LIBS="-latomic"
endif
HOST_ICU_CONF_OPTS = \
--disable-samples \
--disable-tests \