Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: graphics/ffmpeg vs llvm 22 on i386
To:
Brad <brad@comstyle.com>, "Kirill A. Korinsky" <kirill@korins.ky>, ports <ports@openbsd.org>
Date:
Mon, 01 Jun 2026 19:25:45 +0200

Download raw body.

Thread
On Sat, 30 May 2026 17:08:05 +0200,
Stuart Henderson <stu@spacehopper.org> wrote:
> 
> [1  <text/plain; us-ascii (quoted-printable)>]
> swscale build fails, full build log for current (llvm 22) and previous
> (llvm 19) builds attached, tail below. both are from the same version
> (8.1.1).
> 
> there is this change in configure output:
> 
> llvm19: EBP available             no
> llvm22: EBP available             yes
> 
> I also notice there are a bunch of 'loop not vectorized' warnings
> but that's not new.
> 
> cc -I. -Isrc/ -D_ISOC11_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -I/pobj/ffmpeg-8.1.1/ffmpeg-8.1.1/compat/stdbit -DZLIB_CONST -DHAVE_AV_CONFIG_H -DBUILDING_swscale -O2 -pipe  -I/usr/local/include -I/usr/X11R6/include -std=c17 -fPIC -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include -pthread  -I/usr/local/include -I/usr/local/include -I/usr/X11R6/include -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/fribidi -I/usr/X11R6/include/freetype2 -I/usr/local/include -I/usr/X11R6/include -I/usr/X11R6/include/libdrm -I/usr/X11R6/include -I/usr/X11R6/include/freetype2 -I/usr/X11R6/include/freetype2 -I/usr/local/include/fribidi -I/usr/local/include/harfbuzz -I/usr/X11R6/include/freetype2 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/local/include/opus -I/usr/local/include/opus -I/usr/local/include -I/usr/local/include/svt-av1 -DEB_DLL -DRTC_BUILD=0 -I/usr
 /local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include/webp -I/usr/local/include -I/usr/local/include/webp -I/usr/local/include -DX264_API_IMPORTS -I/usr/local/include -I/usr/local/include -I/usr/local/include/libxml2   -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include/libdrm -I/usr/X11R6/include -I/usr/X11R6/include -I/usr/X11R6/include -g -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wempty-body -Wmissing-prototypes -Wstrict-prototypes -Wunterminated-string-initialization -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -Wno-bool-operation -Wno-char-subscripts -Wno-implicit-const-int-float-conversion -Wno-microsoft-enum-forward-reference -O2 -pipe -Wno-red
 un
> src/libswscale/x86/rgb2rgb.c:1476:13: error: inline assembly requires more registers than available
>  1476 |             "mov                        %4, %%"FF_REG_a"\n\t"
>       |             ^
> 1 error generated.
> gmake: *** [/pobj/ffmpeg-8.1.1/ffmpeg-8.1.1/ffbuild/common.mak:91: libswscale/x86/rgb2rgb.o] Error 1
> *** Error 2 in graphics/ffmpeg (/usr/ports/infrastructure/mk/bsd.port.mk:3080 '/pobj/ffmpeg-8.1.1/build-i386/.build_done': @cd /pobj/ffmpeg-...)
> *** Error 2 in graphics/ffmpeg (/usr/ports/infrastructure/mk/bsd.port.mk:2723 'build': @lock=ffmpeg-8.1.1v1;  export _LOCKS_HELD=" ffmpeg-8....)
> ===> Exiting graphics/ffmpeg with an error
> *** Error 1 in /usr/ports (infrastructure/mk/bsd.port.subdir.mk:144 'build': @: ${echo_msg:=echo};  : ${target:=build};  for i in ; do  eval...)
> >>> Ended at 1780152281.15
> max_stuck=68.53/depends=7.70/show-prepare-results=4.51/patch=3.13/configure=101.99/build=240.31
> Error: job failed with 512 on i386-3 at 1780152281
> [2 ffmpeg.log.gz <application/x-gunzip (base64)>]
> [3 ffmpeg.previous.log.gz <application/x-gunzip (base64)>]

May I ask you to try this diff?

Index: patches/patch-configure
===================================================================
RCS file: /home/cvs/ports/graphics/ffmpeg/patches/patch-configure,v
diff -u -p -r1.79 patch-configure
--- patches/patch-configure	21 May 2026 16:24:15 -0000	1.79
+++ patches/patch-configure	1 Jun 2026 17:24:33 -0000
@@ -20,7 +20,28 @@ Index: configure
  
  enable_weak_pic() {
      disabled pic && return
-@@ -7002,7 +7001,7 @@ check_headers asm/types.h
+@@ -6745,11 +6744,19 @@ elif enabled x86; then
+     # As 'i' is stored on the stack, this program will crash
+     # if the base pointer is used to access it because the
+     # base pointer is cleared in the inline assembly code.
+-    check_exec_crash <<EOF && enable ebp_available
++    # Since https://github.com/llvm/llvm-project/commit/0d471b3f64d3116bd57c79d872f7384fff80daa5,
++    # Clang can save/restore EBP around clobber-only asm, so the old
++    # crash probe can be a false positive.
++    check_exec_crash <<EOF && test_cc <<EOF_EBP_REGS && enable ebp_available
+ volatile int i=0;
+ __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
+ return i;
+ EOF
++void foo(void *a, void *b, void *c, void *d, int e, void *f)
++{
++    __asm__ volatile ("" :: "r"(a), "r"(b), "r"(c), "r"(d), "g"(e), "r"(f) : "%eax", "%edx");
++}
++EOF_EBP_REGS
+ 
+     # check whether EBX is available on x86
+     check_inline_asm ebx_available '""::"b"(0)' &&
+@@ -7002,7 +7009,7 @@ check_headers asm/types.h
  #
  # some configurations also require linking to libatomic, so try
  # both with -latomic and without
@@ -29,7 +50,7 @@ Index: configure
      check_builtin stdatomic stdatomic.h                                \
          "atomic_int foo, bar = -1; atomic_store(&foo, 0); foo += bar"  \
          $LATOMIC && eval stdatomic_extralibs="\$LATOMIC" && break
-@@ -7489,13 +7488,13 @@ enabled omx_rpi           && { test_code cc OMX_Core.h
+@@ -7489,13 +7496,13 @@ enabled omx_rpi           && { test_code cc OMX_Core.h
  enabled omx               && require_headers OMX_Core.h && \
      warn "The OpenMAX encoders are deprecated and will be removed in future versions"
  


-- 
wbr, Kirill