Bug#638623: iceweasel: FTBFS on s390x / JavaScript broken on 64-bit big endian

Aurelien Jarno aurel32 at debian.org
Sat Aug 20 10:22:28 UTC 2011


Source: iceweasel
Version: 6.0-2
Severity: important
Tags: patch

iceweasel fails to build from source on s390x for two reasons. First a
case is missing to detect s390x as a 64-bit platform, and secondly 
because JavaScript is broken on 64-bit big-endian, causing hangs in the
testsuite. The patch below addresses both this issues. 

The first part is almost trivial, the only things to know is that 
__s390__ matches both s390 and s390x, so __s390x__ has to be placed
first.

The second part is more complex, so I have added an explanation at the
top of the patch, and report the issue upstream:

  https://bugzilla.mozilla.org/show_bug.cgi?id=680652

Would it be possible to include this patch in the next upload? Thanks in 
advance.

diff -Nru iceweasel-6.0/debian/patches/porting/Add-mips-hppa-ia64-s390-and-sparc-defines-in-ipc-chr.patch iceweasel-6.0/debian/patches/porting/Add-mips-hppa-ia64-s390-and-sparc-defines-in-ipc-chr.patch
--- iceweasel-6.0/debian/patches/porting/Add-mips-hppa-ia64-s390-and-sparc-defines-in-ipc-chr.patch	2011-08-15 15:33:46.000000000 +0000
+++ iceweasel-6.0/debian/patches/porting/Add-mips-hppa-ia64-s390-and-sparc-defines-in-ipc-chr.patch	2011-08-19 07:00:54.000000000 +0000
@@ -12,7 +12,7 @@
 index f7293d9..3536d1c 100644
 --- a/ipc/chromium/src/build/build_config.h
 +++ b/ipc/chromium/src/build/build_config.h
-@@ -60,6 +60,21 @@
+@@ -60,6 +60,24 @@
  #elif defined(__ppc__) || defined(__powerpc__)
  #define ARCH_CPU_PPC 1
  #define ARCH_CPU_32_BITS 1
@@ -25,6 +25,9 @@
 +#elif defined(__ia64__)
 +#define ARCH_CPU_IA64 1
 +#define ARCH_CPU_64_BITS 1
++#elif defined(__s390x__)
++#define ARCH_CPU_S390X 1
++#define ARCH_CPU_64_BITS 1
 +#elif defined(__s390__)
 +#define ARCH_CPU_S390 1
 +#define ARCH_CPU_32_BITS 1
diff -Nru iceweasel-6.0/debian/patches/porting/Fix-js-engine-on-64-bit-big-endian.patch iceweasel-6.0/debian/patches/porting/Fix-js-engine-on-64-bit-big-endian.patch
--- iceweasel-6.0/debian/patches/porting/Fix-js-engine-on-64-bit-big-endian.patch	1970-01-01 00:00:00.000000000 +0000
+++ iceweasel-6.0/debian/patches/porting/Fix-js-engine-on-64-bit-big-endian.patch	2011-08-19 20:04:47.000000000 +0000
@@ -0,0 +1,48 @@
+From: Aurelien Jarno <aurel32 at debian.org>
+Date: Fri, 19 Aug 2011 21:53:45 +0200
+Subject: Fix JavaScript Engine on 64-bit big endian
+
+On 64-bit architectures, jsval is represented as an union mapping 
+double, 32- or 64-bit values. It uses the IEEE754 denormalized number 
+representation to encode the type of the variable when it is not a float
+value. That's why the tag part is exactly at the same place and location
+than the sign + exponent in a 64-bit double value, and the payload is 
+exactly at the same place than the mantissa.
+
+However this way only works for little-endian machines. On big-endian 
+machines the payload overrides the sign+exponent and the tag overrides
+the mantissa. Moreover all the 64-bit macros in jsval.h assume a little
+endian order.
+
+The patch below tries to fix that by modifying the jsval layout to make
+it little-endian (at the 32-bit word level), by swapping the two 32-bit
+words. For that it uses dummy 32-bit values in an anonymous structure to
+force the location of the other 32-bit values. With this patch, the 
+JavaScript testsuite gives the same result than on a 64-bit little 
+endian machine (s390x versus amd64).
+
+
+--- iceweasel-6.0.orig/js/src/jsval.h
++++ iceweasel-6.0/js/src/jsval.h
+@@ -351,9 +351,18 @@ typedef union jsval_layout
+     } debugView;
+     struct {
+         union {
+-            int32          i32;
+-            uint32         u32;
+-            JSWhyMagic     why;
++            struct {
++                int32      dummy1;
++                int32      i32;
++            };
++            struct {
++                uint32     dummy2;
++                uint32     u32;
++            };
++            struct {
++                JSWhyMagic dummy3;
++                JSWhyMagic why;
++            };
+             jsuword        word;
+         } payload;
+     } s;
diff -Nru iceweasel-6.0/debian/patches/series iceweasel-6.0/debian/patches/series
--- iceweasel-6.0/debian/patches/series	2011-08-15 15:46:35.000000000 +0000
+++ iceweasel-6.0/debian/patches/series	2011-08-19 20:16:06.000000000 +0000
@@ -29,6 +29,7 @@
 porting/Allow-ARMv4T-in-nanojit.patch
 porting/Allow-ipc-code-to-build-on-GNU-kfreebsd.patch
 porting/Allow-ipc-code-to-build-on-GNU-Hurd.patch
+porting/Fix-js-engine-on-64-bit-big-endian.patch
 prefs/Remove-general.useragent.locale-prefs-from-firefox-..patch
 prefs/Enable-intl.locale.matchOS-and-report-the-locale-cor.patch
 prefs/Set-javascript.options.showInConsole.patch


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

Kernel: Linux 3.0.0-1-s390x (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash





More information about the pkg-mozilla-maintainers mailing list