Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<node>: Illegal instruction with raspberry pi zero w #5728

Closed
godunkchen opened this issue Mar 8, 2018 · 6 comments
Closed

<node>: Illegal instruction with raspberry pi zero w #5728

godunkchen opened this issue Mar 8, 2018 · 6 comments

Comments

@godunkchen
Copy link

godunkchen commented Mar 8, 2018

Hi

Got "Illegal instruction" while executing node.
From gdb trace, it shows fault at instruction

=> 0x36e24dd8: movw r7, #53100 ; 0xcf6c

root@OpenWrt:~/sandbox# cat test.js
console.log("hello world!");
root@OpenWrt:~/sandbox# node test.js
Illegal instruction

Environment: (put here arch, model, OpenWrt version)

root@OpenWrt:~/sandbox# uname -a
Linux OpenWrt 4.9.85 #0 Tue Mar 6 07:52:13 2018 armv6l GNU/Linux
root@OpenWrt:~/sandbox# cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 9000c1
Serial          : 00000000ae06c113

Description:

root@OpenWrt:~/sandbox# gdb node test.js
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 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 "arm-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...(no debugging symbols found)...done.
"/root/sandbox/test.js" is not a core dump: File format not recognized
(gdb) run
Starting program: /usr/bin/node
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
[New LWP 4693]
[New LWP 4694]
[New LWP 4695]
[New LWP 4696]
[New LWP 4697]

Thread 1 "node" received signal SIGILL, Illegal instruction.
0x36e24dd8 in ?? ()
(gdb) bt
#0  0x36e24dd8 in ?? ()
#1  0x36e200e8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) disassemble $pc,$pc+32
Dump of assembler code from 0x36e24dd8 to 0x36e24df8:
=> 0x36e24dd8:  movw    r7, #53100      ; 0xcf6c
   0x36e24ddc:  movt    r7, #155        ; 0x9b
   0x36e24de0:  ldr     r7, [r7]
   0x36e24de4:  movw    r10, #49188     ; 0xc024
   0x36e24de8:  movt    r10, #155       ; 0x9b
   0x36e24dec:  push    {r1}            ; (str r1, [sp, #-4]!)
   0x36e24df0:  push    {r2}            ; (str r2, [sp, #-4]!)
   0x36e24df4:  ldr     r2, [r10, #1416]        ; 0x588
End of assembler dump.
@nxhack
Copy link
Contributor

nxhack commented Mar 9, 2018

Probably...
https://chromium.googlesource.com/v8/v8/+/886b259e229572257e6271c3f6d1532c510e15ef%5E%21/

Update for "chromium-v8" is done in node v7.x upper.

@nxhack
Copy link
Contributor

nxhack commented Mar 9, 2018

Tested with Raspbian Stretch and node.js official node-v6.11.2-linux-armv6l, it worked normally. There may be problems from OpenWrt something.

@nxhack
Copy link
Contributor

nxhack commented Mar 20, 2018

Raspbian:

raspberrypi:~ $ echo | gcc -dM -E - | grep ARM_ARCH
#define __ARM_ARCH_ISA_ARM 1
#define __ARM_ARCH_6__ 1
#define __ARM_ARCH_ISA_THUMB 1
#define __ARM_ARCH 6

OpenWrt (cross-env):

ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -dM -E - | grep ARM_ARCH
#define __ARM_ARCH_ISA_ARM 1
#define __ARM_ARCH_5T__ 1
#define __ARM_ARCH_ISA_THUMB 1
#define __ARM_ARCH 5
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -mcpu=arm1176jzf-s -dM -E - | grep ARM_ARCH
#define __ARM_ARCH_ISA_ARM 1
#define __ARM_ARCH_6KZ__ 1
#define __ARM_ARCH_ISA_THUMB 1
#define __ARM_ARCH 6
#define __ARM_ARCH_6ZK__ 1

@nxhack
Copy link
Contributor

nxhack commented Mar 23, 2018

Probably we can fix this.
#5800

nxhack added a commit to nxhack/packages that referenced this issue May 17, 2018
Automatic detection of the arm architecture does not work well.

http://downloads.lede-project.org/snapshots/faillogs/arm_arm1176jzf-s_vfp/packages/node/compile.txt

```
../deps/v8/src/arm/assembler-arm.cc:176:2: error: #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
 #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
   ^~~~~
```

openwrt#5728

Explicitly set cpu arch optimization flag to the compiler option so that "configure" script correctly identifies "arm version".

(Raspberry Pi Zero W)
Raspbian:
```
raspberrypi:~ $ echo | gcc -dM -E - | grep ARM_ARCH
```
OpenWrt (cross-env):
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -dM -E - | grep ARM_ARCH
```
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -mcpu=arm1176jzf-s -dM -E - | grep ARM_ARCH
```

Also specifying an option lines compactly.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
sjjgo pushed a commit to sjjgo/packages that referenced this issue Jul 1, 2018
Automatic detection of the arm architecture does not work well.

http://downloads.lede-project.org/snapshots/faillogs/arm_arm1176jzf-s_vfp/packages/node/compile.txt

```
../deps/v8/src/arm/assembler-arm.cc:176:2: error: #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
 #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
   ^~~~~
```

openwrt#5728

Explicitly set cpu arch optimization flag to the compiler option so that "configure" script correctly identifies "arm version".

(Raspberry Pi Zero W)
Raspbian:
```
raspberrypi:~ $ echo | gcc -dM -E - | grep ARM_ARCH
```
OpenWrt (cross-env):
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -dM -E - | grep ARM_ARCH
```
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -mcpu=arm1176jzf-s -dM -E - | grep ARM_ARCH
```

Also specifying an option lines compactly.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
@nxhack
Copy link
Contributor

nxhack commented Jul 10, 2018

@godunkchen
The package has been updated.
Is the problem solved?

@godunkchen
Copy link
Author

@nxhack
Sorry for late.
I've just verified it from upgrading node to version v8.11.3-1, it works fine now.

Great thanks for your contribution.

root@OpenWrt:~# opkg info node
Package: node
Version: v8.11.3-1
Depends: libc, libstdcpp, libopenssl, zlib
Status: install user installed
Section: lang
Architecture: arm_arm1176jzf-s_vfp
Size: 4462403
Filename: node_v8.11.3-1_arm_arm1176jzf-s_vfp.ipk
Description: Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
Installed-Time: 1531453633

root@OpenWrt:~# cat test.js
console.log("hello world!");

root@OpenWrt:~# node test.js
hello world!

jow- pushed a commit that referenced this issue Sep 24, 2018
Automatic detection of the arm architecture does not work well.

http://downloads.lede-project.org/snapshots/faillogs/arm_arm1176jzf-s_vfp/packages/node/compile.txt

```
../deps/v8/src/arm/assembler-arm.cc:176:2: error: #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
 #error "CAN_USE_ARMV7_INSTRUCTIONS should match CAN_USE_VFP3_INSTRUCTIONS"
   ^~~~~
```

#5728

Explicitly set cpu arch optimization flag to the compiler option so that "configure" script correctly identifies "arm version".

(Raspberry Pi Zero W)
Raspbian:
```
raspberrypi:~ $ echo | gcc -dM -E - | grep ARM_ARCH
```
OpenWrt (cross-env):
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -dM -E - | grep ARM_ARCH
```
```
ubuntu:~ $ echo | ./arm-openwrt-linux-muslgnueabi-gcc -mcpu=arm1176jzf-s -dM -E - | grep ARM_ARCH
```

Also specifying an option lines compactly.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
(cherry picked from commit 3482320)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants