Repository navigation
Node fails to start on MTK7620: "Illegal instruction" #4818
Description
Activity
Can you run
gdb --args node test.js->run->disassemble $pc,$pc+32(after the SIGILL)?- addedmipsIssues and PRs related to the MIPS architecture.Issues and PRs related to the MIPS architecture.
on Jan 22, 2016 Aside, it's odd that you ran configure with
--without-sslbut the binary is linked against libcrypto and libssl.- addedbuildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.
on Jan 22, 2016 root@OpenWrt:/# cat test.js
console.log("hello");root@OpenWrt:~# gdb --args node test.js
GNU gdb (GDB) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mipsel-openwrt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from node...done.
(gdb) run
Starting program: /usr/bin/node test.js
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: File "/lib/libthread_db-0.9.33.2.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
add-auto-load-safe-path /lib/libthread_db-0.9.33.2.so
line to your configuration file "/root/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/root/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.Program received signal SIGILL, Illegal instruction.
0x00c79008 in v8::base::CPU::CPU() ()
(gdb) disassemble $pc,$pc+32
Dump of assembler code from 0xc79008 to 0xc79028:
=> 0x00c79008 <_ZN2v84base3CPUC2Ev+308>: ldc1 $f0,32(s8)
0x00c7900c <_ZN2v84base3CPUC2Ev+312>: mtc1 t0,$f1
0x00c79010 <_ZN2v84base3CPUC2Ev+316>: sdc1 $f0,32(s8)
0x00c79014 <_ZN2v84base3CPUC2Ev+320>: lui v0,0xc8
0x00c79018 <_ZN2v84base3CPUC2Ev+324>: lw a0,32(s8)
0x00c7901c <_ZN2v84base3CPUC2Ev+328>: lw a1,36(s8)
0x00c79020 <_ZN2v84base3CPUC2Ev+332>: lw a2,21216(v0)
0x00c79024 <_ZN2v84base3CPUC2Ev+336>: jal 0xe25c30 __nedf2@plt
End of assembler dump.root@OpenWrt:/usr/bin# ldd node
libdl.so.0 => /lib/libdl.so.0 (0x7702c000)
librt.so.0 => /lib/librt.so.0 (0x77018000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x76f30000)
libm.so.0 => /lib/libm.so.0 (0x76f0a000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76ee6000)
libpthread.so.0 => /lib/libpthread.so.0 (0x76ec0000)
libc.so.0 => /lib/libc.so.0 (0x76e54000)
ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x77040000)root@OpenWrt:/usr/bin# node -v
v4.1.2Are you sure the kernel has FPU emulation compiled in? Does
dmesg | grep -i fpushow anything? I believe it should show something like "Algorithmics/MIPS FPU Emulator" if FPU emulation is in fact enabled in the kernel.dmesg | grep -i fpu
no any output!
How to enable soft fpu in Openwrt 15.05?
I have select software floating piont in Openwrt, see below:
Advanced configuration options (for developers)->Target Options->[*] Use software floating point by defaultAfter
make menuconfig, you should be able to domake kernel_menuconfigand select theEnable FPU emulationoption as shown here.thanks a lot!!!!! but dmesg | grep -i fpu still no any output!!
I am sorry, does the app still crash after enabling software fpu?
From what I understand, floating point emulation on MIPS platforms was disabled several years ago: https://lists.openwrt.org/pipermail/openwrt-devel/2009-June/004562.html , So, node.js should be compiled with floating point emulation support - but, apparently, it is not. I have this same issue with CC 15.05.1 on a TP-LINK TL-WR1043ND v3 (CPU MIPS 74Kc V5.0): the binary package for Node downloaded from https://downloads.openwrt.org/chaos_calmer/15.05.1/ar71xx/generic/packages/packages/node_v0.12.7-1_ar71xx.ipk crashes on a FP instruction (swc1):
Program received signal SIGILL, Illegal instruction.
0x57e2cc10 in ?? ()
(gdb) disassemble $pc,$pc+32
Dump of assembler code from 0x57e2cc10 to 0x57e2cc30:
=> 0x57e2cc10: swc1 $f30,44(sp)
0x57e2cc14: swc1 $f31,40(sp)
0x57e2cc18: swc1 $f28,36(sp)
0x57e2cc1c: swc1 $f29,32(sp)
0x57e2cc20: swc1 $f26,28(sp)
0x57e2cc24: swc1 $f27,24(sp)
0x57e2cc28: swc1 $f24,20(sp)
0x57e2cc2c: swc1 $f25,16(sp)
End of assembler dump.
I cross compiled nodejs for a MIPSel target (without FPU but FPU emulation in the kernel) using the OpenWRT 15.05 Chaos Calmer toolchain. The target CPU is an MT7620A
I compile using:
./configure --without-snapshot --dest-cpu=mipsel --dest-os=linux --without-npm --without-ssl --without-etw --without-perfctr --with-mips-float-abi=softHowever then I run into the problem is describing.
"Illegal instruction"
on any of the js files in the test directory.
I can execute
node -v, but notnode test.js, ornode debug test.jsinformation see below: