- use fetch_and_add from GCC, fixes build on non-x86 arches

This commit is contained in:
Dan Horák 2013-06-14 14:05:07 +02:00
parent e5b4022dc9
commit ebc3b4d323
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
diff -up zookeeper-3.4.5/src/c/src/mt_adaptor.c.atomic zookeeper-3.4.5/src/c/src/mt_adaptor.c
--- zookeeper-3.4.5/src/c/src/mt_adaptor.c.atomic 2013-06-14 09:58:27.000000000 +0200
+++ zookeeper-3.4.5/src/c/src/mt_adaptor.c 2013-06-14 10:00:09.000000000 +0200
@@ -482,27 +482,7 @@ int32_t inc_ref_counter(zhandle_t* zh,in
int32_t fetch_and_add(volatile int32_t* operand, int incr)
{
-#ifndef WIN32
- int32_t result;
- asm __volatile__(
- "lock xaddl %0,%1\n"
- : "=r"(result), "=m"(*(int *)operand)
- : "0"(incr)
- : "memory");
- return result;
-#else
- volatile int32_t result;
- _asm
- {
- mov eax, operand; //eax = v;
- mov ebx, incr; // ebx = i;
- mov ecx, 0x0; // ecx = 0;
- lock xadd dword ptr [eax], ecx;
- lock xadd dword ptr [eax], ebx;
- mov result, ecx; // result = ebx;
- }
- return result;
-#endif
+ return __atomic_add_fetch(operand, incr, __ATOMIC_SEQ_CST);
}
// make sure the static xid is initialized before any threads started

View File

@ -1,7 +1,7 @@
%global _hardened_build 1
Name: zookeeper
Version: 3.4.5
Release: 5%{?dist}
Release: 6%{?dist}
Summary: A high-performance coordination service for distributed applications
Group: Development/Libraries
License: ASL 2.0 and BSD
@ -20,6 +20,7 @@ Patch2: %{name}-3.4.5-zktreeutil-gcc.patch
Patch3: %{name}-3.4.5-disable-cygwin-detection.patch
Patch4: %{name}-3.4.5-build-contrib.patch
Patch5: %{name}-3.4.5-add-PIE-and-RELRO.patch
Patch6: %{name}-3.4.5-atomic.patch
BuildRequires: autoconf
BuildRequires: automake
@ -144,6 +145,7 @@ find -name "*.dll" -delete
%patch3 -p0
%patch4 -p1
%patch5 -p1
%patch6 -p1
sed -i "s|<packaging>pom</packaging>|<packaging>jar</packaging>|" dist-maven/%{name}-%{version}.pom
sed -i "s|<groupId>checkstyle</groupId>|<groupId>com.puppycrawl.tools</groupId>|" dist-maven/%{name}-%{version}.pom
@ -305,6 +307,9 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
%doc LICENSE.txt NOTICE.txt src/contrib/zkpython/README
%changelog
* Fri Jun 14 2013 Dan Horák <dan[at]danny.cz> - 3.4.5-6
- use fetch_and_add from GCC, fixes build on non-x86 arches
* Tue Jun 11 2013 gil cattaneo <puntogil@libero.it> 3.4.5-5
- fixed zookeeper.so non-standard-executable-perm thanks to Björn Esser