Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: missing endbr64
To:
Theo Buehler <tb@theobuehler.org>
Cc:
ports@openbsd.org, kettenis@openbsd.org
Date:
Tue, 27 Feb 2024 16:03:58 +0000

Download raw body.

Thread
On 2024/02/27 12:08, Theo Buehler wrote:
> Now that the bulk has completed here's the remainder of the list with
> two more that may need fixing. 119 ports total contained a warning.
> I did not build the chromium variants.
> 
> audio/deadbeef.log
> ld: warning: ff_scalarproduct_and_madd_int16_sse2: missing endbr64

This is when building the plugin for playback of monkey's audio (ape)
files (plugins/ffap) which has its own copy of (a very old version of)
some asm from ffmpeg, see plugins/ffap/x86inc.asm and dsputil_yasm.asm.

This seems to do the trick on amd64, there might be a better way but
I was struggling with yasm vs nasm syntax. I'm testing to make sure it
doesn't break i386 now.

This Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/deadbeef/Makefile,v
retrieving revision 1.53
diff -u -p -r1.53 Makefile
--- Makefile	20 Sep 2023 15:58:34 -0000	1.53
+++ Makefile	27 Feb 2024 16:00:57 -0000
@@ -1,7 +1,7 @@
 COMMENT =		DeaDBeeF is an audio player
 DISTNAME =		deadbeef-1.9.4
 CATEGORIES =		audio
-REVISION =		0
+REVISION =		1
 
 HOMEPAGE =		https://deadbeef.sourceforge.io/
 
Index: patches/patch-plugins_ffap_x86inc_asm
===================================================================
RCS file: patches/patch-plugins_ffap_x86inc_asm
diff -N patches/patch-plugins_ffap_x86inc_asm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-plugins_ffap_x86inc_asm	27 Feb 2024 16:00:57 -0000
@@ -0,0 +1,28 @@
+Index: plugins/ffap/x86inc.asm
+--- plugins/ffap/x86inc.asm.orig
++++ plugins/ffap/x86inc.asm
+@@ -28,6 +28,16 @@
+     %endif
+ %endif
+ 
++%ifdef ARCH_X86_64
++%imacro _endbr64 0
++    dd 0xfa1e0ff3
++%endmacro
++%else
++%imacro _endbr64 0
++; empty
++%endmacro
++%endif
++
+ ; FIXME: All of the 64bit asm functions that take a stride as an argument
+ ; via register, assume that the high dword of that register is filled with 0.
+ ; This is true in practice (since we never do any 64bit arithmetic on strides,
+@@ -446,6 +456,7 @@ DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset
+     %endif
+     align function_align
+     %1:
++    _endbr64
+     RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
+     %assign stack_offset 0
+     %if %0 > 1