Wednesday, August 31, 2022

riscv64 support for lang/node

Hopefully the comments in the patches explain what is going on. No
REVISION bump since all the patched are riscv64-specific or (AFAIK)
not affecting any arch where node currently builds
(patches/patch-tools_v8_gypfiles_v8_gyp). But I can add a REVISION bump
if it feels more comfortable.

With this I can attempt building firefox (build ongoing) or chromium.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/node/Makefile,v
retrieving revision 1.105
diff -u -p -r1.105 Makefile
--- Makefile 22 Jul 2022 17:46:49 -0000 1.105
+++ Makefile 30 Aug 2022 15:44:48 -0000
@@ -1,4 +1,4 @@
-ONLY_FOR_ARCHS = amd64 aarch64 i386 powerpc64
+ONLY_FOR_ARCHS = amd64 aarch64 i386 powerpc64 riscv64
DPB_PROPERTIES = parallel

USE_WXNEEDED = Yes
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_v8_src_codegen_riscv64_assembler-riscv64_cc 31 Aug 2022 09:04:56 -0000
@@ -0,0 +1,17 @@
+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
+@@ -400,7 +400,7 @@ int Assembler::target_at(int pos, bool is_internal) {
+ Address pc = reinterpret_cast<Address>(buffer_start_ + pos);
+ pc = target_address_at(pc);
+ uint64_t instr_address = reinterpret_cast<uint64_t>(buffer_start_ + pos);
+- uint64_t imm = reinterpret_cast<uint64_t>(pc);
++ uint64_t imm = static_cast<uint64_t>(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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_v8_src_codegen_riscv64_cpu-riscv64_cc 1 Sep 2022 00:28:54 -0000
@@ -0,0 +1,39 @@
+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 <sys/syscall.h>
++#ifdef __OpenBSD__
++# include <sys/types.h>
++# include <machine/sysarch.h>
++#else
++# include <sys/syscall.h>
++

No comments:

Post a Comment