Index | Thread | Search

From:
Theo Buehler <tb@openbsd.org>
Subject:
Re: missing endbr64
To:
Mark Kettenis <mark.kettenis@xs4all.nl>
Cc:
ports@openbsd.org, brad@comstyle.com
Date:
Sun, 25 Feb 2024 14:39:37 +0100

Download raw body.

Thread
On Sun, Feb 25, 2024 at 01:35:54PM +0100, Mark Kettenis wrote:
> > From: Theo Buehler <tb () theobuehler ! org>
> > Date: Sun, 25 Feb 2024 09:39:39 +0000
> > 
> > Here's the list of ~90 ports emitting warnings after about 1/4 of an
> > amd64 bulk. First the ports that I haven't looked at more closely with
> > (some of) the warnings. Then some ports using D where I suspect NOBTCFI
> > is missing. Go, Haskell and Ocaml ports are linked using nobtcfi, as far
> > as I know, so I moved them to the end without details.
> 
> ...
> 
> > multimedia/x264.log
> > ld: warning: x264_8_sub8x8_dct_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct8_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct_ssse3.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct8_ssse3.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct_avx.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct8_avx.skip_prologue: missing endbr64
> > ld: warning: x264_8_sub8x8_dct_xop.skip_prologue: missing endbr64
> > ld: warning: x264_8_add8x8_idct8_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_8_add8x8_idct8_avx.skip_prologue: missing endbr64
> > ld: warning: x264_8_add8x8_idct_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_8_add8x8_idct_avx.skip_prologue: missing endbr64
> > ld: warning: x264_10_sub8x8_dct8_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_10_sub8x8_dct8_sse4.skip_prologue: missing endbr64
> > ld: warning: x264_10_sub8x8_dct8_avx.skip_prologue: missing endbr64
> > ld: warning: x264_10_add8x8_idct8_sse2.skip_prologue: missing endbr64
> > ld: warning: x264_10_add8x8_idct8_avx.skip_prologue: missing endbr64
> 
> Here is a fix:

ok tb

> 
> Index: multimedia/x264/Makefile
> ===================================================================
> RCS file: /cvs/ports/multimedia/x264/Makefile,v
> retrieving revision 1.69
> diff -u -p -r1.69 Makefile
> --- multimedia/x264/Makefile	20 Feb 2024 10:06:12 -0000	1.69
> +++ multimedia/x264/Makefile	25 Feb 2024 12:32:10 -0000
> @@ -4,7 +4,7 @@ DISTNAME=	x264-20221028
>  GH_ACCOUNT=	mirror
>  GH_PROJECT=	x264
>  GH_COMMIT=	416e3eb2b52abb0a67e57599aba4f8be3003b36d
> -REVISION=	2
> +REVISION=	3
>  CATEGORIES=	multimedia
>  
>  SHARED_LIBS=	x264	24.0
> Index: multimedia/x264/patches/patch-common_x86_x86inc_asm
> ===================================================================
> RCS file: /cvs/ports/multimedia/x264/patches/patch-common_x86_x86inc_asm,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-common_x86_x86inc_asm
> --- multimedia/x264/patches/patch-common_x86_x86inc_asm	20 Feb 2024 10:06:12 -0000	1.1
> +++ multimedia/x264/patches/patch-common_x86_x86inc_asm	25 Feb 2024 12:32:10 -0000
> @@ -11,3 +11,13 @@ Index: common/x86/x86inc.asm
>       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
> +@@ -823,6 +826,9 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg,
> +         global current_function %+ %1
> +     %endif
> +     %1:
> ++    %if ARCH_X86_64
> ++        endbr64
> ++    %endif
> + %endmacro
> + 
> + %macro cextern 1