[packages/tbb] do not use sse2 mfence instructions on ia32; fedora patch

glen glen at pld-linux.org
Sat Oct 5 19:13:13 CEST 2013


commit eb5b42b51e9db9482bcda864621762d95a4ab4b2
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Oct 5 20:12:43 2013 +0300

    do not use sse2 mfence instructions on ia32; fedora patch

 mfence.patch | 21 +++++++++++++++++++++
 tbb.spec     | 11 +++++------
 2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/tbb.spec b/tbb.spec
index b0828c2..56323e7 100644
--- a/tbb.spec
+++ b/tbb.spec
@@ -23,13 +23,14 @@ Source5:	%{name}.pc.in
 Source6:	%{name}malloc.pc.in
 Source7:	%{name}malloc_proxy.pc.in
 Patch1:		%{name}-cxxflags.patch
+Patch2:		mfence.patch
 URL:		http://www.threadingbuildingblocks.org/
 BuildRequires:	libstdc++-devel
 BuildRequires:	net-tools
 BuildRequires:	sed >= 4.0
 # We need "arch" and "hostname" binaries:
 BuildRequires:	util-linux
-ExclusiveArch:	%{ix86} %{x8664} ia64
+ExclusiveArch:	%{ix86} %{x8664} %{arm} ia64 ppc ppc64
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -84,7 +85,8 @@ Building Blocks (TBB).
 
 %prep
 %setup -q -n %{sourcebasename}
-#%patch1 -p1
+%patch1 -p1
+%patch2 -p1
 
 cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
 
@@ -100,9 +102,7 @@ sed -i -e 's/-march=pentium4//' build/linux.gcc.inc
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
-
-cp -p %{SOURCE5} %{SOURCE6} %{SOURCE7} .
+install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir},%{_pkgconfigdir}}
 
 cd build/obj_release
 for file in tbb tbbmalloc tbbmalloc_proxy; do
@@ -117,7 +117,6 @@ find tbb -type f -name '*.h' -exec \
 	install -p -D -m 644 {} $RPM_BUILD_ROOT%{_includedir}/{} ';'
 cd -
 
-install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
 for pc in tbb.pc tbbmalloc.pc tbbmalloc_proxy.pc; do
 	in=$pc.in
 	# fail if obsolete
diff --git a/mfence.patch b/mfence.patch
new file mode 100644
index 0000000..a463bc9
--- /dev/null
+++ b/mfence.patch
@@ -0,0 +1,21 @@
+diff -up tbb40_20110809oss/include/tbb/machine/linux_ia32.h\~ tbb40_20110809oss/include/tbb/machine/linux_ia32.h
+--- tbb40_20110809oss/include/tbb/machine/linux_ia32.h~	2011-08-24 15:51:56.000000000 +0200
++++ tbb40_20110809oss/include/tbb/machine/linux_ia32.h	2011-10-18 15:04:01.994271994 +0200
+@@ -42,7 +42,14 @@
+ #define __TBB_control_consistency_helper() __TBB_compiler_fence()
+ #define __TBB_acquire_consistency_helper() __TBB_compiler_fence()
+ #define __TBB_release_consistency_helper() __TBB_compiler_fence()
+-#define __TBB_full_memory_fence()          __asm__ __volatile__("mfence": : :"memory")
++#define __TBB_full_memory_fence()          __TBB_full_memory_fence_imp()
++inline void __TBB_full_memory_fence_imp() {
++    int tmp;
++    __asm__ __volatile__("xchg %0,%0"
++			 : "=r"(tmp)
++			 : "r"(tmp)
++			 : "memory");
++}
+ 
+ #if __TBB_ICC_ASM_VOLATILE_BROKEN
+ #define __TBB_VOLATILE
+
+Diff finished.  Tue Oct 18 15:04:09 2011
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tbb.git/commitdiff/eb5b42b51e9db9482bcda864621762d95a4ab4b2



More information about the pld-cvs-commit mailing list