From: Volker Schlecht Subject: Re: [Maintainer Update] lang/node 20.13.1 To: ports@openbsd.org Cc: aisha@openbsd.org, gkoehler@openbsd.org Date: Tue, 14 May 2024 19:33:13 +0200 Update with some additional feedback from jca@ for riscv64 and without REVISION. On 2024-05-13 19:51, Volker Schlecht wrote: >I'd like to propose a switch of lang/node to their 20.x release branch, the >currently active LTS release, which is probably more likely to become compatible >with OpenSSL 3.2 eventually :-) > >The attached diff builds and works on amd64 (with IBT) and arm64 (tested >without IBT). It includes patches for riscv from jca@, so it should build there >as well. > >It would be great if someone could try it out on ppc64. FreeBSD includes two >patches for that platform, but I don't know if those are needed or even make >sense for us: > >https://raw.githubusercontent.com/freebsd/freebsd-ports/main/www/node20/files/patch-deps_v8_src_libsampler_sampler.cc >https://raw.githubusercontent.com/freebsd/freebsd-ports/main/www/node20/files/patch-deps_v8_src_codegen_ppc_constants-ppc.h > >aisha@ : could you give your WIP javascript ports a spin with that version of >node? Index: Makefile =================================================================== RCS file: /cvs/ports/lang/node/Makefile,v diff -u -p -r1.133 Makefile --- Makefile 6 May 2024 12:23:44 -0000 1.133 +++ Makefile 14 May 2024 17:29:41 -0000 @@ -5,7 +5,7 @@ USE_WXNEEDED = Yes COMMENT = JavaScript runtime built on Chrome's V8 JavaScript engine -NODE_VERSION = v18.19.1 +NODE_VERSION = v20.13.1 PLEDGE_VER = 1.1.3 DISTFILES = ${DISTNAME}-headers.tar.gz \ ${DISTNAME}.tar.xz @@ -14,7 +14,6 @@ DISTFILES.pledge = node-pledge-{}${PLEDG DISTNAME = node-${NODE_VERSION} PKGNAME = ${DISTNAME:S/v//g} EPOCH = 0 -REVISION = 0 SITES.pledge = https://github.com/qbit/node-pledge/archive/ @@ -50,7 +49,7 @@ RUN_DEPENDS = devel/gmake \ # Needed to build js_native_api_v8_internals.h TEST_DEPENDS = devel/gtest -TEST_TARGET = test-only +TEST_TARGET = check CONFIGURE_STYLE = simple CONFIGURE_SCRIPT = configure @@ -72,8 +71,8 @@ SUBST_VARS += EOPENSSL_LIB # uses a wide range of OpenSSL API and only really supports boring/openssl LIB_DEPENDS += archivers/brotli \ - devel/libuv \ net/libcares \ + devel/libuv \ textproc/icu4c \ www/nghttp2 \ security/openssl/3.1 Index: distinfo =================================================================== RCS file: /cvs/ports/lang/node/distinfo,v diff -u -p -r1.75 distinfo --- distinfo 19 Feb 2024 07:45:39 -0000 1.75 +++ distinfo 14 May 2024 17:29:41 -0000 @@ -1,6 +1,6 @@ SHA256 (node-pledge-1.1.3.tar.gz) = fEaXvLg6hYEJ69K+mgQFizf8DiJY2/DtyFJB/pEanVU= -SHA256 (node-v18.19.1-headers.tar.gz) = JrnSZiPunJa/SfEq8t34CtUfdO4hmh78TOvCl+983ps= -SHA256 (node-v18.19.1.tar.xz) = CQ+WouzeCAtrOCxtZCvKXQvkcCp4y1Vb578CsgvRbe0= +SHA256 (node-v20.13.1-headers.tar.gz) = +BYHlm1REnbuwpEjGiMp4rYm1e1z6MtaE2FqajIPYLI= +SHA256 (node-v20.13.1.tar.xz) = eReGoJAjJBy35PfWXskKqSS7ORQf97ttWh3t9970tOc= SIZE (node-pledge-1.1.3.tar.gz) = 3167 -SIZE (node-v18.19.1-headers.tar.gz) = 8716368 -SIZE (node-v18.19.1.tar.xz) = 41250068 +SIZE (node-v20.13.1-headers.tar.gz) = 8760725 +SIZE (node-v20.13.1.tar.xz) = 41770976 Index: patches/patch-Makefile =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-Makefile,v diff -u -p -r1.19 patch-Makefile --- patches/patch-Makefile 26 Sep 2023 10:44:19 -0000 1.19 +++ patches/patch-Makefile 14 May 2024 17:29:41 -0000 @@ -7,10 +7,10 @@ Index: Makefile .PHONY: install -install: all ## Installs node into $PREFIX (default=/usr/local). +install: all build-pledge ## Installs node into $PREFIX (default=/usr/local). - $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)' + $(PYTHON) tools/install.py $@ --dest-dir '$(DESTDIR)' --prefix '$(PREFIX)' .PHONY: uninstall -@@ -420,6 +420,12 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \ +@@ -433,6 +433,12 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \ # Just goes to show that recursive make really is harmful... # TODO(bnoordhuis) Force rebuild after gyp update. build-addons: | $(NODE_EXE) test/addons/.buildstamp Index: patches/patch-common_gypi =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-common_gypi,v diff -u -p -r1.30 patch-common_gypi --- patches/patch-common_gypi 26 Sep 2023 10:44:19 -0000 1.30 +++ patches/patch-common_gypi 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: common.gypi --- common.gypi.orig +++ common.gypi -@@ -180,7 +180,6 @@ +@@ -189,7 +189,6 @@ }], ], }, @@ -9,7 +9,7 @@ Index: common.gypi 'conditions': [ ['enable_lto=="true"', { 'cflags': ['<(lto)'], -@@ -409,7 +408,9 @@ +@@ -473,7 +472,9 @@ }], ['OS=="openbsd"', { 'cflags': [ '-I/usr/local/include' ], @@ -20,7 +20,7 @@ Index: common.gypi }], ['_toolset=="host"', { 'conditions': [ -@@ -426,7 +427,7 @@ +@@ -490,7 +491,7 @@ 'ldflags': [ '-m32' ], }], [ 'host_arch=="ppc64" and OS not in "aix os400"', { @@ -29,7 +29,7 @@ Index: common.gypi 'ldflags': [ '-m64' ], }], [ 'host_arch=="s390x" and OS=="linux"', { -@@ -450,7 +451,7 @@ +@@ -514,7 +515,7 @@ 'ldflags': [ '-m32' ], }], [ 'target_arch=="ppc64" and OS not in "aix os400"', { Index: patches/patch-configure =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-configure,v diff -u -p -r1.2 patch-configure --- patches/patch-configure 19 Feb 2023 12:27:19 -0000 1.2 +++ patches/patch-configure 14 May 2024 17:29:41 -0000 @@ -1,10 +1,11 @@ Index: configure --- configure.orig +++ configure -@@ -4,12 +4,6 @@ +@@ -4,13 +4,6 @@ # Note that the mix of single and double quotes is intentional, # as is the fact that the ] goes on a new line. _=[ 'exec' '/bin/sh' '-c' ''' +-command -v python3.12 >/dev/null && exec python3.12 "$0" "$@" -command -v python3.11 >/dev/null && exec python3.11 "$0" "$@" -command -v python3.10 >/dev/null && exec python3.10 "$0" "$@" -command -v python3.9 >/dev/null && exec python3.9 "$0" "$@" Index: patches/patch-configure_py =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-configure_py,v diff -u -p -r1.4 patch-configure_py --- patches/patch-configure_py 15 Aug 2023 13:46:36 -0000 1.4 +++ patches/patch-configure_py 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: configure.py --- configure.py.orig +++ configure.py -@@ -1560,6 +1560,10 @@ def configure_v8(o): +@@ -1540,6 +1540,10 @@ def configure_v8(o): raise Exception( 'Only one of the --v8-enable-object-print or --v8-disable-object-print options ' 'can be specified at a time.') Index: patches/patch-deps_ada_ada_cpp =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_ada_ada_cpp,v diff -u -p -r1.1 patch-deps_ada_ada_cpp --- patches/patch-deps_ada_ada_cpp 7 Dec 2023 17:01:27 -0000 1.1 +++ patches/patch-deps_ada_ada_cpp 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/ada/ada.cpp --- deps/ada/ada.cpp.orig +++ deps/ada/ada.cpp -@@ -10512,7 +10512,7 @@ ada_unused std::string get_state(ada::state s) { +@@ -10485,7 +10485,7 @@ ada_unused std::string get_state(ada::state s) { return "Special Authority Slashes"; case ada::state::SPECIAL_RELATIVE_OR_AUTHORITY: return "Special Relative or Authority"; @@ -10,7 +10,7 @@ Index: deps/ada/ada.cpp return "Query"; case ada::state::PATH: return "Path"; -@@ -12504,7 +12504,7 @@ result_type parse_url(std::string_view user_input, +@@ -12573,7 +12573,7 @@ result_type parse_url(std::string_view user_input, // state to query state. if ((input_position != input_size) && (url_data[input_position] == '?')) { @@ -19,7 +19,7 @@ Index: deps/ada/ada.cpp } // Otherwise, if c is not the EOF code point: else if (input_position != input_size) { -@@ -12599,7 +12599,7 @@ result_type parse_url(std::string_view user_input, +@@ -12668,7 +12668,7 @@ result_type parse_url(std::string_view user_input, break; } @@ -28,7 +28,7 @@ Index: deps/ada/ada.cpp ada_log("QUERY ", helpers::substring(url_data, input_position)); // Let queryPercentEncodeSet be the special-query percent-encode set if // url is special; otherwise the query percent-encode set. -@@ -12681,7 +12681,7 @@ result_type parse_url(std::string_view user_input, +@@ -12750,7 +12750,7 @@ result_type parse_url(std::string_view user_input, size_t location = view.find('?'); if (location != std::string_view::npos) { view.remove_suffix(view.size() - location); @@ -37,7 +37,7 @@ Index: deps/ada/ada.cpp input_position += location + 1; } else { input_position = input_size + 1; -@@ -12734,7 +12734,7 @@ result_type parse_url(std::string_view user_input, +@@ -12803,7 +12803,7 @@ result_type parse_url(std::string_view user_input, // set url's query to the empty string and state to query state. else if ((input_position != input_size) && (url_data[input_position] == '?')) { @@ -46,7 +46,7 @@ Index: deps/ada/ada.cpp } // Otherwise, if c is not the EOF code point: else if (input_position != input_size) { -@@ -12758,7 +12758,7 @@ result_type parse_url(std::string_view user_input, +@@ -12827,7 +12827,7 @@ result_type parse_url(std::string_view user_input, // Furthermore, we can immediately locate the '?'. size_t locofquestionmark = view.find('?'); if (locofquestionmark != std::string_view::npos) { @@ -55,7 +55,7 @@ Index: deps/ada/ada.cpp view.remove_suffix(view.size() - locofquestionmark); input_position += locofquestionmark + 1; } else { -@@ -12918,7 +12918,7 @@ result_type parse_url(std::string_view user_input, +@@ -12987,7 +12987,7 @@ result_type parse_url(std::string_view user_input, // If c is U+003F (?), then set url's query to the empty string and // state to query state. if (input_position != input_size && url_data[input_position] == '?') { Index: patches/patch-deps_ada_ada_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_ada_ada_h,v diff -u -p -r1.1 patch-deps_ada_ada_h --- patches/patch-deps_ada_ada_h 7 Dec 2023 17:01:27 -0000 1.1 +++ patches/patch-deps_ada_ada_h 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/ada/ada.h --- deps/ada/ada.h.orig +++ deps/ada/ada.h -@@ -1219,7 +1219,7 @@ enum class state { +@@ -1229,7 +1229,7 @@ enum class state { SPECIAL_AUTHORITY_IGNORE_SLASHES, SPECIAL_AUTHORITY_SLASHES, SPECIAL_RELATIVE_OR_AUTHORITY, Index: patches/patch-deps_base64_base64_Makefile =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_base64_base64_Makefile,v diff -u -p -r1.1 patch-deps_base64_base64_Makefile --- patches/patch-deps_base64_base64_Makefile 29 Dec 2022 23:34:13 -0000 1.1 +++ patches/patch-deps_base64_base64_Makefile 14 May 2024 17:29:41 -0000 @@ -1,9 +1,10 @@ Index: deps/base64/base64/Makefile --- deps/base64/base64/Makefile.orig +++ deps/base64/base64/Makefile -@@ -1,4 +1,4 @@ --CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -+CFLAGS += -std=c99 -Wall -Wextra -pedantic - +@@ -1,5 +1,5 @@ + CFLAGS += -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE +- ++CFLAGS += -std=c99 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE # Set OBJCOPY if not defined by environment: OBJCOPY ?= objcopy + Index: patches/patch-deps_v8_include_v8-internal_h =================================================================== RCS file: patches/patch-deps_v8_include_v8-internal_h diff -N patches/patch-deps_v8_include_v8-internal_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_include_v8-internal_h 14 May 2024 17:29:41 -0000 @@ -0,0 +1,12 @@ +Index: deps/v8/include/v8-internal.h +--- deps/v8/include/v8-internal.h.orig ++++ deps/v8/include/v8-internal.h +@@ -173,7 +173,7 @@ using SandboxedPointer_t = Address; + #ifdef V8_ENABLE_SANDBOX + + // Size of the sandbox, excluding the guard regions surrounding it. +-#ifdef V8_TARGET_OS_ANDROID ++#if defined(V8_TARGET_OS_ANDROID) || defined(V8_TARGET_OS_OPENBSD) + // On Android, most 64-bit devices seem to be configured with only 39 bits of + // virtual address space for userspace. As such, limit the sandbox to 128GB (a + // quarter of the total available address space). Index: patches/patch-deps_v8_include_v8config_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_include_v8config_h,v diff -u -p -r1.3 patch-deps_v8_include_v8config_h --- patches/patch-deps_v8_include_v8config_h 29 Dec 2022 23:34:13 -0000 1.3 +++ patches/patch-deps_v8_include_v8config_h 14 May 2024 17:29:41 -0000 @@ -1,25 +1,25 @@ Index: deps/v8/include/v8config.h --- deps/v8/include/v8config.h.orig +++ deps/v8/include/v8config.h -@@ -183,6 +183,8 @@ path. Add it with -I to the command line +@@ -184,6 +184,8 @@ path. Add it with -I to the command line && !defined(V8_TARGET_OS_FUCHSIA) \ && !defined(V8_TARGET_OS_IOS) \ && !defined(V8_TARGET_OS_LINUX) \ + && !defined(V8_TARGET_OS_OPENBSD) \ + && !defined(V8_TARGET_OS_FREEBSD) \ && !defined(V8_TARGET_OS_MACOS) \ - && !defined(V8_TARGET_OS_WIN) - # error No known target OS defined. -@@ -194,6 +196,8 @@ path. Add it with -I to the command line + && !defined(V8_TARGET_OS_WIN) \ + && !defined(V8_TARGET_OS_CHROMEOS) +@@ -196,6 +198,8 @@ path. Add it with -I to the command line || defined(V8_TARGET_OS_FUCHSIA) \ || defined(V8_TARGET_OS_IOS) \ || defined(V8_TARGET_OS_LINUX) \ + || defined(V8_TARGET_OS_OPENBSD) \ + || defined(V8_TARGET_OS_FREEBSD) \ || defined(V8_TARGET_OS_MACOS) \ - || defined(V8_TARGET_OS_WIN) - # error A target OS is defined but V8_HAVE_TARGET_OS is unset. -@@ -214,6 +218,16 @@ path. Add it with -I to the command line + || defined(V8_TARGET_OS_WIN) \ + || defined(V8_TARGET_OS_CHROMEOS) +@@ -217,6 +221,16 @@ path. Add it with -I to the command line #ifdef V8_OS_LINUX # define V8_TARGET_OS_LINUX Index: patches/patch-deps_v8_src_api_api_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_api_api_cc,v diff -u -p -r1.3 patch-deps_v8_src_api_api_cc --- patches/patch-deps_v8_src_api_api_cc 29 Dec 2022 23:34:13 -0000 1.3 +++ patches/patch-deps_v8_src_api_api_cc 14 May 2024 17:29:41 -0000 @@ -1,16 +1,16 @@ Index: deps/v8/src/api/api.cc --- deps/v8/src/api/api.cc.orig +++ deps/v8/src/api/api.cc -@@ -138,7 +138,7 @@ +@@ -142,7 +142,7 @@ #include "src/wasm/wasm-serialization.h" #endif // V8_ENABLE_WEBASSEMBLY -#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD +#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD || V8_OS_OPENBSD #include - #include "include/v8-wasm-trap-handler-posix.h" - #include "src/trap-handler/handler-inside-posix.h" -@@ -6077,7 +6077,7 @@ bool v8::V8::Initialize(const int build_config) { + #include + +@@ -6454,7 +6454,7 @@ bool v8::V8::Initialize(const int build_config) { return true; } Index: patches/patch-deps_v8_src_base_atomicops_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_base_atomicops_h,v diff -u -p -r1.6 patch-deps_v8_src_base_atomicops_h --- patches/patch-deps_v8_src_base_atomicops_h 4 Jan 2023 17:06:33 -0000 1.6 +++ patches/patch-deps_v8_src_base_atomicops_h 14 May 2024 17:29:41 -0000 @@ -14,7 +14,7 @@ Index: deps/v8/src/base/atomicops.h using Atomic64 = int64_t; #else using Atomic64 = intptr_t; -@@ -257,7 +257,7 @@ inline Atomic32 SeqCst_Load(volatile const Atomic32* p +@@ -258,7 +258,7 @@ inline Atomic32 SeqCst_Load(volatile const Atomic32* p std::memory_order_seq_cst); } @@ -23,12 +23,3 @@ Index: deps/v8/src/base/atomicops.h inline Atomic64 Relaxed_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { -@@ -468,7 +468,7 @@ inline int Relaxed_Memcmp(volatile const Atomic8* s1, - - // On some platforms we need additional declarations to make - // AtomicWord compatible with our other Atomic* types. --#if defined(V8_OS_DARWIN) || defined(V8_OS_OPENBSD) || defined(V8_OS_AIX) -+#if defined(V8_OS_DARWIN) || defined(V8_OS_AIX) - #include "src/base/atomicops_internals_atomicword_compat.h" - #endif - Index: patches/patch-deps_v8_src_base_bit-field_h =================================================================== RCS file: patches/patch-deps_v8_src_base_bit-field_h diff -N patches/patch-deps_v8_src_base_bit-field_h --- patches/patch-deps_v8_src_base_bit-field_h 7 Dec 2023 17:01:27 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,18 +0,0 @@ - -Workaround for clang 16. known to not workaround in clang 17. - -Index: deps/v8/src/base/bit-field.h ---- deps/v8/src/base/bit-field.h.orig -+++ deps/v8/src/base/bit-field.h -@@ -39,8 +39,11 @@ class BitField final { - static constexpr int kLastUsedBit = kShift + kSize - 1; - static constexpr U kNumValues = U{1} << kSize; - -+ #pragma clang diagnostic push -+ #pragma clang diagnostic ignored "-Wenum-constexpr-conversion" - // Value for the field with all bits set. - static constexpr T kMax = static_cast(kNumValues - 1); -+ #pragma clang diagnostic pop - - template - using Next = BitField; Index: patches/patch-deps_v8_src_base_cpu_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_base_cpu_cc,v diff -u -p -r1.5 patch-deps_v8_src_base_cpu_cc --- patches/patch-deps_v8_src_base_cpu_cc 29 Dec 2022 23:34:13 -0000 1.5 +++ patches/patch-deps_v8_src_base_cpu_cc 14 May 2024 17:29:41 -0000 @@ -4,7 +4,7 @@ OpenBSD/riscv64 always uses floating-poi Index: deps/v8/src/base/cpu.cc --- deps/v8/src/base/cpu.cc.orig +++ deps/v8/src/base/cpu.cc -@@ -871,6 +871,8 @@ CPU::CPU() +@@ -868,6 +868,8 @@ CPU::CPU() #endif // !USE_SIMULATOR #elif V8_HOST_ARCH_RISCV64 @@ -13,7 +13,7 @@ Index: deps/v8/src/base/cpu.cc CPUInfo cpu_info; char* features = cpu_info.ExtractField("isa"); -@@ -881,6 +883,14 @@ CPU::CPU() +@@ -878,6 +880,14 @@ CPU::CPU() has_fpu_ = true; has_rvv_ = true; } Index: patches/patch-deps_v8_src_base_platform-openbsd_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_base_platform-openbsd_cc,v diff -u -p -r1.3 patch-deps_v8_src_base_platform-openbsd_cc --- patches/patch-deps_v8_src_base_platform-openbsd_cc 29 Dec 2022 23:34:13 -0000 1.3 +++ patches/patch-deps_v8_src_base_platform-openbsd_cc 14 May 2024 17:29:41 -0000 @@ -15,7 +15,7 @@ Index: deps/v8/src/base/platform/platfor void OS::AdjustSchedulingParams() {} + +// static -+Stack::StackSlot Stack::GetStackStart() { ++Stack::StackSlot Stack::ObtainCurrentThreadStackStart() { + stack_t ss; + void *base; + if (pthread_stackseg_np(pthread_self(), &ss) != 0) Index: patches/patch-deps_v8_src_base_platform-posix_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_base_platform-posix_cc,v diff -u -p -r1.4 patch-deps_v8_src_base_platform-posix_cc --- patches/patch-deps_v8_src_base_platform-posix_cc 7 Dec 2023 17:01:27 -0000 1.4 +++ patches/patch-deps_v8_src_base_platform-posix_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,16 @@ Index: deps/v8/src/base/platform/platform-posix.cc --- deps/v8/src/base/platform/platform-posix.cc.orig +++ deps/v8/src/base/platform/platform-posix.cc -@@ -68,7 +68,7 @@ +@@ -53,7 +53,7 @@ + #if V8_OS_DARWIN + #include + #include +-#else ++#elif !V8_OS_BSD + #include + #endif + +@@ -71,7 +71,7 @@ #include #endif @@ -10,7 +19,7 @@ Index: deps/v8/src/base/platform/platfor #define MAP_ANONYMOUS MAP_ANON #endif -@@ -300,8 +300,15 @@ void OS::SetRandomMmapSeed(int64_t seed) { +@@ -303,8 +303,15 @@ void OS::SetRandomMmapSeed(int64_t seed) { } } @@ -26,7 +35,7 @@ Index: deps/v8/src/base/platform/platfor uintptr_t raw_addr; { MutexGuard guard(rng_mutex.Pointer()); -@@ -392,6 +399,7 @@ void* OS::GetRandomMmapAddr() { +@@ -399,6 +406,7 @@ void* OS::GetRandomMmapAddr() { #endif return reinterpret_cast(raw_addr); } @@ -34,7 +43,7 @@ Index: deps/v8/src/base/platform/platfor // TODO(bbudge) Move Cygwin and Fuchsia stuff into platform-specific files. #if !V8_OS_CYGWIN && !V8_OS_FUCHSIA -@@ -600,7 +608,7 @@ void OS::DestroySharedMemoryHandle(PlatformSharedMemor +@@ -667,7 +675,7 @@ void OS::DestroySharedMemoryHandle(PlatformSharedMemor // static bool OS::HasLazyCommits() { @@ -43,7 +52,7 @@ Index: deps/v8/src/base/platform/platfor return true; #else // TODO(bbudge) Return true for all POSIX platforms. -@@ -1219,7 +1227,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* +@@ -1244,7 +1252,7 @@ void Thread::SetThreadLocal(LocalStorageKey key, void* // keep this version in POSIX as most Linux-compatible derivatives will // support it. MacOS and FreeBSD are different here. #if !defined(V8_OS_FREEBSD) && !defined(V8_OS_DARWIN) && !defined(_AIX) && \ @@ -51,4 +60,4 @@ Index: deps/v8/src/base/platform/platfor + !defined(V8_OS_SOLARIS) && !defined(V8_OS_OPENBSD) // static - Stack::StackSlot Stack::GetStackStart() { + Stack::StackSlot Stack::ObtainCurrentThreadStackStart() { Index: patches/patch-deps_v8_src_base_platform_memory_h =================================================================== RCS file: patches/patch-deps_v8_src_base_platform_memory_h diff -N patches/patch-deps_v8_src_base_platform_memory_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_base_platform_memory_h 14 May 2024 17:29:41 -0000 @@ -0,0 +1,17 @@ +Index: deps/v8/src/base/platform/memory.h +--- deps/v8/src/base/platform/memory.h.orig ++++ deps/v8/src/base/platform/memory.h +@@ -19,11 +19,11 @@ + + #if V8_OS_DARWIN + #include +-#else // !V8_OS_DARWIN ++#elif !V8_OS_BSD + #include + #endif // !V8_OS_DARWIN + +-#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS) || V8_OS_WIN ++#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_BSD) || V8_OS_WIN + #define V8_HAS_MALLOC_USABLE_SIZE 1 + #endif // (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS) || V8_OS_WIN + Index: patches/patch-deps_v8_src_baseline_x64_baseline-assembler-x64-inl_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_baseline_x64_baseline-assembler-x64-inl_h,v diff -u -p -r1.1 patch-deps_v8_src_baseline_x64_baseline-assembler-x64-inl_h --- patches/patch-deps_v8_src_baseline_x64_baseline-assembler-x64-inl_h 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_baseline_x64_baseline-assembler-x64-inl_h 14 May 2024 17:29:41 -0000 @@ -1,9 +1,9 @@ Index: deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h --- deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h.orig +++ deps/v8/src/baseline/x64/baseline-assembler-x64-inl.h -@@ -98,9 +98,7 @@ MemOperand BaselineAssembler::FeedbackVectorOperand() +@@ -73,9 +73,7 @@ MemOperand BaselineAssembler::FeedbackVectorOperand() + void BaselineAssembler::Bind(Label* label) { __ bind(label); } - void BaselineAssembler::BindWithoutJumpTarget(Label* label) { __ bind(label); } -void BaselineAssembler::JumpTarget() { - // NOP on x64. Index: patches/patch-deps_v8_src_builtins_x64_builtins-x64_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_builtins_x64_builtins-x64_cc,v diff -u -p -r1.1 patch-deps_v8_src_builtins_x64_builtins-x64_cc --- patches/patch-deps_v8_src_builtins_x64_builtins-x64_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_builtins_x64_builtins-x64_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/builtins/x64/builtins-x64.cc --- deps/v8/src/builtins/x64/builtins-x64.cc.orig +++ deps/v8/src/builtins/x64/builtins-x64.cc -@@ -42,6 +42,8 @@ namespace internal { +@@ -43,6 +43,8 @@ namespace internal { #define __ ACCESS_MASM(masm) void Builtins::Generate_Adaptor(MacroAssembler* masm, Address address) { @@ -10,7 +10,7 @@ Index: deps/v8/src/builtins/x64/builtins __ LoadAddress(kJavaScriptCallExtraArg1Register, ExternalReference::Create(address)); __ Jump(BUILTIN_CODE(masm->isolate(), AdaptorWithBuiltinExitFrame), -@@ -456,7 +458,7 @@ void Generate_JSEntryVariant(MacroAssembler* masm, Sta +@@ -457,7 +459,7 @@ void Generate_JSEntryVariant(MacroAssembler* masm, Sta // Jump to a faked try block that does the invoke, with a faked catch // block that sets the pending exception. __ jmp(&invoke); @@ -19,8 +19,8 @@ Index: deps/v8/src/builtins/x64/builtins // Store the current pc as the handler offset. It's used later to create the // handler table. -@@ -3716,6 +3718,8 @@ void GenericJSToWasmWrapperHelper(MacroAssembler* masm - RestoreParentSuspender(masm); +@@ -3798,6 +3800,8 @@ void GenericJSToWasmWrapperHelper(MacroAssembler* masm + RestoreParentSuspender(masm, rbx, rcx); } __ bind(&suspend); + @@ -28,7 +28,7 @@ Index: deps/v8/src/builtins/x64/builtins // No need to process the return value if the stack is suspended, there is a // single 'externref' value (the promise) which doesn't require conversion. -@@ -4068,6 +4072,7 @@ void Builtins::Generate_WasmSuspend(MacroAssembler* ma +@@ -4146,6 +4150,7 @@ void Builtins::Generate_WasmSuspend(MacroAssembler* ma LoadJumpBuffer(masm, jmpbuf, true); __ Trap(); __ bind(&resume); @@ -36,11 +36,11 @@ Index: deps/v8/src/builtins/x64/builtins __ LeaveFrame(StackFrame::STACK_SWITCH); __ ret(0); } -@@ -4191,6 +4196,7 @@ void Builtins::Generate_WasmResume(MacroAssembler* mas - LoadJumpBuffer(masm, target_jmpbuf, true); +@@ -4289,6 +4294,7 @@ void Generate_WasmResumeHelper(MacroAssembler* masm, w + } __ Trap(); __ bind(&suspend); + __ endbr64(); __ LeaveFrame(StackFrame::STACK_SWITCH); - __ ret(3); - } + // Pop receiver + parameter. + __ ret(2 * kSystemPointerSize); Index: patches/patch-deps_v8_src_codegen_riscv64_assembler-riscv64_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv64_assembler-riscv64_cc diff -N patches/patch-deps_v8_src_codegen_riscv64_assembler-riscv64_cc --- patches/patch-deps_v8_src_codegen_riscv64_assembler-riscv64_cc 29 Dec 2022 23:34:13 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ -Use static_cast instead of a potentially dangerous reinterpret_cast. -Doesn't matter since this file only supports riscv64 where unsigned long and -unsigned long long are actually the same size. -../deps/v8/src/codegen/riscv64/assembler-riscv64.cc:403:22: error: reinterpret_cast from 'v8::internal::Address' (aka 'unsigned long') to 'uint64_t' (aka 'unsigned long long') is not allowed - -Index: deps/v8/src/codegen/riscv64/assembler-riscv64.cc ---- deps/v8/src/codegen/riscv64/assembler-riscv64.cc.orig -+++ deps/v8/src/codegen/riscv64/assembler-riscv64.cc -@@ -406,7 +406,7 @@ int Assembler::target_at(int pos, bool is_internal) { - Address pc = reinterpret_cast
(buffer_start_ + pos); - pc = target_address_at(pc); - uint64_t instr_address = reinterpret_cast(buffer_start_ + pos); -- uint64_t imm = reinterpret_cast(pc); -+ uint64_t imm = static_cast(pc); - if (imm == kEndOfJumpChain) { - return kEndOfChain; - } else { Index: patches/patch-deps_v8_src_codegen_riscv64_cpu-riscv64_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv64_cpu-riscv64_cc diff -N patches/patch-deps_v8_src_codegen_riscv64_cpu-riscv64_cc --- patches/patch-deps_v8_src_codegen_riscv64_cpu-riscv64_cc 1 Sep 2022 19:23:04 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,39 +0,0 @@ -Implement instruction cache flush using sysarch(RISCV_SYNC_ICACHE). - -Index: deps/v8/src/codegen/riscv64/cpu-riscv64.cc ---- deps/v8/src/codegen/riscv64/cpu-riscv64.cc.orig -+++ deps/v8/src/codegen/riscv64/cpu-riscv64.cc -@@ -4,7 +4,13 @@ - - // CPU specific code for arm independent of OS goes here. - --#include -+#ifdef __OpenBSD__ -+# include -+# include -+#else -+# include -+#endif -+ - #include - - #if V8_TARGET_ARCH_RISCV64 -@@ -16,6 +22,10 @@ namespace internal { - - void CpuFeatures::FlushICache(void* start, size_t size) { - #if !defined(USE_SIMULATOR) -+# ifdef __OpenBSD__ -+ struct riscv_sync_icache_args args = { (u_int64_t)(uintptr_t)start, size }; -+ sysarch(RISCV_SYNC_ICACHE, &args); -+# else - char* end = reinterpret_cast(start) + size; - // The definition of this syscall is - // SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, -@@ -23,6 +33,7 @@ void CpuFeatures::FlushICache(void* start, size_t size - // The flag here is set to be SYS_RISCV_FLUSH_ICACHE_LOCAL, which is - // defined as 1 in the Linux kernel. - syscall(SYS_riscv_flush_icache, start, end, 1); -+# endif // !__OpenBSD__ - #endif // !USE_SIMULATOR. - } - Index: patches/patch-deps_v8_src_codegen_riscv64_macro-assembler-riscv64_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv64_macro-assembler-riscv64_cc diff -N patches/patch-deps_v8_src_codegen_riscv64_macro-assembler-riscv64_cc --- patches/patch-deps_v8_src_codegen_riscv64_macro-assembler-riscv64_cc 29 Dec 2022 23:34:13 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -Force picking up the correct RecordEntry function. - -Index: deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc ---- deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc.orig -+++ deps/v8/src/codegen/riscv64/macro-assembler-riscv64.cc -@@ -4182,7 +4182,7 @@ void MacroAssembler::JumpToOffHeapInstructionStream(Ad - if (!FLAG_riscv_constant_pool) { - li(kOffHeapTrampolineRegister, Operand(entry, RelocInfo::OFF_HEAP_TARGET)); - } else { -- RecordEntry(entry, RelocInfo::OFF_HEAP_TARGET); -+ RecordEntry(static_cast(entry), RelocInfo::OFF_HEAP_TARGET); - RecordRelocInfo(RelocInfo::OFF_HEAP_TARGET, entry); - auipc(kOffHeapTrampolineRegister, 0); - ld(kOffHeapTrampolineRegister, kOffHeapTrampolineRegister, 0); Index: patches/patch-deps_v8_src_codegen_riscv_assembler-riscv_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv_assembler-riscv_cc diff -N patches/patch-deps_v8_src_codegen_riscv_assembler-riscv_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_codegen_riscv_assembler-riscv_cc 14 May 2024 17:29:41 -0000 @@ -0,0 +1,103 @@ +1st hunk: +Use static_cast instead of a potentially dangerous reinterpret_cast. +Doesn't matter since this file only supports riscv64 where unsigned long and +unsigned long long are actually the same size. +../deps/v8/src/codegen/riscv64/assembler-riscv64.cc:403:22: error: reinterpret_cast from 'v8::internal::Address' (aka 'unsigned long') to 'uint64_t' (aka 'unsigned long long') is not allowed + +Other hunks: +Fix build errors due to type mismatch between intptr_t (long) and int64_t +(long long). + +Index: deps/v8/src/codegen/riscv/assembler-riscv.cc +--- deps/v8/src/codegen/riscv/assembler-riscv.cc.orig ++++ deps/v8/src/codegen/riscv/assembler-riscv.cc +@@ -344,7 +344,7 @@ int Assembler::target_at(int pos, bool is_internal) { + pc = target_address_at(pc); + uintptr_t instr_address = + reinterpret_cast(buffer_start_ + pos); +- uintptr_t imm = reinterpret_cast(pc); ++ uintptr_t imm = static_cast(pc); + if (imm == kEndOfJumpChain) { + return kEndOfChain; + } else { +@@ -891,7 +891,7 @@ inline int64_t signExtend(uint64_t V, int N) { + } + + #if V8_TARGET_ARCH_RISCV64 +-void Assembler::RV_li(Register rd, int64_t imm) { ++void Assembler::RV_li(Register rd, intptr_t imm) { + UseScratchRegisterScope temps(this); + if (RecursiveLiCount(imm) > GeneralLiCount(imm, temps.hasAvailable())) { + GeneralLi(rd, imm); +@@ -1060,7 +1060,7 @@ void Assembler::GeneralLi(Register rd, int64_t imm) { + } + } + +-void Assembler::li_ptr(Register rd, int64_t imm) { ++void Assembler::li_ptr(Register rd, intptr_t imm) { + // Initialize rd with an address + // Pointers are 48 bits + // 6 fixed instructions are generated +@@ -1078,7 +1078,7 @@ void Assembler::li_ptr(Register rd, int64_t imm) { + ori(rd, rd, a6); // 6 bits are put in. 48 bis in rd + } + +-void Assembler::li_constant(Register rd, int64_t imm) { ++void Assembler::li_constant(Register rd, intptr_t imm) { + DEBUG_PRINTF("\tli_constant(%d, %lx <%ld>)\n", ToNumber(rd), imm, imm); + lui(rd, (imm + (1LL << 47) + (1LL << 35) + (1LL << 23) + (1LL << 11)) >> + 48); // Bits 63:48 +@@ -1527,7 +1527,7 @@ Address Assembler::target_address_at(Address pc) { + // + // Patching the address must replace all instructions, and flush the i-cache. + // Note that this assumes the use of SV48, the 48-bit virtual memory system. +-void Assembler::set_target_value_at(Address pc, uint64_t target, ++void Assembler::set_target_value_at(Address pc, uintptr_t target, + ICacheFlushMode icache_flush_mode) { + DEBUG_PRINTF("set_target_value_at: pc: %lx\ttarget: %lx\n", pc, target); + uint32_t* p = reinterpret_cast(pc); +@@ -1820,7 +1820,7 @@ const size_t ConstantPool::kApproxMaxEntryCount = 512; + // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + // + //===----------------------------------------------------------------------===// +-void Assembler::RecursiveLi(Register rd, int64_t val) { ++void Assembler::RecursiveLi(Register rd, intptr_t val) { + if (val > 0 && RecursiveLiImplCount(val) > 2) { + unsigned LeadingZeros = base::bits::CountLeadingZeros((uint64_t)val); + uint64_t ShiftedVal = (uint64_t)val << LeadingZeros; +@@ -1834,7 +1834,7 @@ void Assembler::RecursiveLi(Register rd, int64_t val) + RecursiveLiImpl(rd, val); + } + +-int Assembler::RecursiveLiCount(int64_t val) { ++int Assembler::RecursiveLiCount(intptr_t val) { + if (val > 0 && RecursiveLiImplCount(val) > 2) { + unsigned LeadingZeros = base::bits::CountLeadingZeros((uint64_t)val); + uint64_t ShiftedVal = (uint64_t)val << LeadingZeros; +@@ -1849,7 +1849,7 @@ int Assembler::RecursiveLiCount(int64_t val) { + return RecursiveLiImplCount(val); + } + +-void Assembler::RecursiveLiImpl(Register rd, int64_t Val) { ++void Assembler::RecursiveLiImpl(Register rd, intptr_t Val) { + if (is_int32(Val)) { + // Depending on the active bits in the immediate Value v, the following + // instruction sequences are emitted: +@@ -1926,7 +1926,7 @@ void Assembler::RecursiveLiImpl(Register rd, int64_t V + } + } + +-int Assembler::RecursiveLiImplCount(int64_t Val) { ++int Assembler::RecursiveLiImplCount(intptr_t Val) { + int count = 0; + if (is_int32(Val)) { + // Depending on the active bits in the immediate Value v, the following +@@ -2007,7 +2007,7 @@ int Assembler::RecursiveLiImplCount(int64_t Val) { + return count; + } + +-int Assembler::GeneralLiCount(int64_t imm, bool is_get_temp_reg) { ++int Assembler::GeneralLiCount(intptr_t imm, bool is_get_temp_reg) { + int count = 0; + // imitate Assembler::RV_li + if (is_int32(imm + 0x800)) { Index: patches/patch-deps_v8_src_codegen_riscv_cpu-riscv_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv_cpu-riscv_cc diff -N patches/patch-deps_v8_src_codegen_riscv_cpu-riscv_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_codegen_riscv_cpu-riscv_cc 14 May 2024 17:29:41 -0000 @@ -0,0 +1,39 @@ +Implement instruction cache flush using sysarch(RISCV_SYNC_ICACHE). + +Index: deps/v8/src/codegen/riscv/cpu-riscv.cc +--- deps/v8/src/codegen/riscv/cpu-riscv.cc.orig ++++ deps/v8/src/codegen/riscv/cpu-riscv.cc +@@ -4,7 +4,13 @@ + + // CPU specific code for arm independent of OS goes here. + +-#include ++#ifdef __OpenBSD__ ++# include ++# include ++#else ++# include ++#endif ++ + #include + + #include "src/codegen/cpu-features.h" +@@ -14,6 +20,10 @@ namespace internal { + + void CpuFeatures::FlushICache(void* start, size_t size) { + #if !defined(USE_SIMULATOR) ++# ifdef __OpenBSD__ ++ struct riscv_sync_icache_args args = { (u_int64_t)(uintptr_t)start, size }; ++ sysarch(RISCV_SYNC_ICACHE, &args); ++# else + char* end = reinterpret_cast(start) + size; + // The definition of this syscall is + // SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, +@@ -21,6 +31,7 @@ void CpuFeatures::FlushICache(void* start, size_t size + // The flag here is set to be SYS_RISCV_FLUSH_ICACHE_LOCAL, which is + // defined as 1 in the Linux kernel. + syscall(SYS_riscv_flush_icache, start, end, 1); ++# endif // !__OpenBSD__ + #endif // !USE_SIMULATOR. + } + Index: patches/patch-deps_v8_src_codegen_riscv_macro-assembler-riscv_cc =================================================================== RCS file: patches/patch-deps_v8_src_codegen_riscv_macro-assembler-riscv_cc diff -N patches/patch-deps_v8_src_codegen_riscv_macro-assembler-riscv_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_codegen_riscv_macro-assembler-riscv_cc 14 May 2024 17:29:41 -0000 @@ -0,0 +1,12 @@ +Index: deps/v8/src/codegen/riscv/macro-assembler-riscv.cc +--- deps/v8/src/codegen/riscv/macro-assembler-riscv.cc.orig ++++ deps/v8/src/codegen/riscv/macro-assembler-riscv.cc +@@ -2149,7 +2149,7 @@ void MacroAssembler::li(Register rd, Operand j, LiFlag + int reverse_count = RV_li_count(~j.immediate(), temps.hasAvailable()); + if (v8_flags.riscv_constant_pool && count >= 4 && reverse_count >= 4) { + // Ld/Lw a Address from a constant pool. +- RecordEntry((uintptr_t)j.immediate(), j.rmode()); ++ RecordEntry((uint64_t)j.immediate(), j.rmode()); + auipc(rd, 0); + // Record a value into constant pool. + LoadWord(rd, MemOperand(rd, 0)); Index: patches/patch-deps_v8_src_codegen_x64_assembler-x64_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_codegen_x64_assembler-x64_cc,v diff -u -p -r1.1 patch-deps_v8_src_codegen_x64_assembler-x64_cc --- patches/patch-deps_v8_src_codegen_x64_assembler-x64_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_codegen_x64_assembler-x64_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/codegen/x64/assembler-x64.cc --- deps/v8/src/codegen/x64/assembler-x64.cc.orig +++ deps/v8/src/codegen/x64/assembler-x64.cc -@@ -1266,6 +1266,14 @@ void Assembler::hlt() { +@@ -1268,6 +1268,14 @@ void Assembler::hlt() { emit(0xF4); } @@ -16,7 +16,7 @@ Index: deps/v8/src/codegen/x64/assembler void Assembler::emit_idiv(Register src, int size) { EnsureSpace ensure_space(this); emit_rex(src, size); -@@ -1545,16 +1553,22 @@ void Assembler::jmp(Handle target, RelocInfo::M +@@ -1527,16 +1535,22 @@ void Assembler::jmp(Handle target, RelocInfo::Mo emitl(code_target_index); } Index: patches/patch-deps_v8_src_codegen_x64_assembler-x64_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_codegen_x64_assembler-x64_h,v diff -u -p -r1.1 patch-deps_v8_src_codegen_x64_assembler-x64_h --- patches/patch-deps_v8_src_codegen_x64_assembler-x64_h 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_codegen_x64_assembler-x64_h 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/codegen/x64/assembler-x64.h --- deps/v8/src/codegen/x64/assembler-x64.h.orig +++ deps/v8/src/codegen/x64/assembler-x64.h -@@ -770,6 +770,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBa +@@ -856,6 +856,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBa void ret(int imm16); void ud2(); void setcc(Condition cc, Register reg); @@ -9,8 +9,8 @@ Index: deps/v8/src/codegen/x64/assembler void pblendw(XMMRegister dst, Operand src, uint8_t mask); void pblendw(XMMRegister dst, XMMRegister src, uint8_t mask); -@@ -819,8 +820,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBa - void jmp(Address entry, RelocInfo::Mode rmode); +@@ -904,8 +905,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBa + void jmp(Handle target, RelocInfo::Mode rmode); // Jump near absolute indirect (r64) - void jmp(Register adr); Index: patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_cc,v diff -u -p -r1.1 patch-deps_v8_src_codegen_x64_macro-assembler-x64_cc --- patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_cc 14 May 2024 17:29:41 -0000 @@ -1,21 +1,21 @@ Index: deps/v8/src/codegen/x64/macro-assembler-x64.cc --- deps/v8/src/codegen/x64/macro-assembler-x64.cc.orig +++ deps/v8/src/codegen/x64/macro-assembler-x64.cc -@@ -46,6 +46,8 @@ Operand StackArgumentsAccessor::GetArgumentOperand(int +@@ -49,6 +49,8 @@ Operand StackArgumentsAccessor::GetArgumentOperand(int return Operand(rsp, kPCOnStackSize + index * kSystemPointerSize); } -+void TurboAssembler::CodeEntry() { endbr64(); } ++void MacroAssembler::CodeEntry() { endbr64(); } + void MacroAssembler::Load(Register destination, ExternalReference source) { if (root_array_available_ && options().enable_root_relative_access) { intptr_t delta = RootRegisterOffsetForExternalReference(isolate(), source); -@@ -433,7 +435,7 @@ void TurboAssembler::LoadExternalPointerField( - } - movl(destination, field_operand); - shrq(destination, Immediate(kExternalPointerIndexShift)); -- movq(destination, Operand(scratch, destination, times_8, 0)); -+ movq(destination, Operand(scratch, destination, times_8, 0), /*notrack=*/true); - movq(scratch, Immediate64(~tag)); - andq(destination, scratch); - #else +@@ -1701,7 +1703,7 @@ void MacroAssembler::Switch(Register scratch, Register + cmpq(reg, Immediate(num_labels)); + j(above_equal, &fallthrough); + leaq(table, MemOperand(&jump_table)); +- jmp(MemOperand(table, reg, times_8, 0)); ++ jmp(MemOperand(table, reg, times_8, 0), /*notrack=*/true); + // Emit the jump table inline, under the assumption that it's not too big. + Align(kSystemPointerSize); + bind(&jump_table); Index: patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_h,v diff -u -p -r1.1 patch-deps_v8_src_codegen_x64_macro-assembler-x64_h --- patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_h 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_codegen_x64_macro-assembler-x64_h 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/codegen/x64/macro-assembler-x64.h --- deps/v8/src/codegen/x64/macro-assembler-x64.h.orig +++ deps/v8/src/codegen/x64/macro-assembler-x64.h -@@ -556,11 +556,14 @@ class V8_EXPORT_PRIVATE TurboAssembler +@@ -577,11 +577,14 @@ class V8_EXPORT_PRIVATE MacroAssembler // Define a function entrypoint. This doesn't emit any code for this // architecture, as control-flow integrity is not supported for it. Index: patches/patch-deps_v8_src_compiler_backend_x64_code-generator-x64_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_compiler_backend_x64_code-generator-x64_cc,v diff -u -p -r1.1 patch-deps_v8_src_compiler_backend_x64_code-generator-x64_cc --- patches/patch-deps_v8_src_compiler_backend_x64_code-generator-x64_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_compiler_backend_x64_code-generator-x64_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/compiler/backend/x64/code-generator-x64.cc --- deps/v8/src/compiler/backend/x64/code-generator-x64.cc.orig +++ deps/v8/src/compiler/backend/x64/code-generator-x64.cc -@@ -4583,7 +4583,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instructio +@@ -5497,7 +5497,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instructio __ cmpl(input, Immediate(case_count)); __ j(above_equal, GetLabel(i.InputRpo(1))); __ leaq(kScratchRegister, Operand(table)); Index: patches/patch-deps_v8_src_execution_isolate_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_execution_isolate_cc,v diff -u -p -r1.2 patch-deps_v8_src_execution_isolate_cc --- patches/patch-deps_v8_src_execution_isolate_cc 19 Feb 2023 12:27:19 -0000 1.2 +++ patches/patch-deps_v8_src_execution_isolate_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/execution/isolate.cc --- deps/v8/src/execution/isolate.cc.orig +++ deps/v8/src/execution/isolate.cc -@@ -141,6 +141,10 @@ +@@ -145,6 +145,10 @@ #include "src/execution/simulator-base.h" #endif @@ -9,17 +9,19 @@ Index: deps/v8/src/execution/isolate.cc +#include +#endif + - extern "C" const uint8_t* v8_Default_embedded_blob_code_; + extern "C" const uint8_t v8_Default_embedded_blob_code_[]; extern "C" uint32_t v8_Default_embedded_blob_code_size_; - extern "C" const uint8_t* v8_Default_embedded_blob_data_; -@@ -3691,6 +3695,11 @@ void Isolate::InitializeDefaultEmbeddedBlob() { + extern "C" const uint8_t v8_Default_embedded_blob_data_[]; +@@ -3864,6 +3868,13 @@ void Isolate::InitializeDefaultEmbeddedBlob() { uint32_t code_size = DefaultEmbeddedBlobCodeSize(); const uint8_t* data = DefaultEmbeddedBlobData(); uint32_t data_size = DefaultEmbeddedBlobDataSize(); + -+#if defined(V8_OS_OPENBSD) -+ mprotect(reinterpret_cast(const_cast(code)), -+ code_size, PROT_READ | PROT_EXEC); ++#if defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32) ++ if (code_size > 0) { ++ mprotect(reinterpret_cast(const_cast(code)), ++ code_size, PROT_READ | PROT_EXEC); ++ } +#endif if (StickyEmbeddedBlobCode() != nullptr) { Index: patches/patch-deps_v8_src_flags_flags_cc =================================================================== RCS file: patches/patch-deps_v8_src_flags_flags_cc diff -N patches/patch-deps_v8_src_flags_flags_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_flags_flags_cc 14 May 2024 17:29:41 -0000 @@ -0,0 +1,37 @@ +Index: deps/v8/src/flags/flags.cc +--- deps/v8/src/flags/flags.cc.orig ++++ deps/v8/src/flags/flags.cc +@@ -13,6 +13,10 @@ + #include + #include + ++#if V8_OS_OPENBSD ++#include ++#endif ++ + #include "src/base/functional.h" + #include "src/base/logging.h" + #include "src/base/platform/platform.h" +@@ -32,7 +36,11 @@ + namespace v8::internal { + + // Define {v8_flags}, declared in flags.h. ++#if V8_OS_OPENBSD ++FlagValues v8_flags __attribute__((section(".openbsd.mutable"))); ++#else + FlagValues v8_flags; ++#endif + + // {v8_flags} needs to be aligned to a memory page, and the size needs to be a + // multiple of a page size. This is required for memory-protection of the memory +@@ -899,6 +907,10 @@ void FlagList::FreezeFlags() { + // Note that for string flags we only protect the pointer itself, but not the + // string storage. TODO(12887): Fix this. + base::OS::SetDataReadOnly(&v8_flags, sizeof(v8_flags)); ++#if V8_OS_OPENBSD ++ if (mimmutable(&v8_flags, sizeof(v8_flags)) == -1) ++ FATAL("unable to set immutability of v8_flags"); ++#endif + } + + // static Index: patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64-inl_h =================================================================== RCS file: patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64-inl_h diff -N patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64-inl_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64-inl_h 14 May 2024 17:29:41 -0000 @@ -0,0 +1,15 @@ +Index: deps/v8/src/maglev/x64/maglev-assembler-x64-inl.h +--- deps/v8/src/maglev/x64/maglev-assembler-x64-inl.h.orig ++++ deps/v8/src/maglev/x64/maglev-assembler-x64-inl.h +@@ -181,7 +181,10 @@ void MaglevAssembler::PushReverse(T... vals) { + detail::PushAllHelper::PushReverse(this, vals...); + } + +-inline void MaglevAssembler::BindJumpTarget(Label* label) { bind(label); } ++inline void MaglevAssembler::BindJumpTarget(Label* label) { ++ bind(label); ++ endbr64(); ++} + + inline void MaglevAssembler::BindBlock(BasicBlock* block) { + bind(block->label()); Index: patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64_cc =================================================================== RCS file: patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64_cc diff -N patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64_cc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-deps_v8_src_maglev_x64_maglev-assembler-x64_cc 14 May 2024 17:29:41 -0000 @@ -0,0 +1,16 @@ +Index: deps/v8/src/maglev/x64/maglev-assembler-x64.cc +--- deps/v8/src/maglev/x64/maglev-assembler-x64.cc.orig ++++ deps/v8/src/maglev/x64/maglev-assembler-x64.cc +@@ -631,10 +631,11 @@ void MaglevAssembler::TryTruncateDoubleToInt32(Registe + } + + void MaglevAssembler::Prologue(Graph* graph) { ++ CodeEntry(); + BailoutIfDeoptimized(rbx); + + if (graph->has_recursive_calls()) { +- bind(code_gen_state()->entry_label()); ++ BindJumpTarget(code_gen_state()->entry_label()); + } + + // Tiering support. Index: patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_cc,v diff -u -p -r1.1 patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_cc --- patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_cc 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc --- deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc.orig +++ deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc -@@ -109,6 +109,7 @@ RegExpMacroAssemblerX64::RegExpMacroAssemblerX64(Isola +@@ -110,6 +110,7 @@ RegExpMacroAssemblerX64::RegExpMacroAssemblerX64(Isola backtrack_label_(), exit_label_() { DCHECK_EQ(0, registers_to_save % 2); @@ -9,7 +9,16 @@ Index: deps/v8/src/regexp/x64/regexp-mac __ jmp(&entry_label_); // We'll write the entry code when we know more. __ bind(&start_label_); // And then continue from here. } -@@ -696,6 +697,11 @@ bool RegExpMacroAssemblerX64::CheckSpecialCharacterCla +@@ -170,7 +171,7 @@ void RegExpMacroAssemblerX64::Backtrack() { + // and jump to location. + Pop(rbx); + __ addq(rbx, code_object_pointer()); +- __ jmp(rbx); ++ __ jmp(rbx, /*notrack=*/true); + } + + +@@ -714,6 +715,11 @@ bool RegExpMacroAssemblerX64::CheckSpecialClassRanges( // Match any character. return true; } Index: patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_h,v diff -u -p -r1.1 patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_h --- patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_h 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_regexp_x64_regexp-macro-assembler-x64_h 14 May 2024 17:29:41 -0000 @@ -1,13 +1,11 @@ Index: deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h --- deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h.orig +++ deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h -@@ -59,6 +59,9 @@ class V8_EXPORT_PRIVATE RegExpMacroAssemblerX64 - void CheckPosition(int cp_offset, Label* on_outside_input) override; - bool CheckSpecialCharacterClass(StandardCharacterSet type, - Label* on_no_match) override; -+ +@@ -23,6 +23,7 @@ class V8_EXPORT_PRIVATE RegExpMacroAssemblerX64 + void AdvanceRegister(int reg, int by) override; + void Backtrack() override; + void Bind(Label* label) override; + void BindJumpTarget(Label* label) override; -+ - void Fail() override; - Handle GetCode(Handle source) override; - void GoTo(Label* label) override; + void CheckAtStart(int cp_offset, Label* on_at_start) override; + void CheckCharacter(uint32_t c, Label* on_equal) override; + void CheckCharacterAfterAnd(uint32_t c, uint32_t mask, Index: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h,v diff -u -p -r1.1 patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h --- patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h 28 Jan 2023 12:46:46 -0000 1.1 +++ patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-base_h 14 May 2024 17:29:41 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h --- deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h.orig +++ deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h -@@ -33,6 +33,7 @@ enum class EmbeddedTargetOs { +@@ -31,6 +31,7 @@ enum class EmbeddedTargetOs { kMac, kWin, kStarboard, Index: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc,v diff -u -p -r1.1 patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc --- patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc 28 Jan 2023 12:46:46 -0000 1.1 +++ patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_cc 14 May 2024 17:29:41 -0000 @@ -1,8 +1,8 @@ Index: deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc --- deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc.orig +++ deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc -@@ -10,6 +10,10 @@ - #include "src/common/globals.h" +@@ -9,6 +9,10 @@ + #include "src/objects/code.h" +#if V8_OS_OPENBSD @@ -12,36 +12,32 @@ Index: deps/v8/src/snapshot/embedded/pla namespace v8 { namespace internal { -@@ -36,6 +40,8 @@ const char* DirectiveAsString(DataDirective directive) +@@ -35,6 +39,10 @@ const char* DirectiveAsString(DataDirective directive) void PlatformEmbeddedFileWriterGeneric::SectionText() { if (target_os_ == EmbeddedTargetOs::kChromeOS) { fprintf(fp_, ".section .text.hot.embedded\n"); ++#if !defined(V8_TARGET_ARCH_IA32) + } else if (target_os_ == EmbeddedTargetOs::kOpenBSD) { + fprintf(fp_, ".section .openbsd.mutable,\"a\"\n"); ++#endif } else { fprintf(fp_, ".section .text\n"); } -@@ -74,7 +80,9 @@ void PlatformEmbeddedFileWriterGeneric::DeclareSymbolG - } - - void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() { --#if V8_TARGET_ARCH_X64 -+#if V8_OS_OPENBSD +@@ -66,6 +74,8 @@ void PlatformEmbeddedFileWriterGeneric::AlignToCodeAli + // On these architectures and platforms, we remap the builtins, so need these + // to be aligned on a page boundary. + fprintf(fp_, ".balign 4096\n"); ++#elif defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32) + fprintf(fp_, ".balign %d\n", PAGE_SIZE); -+#elif V8_TARGET_ARCH_X64 + #elif V8_TARGET_ARCH_X64 // On x64 use 64-bytes code alignment to allow 64-bytes loop header alignment. - STATIC_ASSERT(64 >= kCodeAlignment); - fprintf(fp_, ".balign 64\n"); -@@ -96,6 +104,12 @@ void PlatformEmbeddedFileWriterGeneric::AlignToDataAli - // load target to be aligned at 8 bytes (2^3). - STATIC_ASSERT(8 >= Code::kMetadataAlignment); - fprintf(fp_, ".balign 8\n"); -+} -+ -+void PlatformEmbeddedFileWriterGeneric::PaddingAfterCode() { -+#if V8_OS_OPENBSD + static_assert(64 >= kCodeAlignment); +@@ -86,6 +96,8 @@ void PlatformEmbeddedFileWriterGeneric::AlignToPageSiz + (V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64) + // Since the builtins are remapped, need to pad until the next page boundary. + fprintf(fp_, ".balign 4096\n"); ++#elif defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32) + fprintf(fp_, ".balign %d\n", PAGE_SIZE); -+#endif + #endif } - void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) { Index: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h =================================================================== RCS file: patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h diff -N patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h --- patches/patch-deps_v8_src_snapshot_embedded_platform-embedded-file-writer-generic_h 28 Jan 2023 12:46:46 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,11 +0,0 @@ -Index: deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h ---- deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h.orig -+++ deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h -@@ -28,6 +28,7 @@ class PlatformEmbeddedFileWriterGeneric - void SectionRoData() override; - - void AlignToCodeAlignment() override; -+ void PaddingAfterCode() override; - void AlignToDataAlignment() override; - - void DeclareUint32(const char* name, uint32_t value) override; Index: patches/patch-deps_v8_src_trap-handler_handler-inside-posix_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_trap-handler_handler-inside-posix_cc,v diff -u -p -r1.2 patch-deps_v8_src_trap-handler_handler-inside-posix_cc --- patches/patch-deps_v8_src_trap-handler_handler-inside-posix_cc 11 Mar 2022 19:29:08 -0000 1.2 +++ patches/patch-deps_v8_src_trap-handler_handler-inside-posix_cc 14 May 2024 17:29:41 -0000 @@ -1,6 +1,7 @@ ---- deps/v8/src/trap-handler/handler-inside-posix.cc.orig Sat Jan 1 17:10:11 2022 -+++ deps/v8/src/trap-handler/handler-inside-posix.cc Sat Jan 1 17:10:11 2022 -@@ -53,6 +53,8 @@ namespace trap_handler { +Index: deps/v8/src/trap-handler/handler-inside-posix.cc +--- deps/v8/src/trap-handler/handler-inside-posix.cc.orig ++++ deps/v8/src/trap-handler/handler-inside-posix.cc +@@ -55,6 +55,8 @@ namespace trap_handler { #define CONTEXT_REG(reg, REG) &uc->uc_mcontext->__ss.__##reg #elif V8_OS_FREEBSD #define CONTEXT_REG(reg, REG) &uc->uc_mcontext.mc_##reg @@ -9,7 +10,7 @@ #else #error "Unsupported platform." #endif -@@ -62,8 +64,12 @@ bool IsKernelGeneratedSignal(siginfo_t* info) { +@@ -64,8 +66,12 @@ bool IsKernelGeneratedSignal(siginfo_t* info) { // si_code at its default of 0 for signals that don’t originate in hardware. // The other conditions are only relevant for Linux. return info->si_code > 0 && info->si_code != SI_USER && Index: patches/patch-deps_v8_src_wasm_baseline_ia32_liftoff-assembler-ia32_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_wasm_baseline_ia32_liftoff-assembler-ia32_h,v diff -u -p -r1.3 patch-deps_v8_src_wasm_baseline_ia32_liftoff-assembler-ia32_h --- patches/patch-deps_v8_src_wasm_baseline_ia32_liftoff-assembler-ia32_h 29 Dec 2022 23:34:13 -0000 1.3 +++ patches/patch-deps_v8_src_wasm_baseline_ia32_liftoff-assembler-ia32_h 14 May 2024 17:29:42 -0000 @@ -1,102 +1,102 @@ Index: deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h --- deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h.orig +++ deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h -@@ -434,7 +434,7 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst +@@ -419,7 +419,7 @@ void LiftoffAssembler::StoreTaggedPointer(Register dst } void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, - Register offset_reg, uint32_t offset_imm, + Register offset_reg, uintptr_t offset_imm, - LoadType type, LiftoffRegList pinned, - uint32_t* protected_load_pc, bool is_load_mem, - bool i64_offset) { -@@ -511,7 +511,7 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Regis + LoadType type, uint32_t* protected_load_pc, + bool /* is_load_mem */, bool /* i64_offset */, + bool needs_shift) { +@@ -499,7 +499,7 @@ void LiftoffAssembler::Load(LiftoffRegister dst, Regis } void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister src, + uintptr_t offset_imm, LiftoffRegister src, StoreType type, LiftoffRegList pinned, - uint32_t* protected_store_pc, bool is_store_mem) { - DCHECK_EQ(type.value_type() == kWasmI64, src.is_gp_pair()); -@@ -579,7 +579,7 @@ void LiftoffAssembler::Store(Register dst_addr, Regist + uint32_t* protected_store_pc, + bool /* is_store_mem */, bool /* i64_offset */) { +@@ -568,7 +568,7 @@ void LiftoffAssembler::Store(Register dst_addr, Regist } void LiftoffAssembler::AtomicLoad(LiftoffRegister dst, Register src_addr, - Register offset_reg, uint32_t offset_imm, + Register offset_reg, uintptr_t offset_imm, - LoadType type, LiftoffRegList pinned) { + LoadType type, LiftoffRegList /* pinned */, + bool /* i64_offset */) { if (type.value() != LoadType::kI64Load) { - Load(dst, src_addr, offset_reg, offset_imm, type, pinned, nullptr, true); -@@ -598,7 +598,7 @@ void LiftoffAssembler::AtomicLoad(LiftoffRegister dst, +@@ -588,7 +588,7 @@ void LiftoffAssembler::AtomicLoad(LiftoffRegister dst, } void LiftoffAssembler::AtomicStore(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister src, + uintptr_t offset_imm, LiftoffRegister src, - StoreType type, LiftoffRegList pinned) { + StoreType type, LiftoffRegList pinned, + bool /* i64_offset */) { DCHECK_NE(offset_reg, no_reg); - DCHECK_LE(offset_imm, std::numeric_limits::max()); -@@ -938,7 +938,7 @@ inline void AtomicBinop64(LiftoffAssembler* lasm, Bino +@@ -929,7 +929,7 @@ inline void AtomicBinop64(LiftoffAssembler* lasm, Bino } // namespace liftoff void LiftoffAssembler::AtomicAdd(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister value, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { if (type.value() == StoreType::kI64Store) { - liftoff::AtomicBinop64(this, liftoff::kAdd, dst_addr, offset_reg, -@@ -951,7 +951,7 @@ void LiftoffAssembler::AtomicAdd(Register dst_addr, Re +@@ -943,7 +943,7 @@ void LiftoffAssembler::AtomicAdd(Register dst_addr, Re } void LiftoffAssembler::AtomicSub(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister value, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { if (type.value() == StoreType::kI64Store) { - liftoff::AtomicBinop64(this, liftoff::kSub, dst_addr, offset_reg, -@@ -963,7 +963,7 @@ void LiftoffAssembler::AtomicSub(Register dst_addr, Re +@@ -956,7 +956,7 @@ void LiftoffAssembler::AtomicSub(Register dst_addr, Re } void LiftoffAssembler::AtomicAnd(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister value, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { if (type.value() == StoreType::kI64Store) { - liftoff::AtomicBinop64(this, liftoff::kAnd, dst_addr, offset_reg, -@@ -976,7 +976,7 @@ void LiftoffAssembler::AtomicAnd(Register dst_addr, Re +@@ -970,7 +970,7 @@ void LiftoffAssembler::AtomicAnd(Register dst_addr, Re } void LiftoffAssembler::AtomicOr(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister value, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { if (type.value() == StoreType::kI64Store) { - liftoff::AtomicBinop64(this, liftoff::kOr, dst_addr, offset_reg, offset_imm, -@@ -989,7 +989,7 @@ void LiftoffAssembler::AtomicOr(Register dst_addr, Reg +@@ -984,7 +984,7 @@ void LiftoffAssembler::AtomicOr(Register dst_addr, Reg } void LiftoffAssembler::AtomicXor(Register dst_addr, Register offset_reg, - uint32_t offset_imm, LiftoffRegister value, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { if (type.value() == StoreType::kI64Store) { - liftoff::AtomicBinop64(this, liftoff::kXor, dst_addr, offset_reg, -@@ -1002,7 +1002,7 @@ void LiftoffAssembler::AtomicXor(Register dst_addr, Re +@@ -998,7 +998,7 @@ void LiftoffAssembler::AtomicXor(Register dst_addr, Re } void LiftoffAssembler::AtomicExchange(Register dst_addr, Register offset_reg, - uint32_t offset_imm, + uintptr_t offset_imm, LiftoffRegister value, - LiftoffRegister result, StoreType type) { - if (type.value() == StoreType::kI64Store) { -@@ -1016,7 +1016,7 @@ void LiftoffAssembler::AtomicExchange(Register dst_add + LiftoffRegister result, StoreType type, + bool /* i64_offset */) { +@@ -1013,7 +1013,7 @@ void LiftoffAssembler::AtomicExchange(Register dst_add } void LiftoffAssembler::AtomicCompareExchange( - Register dst_addr, Register offset_reg, uint32_t offset_imm, + Register dst_addr, Register offset_reg, uintptr_t offset_imm, LiftoffRegister expected, LiftoffRegister new_value, LiftoffRegister result, - StoreType type) { + StoreType type, bool /* i64_offset */) { // We expect that the offset has already been added to {dst_addr}, and no Index: patches/patch-deps_v8_src_wasm_jump-table-assembler_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_wasm_jump-table-assembler_cc,v diff -u -p -r1.1 patch-deps_v8_src_wasm_jump-table-assembler_cc --- patches/patch-deps_v8_src_wasm_jump-table-assembler_cc 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_wasm_jump-table-assembler_cc 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/wasm/jump-table-assembler.cc --- deps/v8/src/wasm/jump-table-assembler.cc.orig +++ deps/v8/src/wasm/jump-table-assembler.cc -@@ -16,15 +16,21 @@ namespace wasm { +@@ -52,15 +52,21 @@ void JumpTableAssembler::InitializeJumpsToLazyCompileT #if V8_TARGET_ARCH_X64 void JumpTableAssembler::EmitLazyCompileJumpSlot(uint32_t func_index, Address lazy_compile_target) { @@ -26,7 +26,7 @@ Index: deps/v8/src/wasm/jump-table-assem near_jmp(displacement, RelocInfo::NO_INFO); // 5 bytes return true; } -@@ -32,11 +38,12 @@ bool JumpTableAssembler::EmitJumpSlot(Address target) +@@ -68,11 +74,12 @@ bool JumpTableAssembler::EmitJumpSlot(Address target) void JumpTableAssembler::EmitFarJumpSlot(Address target) { Label data; int start_offset = pc_offset(); @@ -41,7 +41,7 @@ Index: deps/v8/src/wasm/jump-table-assem USE(start_offset); bind(&data); dq(target); // 8 bytes -@@ -47,7 +54,7 @@ void JumpTableAssembler::PatchFarJumpSlot(Address slot +@@ -83,7 +90,7 @@ void JumpTableAssembler::PatchFarJumpSlot(Address slot // The slot needs to be pointer-size aligned so we can atomically update it. DCHECK(IsAligned(slot, kSystemPointerSize)); // Offset of the target is at 8 bytes, see {EmitFarJumpSlot}. Index: patches/patch-deps_v8_src_wasm_jump-table-assembler_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-deps_v8_src_wasm_jump-table-assembler_h,v diff -u -p -r1.1 patch-deps_v8_src_wasm_jump-table-assembler_h --- patches/patch-deps_v8_src_wasm_jump-table-assembler_h 7 Jul 2023 10:44:15 -0000 1.1 +++ patches/patch-deps_v8_src_wasm_jump-table-assembler_h 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: deps/v8/src/wasm/jump-table-assembler.h --- deps/v8/src/wasm/jump-table-assembler.h.orig +++ deps/v8/src/wasm/jump-table-assembler.h -@@ -176,9 +176,10 @@ class V8_EXPORT_PRIVATE JumpTableAssembler : public Ma +@@ -185,9 +185,10 @@ class V8_EXPORT_PRIVATE JumpTableAssembler : public Ma // boundaries. The jump table line size has been chosen to satisfy this. #if V8_TARGET_ARCH_X64 static constexpr int kJumpTableLineSize = 64; Index: patches/patch-include_node_common_gypi =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-include_node_common_gypi,v diff -u -p -r1.4 patch-include_node_common_gypi --- patches/patch-include_node_common_gypi 26 Sep 2023 10:44:19 -0000 1.4 +++ patches/patch-include_node_common_gypi 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: include/node/common.gypi --- include/node/common.gypi.orig +++ include/node/common.gypi -@@ -180,7 +180,6 @@ +@@ -189,7 +189,6 @@ }], ], }, @@ -9,7 +9,7 @@ Index: include/node/common.gypi 'conditions': [ ['enable_lto=="true"', { 'cflags': ['<(lto)'], -@@ -426,7 +425,7 @@ +@@ -490,7 +489,7 @@ 'ldflags': [ '-m32' ], }], [ 'host_arch=="ppc64" and OS not in "aix os400"', { @@ -18,7 +18,7 @@ Index: include/node/common.gypi 'ldflags': [ '-m64' ], }], [ 'host_arch=="s390x" and OS=="linux"', { -@@ -450,7 +449,7 @@ +@@ -514,7 +513,7 @@ 'ldflags': [ '-m32' ], }], [ 'target_arch=="ppc64" and OS not in "aix os400"', { Index: patches/patch-lib_internal_modules_cjs_loader_js =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-lib_internal_modules_cjs_loader_js,v diff -u -p -r1.12 patch-lib_internal_modules_cjs_loader_js --- patches/patch-lib_internal_modules_cjs_loader_js 7 Dec 2023 17:01:27 -0000 1.12 +++ patches/patch-lib_internal_modules_cjs_loader_js 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: lib/internal/modules/cjs/loader.js --- lib/internal/modules/cjs/loader.js.orig +++ lib/internal/modules/cjs/loader.js -@@ -1516,7 +1516,10 @@ Module._initPaths = function() { +@@ -1518,7 +1518,10 @@ Module._initPaths = function() { path.resolve(process.execPath, '..') : path.resolve(process.execPath, '..', '..'); Index: patches/patch-lib_net_js =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-lib_net_js,v diff -u -p -r1.9 patch-lib_net_js --- patches/patch-lib_net_js 26 Sep 2023 10:44:19 -0000 1.9 +++ patches/patch-lib_net_js 14 May 2024 17:29:42 -0000 @@ -13,7 +13,7 @@ for "any address" but that's not really Index: lib/net.js --- lib/net.js.orig +++ lib/net.js -@@ -1779,22 +1779,12 @@ function setupListenHandle(address, port, addressType, +@@ -1860,22 +1860,12 @@ function setupListenHandle(address, port, addressType, let rval = null; @@ -38,4 +38,4 @@ Index: lib/net.js + rval = createServerHandle(address, port, addressType, fd, flags); if (typeof rval === 'number') { - const error = uvExceptionWithHostPort(rval, 'listen', address, port); + const error = new UVExceptionWithHostPort(rval, 'listen', address, port); Index: patches/patch-node_gyp =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-node_gyp,v diff -u -p -r1.21 patch-node_gyp --- patches/patch-node_gyp 7 Dec 2023 17:01:27 -0000 1.21 +++ patches/patch-node_gyp 14 May 2024 17:29:42 -0000 @@ -4,7 +4,7 @@ devel/gtest if installed. Index: node.gyp --- node.gyp.orig +++ node.gyp -@@ -468,7 +468,7 @@ +@@ -826,7 +826,7 @@ ], 'dependencies': [ 'deps/base64/base64.gyp:base64', @@ -13,7 +13,7 @@ Index: node.gyp 'deps/histogram/histogram.gyp:histogram', 'deps/uvwasi/uvwasi.gyp:uvwasi', 'deps/simdutf/simdutf.gyp:simdutf', -@@ -1222,8 +1222,8 @@ +@@ -1056,8 +1056,8 @@ 'dependencies': [ '<(node_lib_target_name)', 'deps/base64/base64.gyp:base64', @@ -23,8 +23,8 @@ Index: node.gyp + #'deps/googletest/googletest.gyp:gtest_main', 'deps/histogram/histogram.gyp:histogram', 'deps/uvwasi/uvwasi.gyp:uvwasi', - 'node_dtrace_header', -@@ -1299,6 +1299,10 @@ + 'deps/simdutf/simdutf.gyp:simdutf', +@@ -1105,6 +1105,10 @@ }], ['OS=="solaris"', { 'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ] Index: patches/patch-src_cares_wrap_h =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-src_cares_wrap_h,v diff -u -p -r1.3 patch-src_cares_wrap_h --- patches/patch-src_cares_wrap_h 29 Dec 2022 23:34:13 -0000 1.3 +++ patches/patch-src_cares_wrap_h 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: src/cares_wrap.h --- src/cares_wrap.h.orig +++ src/cares_wrap.h -@@ -521,4 +521,109 @@ using GetHostByAddrWrap = QueryWrap; +@@ -524,4 +524,109 @@ using GetHostByAddrWrap = QueryWrap; #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS Index: patches/patch-src_env_cc =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-src_env_cc,v diff -u -p -r1.8 patch-src_env_cc --- patches/patch-src_env_cc 7 Dec 2023 17:01:27 -0000 1.8 +++ patches/patch-src_env_cc 14 May 2024 17:29:42 -0000 @@ -1,10 +1,10 @@ Index: src/env.cc --- src/env.cc.orig +++ src/env.cc -@@ -621,29 +621,7 @@ std::unique_ptr Environment::release +@@ -745,29 +745,7 @@ std::unique_ptr Environment::release } - std::string GetExecPath(const std::vector& argv) { + std::string Environment::GetExecPath(const std::vector& argv) { - char exec_path_buf[2 * PATH_MAX]; - size_t exec_path_len = sizeof(exec_path_buf); - std::string exec_path; Index: patches/patch-tools_test_py =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-tools_test_py,v diff -u -p -r1.13 patch-tools_test_py --- patches/patch-tools_test_py 15 Aug 2023 13:46:36 -0000 1.13 +++ patches/patch-tools_test_py 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: tools/test.py --- tools/test.py.orig +++ tools/test.py -@@ -937,9 +937,9 @@ class Context(object): +@@ -944,9 +944,9 @@ class Context(object): if self.vm is not None: return self.vm if arch == 'none': Index: patches/patch-tools_v8_gypfiles_toolchain_gypi =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-tools_v8_gypfiles_toolchain_gypi,v diff -u -p -r1.1 patch-tools_v8_gypfiles_toolchain_gypi --- patches/patch-tools_v8_gypfiles_toolchain_gypi 29 Dec 2022 23:34:13 -0000 1.1 +++ patches/patch-tools_v8_gypfiles_toolchain_gypi 14 May 2024 17:29:42 -0000 @@ -1,7 +1,7 @@ Index: tools/v8_gypfiles/toolchain.gypi --- tools/v8_gypfiles/toolchain.gypi.orig +++ tools/v8_gypfiles/toolchain.gypi -@@ -1304,11 +1304,9 @@ +@@ -861,11 +861,9 @@ # Don't use -O3 with sanitizers. ['asan==0 and msan==0 and lsan==0 \ and tsan==0 and ubsan==0 and ubsan_vptr==0', { Index: patches/patch-tools_v8_gypfiles_v8_gyp =================================================================== RCS file: /cvs/ports/lang/node/patches/patch-tools_v8_gypfiles_v8_gyp,v diff -u -p -r1.11 patch-tools_v8_gypfiles_v8_gyp --- patches/patch-tools_v8_gypfiles_v8_gyp 15 Aug 2023 13:46:36 -0000 1.11 +++ patches/patch-tools_v8_gypfiles_v8_gyp 14 May 2024 17:29:42 -0000 @@ -7,7 +7,7 @@ from "0.0" if llvm (clang) is detected. Index: tools/v8_gypfiles/v8.gyp --- tools/v8_gypfiles/v8.gyp.orig +++ tools/v8_gypfiles/v8.gyp -@@ -372,6 +372,9 @@ +@@ -373,6 +373,9 @@ 'v8_libplatform', ] }], @@ -17,34 +17,34 @@ Index: tools/v8_gypfiles/v8.gyp ], 'sources': [ '<(V8_ROOT)/src/init/setup-isolate-deserialize.cc', -@@ -581,7 +584,7 @@ +@@ -605,7 +608,7 @@ }], ['v8_enable_webassembly==1', { 'conditions': [ - ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', { + ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd" or OS=="openbsd"', { 'sources': [ - '