This seems to be the magic to insert an endbr64 at the start of global
functions. Even though many of these are hidden in the shared
library, the majority seems to be called through function pointers
that are setup based on the available instruction set extensions.
With this diff "make test" passes again.
ok?
Index: multimedia/x265/Makefile
===
RCS file: /cvs/ports/multimedia/x265/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- multimedia/x265/Makefile27 Sep 2023 10:10:22 - 1.57
+++ multimedia/x265/Makefile19 Feb 2024 22:54:22 -
@@ -3,7 +3,7 @@ COMMENT=free H.265/HEVC encoder
VER= 3.5
DISTNAME= x265_${VER}
PKGNAME= x265-${VER}
-REVISION= 2
+REVISION= 3
CATEGORIES=multimedia
SITES= https://bitbucket.org/multicoreware/x265_git/downloads/
Index: multimedia/x265/patches/patch-source_common_x86_x86inc_asm
===
RCS file: multimedia/x265/patches/patch-source_common_x86_x86inc_asm
diff -N multimedia/x265/patches/patch-source_common_x86_x86inc_asm
--- /dev/null 1 Jan 1970 00:00:00 -
+++ multimedia/x265/patches/patch-source_common_x86_x86inc_asm 19 Feb 2024
22:54:22 -
@@ -0,0 +1,13 @@
+Index: source/common/x86/x86inc.asm
+--- source/common/x86/x86inc.asm.orig
source/common/x86/x86inc.asm
+@@ -717,6 +717,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg,
+ %endif
+ align function_align
+ %2:
++%if ARCH_X86_64
++endbr64
++%endif
+ RESET_MM_PERMUTATION; needed for x86-64, also makes disassembly
somewhat nicer
+ %xdefine rstk rsp ; copy of the original stack pointer, used
when greater alignment than the known stack alignment is required
+ %assign stack_offset 0 ; stack pointer offset relative to the return
address