Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.17',
'v8_embedder_string': '-node.18',

##### V8 defaults for Node.js #####

Expand Down Expand Up @@ -591,6 +591,18 @@
'-maix64',
],
'conditions': [
[ 'clang==1', {
'cflags': [
'-fno-integrated-as',
'-fno-xl-pragma-pack',
'-mcpu=power9',
],
'cflags_cc': [
'-fno-integrated-as',
'-fno-xl-pragma-pack',
'-mcpu=power9',
],
}],
[ '"<(aix_variant_name)"=="OS400"', { # a.k.a. `IBM i`
'ldflags': [
'-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
Expand Down
4 changes: 2 additions & 2 deletions deps/openssl/openssl/crypto/bio/bss_dgram.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
#undef NO_RECVMMSG
#define NO_RECVMMSG
#endif
#if defined(_AIX) && !defined(_AIX72)
/* AIX >= 7.2 provides sendmmsg() and recvmmsg(). */
#if defined(_AIX)
/* Force fallback to sndmsg and recvmsg */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be made upstream as otherwise it's going to get reverted every OpenSSL upgrade we take: https://github.com/openssl/openssl/blob/72d5e8dcd2977234e47e840d2173917daa8bb0fa/crypto/bio/bss_dgram.c#L71-L72

#undef NO_RECVMMSG
#define NO_RECVMMSG
#endif
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ config("toolchain") {
if (v8_current_cpu == "ppc64") {
defines += [ "V8_TARGET_ARCH_PPC64" ]
cflags += [ "-ffp-contract=off" ]
if (current_os == "aix") {
if (current_os == "aix" and !is_clang) {
cflags += [
# Work around AIX ceil, trunc and round oddities.
"-mcpu=power5+",
Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/builtins/ppc/builtins-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4219,6 +4219,19 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size,

// If return value is on the stack, pop it to registers.
if (needs_return_buffer) {
Label done;
if (switch_to_central_stack) {
Label no_stack_change;
__ CmpU64(kOldSPRegister, Operand(0), r0);
__ beq(&no_stack_change);
__ addi(r3, kOldSPRegister,
Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize));
__ b(&done);
__ bind(&no_stack_change);
}
__ addi(r3, sp,
Operand((kStackFrameExtraParamSlot + 1) * kSystemPointerSize));
__ bind(&done);
__ LoadU64(r4, MemOperand(r3, kSystemPointerSize));
__ LoadU64(r3, MemOperand(r3));
}
Expand Down
6 changes: 3 additions & 3 deletions deps/v8/src/compiler/turboshaft/operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class InputsRepFactory {
};
};

struct EffectDimensions {
struct __attribute__((packed)) EffectDimensions {
// Produced by loads, consumed by operations that should not move before loads
// because they change memory.
bool load_heap_memory : 1;
Expand Down Expand Up @@ -621,7 +621,7 @@ static_assert(sizeof(EffectDimensions) == sizeof(EffectDimensions::Bits));
// they become more restricted in their movement. Note that calls are not the
// most side-effectful operations, as they do not leave the heap in an
// inconsistent state, so they do not need to be marked as raw heap access.
struct OpEffects {
struct __attribute__((packed)) OpEffects {
EffectDimensions produces;
EffectDimensions consumes;

Expand Down Expand Up @@ -2878,7 +2878,7 @@ struct ConstantOp : FixedArityOperationT<0, ConstantOp> {
// When result_rep is RegisterRepresentation::Compressed(), then the load does
// not decompress the value.
struct LoadOp : OperationT<LoadOp> {
struct Kind {
struct __attribute__((packed)) Kind {
// The `base` input is a tagged pointer to a HeapObject.
bool tagged_base : 1;
// The effective address might be unaligned. This is only set to true if
Expand Down
18 changes: 11 additions & 7 deletions deps/v8/src/execution/simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,17 @@ class GeneratedCode {
return fn(args...);
#else
// AIX ABI requires function descriptors (FD). Artificially create a pseudo
// FD to ensure correct dispatch to generated code. The 'volatile'
// declaration is required to avoid the compiler from not observing the
// alias of the pseudo FD to the function pointer, and hence, optimizing the
// pseudo FD declaration/initialization away.
volatile Address function_desc[] = {reinterpret_cast<Address>(fn_ptr_), 0,
0};
Signature* fn = reinterpret_cast<Signature*>(function_desc);
// FD to ensure correct dispatch to generated code.
void* function_desc[3];
Signature* fn;
asm("std %1, 0(%2)\n\t"
"li 0, 0\n\t"
"std 0, 8(%2)\n\t"
"std 0, 16(%2)\n\t"
"mr %0, %2\n\t"
: "=r"(fn)
: "r"(fn_ptr_), "r"(function_desc)
: "memory", "0");
return fn(args...);
#endif // V8_OS_ZOS
#else
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/trap-handler/handler-shared.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ namespace v8 {
namespace internal {
namespace trap_handler {

#if defined(V8_OS_AIX)
__thread bool TrapHandlerGuard::is_active_ = 0;
#else
thread_local bool TrapHandlerGuard::is_active_ = 0;
#endif

size_t gNumCodeObjects = 0;
CodeProtectionInfoListEntry* gCodeObjects = nullptr;
Expand Down
88 changes: 62 additions & 26 deletions tools/create_expfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,24 @@
# specifically for export so that they can be used
# by native add-ons.
#
# The raw symbol data is obtained by using nm on
# The raw symbol data is obtained by using dump -tov on
# the .a files which make up the node executable.
#
# -Xany processes symbols for both 32-bit and
# 64-bit (the default is for 32-bit only).
# dump -tov flags:
# -t: Display symbol table entries
# -o: Display object file headers
# -v: Display visibility information (HIDDEN/EXPORTED/PROTECTED)
# -X 32_64: Process both 32-bit and 64-bit symbols
#
# -g selects only exported symbols.
# This approach is similar to CMake's ExportImportList module for AIX:
# https://github.com/Kitware/CMake/blob/45f4742cbfe6c25c7c801e3806c8af04a2c4b09b/Modules/Platform/AIX/ExportImportList#L67-L80
#
# -C, -B and -p ensure that the output is in a
# format that can be easily parsed and converted
# into the required symbol.
#
# -C suppresses the demangling of C++ names.
# -B writes the output in BSD format.
# -p displays the info in a standard portable
# output format.
#
# Only include symbols if they are of the following
# types and don't start with a dot.
#
# T - Global text symbol.
# D - Global data symbol.
# B - Global bss symbol.
# We filter for symbols in .text, .data, .tdata, and .bss sections
# with extern or weak linkage, excluding:
# - Symbols starting with dot (internal/local symbols)
# - __sinit/__sterm (static initialization/termination)
# - __[0-9]+__ (compiler-generated symbols)
# - HIDDEN visibility symbols (to avoid linker error 0711-407)
#
# The final sort allows removal of any duplicates.
#
Expand All @@ -40,12 +35,53 @@
echo "#!." > "$2.tmp"

# Pull the symbols from the .a files.
find "$1" -name "*.a" | grep -v gtest \
| xargs nm -Xany -BCpg \
| awk '{
if ((($2 == "T") || ($2 == "D") || ($2 == "B")) &&
(substr($3,1,1) != ".")) { print $3 }
}' \
| sort -u >> "$2.tmp"
# Use dump -tov to get visibility information and exclude HIDDEN symbols.
# This prevents AIX linker error 0711-407 when addons try to import symbols
# with visibility attributes.
#
# IMPORTANT: AIX dump -tov output has a visibility column that contains either
# a visibility keyword (HIDDEN/EXPORTED/PROTECTED) or blank spaces when no
# visibility attribute is set. Since AWK splits fields on whitespace, this
# results in different field counts:
#
# With visibility keyword (8 fields after AWK splits):
# [137] m 0x00003290 .text 1 weak HIDDEN ._ZNKSt3__1...
# $1 $2 $3 $4 $5 $6 $7 $8
# | | └─ Symbol name
# | └─ Visibility (HIDDEN/EXPORTED/PROTECTED)
# └─ Linkage (weak/extern)
#
# Without visibility keyword (7 fields after AWK splits, spaces collapsed):
# [77] m 0x00000000 .text 1 weak ._ZN8simdjson...
# $1 $2 $3 $4 $5 $6 $7
# | └─ Symbol name
# └─ Linkage (weak/extern)
#
# The awk script handles both cases by using an associative array V[]
# to map field values to their export suffixes. For fields that don't match
# any key in V[], the lookup returns an empty string, which is perfect for
# handling the variable field positions caused by the blank visibility column.
#
find "$1" -name "*.a" | grep -v gtest | while read f; do

Check failure on line 65 in tools/create_expfile.sh

View workflow job for this annotation

GitHub Actions / lint-sh

/home/runner/work/node/node/tools/create_expfile.sh:65:47: read without -r will mangle backslashes.
dump -tov -X 32_64 "$f" 2>/dev/null | \
awk '
BEGIN {
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
V["HIDDEN"]=" hidden"
V["weak"]=" weak"
}
/^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|tdata|bss) +[^ ]+ +(extern|weak)( +(EXPORTED|PROTECTED|HIDDEN))?/ {
# Exclude symbols starting with dot, __sinit, __sterm, __[0-9]+__
# Also exclude HIDDEN symbols to avoid visibility attribute issues
if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
# Skip if HIDDEN visibility (can be at $(NF-1) or $(NF-2))
if ($(NF-1) != "HIDDEN" && $(NF-2) != "HIDDEN") {
print $NF V[$(NF-1)] V[$(NF-2)]
}
}
}
'
done | sort -u >> "$2.tmp"

mv -f "$2.tmp" "$2"
22 changes: 18 additions & 4 deletions tools/v8_gypfiles/toolchain.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,20 @@
'conditions': [
['OS=="aix" or OS=="os400"', {
# Work around AIX ceil, trunc and round oddities.
'cflags': [ '-mcpu=power9 -mfprnd' ],
'cflags': [ '-mcpu=power9' ],
'conditions': [
['clang==0', {
'cflags': [ '-mfprnd' ],
}],
],
}],
['OS=="aix" or OS=="os400"', {
# Work around AIX assembler popcntb bug.
'cflags': [ '-mno-popcntb' ],
'conditions': [
['clang==0', {
# Work around AIX assembler popcntb bug.
'cflags': [ '-mno-popcntb' ],
}],
],
}],
],
}], # ppc64
Expand Down Expand Up @@ -593,8 +602,13 @@
'_ALL_SOURCE=1'],
'conditions': [
[ 'v8_target_arch=="ppc64"', {
'cflags': [ '-maix64', '-fdollars-in-identifiers', '-fno-extern-tls-init' ],
'cflags': [ '-maix64', '-fdollars-in-identifiers' ],
'ldflags': [ '-maix64 -Wl,-bbigtoc' ],
'conditions': [
['clang==0', {
'cflags': [ '-fno-extern-tls-init' ],
}],
],
}],
],
}],
Expand Down
Loading