Commit 192d8c17 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

Fix target and endianness detection on PPC/s390

This patch fixes machine detection on nodejs where the build
pipeline may not use gn and as a result certain macros
will not get set.

More details can be found in this comment:
https://github.com/nodejs/node-v8/issues/223#issuecomment-1180505313

Change-Id: I0cbfc736b28bc130acbdc2cf2e27bbf687be463c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3757944Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#81667}
parent e8610ab8
......@@ -670,6 +670,11 @@ V8 shared library set USING_V8_SHARED.
#define V8_TARGET_ARCH_PPC64 1
#elif defined(_ARCH_PPC)
#define V8_TARGET_ARCH_PPC 1
#elif defined(__s390__)
#define V8_TARGET_ARCH_S390 1
#if defined(__s390x__)
#define V8_TARGET_ARCH_S390X 1
#endif
#elif defined(__riscv) || defined(__riscv__)
#if __riscv_xlen == 64
#define V8_TARGET_ARCH_RISCV64 1
......@@ -770,7 +775,7 @@ V8 shared library set USING_V8_SHARED.
#else
#define V8_TARGET_LITTLE_ENDIAN 1
#endif
#elif __BIG_ENDIAN__ // FOR PPCGR on AIX
#elif defined(__BIG_ENDIAN__) // FOR PPCGR on AIX
#define V8_TARGET_BIG_ENDIAN 1
#elif V8_TARGET_ARCH_PPC_LE
#define V8_TARGET_LITTLE_ENDIAN 1
......@@ -784,6 +789,12 @@ V8 shared library set USING_V8_SHARED.
#endif
#elif V8_TARGET_ARCH_RISCV64
#define V8_TARGET_LITTLE_ENDIAN 1
#elif defined(__BYTE_ORDER__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define V8_TARGET_BIG_ENDIAN 1
#else
#define V8_TARGET_LITTLE_ENDIAN 1
#endif
#else
#error Unknown target architecture endianness
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment