4

I can't run node.js on PowerPC 440EP, I get only error "Illegal instruction".

Hardware info:

cat /proc/cpuinfo
processor       : 0
cpu             : 440EP Rev. C
clock           : 533.333332MHz
revision        : 24.212 (pvr 4222 18d4)
bogomips        : 1066.66
timebase        : 533333332
platform        : CPU440EP
model           : micran,cpu440
Memory          : 128 MB

LD_SHOW_AUXV=1 /bin/true
AT_DCACHEBSIZE:  0x20
AT_ICACHEBSIZE:  0x20
AT_UCACHEBSIZE:  0x0
AT_SYSINFO_EHDR: 0x100000
AT_HWCAP:        booke mmu fpu ppc32
AT_PAGESZ:       4096
AT_CLKTCK:       100
AT_PHDR:         0x10000034
AT_PHENT:        32
AT_PHNUM:        8
AT_BASE:         0x48000000
AT_FLAGS:        0x0
AT_ENTRY:        0x1000446c
AT_UID:          0
AT_EUID:         0
AT_GID:          0
AT_EGID:         0
AT_SECURE:       0
AT_RANDOM:       0xbf8c04f2
AT_EXECFN:       /bin/true
AT_PLATFORM:     ppc440
AT_BASE_PLATFORM:ppc440

Software info:

I'm using powerpc-440-linux-gnu compiler (version 5.2.0) and Linux v3.6.7.

I tried to use different versions of sources:

*node-0.10-ppc* from https://github.com/ibmruntimes/node
*node-4.x-port* from https://github.com/ibmruntimes/node
*node-v4.4.7* from https://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz
*node-6.x* from https://github.com/nodejs/node

I'm using the following script for build of node.js:

#!/bin/bash

CROSS_COMPILER=powerpc-440-linux-gnu
HOST=powerpc-linux
ENDIAN=big
BUILD_PATH=/home/user/node
CFLAGS=-Os
JOBS=4

export ARCH=ppc
export CC=${CROSS_COMPILER}-gcc
export CXX=${CROSS_COMPILER}-g++
export CFLAG=${CFLAGS}
export AR=${CROSS_COMPILER}-ar r
export LINK=${CROSS_COMPILER}-g++

export PATH=${PATH}:/home/user/powerpc-440-linux-gnu/bin

./configure --without-snapshot --prefix=${BUILD_PATH} --dest-cpu=ppc --dest-os=linux

make -j ${JOBS}
make install
  • Which version of node.js should I use?
  • Do we have working portable version of node.js for PowerPC 440EP ?

Sad update

I got the following answer from issues page on https://github.com/nodejs:

[Michael Dawson] The particular chip mentioned is based on the older PowerPC cores and does not have all of the Power5+ instructions available.

1 Answers1

2

There are roughly two reasons for an illegal instruction. Either a memory corruption is derailing the control flow with the result that the CPU is trying to execute garbage/data. The other reason would be that your node.js binary contains an instruction that isn't known to your CPU aka. your cross compiler output isn't matching your CPU. Investigate if you need to pass an additional -mcpu= or -mtune= argument to the compiler (or rather to configure).

As node.js contains a just in time compiler itself there is also the third option that node.js is generating instructions not suitable for you CPU variant.

I would investigate option two first.

Frank Meerkötter
  • 2,778
  • 2
  • 20
  • 26
  • "-mcpu= or -mtune=", I already use flags CT_ARCH_CPU="440" and CT_ARCH_TUNE="440" when build crosscompiler with help crosstool-ng – Oleg Sokovykh Aug 12 '16 at 12:39
  • Hmm, that leaves option one and two. Where did you get your node.js? See that answer https://stackoverflow.com/questions/18519899/is-it-possible-to-run-nodejs-on-powerpc-based-linux – Frank Meerkötter Aug 12 '16 at 13:10
  • Yes, but it seems we need power5+ instructions isn't supported by PowerPC 440ep or PowerPC e300c3... – Oleg Sokovykh Aug 14 '16 at 06:23