Atomics patch to fix building on ARM (thanks to Jon Masters)

This commit is contained in:
Peter Robinson 2012-11-11 19:05:07 +00:00
parent 8a9a5e2928
commit ef98c8d527
2 changed files with 663 additions and 1 deletions

View File

@ -0,0 +1,651 @@
Binary files openmpi-1.6.3_orig/opal/asm/.asm-data.txt.swp and openmpi-1.6.3/opal/asm/.asm-data.txt.swp differ
diff -urNp openmpi-1.6.3_orig/opal/asm/base/ARM.asm openmpi-1.6.3/opal/asm/base/ARM.asm
--- openmpi-1.6.3_orig/opal/asm/base/ARM.asm 2012-04-03 10:29:44.000000000 -0400
+++ openmpi-1.6.3/opal/asm/base/ARM.asm 1969-12-31 19:00:00.000000000 -0500
@@ -1,153 +0,0 @@
-START_FILE
- TEXT
-
- ALIGN(4)
-START_FUNC(opal_atomic_mb)
- dmb
- bx lr
-END_FUNC(opal_atomic_mb)
-
-
-START_FUNC(opal_atomic_rmb)
- dmb
- bx lr
-END_FUNC(opal_atomic_rmb)
-
-
-START_FUNC(opal_atomic_wmb)
- dmb
- bx lr
-END_FUNC(opal_atomic_wmb)
-
-
-START_FUNC(opal_atomic_cmpset_32)
- LSYM(1)
- ldrex r3, [r0]
- cmp r1, r3
- bne REFLSYM(2)
- strex r12, r2, [r0]
- cmp r12, #0
- bne REFLSYM(1)
- mov r0, #1
- LSYM(2)
- movne r0, #0
- bx lr
-END_FUNC(opal_atomic_cmpset_32)
-
-
-START_FUNC(opal_atomic_cmpset_acq_32)
- LSYM(3)
- ldrex r3, [r0]
- cmp r1, r3
- bne REFLSYM(4)
- strex r12, r2, [r0]
- cmp r12, #0
- bne REFLSYM(3)
- dmb
- mov r0, #1
- LSYM(4)
- movne r0, #0
- bx lr
-END_FUNC(opal_atomic_cmpset_acq_32)
-
-
-START_FUNC(opal_atomic_cmpset_rel_32)
- LSYM(5)
- ldrex r3, [r0]
- cmp r1, r3
- bne REFLSYM(6)
- dmb
- strex r12, r2, [r0]
- cmp r12, #0
- bne REFLSYM(4)
- mov r0, #1
- LSYM(6)
- movne r0, #0
- bx lr
-END_FUNC(opal_atomic_cmpset_rel_32)
-
-#START_64BIT
-START_FUNC(opal_atomic_cmpset_64)
- push {r4-r7}
- ldrd r6, r7, [sp, #16]
- LSYM(7)
- ldrexd r4, r5, [r0]
- cmp r4, r2
- it eq
- cmpeq r5, r3
- bne REFLSYM(8)
- strexd r1, r6, r7, [r0]
- cmp r1, #0
- bne REFLSYM(7)
- mov r0, #1
- LSYM(8)
- movne r0, #0
- pop {r4-r7}
- bx lr
-END_FUNC(opal_atomic_cmpset_64)
-
-START_FUNC(opal_atomic_cmpset_acq_64)
- push {r4-r7}
- ldrd r6, r7, [sp, #16]
- LSYM(9)
- ldrexd r4, r5, [r0]
- cmp r4, r2
- it eq
- cmpeq r5, r3
- bne REFLSYM(10)
- strexd r1, r6, r7, [r0]
- cmp r1, #0
- bne REFLSYM(9)
- dmb
- mov r0, #1
- LSYM(10)
- movne r0, #0
- pop {r4-r7}
- bx lr
-END_FUNC(opal_atomic_cmpset_acq_64)
-
-
-START_FUNC(opal_atomic_cmpset_rel_64)
- push {r4-r7}
- ldrd r6, r7, [sp, #16]
- LSYM(11)
- ldrexd r4, r5, [r0]
- cmp r4, r2
- it eq
- cmpeq r5, r3
- bne REFLSYM(12)
- dmb
- strexd r1, r6, r7, [r0]
- cmp r1, #0
- bne REFLSYM(11)
- mov r0, #1
- LSYM(12)
- movne r0, #0
- pop {r4-r7}
- bx lr
-END_FUNC(opal_atomic_cmpset_rel_64)
-#END_64BIT
-
-
-START_FUNC(opal_atomic_add_32)
- LSYM(13)
- ldrex r2, [r0]
- add r2, r2, r1
- strex r3, r2, [r0]
- cmp r3, #0
- bne REFLSYM(13)
- mov r0, r2
- bx lr
-END_FUNC(opal_atomic_add_32)
-
-
-START_FUNC(opal_atomic_sub_32)
- LSYM(14)
- ldrex r2, [r0]
- sub r2, r2, r1
- strex r3, r2, [r0]
- cmp r3, #0
- bne REFLSYM(14)
- mov r0, r2
- bx lr
-END_FUNC(opal_atomic_sub_32)
diff -urNp openmpi-1.6.3_orig/opal/asm/base/ARMV5.asm openmpi-1.6.3/opal/asm/base/ARMV5.asm
--- openmpi-1.6.3_orig/opal/asm/base/ARMV5.asm 1969-12-31 19:00:00.000000000 -0500
+++ openmpi-1.6.3/opal/asm/base/ARMV5.asm 2012-11-11 00:04:19.340576499 -0500
@@ -0,0 +1,120 @@
+START_FILE
+ TEXT
+
+ ALIGN(4)
+START_FUNC(opal_atomic_mb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_mb)
+
+
+START_FUNC(opal_atomic_rmb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_rmb)
+
+
+START_FUNC(opal_atomic_wmb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_wmb)
+
+
+START_FUNC(opal_atomic_cmpset_32)
+ mov r3, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ mov r12, lr
+ ldr r3, REFLSYM(1)
+ blx r3
+ cmp r0, #0
+ movne r0, #0
+ moveq r0, #1
+ mov lr, r12
+ bx lr
+ LSYM(1)
+ .align 2
+ .word -61504
+END_FUNC(opal_atomic_cmpset_32)
+
+
+START_FUNC(opal_atomic_cmpset_acq_32)
+ mov r3, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ mov r12, lr
+ ldr r3, REFLSYM(2)
+ blx r3
+ cmp r0, #0
+ movne r0, #0
+ moveq r0, #1
+ mov lr, r12
+ bx lr
+ LSYM(2)
+ .align 2
+ .word -61504
+END_FUNC(opal_atomic_cmpset_acq_32)
+
+
+START_FUNC(opal_atomic_cmpset_rel_32)
+ mov r3, r0
+ mov r0, r1
+ mov r1, r2
+ mov r2, r3
+ mov r12, lr
+ ldr r3, REFLSYM(3)
+ blx r3
+ cmp r0, #0
+ movne r0, #0
+ moveq r0, #1
+ mov lr, r12
+ bx lr
+ LSYM(3)
+ .align 2
+ .word -61504
+END_FUNC(opal_atomic_cmpset_rel_32)
+
+START_FUNC(opal_atomic_add_32)
+ push {r4-r7}
+ mov r4, r1
+ mov r2, r0
+ mov r12, lr
+ ldr r3, REFLSYM(5)
+ LSYM(4)
+ ldr r0, [r2]
+ add r1, r0, r4
+ blx r3
+ cmp r0, #0
+ movne r0, #1
+ bne REFLSYM(4)
+ mov lr, r12
+ pop {r4-r7}
+ bx lr
+ LSYM(5)
+ .align 2
+ .word -61504
+END_FUNC(opal_atomic_add_32)
+
+
+START_FUNC(opal_atomic_sub_32)
+ push {r4-r7}
+ mov r4, r1
+ mov r2, r0
+ mov r12, lr
+ ldr r3, REFLSYM(5)
+ LSYM(6)
+ ldr r0, [r2]
+ sub r1, r0, r4
+ blx r3
+ cmp r0, #0
+ movne r0, #1
+ bne REFLSYM(4)
+ mov lr, r12
+ pop {r4-r7}
+ bx lr
+ LSYM(7)
+ .align 2
+ .word -61504
+END_FUNC(opal_atomic_sub_32)
diff -urNp openmpi-1.6.3_orig/opal/asm/base/ARMV6.asm openmpi-1.6.3/opal/asm/base/ARMV6.asm
--- openmpi-1.6.3_orig/opal/asm/base/ARMV6.asm 1969-12-31 19:00:00.000000000 -0500
+++ openmpi-1.6.3/opal/asm/base/ARMV6.asm 2012-11-10 01:14:33.560297218 -0500
@@ -0,0 +1,153 @@
+START_FILE
+ TEXT
+
+ ALIGN(4)
+START_FUNC(opal_atomic_mb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_mb)
+
+
+START_FUNC(opal_atomic_rmb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_rmb)
+
+
+START_FUNC(opal_atomic_wmb)
+ mcr p15, 0, r0, c7, c10, 5
+ bx lr
+END_FUNC(opal_atomic_wmb)
+
+
+START_FUNC(opal_atomic_cmpset_32)
+ LSYM(1)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(2)
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(1)
+ mov r0, #1
+ LSYM(2)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_32)
+
+
+START_FUNC(opal_atomic_cmpset_acq_32)
+ LSYM(3)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(4)
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(3)
+ dmb
+ mov r0, #1
+ LSYM(4)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_acq_32)
+
+
+START_FUNC(opal_atomic_cmpset_rel_32)
+ LSYM(5)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(6)
+ dmb
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(4)
+ mov r0, #1
+ LSYM(6)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_rel_32)
+
+#START_64BIT
+START_FUNC(opal_atomic_cmpset_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(7)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(8)
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(7)
+ mov r0, #1
+ LSYM(8)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_64)
+
+START_FUNC(opal_atomic_cmpset_acq_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(9)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(10)
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(9)
+ dmb
+ mov r0, #1
+ LSYM(10)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_acq_64)
+
+
+START_FUNC(opal_atomic_cmpset_rel_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(11)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(12)
+ dmb
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(11)
+ mov r0, #1
+ LSYM(12)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_rel_64)
+#END_64BIT
+
+
+START_FUNC(opal_atomic_add_32)
+ LSYM(13)
+ ldrex r2, [r0]
+ add r2, r2, r1
+ strex r3, r2, [r0]
+ cmp r3, #0
+ bne REFLSYM(13)
+ mov r0, r2
+ bx lr
+END_FUNC(opal_atomic_add_32)
+
+
+START_FUNC(opal_atomic_sub_32)
+ LSYM(14)
+ ldrex r2, [r0]
+ sub r2, r2, r1
+ strex r3, r2, [r0]
+ cmp r3, #0
+ bne REFLSYM(14)
+ mov r0, r2
+ bx lr
+END_FUNC(opal_atomic_sub_32)
diff -urNp openmpi-1.6.3_orig/opal/asm/base/ARMV7.asm openmpi-1.6.3/opal/asm/base/ARMV7.asm
--- openmpi-1.6.3_orig/opal/asm/base/ARMV7.asm 1969-12-31 19:00:00.000000000 -0500
+++ openmpi-1.6.3/opal/asm/base/ARMV7.asm 2012-04-03 10:29:44.000000000 -0400
@@ -0,0 +1,153 @@
+START_FILE
+ TEXT
+
+ ALIGN(4)
+START_FUNC(opal_atomic_mb)
+ dmb
+ bx lr
+END_FUNC(opal_atomic_mb)
+
+
+START_FUNC(opal_atomic_rmb)
+ dmb
+ bx lr
+END_FUNC(opal_atomic_rmb)
+
+
+START_FUNC(opal_atomic_wmb)
+ dmb
+ bx lr
+END_FUNC(opal_atomic_wmb)
+
+
+START_FUNC(opal_atomic_cmpset_32)
+ LSYM(1)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(2)
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(1)
+ mov r0, #1
+ LSYM(2)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_32)
+
+
+START_FUNC(opal_atomic_cmpset_acq_32)
+ LSYM(3)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(4)
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(3)
+ dmb
+ mov r0, #1
+ LSYM(4)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_acq_32)
+
+
+START_FUNC(opal_atomic_cmpset_rel_32)
+ LSYM(5)
+ ldrex r3, [r0]
+ cmp r1, r3
+ bne REFLSYM(6)
+ dmb
+ strex r12, r2, [r0]
+ cmp r12, #0
+ bne REFLSYM(4)
+ mov r0, #1
+ LSYM(6)
+ movne r0, #0
+ bx lr
+END_FUNC(opal_atomic_cmpset_rel_32)
+
+#START_64BIT
+START_FUNC(opal_atomic_cmpset_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(7)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(8)
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(7)
+ mov r0, #1
+ LSYM(8)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_64)
+
+START_FUNC(opal_atomic_cmpset_acq_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(9)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(10)
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(9)
+ dmb
+ mov r0, #1
+ LSYM(10)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_acq_64)
+
+
+START_FUNC(opal_atomic_cmpset_rel_64)
+ push {r4-r7}
+ ldrd r6, r7, [sp, #16]
+ LSYM(11)
+ ldrexd r4, r5, [r0]
+ cmp r4, r2
+ it eq
+ cmpeq r5, r3
+ bne REFLSYM(12)
+ dmb
+ strexd r1, r6, r7, [r0]
+ cmp r1, #0
+ bne REFLSYM(11)
+ mov r0, #1
+ LSYM(12)
+ movne r0, #0
+ pop {r4-r7}
+ bx lr
+END_FUNC(opal_atomic_cmpset_rel_64)
+#END_64BIT
+
+
+START_FUNC(opal_atomic_add_32)
+ LSYM(13)
+ ldrex r2, [r0]
+ add r2, r2, r1
+ strex r3, r2, [r0]
+ cmp r3, #0
+ bne REFLSYM(13)
+ mov r0, r2
+ bx lr
+END_FUNC(opal_atomic_add_32)
+
+
+START_FUNC(opal_atomic_sub_32)
+ LSYM(14)
+ ldrex r2, [r0]
+ sub r2, r2, r1
+ strex r3, r2, [r0]
+ cmp r3, #0
+ bne REFLSYM(14)
+ mov r0, r2
+ bx lr
+END_FUNC(opal_atomic_sub_32)
diff -urNp openmpi-1.6.3_orig/opal/asm/Makefile.am openmpi-1.6.3/opal/asm/Makefile.am
--- openmpi-1.6.3_orig/opal/asm/Makefile.am 2012-04-03 10:29:44.000000000 -0400
+++ openmpi-1.6.3/opal/asm/Makefile.am 2012-11-11 02:32:34.933714963 -0500
@@ -65,7 +65,9 @@ EXTRA_DIST = \
base/default.conf \
base/ALPHA.asm \
base/AMD64.asm \
- base/ARM.asm \
+ base/ARMV5.asm \
+ base/ARMV6.asm \
+ base/ARMV7.asm \
base/IA32.asm \
base/IA64.asm \
base/MIPS.asm \
diff -urNp openmpi-1.6.3_orig/opal/asm/Makefile.in openmpi-1.6.3/opal/asm/Makefile.in
--- openmpi-1.6.3_orig/opal/asm/Makefile.in 2012-10-24 11:41:12.000000000 -0400
+++ openmpi-1.6.3/opal/asm/Makefile.in 2012-11-11 02:33:07.069715466 -0500
@@ -1154,7 +1154,9 @@ EXTRA_DIST = \
base/default.conf \
base/ALPHA.asm \
base/AMD64.asm \
- base/ARM.asm \
+ base/ARMV5.asm \
+ base/ARMV6.asm \
+ base/ARMV7.asm \
base/IA32.asm \
base/IA64.asm \
base/MIPS.asm \
diff -urNp openmpi-1.6.3_orig/opal/config/opal_config_asm.m4 openmpi-1.6.3/opal/config/opal_config_asm.m4
--- openmpi-1.6.3_orig/opal/config/opal_config_asm.m4 2012-05-02 09:04:04.000000000 -0400
+++ openmpi-1.6.3/opal/config/opal_config_asm.m4 2012-11-11 02:31:38.429714062 -0500
@@ -904,6 +904,7 @@ AC_DEFUN([OMPI_CONFIG_ASM],[
ompi_cv_asm_arch="ARM"
OPAL_ASM_SUPPORT_64BIT=1
OPAL_ASM_ARM_VERSION=7
+ cp -f "$top_ompi_builddir/opal/asm/base/ARMV7.asm" "$top_ompi_builddir/opal/asm/base/ARM.asm"
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
OMPI_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
@@ -913,6 +914,7 @@ AC_DEFUN([OMPI_CONFIG_ASM],[
ompi_cv_asm_arch="ARM"
OPAL_ASM_SUPPORT_64BIT=0
OPAL_ASM_ARM_VERSION=6
+ cp -f "$top_ompi_builddir/opal/asm/base/ARMV6.asm" "$top_ompi_builddir/opal/asm/base/ARM.asm"
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
OMPI_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'
@@ -923,6 +925,7 @@ AC_DEFUN([OMPI_CONFIG_ASM],[
ompi_cv_asm_arch="ARM"
OPAL_ASM_SUPPORT_64BIT=0
OPAL_ASM_ARM_VERSION=5
+ cp -f "$top_ompi_builddir/opal/asm/base/ARMV5.asm" "$top_ompi_builddir/opal/asm/base/ARM.asm"
AC_DEFINE_UNQUOTED([OPAL_ASM_ARM_VERSION], [$OPAL_ASM_ARM_VERSION],
[What ARM assembly version to use])
OMPI_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)'

View File

@ -19,7 +19,7 @@
Name: openmpi%{?_cc_name_suffix}
Version: 1.6.3
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Open Message Passing Interface
Group: Development/Libraries
License: BSD, MIT and Romio
@ -39,6 +39,8 @@ Patch0: openmpi-removed.patch
Patch1: openmpi-ltdl.patch
# Patch to fix libmpi_f90.so so version
Patch2: openmpi-f90sover.patch
# Patch to fix build on ARM
Patch3: openmpi-1.6.3-arm-atomics.patch
BuildRequires: gcc-gfortran
#sparc 64 doesn't have valgrind
@ -118,11 +120,16 @@ Contains development headers and libraries for openmpi
%patch0 -p1 -b .removed
%patch1 -p1 -b .ltdl
%patch2 -p1 -b .f90sover
%patch3 -p1 -b .arm-atomics
# Make sure we don't use the local libltdl library
rm -r opal/libltdl
%build
./configure --prefix=%{_libdir}/%{name} \
%ifarch armv5tel
--build=armv5tel-redhat-linux-gnueabi \
--host=armv5tel-redhat-linux-gnueabi \
%endif
--mandir=%{_mandir}/%{namearch} \
--includedir=%{_includedir}/%{namearch} \
--sysconfdir=%{_sysconfdir}/%{namearch} \
@ -147,6 +154,7 @@ rm -r opal/libltdl
CXXFLAGS="%{?opt_cxxflags} %{!?opt_cxxflags:$RPM_OPT_FLAGS}" \
FC=%{opt_fc} FCFLAGS="%{?opt_fcflags} %{!?opt_fcflags:$RPM_OPT_FLAGS}" \
F77=%{opt_f77} FFLAGS="%{?opt_fflags} %{!?opt_fflags:$RPM_OPT_FLAGS}"
make %{?_smp_mflags}
%install
@ -235,6 +243,9 @@ make check
%{_sysconfdir}/rpm/macros.%{namearch}
%changelog
* Sun Nov 11 2012 Peter Robinson <pbrobinson@fedoraproject.org> 1.6.3-5
- Atomics patch to fix building on ARM (thanks to Jon Masters)
* Mon Nov 5 2012 Orion Poplawski <orion@cora.nwra.com> 1.6.3-4
- Add patch to fix libmpi_f90.so version
- Add patch to link tests with system libltdl