toolchain: Add config option for atomic intrinsics
authorAnton Kolesov <anton.kolesov@synopsys.com>
Thu, 31 Jul 2014 13:24:42 +0000 (17:24 +0400)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 3 Aug 2014 09:20:47 +0000 (11:20 +0200)
GCC has several builtin functions that implement atomic operations. Those
functions are architecture specific and may not be implemented by the
specific toolchain. In case of GCC for ARC those functions rely on
LLOCK/SCOND instructions which are optional in ARC CPU's. If ARC CPU doesn't
support those instructions but software tries to use them, then application
will be aborted with Illegal instruction exception. To avoid confusion user
should first specify that their CPU supports atomic extension, which will
allow selection of packages that use builtin atomic functions.

Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
arch/Config.in.arc
package/Makefile.in
toolchain/toolchain-common.in

index 60b59f03199437b36b1e9b194695898a04bfb9a2..836cfef638e228217233eacf26a589bc31f26be1 100644 (file)
@@ -1,3 +1,8 @@
+# Choise of atomic instructions presence
+config BR2_ARC_ATOMIC_EXT
+       bool "Atomic extension (LLOCK/SCOND instructions)"
+       select BR2_TOOLCHAIN_HAS_ATOMIC_INTRINSICS
+
 config BR2_ARCH
        default "arc"   if BR2_arcle
        default "arceb" if BR2_arceb
index 02f6e3d62c4237a7c96625e745b1fe69ed36f83b..106a04cc8d2248d92624381cc2dd51ee178cf559 100644 (file)
@@ -102,6 +102,10 @@ ifeq ($(BR2_xtensa),y)
 TARGET_ABI += -mlongcalls -mtext-section-literals
 endif
 
+ifeq ($(BR2_arc)$(BR2_ARC_ATOMIC_EXT),yy)
+TARGET_ABI += -matomic
+endif
+
 STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
 STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
 
index 2df8ddb637a0f36f1ffa78c391d2da37b9c62004..48ba8400cab705692c7ffba0a4ed11f8e783231b 100644 (file)
@@ -44,6 +44,10 @@ config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
 config BR2_TOOLCHAIN_HAS_SSP
        bool
 
+config BR2_TOOLCHAIN_HAS_ATOMIC_INTRINSICS
+       bool
+       default y if !BR2_arc
+
 config BR2_ENABLE_LOCALE_PURGE
        bool "Purge unwanted locales"
        help