[mozjs17] add patch for 64k pages on aarch64

Dennis Gilmore ausil at fedoraproject.org
Fri Jun 6 16:16:27 UTC 2014


commit 85bc6a416038b9059a0b68c81e59f05dcdd84c34
Author: Dennis Gilmore <dennis at ausil.us>
Date:   Fri Jun 6 11:16:35 2014 -0500

    add patch for 64k pages on aarch64

 aarch64-64k-page.patch |   82 ++++++++++++++++++++++++++++++++++++++++++++++++
 mozjs17.spec           |    7 +++-
 2 files changed, 88 insertions(+), 1 deletions(-)
---
diff --git a/aarch64-64k-page.patch b/aarch64-64k-page.patch
new file mode 100644
index 0000000..6e4e619
--- /dev/null
+++ b/aarch64-64k-page.patch
@@ -0,0 +1,82 @@
+From f17bc0302100c885c84ebd06cd003aad9774cbb4 Mon Sep 17 00:00:00 2001
+From: Mark Salter <msalter at redhat.com>
+Date: Thu, 13 Mar 2014 13:16:27 -0400
+Subject: [PATCH] Fix aarch64 support for 64K pagesize
+
+A given AArch64 kernel may be using 4K or 64K pagesizes. When running
+on a kernel with 64K pagesize, this check causes an intentionally
+generated segfault:
+
+  js/src/gc/Memory.cpp:
+
+  void
+  InitMemorySubsystem()
+  {
+      if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
+         MOZ_CRASH();
+  }
+
+This happens because PageSize is fixed to 4K at build time. This mess
+has been cleaned up in mozjs-24 by eliminating the build-time PageSize
+definition. That is too intrusive for mosjs17, so just set PageSize
+to 64K at build time and eliminate the check. This will work with both
+4K and 64K aarch64 kernels.
+
+Signed-off-by: Mark Salter <msalter at redhat.com>
+---
+ js/src/gc/Heap.h     |  2 +-
+ js/src/gc/Heap.h.rej | 11 +++++++++++
+ js/src/gc/Memory.cpp |  3 +++
+ 3 files changed, 15 insertions(+), 1 deletion(-)
+ create mode 100644 js/src/gc/Heap.h.rej
+
+diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
+index 1cfd269..f4dbcda 100644
+--- a/js/src/gc/Heap.h
++++ b/js/src/gc/Heap.h
+@@ -113,7 +113,7 @@ struct Cell
+ #if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
+ const size_t PageShift = 13;
+ const size_t ArenaShift = PageShift;
+-#elif defined(__powerpc__)
++#elif defined(__powerpc__) || defined(__aarch64__)
+ const size_t PageShift = 16;
+ const size_t ArenaShift = 12;
+ #else
+diff --git a/js/src/gc/Heap.h.rej b/js/src/gc/Heap.h.rej
+new file mode 100644
+index 0000000..8b0f1b0
+--- /dev/null
++++ b/js/src/gc/Heap.h.rej
+@@ -0,0 +1,11 @@
++--- js/src/gc/Heap.h
+++++ js/src/gc/Heap.h
++@@ -113,7 +113,7 @@
++ #if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
++ const size_t PageShift = 13;
++ const size_t ArenaShift = PageShift;
++-#elif defined(__powerpc__)
+++#elif defined(__powerpc__) || defined(__aarch64__)
++ const size_t PageShift = 16;
++ const size_t ArenaShift = 12;
++ #else
+diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp
+index 5b386a2..e5ad018 100644
+--- a/js/src/gc/Memory.cpp
++++ b/js/src/gc/Memory.cpp
+@@ -302,8 +302,11 @@ GetPageFaultCount()
+ void
+ InitMemorySubsystem()
+ {
++    /* aarch64 may have 64KB or 4KB pages */
++#ifndef __aarch64__
+     if (size_t(sysconf(_SC_PAGESIZE)) != PageSize)
+         MOZ_CRASH();
++#endif
+ }
+ 
+ void *
+-- 
+1.8.5.3
+
+
diff --git a/mozjs17.spec b/mozjs17.spec
index ef4ec6e..c897f3b 100644
--- a/mozjs17.spec
+++ b/mozjs17.spec
@@ -1,7 +1,7 @@
 Summary:	JavaScript interpreter and libraries
 Name:		mozjs17
 Version:	17.0.0
-Release:	10%{?dist}
+Release:	11%{?dist}
 License:	GPLv2+ or LGPLv2+ or MPLv1.1
 Group:		Development/Languages
 URL:		http://www.mozilla.org/js/
@@ -19,6 +19,7 @@ Patch2:		mozbug746112-no-decommit-on-large-pages.patch
 Patch3:		mozjs17-0001-Add-AArch64-support.patch
 Patch4:         0001-Make-js-config.h-multiarch-compatible.patch
 Patch5:         0001-Move-JS_BYTES_PER_WORD-out-of-config.h.patch
+Patch6:         aarch64-64k-page.patch
 
 %description
 JavaScript is the Netscape-developed object scripting language used in millions
@@ -45,6 +46,7 @@ rm js/src/ctypes/libffi -rf
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1 -b .aarch64
+%patch6 -p1 -b .aarch64
 chmod a+x configure
 (cd js/src && autoconf-2.13)
 %patch5 -p1 -b .multilib-devel
@@ -88,6 +90,9 @@ rm -f %{buildroot}%{_bindir}/js17-config
 %{_includedir}/js-17.0
 
 %changelog
+* Fri Jun 06 2014 Dennis Gilmore <dennis at ausil.us> 17.0.0-11
+- add patch for 64k pages on aarch64
+
 * Tue Mar 18 2014 Colin Walters <walters at redhat.com> 17.0.0-10
 - Add patch to fix multilib conflicts with -devel headers
 


More information about the scm-commits mailing list