Index | Thread | Search

From:
Antoine Jacoutot <ajacoutot@bsdfrog.org>
Subject:
Re: Fix webkitgtk-2.44 on riscv64
To:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Cc:
ports@openbsd.org
Date:
Mon, 15 Apr 2024 13:46:13 +0200

Download raw body.

Thread
On Mon, Apr 15, 2024 at 01:06:41PM +0200, Jeremie Courreges-Anglas wrote:
> 
> Hi,
> 
> this fixes the webkitgtk4 build on riscv64.
> 
> ok?

OK

> 
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/webkitgtk4/Makefile,v
> diff -u -p -r1.211 Makefile
> --- Makefile	13 Apr 2024 09:37:30 -0000	1.211
> +++ Makefile	14 Apr 2024 11:03:42 -0000
> @@ -16,6 +16,7 @@ V =			2.44.1
>  DISTNAME =		webkitgtk-${V}
>  PKGNAME =		webkitgtk${API:S/.//}-${V}
>  FULLPKGNAME =		${PKGNAME}
> +REVISION =		0
>  
>  EXTRACT_SUFX =		.tar.xz
>  SUBST_VARS =		API
> @@ -119,6 +120,13 @@ CONFIGURE_ARGS +=	-DENABLE_GAMEPAD=OFF
>  # #error "The MacroAssembler is not supported on this platform."
>  CONFIGURE_ARGS +=	-DENABLE_JIT=OFF
>  CONFIGURE_ARGS +=	-DENABLE_C_LOOP=ON
> +.endif
> +
> +.if ${MACHINE_ARCH} == riscv64
> +# WEBASSEMBLY and FTL_JIT need at least one of OMGJIT/BBQJIT
> +# check Source/WTF/wtf/PlatformEnable.h
> +CONFIGURE_ARGS +=	-DENABLE_WEBASSEMBLY=OFF
> +CONFIGURE_ARGS +=	-DENABLE_FTL_JIT=OFF
>  .endif
>  
>  # we don't want an allocation of 1GB, it's above the "default" class ulimit
> Index: patches/patch-Source_JavaScriptCore_llint_LowLevelInterpreter64_asm
> ===================================================================
> RCS file: patches/patch-Source_JavaScriptCore_llint_LowLevelInterpreter64_asm
> diff -N patches/patch-Source_JavaScriptCore_llint_LowLevelInterpreter64_asm
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Source_JavaScriptCore_llint_LowLevelInterpreter64_asm	15 Apr 2024 11:01:30 -0000
> @@ -0,0 +1,67 @@
> +Partial revert of https://commits.webkit.org/270649@main
> +To avoid _llint_throw_stack_overflow_error_from_vm_entry being out of reach
> +from its call sites (issue visible on riscv64) we turn it into a local label
> +nested inside the macro that uses it.  Said macro is used only twice anyway.
> +
> +Error message:
> +-->8--
> +<inline asm>:24:1: error: fixup value out of range
> +bleu sp, x13, .Lllint_throw_stack_overflow_error_from_vm_entry 
> +^
> +<inline asm>:26:1: error: fixup value out of range
> +bltu x13, x31, .Lllint_throw_stack_overflow_error_from_vm_entry 
> +^
> +<inline asm>:108:1: error: fixup value out of range
> +bleu sp, x13, .Lllint_throw_stack_overflow_error_from_vm_entry 
> +^
> +<inline asm>:110:1: error: fixup value out of range
> +bltu x13, x31, .Lllint_throw_stack_overflow_error_from_vm_entry 
> +^
> +1 warning and 4 errors generated.
> +--8<--
> +
> +Index: Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
> +--- Source/JavaScriptCore/llint/LowLevelInterpreter64.asm.orig
> ++++ Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
> +@@ -255,7 +255,7 @@ macro doVMEntry(makeCall)
> +     addp CallFrameHeaderSlots, t4, t4
> +     lshiftp 3, t4
> +     subp sp, t4, t3
> +-    bqbeq sp, t3, _llint_throw_stack_overflow_error_from_vm_entry
> ++    bqbeq sp, t3, .llint_throw_stack_overflow_error_from_vm_entry
> + 
> +     # Ensure that we have enough additional stack capacity for the incoming args,
> +     # and the frame for the JS code we're executing. We need to do this check
> +@@ -273,11 +273,11 @@ macro doVMEntry(makeCall)
> + .stackCheckFailed:
> +         move t4, entry
> +         move t5, vm
> +-        jmp  _llint_throw_stack_overflow_error_from_vm_entry
> ++        jmp  .llint_throw_stack_overflow_error_from_vm_entry
> + .stackHeightOK:
> +         move t3, sp
> +     else
> +-        bpb t3, VM::m_softStackLimit[vm],  _llint_throw_stack_overflow_error_from_vm_entry
> ++        bpb t3, VM::m_softStackLimit[vm],  .llint_throw_stack_overflow_error_from_vm_entry
> +         move t3, sp
> +     end
> + 
> +@@ -362,9 +362,8 @@ macro doVMEntry(makeCall)
> +     popCalleeSaves()
> +     functionEpilogue()
> +     ret
> +-end
> + 
> +-_llint_throw_stack_overflow_error_from_vm_entry:
> ++.llint_throw_stack_overflow_error_from_vm_entry:
> +     const entry = a0
> +     const vm = a1
> +     const protoCallFrame = a2
> +@@ -387,6 +386,7 @@ _llint_throw_stack_overflow_error_from_vm_entry:
> +     popCalleeSaves()
> +     functionEpilogue()
> +     ret
> ++end
> + 
> + # a0, a2, t3, t4
> + macro makeJavaScriptCall(entry, protoCallFrame, temp1, temp2)
> 
> -- 
> jca

-- 
Antoine