From ce9756f19a4859b0a89c50c0c496adfa602a6917 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mjw@redhat.com>
Date: Fri, 18 Sep 2015 21:45:42 +0200
Subject: [PATCH] Add valgrind-3.11.0-arm64-libvex_test.patch

---
 valgrind-3.11.0-arm64-libvex_test.patch | 23 +++++++++++++++++++++++
 valgrind.spec                           |  5 +++++
 2 files changed, 28 insertions(+)
 create mode 100644 valgrind-3.11.0-arm64-libvex_test.patch

diff --git a/valgrind-3.11.0-arm64-libvex_test.patch b/valgrind-3.11.0-arm64-libvex_test.patch
new file mode 100644
index 0000000..5ac2dcd
--- /dev/null
+++ b/valgrind-3.11.0-arm64-libvex_test.patch
@@ -0,0 +1,23 @@
+commit b2a2361e9f8b23364819a010f01a51634ab00066
+Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
+Date:   Wed Sep 9 13:40:23 2015 +0000
+
+    libvex_test: Use arm64_[di]MinLine_lg2_szB values that make libvex happy.
+    
+    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15647 a5019735-40e9-0310-863c-91ae7b9d1cf9
+
+diff --git a/none/tests/libvex_test.c b/none/tests/libvex_test.c
+index 5718e54..57184c0 100644
+--- a/none/tests/libvex_test.c
++++ b/none/tests/libvex_test.c
+@@ -221,6 +221,10 @@ int main(int argc, char **argv)
+    // Use some values that makes AMD64 happy.
+    vta.abiinfo_both.guest_stack_redzone_size = 128;
+ 
++   // Use some values that makes ARM64 happy.
++   vta.archinfo_guest.arm64_dMinLine_lg2_szB = 6;
++   vta.archinfo_guest.arm64_iMinLine_lg2_szB = 6;
++
+    // Prepare first for a translation where guest == host
+    // We will translate the get_guest_arch function
+    vta.arch_guest                 = guest_arch;
diff --git a/valgrind.spec b/valgrind.spec
index a703de2..181a25a 100644
--- a/valgrind.spec
+++ b/valgrind.spec
@@ -58,6 +58,9 @@ Patch3: valgrind-3.9.0-ldso-supp.patch
 # Suppress glibc futex warning messages in testsuite.
 Patch4: valgrind-3.11.0-glibc-futex-message.patch
 
+# Fix libvex_test on arm64
+Patch5: valgrind-3.11.0-arm64-libvex_test.patch
+
 %if %{build_multilib}
 # Ensure glibc{,-devel} is installed for both multilib arches
 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@@ -166,6 +169,7 @@ Valgrind User Manual for details.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %build
 # We need to use the software collection compiler and binutils if available.
@@ -344,6 +348,7 @@ echo ===============END TESTING===============
 * Fri Sep 18 2015 Mark Wielaard <mjw@redhat.com>
 - Make sure some info about the system is in the build.log before check.
 - Add valgrind-3.11.0-glibc-futex-message.patch
+- Add valgrind-3.11.0-arm64-libvex_test.patch
 
 * Tue Sep 15 2015 Orion Poplawski <orion@cora.nwra.com> - 1:3.11.0-0.2.TEST1
 - Rebuild for openmpi 1.10.0