Patchwork [4/5] libglib2: define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4

login
register
mail settings
Submitter Sven Neumann
Date July 18, 2012, 9:17 p.m.
Message ID <1342646260-11203-5-git-send-email-s.neumann@raumfeld.com>
Download mbox | patch
Permalink /patch/171842/
State RFC
Headers show

Comments

Sven Neumann - July 18, 2012, 9:17 p.m.
On ARMv5 atomic operations are not actually available as inlines
but libgcc does still provide them as functions. Trick glib into
using the functions instead of using the mutex-based fallbacks.

This should probably be platform-dependant. The inline functions
are available for ARMv6 and above and probably for other platforms
as well. Please advice on how to fix this properly.

Without this change performance of atomic operations is horrible
on ARMv5 systems.

Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
---
 package/libglib2/libglib2.mk |    1 +
 1 file changed, 1 insertion(+)
Thomas Petazzoni - July 20, 2012, 9:39 p.m.
Le Wed, 18 Jul 2012 23:17:39 +0200,
Sven Neumann <s.neumann@raumfeld.com> a écrit :

> On ARMv5 atomic operations are not actually available as inlines
> but libgcc does still provide them as functions. Trick glib into
> using the functions instead of using the mutex-based fallbacks.
> 
> This should probably be platform-dependant. The inline functions
> are available for ARMv6 and above and probably for other platforms
> as well. Please advice on how to fix this properly.
> 
> Without this change performance of atomic operations is horrible
> on ARMv5 systems.
> 
> Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>

But isn't the compiler supposed to define
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 by itself?

Thomas

Patch

diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index 004312f..353c824 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -15,6 +15,7 @@  LIBGLIB2_INSTALL_TARGET = YES
 LIBGLIB2_INSTALL_STAGING_OPT = DESTDIR=$(STAGING_DIR) LDFLAGS=-L$(STAGING_DIR)/usr/lib install
 
 LIBGLIB2_CONF_ENV = \
+		CPPFLAGS=-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 \
 		ac_cv_func_posix_getpwuid_r=yes glib_cv_stack_grows=no \
 		glib_cv_uscore=no ac_cv_func_strtod=yes \
 		ac_fsusage_space=yes fu_cv_sys_stat_statfs2_bsize=yes \