ibmruntimes / v8ppc

Port of Google V8 javascript engine to PowerPC®
Other
94 stars 19 forks source link

Differences between Power and PowerPC assembler: how to implement Darwin PPC? #131

Open barracuda156 opened 2 years ago

barracuda156 commented 2 years ago

Does anyone have an experience with PPC assembler of Apple Darwin? I want to build v8 for 10.5.8 and 10.6 for ppc arch. Any advice will be greatly appreciated.

kapouer commented 2 years ago

FYI node 16 builds on ppc64 here meaning that at least v8 does build on the archs supported here: https://wiki.debian.org/PPC64. EDIT: or a subset of them... machines used for builds are typically not the oldest ones.

barracuda156 commented 2 years ago

FYI node 16 builds on ppc64 here meaning that at least v8 does build on the archs supported here: https://wiki.debian.org/PPC64. EDIT: or a subset of them... machines used for builds are typically not the oldest ones.

@kapouer Thank you for replying. Yes, I am aware that on Linux (and FreeBSD) PPC pretty much everything builds. Unfortunately, it does not automatically translate into support of Darwin PPC. Say, while the latest gcc builds on powerpc-apple-darwin, clang does not, and llvm remains half-broken due to ABI incompatibility.

barracuda156 commented 2 years ago

Trying to build now. At the moment it fails on a bunch of static asserts:

:info:build ../deps/v8/src/execution/isolate-data.h:224:70: error: static assertion failed: offsetof(IsolateData, virtual_call_target_register_) == kVirtualCallTargetRegisterOffset
:info:build   224 |   STATIC_ASSERT(offsetof(IsolateData, virtual_call_target_register_) ==
:info:build       |                                                                      ^
:info:build ../deps/v8/src/base/macros.h:199:43: note: in definition of macro 'STATIC_ASSERT'
:info:build   199 | #define STATIC_ASSERT(test) static_assert(test, #test)
:info:build       |                                           ^~~~
:info:build ../deps/v8/src/execution/isolate-data.h:224:70: note: the comparison reduces to '(18764 == 18760)'
:info:build   224 |   STATIC_ASSERT(offsetof(IsolateData, virtual_call_target_register_) ==
:info:build       |                                                                      ^
:info:build ../deps/v8/src/base/macros.h:199:43: note: in definition of macro 'STATIC_ASSERT'
:info:build   199 | #define STATIC_ASSERT(test) static_assert(test, #test)
:info:build       |                                           ^~~~
:info:build ../deps/v8/src/execution/isolate-data.h:232:63: error: static assertion failed: offsetof(IsolateData, fast_c_call_caller_fp_) == kFastCCallCallerFPOffset
:info:build   232 |   STATIC_ASSERT(offsetof(IsolateData, fast_c_call_caller_fp_) ==
:info:build       |                                                               ^
:info:build ../deps/v8/src/base/macros.h:199:43: note: in definition of macro 'STATIC_ASSERT'
:info:build   199 | #define STATIC_ASSERT(test) static_assert(test, #test)
:info:build       |                                           ^~~~
:info:build ../deps/v8/src/execution/isolate-data.h:232:63: note: the comparison reduces to '(18768 == 18764)'
:info:build   232 |   STATIC_ASSERT(offsetof(IsolateData, fast_c_call_caller_fp_) ==
kapouer commented 2 years ago

It's a lost battle, v8 dropped support for big endian ppc. Unless you're actually on a little endian ppc ?

barracuda156 commented 2 years ago

It's a lost battle, v8 dropped support for big endian ppc. Unless you're actually on a little endian ppc ?

@kapouer There is a branch of nodejs12 with support of AIX and ppc32: https://github.com/nodejs/node/issues/30323#issuecomment-1209571050 It needs additional fixes for Darwin, and this is what I am trying at the moment.

Apparently nodejs16 also has (partial?) support for PPC BE: https://github.com/jhamby/void-packages/tree/master/srcpkgs/nodejs/patches

Some extra support for G4 may be forward-ported from here: https://github.com/andrewlow/v8ppc/tree/g4compat

I mean, we will not get the bleeding edge latest v8 and nodejs, but getting relatively recent versions fixed gonna be good enough.