ibmruntimes / node

This repository is moving to: https://github.com/ibmruntimes/node-zos
69 stars 24 forks source link

Node.js “Illegal instruction” on PowerPC 440EP #65

Closed sokovykh closed 8 years ago

sokovykh commented 8 years ago

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           : 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

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
sokovykh commented 8 years ago

Can I run node.js on ppc32 ?

sxa commented 8 years ago

Although we don't build it on PPC32 I think it still works if you build it yourself. However your issue is more likely to be that the V8 is built with instructions that require power5+ so it won't support anything that old unfortunately.

sokovykh commented 8 years ago

So... needed power5+ instructions isn't supported by PowerPC 440ep or PowerPC e300c3. Do I understant you correctly? or can I build V8 without instructions that require power5+ ?

mhdawson commented 8 years ago

Believe the issue will be that your processor does not support the required instructions. See https://github.com/ibmruntimes/v8ppc/issues/100 for more details.

sxa commented 8 years ago

@zzzlodey I believe so. While I'm not an expert on that generation of chips, from looking around the e300 seems to be a modified PowerPC603e core, and the 440ep is also based on the older PowerPC cores, so won't have the required POWER5+ instructions available.

sokovykh commented 8 years ago

@sxa555 @mhdawson this is very sad news :-( Andrew Low wrote that we can build V8 in special simulation mode, may it can help?

andrewlow commented 8 years ago

Yes - simulation mode will work --- but it will be very very slow.

This issue should be closed (but I'll leave that up to @mhdawson). It is not a Node.js issue - but a problem in the v8 dependency. There are already a number of open issues documenting the problem AND paths to a solution.

It is possible to enhance the code to support older / variations of the PowerPC specification, but so far no one has come forward with the skills or the business case motivation to do so.

sokovykh commented 8 years ago

@andrewlow Thanks Andrew! I'm going to try simulation mode...

mhdawson commented 8 years ago

Closing, please re-open if you feel it should still be open.