I took a look at why x11/gnome/gjs build was failing on aarch64
and traced it back to spidermonkey60 attempting to give mmap
a random hint address. However it assumes 2^46 bits of the address
space is always usable on all 64 bit architectures. Since mmap
on OpenBSD will already select a suitable random address when NULL
is provided as the addr to mmap, just return nullptr from
ComputeRandomAllocationAddress() os OpenBSD's mmap can do its
job.
okay?
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/spidermonkey60/Makefile,v
retrieving revision 1.11
diff -u -p -u -r1.11 Makefile
--- Makefile 17 Aug 2019 11:02:28 -0000 1.11
+++ Makefile 25 Sep 2019 20:17:44 -0000
@@ -21,6 +21,7 @@ DISTNAME = firefox-${V}esr.source
EXTRACT_SUFX = .tar.bz2
PKGNAME = spidermonkey-${MOZILLA_VERSION}.8.0
PKGSPEC = spidermonkey->=60.0v1,<68.0v1
+REVISION = 0
EPOCH = 1
SHARED_LIBS = mozjs-60 0.0
Index: patches/patch-js_src_jit_ProcessExecutableMemory_cpp
===================================================================
RCS file: patches/patch-js_src_jit_ProcessExecutableMemory_cpp
diff -N patches/patch-js_src_jit_ProcessExecutableMemory_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-js_src_jit_ProcessExecutableMemory_cpp 25 Sep 2019
20:17:44 -0000
@@ -0,0 +1,30 @@
+$OpenBSD$
+
+Index: js/src/jit/ProcessExecutableMemory.cpp
+--- js/src/jit/ProcessExecutableMemory.cpp.orig
++++ js/src/jit/ProcessExecutableMemory.cpp
+@@ -241,7 +241,16 @@ static void DecommitPages(void* addr, size_t bytes) {
+ MOZ_CRASH("DecommitPages failed");
+ }
+ #else // !XP_WIN
++
++#ifdef __OpenBSD__
+ static void* ComputeRandomAllocationAddress() {
++ // OpenBSD aleady has random mmap and the idea that all x64 cpus
++ // have 48-bit address space is not correct. Returning nullptr
++ // allows OpenBSD do to the right thing.
++ return nullptr;
++}
++#else
++static void* ComputeRandomAllocationAddress() {
+ uint64_t rand = js::GenerateRandomSeed();
+
+ #ifdef HAVE_64BIT_BUILD
+@@ -262,6 +271,7 @@ static void* ComputeRandomAllocationAddress() {
+ uintptr_t mask = ~uintptr_t(gc::SystemPageSize() - 1);
+ return (void*)uintptr_t(rand & mask);
+ }
++#endif
+
+ static void* ReserveProcessExecutableMemory(size_t bytes) {
+ // Note that randomAddr is just a hint: if the address is not available