Bug#897178: mozjs52: more fixes for ia64

Jason Duerstock <[email protected]>
Newsgroups gmane.linux.debian.ports.ia64
Message-ID <152500778022.17393.4344056936701760128.reportbug__33225.2679778778$1525007961$gmane$org@deb-ia64.gallaudet.edu>
Source: mozjs52
Severity: normal
Tags: patch
User: [email protected]
Usertags: ia64

Dear Maintainer,

Attached please find patches to let mozjs52 build on ia64, and (mostly) pass the test suite.
ia64 currently requires -G0 for linking, but crashes if the current *MAINT_APPEND strings are
used.  Also, the memory allocation fails because the address space randomizer does not
take into account ia64 memory allocation.


-- System Information:
Debian Release: buster/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: ia64

Kernel: Linux 3.14-0.bpo.2-mckinley (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
mozjs52.debian.patch (text/plain, 1.4 KB)
--- debian/test.sh.orig	2018-04-29 08:55:47.958055376 -0400
+++ debian/test.sh	2018-04-29 08:59:29.181143034 -0400
@@ -28,6 +28,9 @@
 		(s390x|ppc64)
 			echo "Ignoring test failure, https://bugs.debian.org/878286"
 			;;
+		(ia64)
+			echo "Ignoring test failure, https://bugs.debian.org/897117"
+			;;
 		(*)
 			echo "Test failure is considered serious, causing FTBFS"
 			exit 1
--- debian/rules.orig	2018-04-29 09:00:41.632848488 -0400
+++ debian/rules	2018-04-29 09:02:53.504307305 -0400
@@ -17,8 +17,15 @@
 SRCDIR = $(CURDIR)/js/src
 CONFIGURE_FLAGS =
 
-DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks
-DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks
+# ia64 currently has toolchain issues, so relax the link optimization
+# -fno-schedule-insns2 breaks gcc on ia64, so leave it enabled
+ifneq (,$(findstring $(DEB_BUILD_ARCH),ia64))
+	DEB_CFLAGS_MAINT_APPEND += -G0
+	DEB_CXXFLAGS_MAINT_APPEND += -G0
+else
+	DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks
+	DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns2 -fno-lifetime-dse -fno-delete-null-pointer-checks
+endif
 ifneq (,$(findstring $(DEB_BUILD_ARCH),armel armhf))
         DEB_CFLAGS_MAINT_APPEND += -fno-schedule-insns
         DEB_CXXFLAGS_MAINT_APPEND += -fno-schedule-insns
mozjs52.ia64-support.patch (text/plain, 829 B)
--- mozjs52-52.3.1/js/src/jit/ProcessExecutableMemory.cpp	2017-08-08 06:25:50.000000000 -0400
+++ mozjs52.fixed/js/src/jit/ProcessExecutableMemory.cpp	2018-04-27 09:30:47.390494330 -0400
@@ -290,8 +290,13 @@
     void* randomAddr = ComputeRandomAllocationAddress();
     void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON,
                                      -1, 0, "js-executable-memory");
-    if (p == MAP_FAILED)
-        return nullptr;
+    if (p == MAP_FAILED) {
+        // the comment above appears to be incorrect, so retry without the hint
+        p = MozTaggedAnonymousMmap(NULL, bytes, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+                                     -1, 0, "js-executable-memory");
+        if (p == MAP_FAILED) 
+            return nullptr;
+    }
     return p;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.