Monday, September 23, 2024

Re: firefox aarch64 pledge crashes

On 2024/09/23 23:08, Stuart Henderson wrote:
> On 2024/09/23 23:21, Theo Buehler wrote:
> > In addition to what sthen posted, I ran into these, the first one smells
> > like a noexeconly issue. Not sure about the second one (I modified kdump
> > to print the trap as hexadecimal since I got tired of translating
> > decimal to hex)
>
> The files in ports/multimedia/dav1d/patches/* mostly don't have
> explanatory comments in the files, but commit log for many are "Fix
> arm64 assembly to be compatible with xonly" (plus there are a few
> missing AARCH64_VALID_JUMP_TARGET too).
>
> Attempting to apply those to the version in firefox there are a bunch
> of failures and porting them across will need knowledge of arm asm.
>
> Just starting a build with this to try. I _think_ it's the right
> place but not entirely sure. Performance is going to suck for things
> using dav1d but it's more appealing than a browser which requires
> USE_WXNEEDED.
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/www/mozilla-firefox/Makefile,v
> diff -u -p -r1.603 Makefile
> --- Makefile 17 Sep 2024 12:55:40 -0000 1.603
> +++ Makefile 23 Sep 2024 22:05:18 -0000
> @@ -1,6 +1,8 @@
> COMMENT = Firefox web browser
> ONLY_FOR_ARCHS = amd64 aarch64 riscv64
>
> +REVISION = 0
> +
> # Don't forget to bump www/firefox-i18n after updates.
>
> MOZILLA_VERSION = 130.0.1
> Index: patches/patch-media_libdav1d_asm_moz_build
> ===================================================================
> RCS file: patches/patch-media_libdav1d_asm_moz_build
> diff -N patches/patch-media_libdav1d_asm_moz_build
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-media_libdav1d_asm_moz_build 23 Sep 2024 22:05:18 -0000
> @@ -0,0 +1,15 @@
> +disable asm in libdav1d on arm64; the vendored copy in mozilla is missings
> +patches to deal with xonly and BTI from the multimedia/dav1d port
> +
> +Index: media/libdav1d/asm/moz.build
> +--- media/libdav1d/asm/moz.build.orig
> ++++ media/libdav1d/asm/moz.build
> +@@ -159,7 +159,7 @@ if CONFIG['TARGET_CPU'] in ('x86', 'x86_64'):
> + entry_point='add_define', inputs=[relative_path + f],
> + flags=['BITDEPTH', '8'])
> +
> +-elif CONFIG['TARGET_CPU'] == 'arm' or CONFIG['TARGET_CPU'] == 'aarch64':
> ++elif CONFIG['TARGET_CPU'] == 'arm':
> + SOURCES += [
> + '../../../third_party/dav1d/src/arm/cpu.c',
> + ]
>

Looks like that's not enough, I happened to look at the screen at
just the right time and noticed some undefined symbol errors from ld.lld
relating to dav1d scrolling past while it was building.

Next attempt is with this diff, results in the morning probably.

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/mozilla-firefox/Makefile,v
diff -u -p -r1.603 Makefile
--- Makefile 17 Sep 2024 12:55:40 -0000 1.603
+++ Makefile 23 Sep 2024 22:58:41 -0000
@@ -1,6 +1,8 @@
COMMENT = Firefox web browser
ONLY_FOR_ARCHS = amd64 aarch64 riscv64

+REVISION = 0
+
# Don't forget to bump www/firefox-i18n after updates.

MOZILLA_VERSION = 130.0.1
@@ -74,6 +76,12 @@ COMMENT_FFVPX ?=
COMMENT_FFVPX = @comment # needs a trailing space
.endif
SUBST_VARS += COMMENT_FFVPX
+
+# vendored copy of dav1d needs patching
+USE_NOBTCFI-aarch64 = Yes
+.if ${MACHINE_ARCH} == aarch64
+USE_WXNEEDED = Yes
+.endif

post-install:
${SUBST_MAN} ${FILESDIR}/mozilla-firefox.1 \

No comments:

Post a Comment