[Pkg-javascript-devel] Bug#800410: nodejs: about some mips*
YunQiang Su
wzssyqa at gmail.com
Mon Sep 28 23:45:08 UTC 2015
Package: nodejs
Version: 4.1.0~dfsg-3
Some fix of mips64el support:
1. configure: add mips64el to valid_arch list
2. fix host_arch_cc, for mips64el, otherwise, it will
be treat as mipsel
3. mips64el, should use fp64 not fpxx or fp32
Fix of mipsel:
currently, mipsel uses fpxx and no-odd-fregs, so
__detect_fp64_mode will get FTBFS.
So don't use the asm code instead of just use configure macros.
--
YunQiang Su
-------------- next part --------------
diff --git a/debian/patches/1007_detect_mipsel.patch b/debian/patches/1007_detect_mipsel.patch
index e82b4cf..3850165 100644
--- a/debian/patches/1007_detect_mipsel.patch
+++ b/debian/patches/1007_detect_mipsel.patch
@@ -2,8 +2,10 @@ Description: upstream configure must detect mipsel
Author: Jérémy Lal <kapouer at melix.org>
Forwarded: https://github.com/nodejs/node/pull/2971
Last-Update: 2015-09-20
---- nodejs.orig/configure
-+++ nodejs/configure
+Index: nodejs-4.1.0~dfsg/configure
+===================================================================
+--- nodejs-4.1.0~dfsg.orig/configure
++++ nodejs-4.1.0~dfsg/configure
@@ -575,6 +575,7 @@ def host_arch_cc():
'__aarch64__' : 'arm64',
'__arm__' : 'arm',
@@ -12,3 +14,35 @@ Last-Update: 2015-09-20
'__mips__' : 'mips',
'__PPC64__' : 'ppc64',
'__PPC__' : 'ppc',
+Index: nodejs-4.1.0~dfsg/deps/v8/src/base/cpu.cc
+===================================================================
+--- nodejs-4.1.0~dfsg.orig/deps/v8/src/base/cpu.cc
++++ nodejs-4.1.0~dfsg/deps/v8/src/base/cpu.cc
+@@ -137,22 +137,11 @@ static uint32_t ReadELFHWCaps() {
+
+ #if V8_HOST_ARCH_MIPS
+ int __detect_fp64_mode(void) {
+- double result = 0;
+- // Bit representation of (double)1 is 0x3FF0000000000000.
+- __asm__ volatile(
+- ".set push\n\t"
+- ".set noreorder\n\t"
+- ".set oddspreg\n\t"
+- "lui $t0, 0x3FF0\n\t"
+- "ldc1 $f0, %0\n\t"
+- "mtc1 $t0, $f1\n\t"
+- "sdc1 $f0, %0\n\t"
+- ".set pop\n\t"
+- : "+m"(result)
+- :
+- : "t0", "$f0", "$f1", "memory");
+-
+- return !(result == 1);
++#ifdef FPU_MODE_FP64
++ return 1;
++#else
++ return 0;
++#endif
+ }
+
+
diff --git a/debian/patches/2016_mips64el.patch b/debian/patches/2016_mips64el.patch
new file mode 100644
index 0000000..f0131b1
--- /dev/null
+++ b/debian/patches/2016_mips64el.patch
@@ -0,0 +1,41 @@
+Index: nodejs-4.1.0~dfsg/configure
+===================================================================
+--- nodejs-4.1.0~dfsg.orig/configure
++++ nodejs-4.1.0~dfsg/configure
+@@ -27,7 +27,7 @@ parser = optparse.OptionParser()
+
+ valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
+ 'android', 'aix')
+-valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 'x32',
++valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el','ppc', 'ppc64', 'x32',
+ 'x64', 'x86')
+ valid_arm_float_abi = ('soft', 'softfp', 'hard')
+ valid_arm_fpu = ('vfp', 'vfpv2', 'vfpv3', 'neon')
+@@ -581,14 +581,16 @@ def host_arch_cc():
+ '__PPC__' : 'ppc',
+ '__x86_64__' : 'x64',
+ }
+-
++
++ if k.get('_MIPS_SIM') == '_ABI64' and k.get('__MIPSEL__') == '1':
++ return 'mips64el'
++
+ rtn = 'ia32' # default
+
+ for i in matchup:
+ if i in k and k[i] != '0':
+ rtn = matchup[i]
+ break
+-
+ return rtn
+
+
+@@ -664,7 +666,7 @@ def configure_node(o):
+
+ if target_arch == 'arm':
+ configure_arm(o)
+- elif target_arch in ('mips', 'mipsel'):
++ elif target_arch in ('mips', 'mipsel', 'mips64el'):
+ configure_mips(o)
+
+ if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
diff --git a/debian/patches/series b/debian/patches/series
index 53291d5..b5488c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ shared_can_build_without_gyp.patch
1006_arm_fpu.patch
2015_gypnoparallel.patch
1007_detect_mipsel.patch
+2016_mips64el.patch
diff --git a/debian/rules b/debian/rules
index 4083d64..f01c19d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -71,7 +71,7 @@ endif
# mips32r1 or greater, detected at runtime
# fpu 32 or 64 detected at runtime
ifeq (mips64el, $(DEB_HOST_ARCH))
-DEB_CONFIGURE_EXTRA_FLAGS += --with-mips-arch-variant=rx --with-mips-fpu-mode=fpxx
+DEB_CONFIGURE_EXTRA_FLAGS += --with-mips-arch-variant=rx --with-mips-fpu-mode=fp64
endif
ifeq (armel, $(DEB_HOST_ARCH))
More information about the Pkg-javascript-devel
mailing list