[vlc-devel] [PATCH] contrib: ffmpeg: disable some inline assembler in win32 builds with LLVM

Steve Lhomme robux4 at ycbcr.xyz
Wed Jun 17 16:30:37 CEST 2020


Fixes this error in i686 builds:

 In file included from libavcodec/h264_cabac.c:46:
libavcodec/x86/h264_cabac.c:66:9: error: inline assembly requires more registers than available
        "3:                                     \n\t"
        ^
1 error generated.
make[1]: *** [ffbuild/common.mak:59: libavcodec/h264_cabac.o] Error 1

The other suggestion [1] to disable the integrated assembler causes other
issues.

This is a limitation of LLVM when working in i686 [2]

[1] https://trac.ffmpeg.org/ticket/7796
[2] https://bugs.llvm.org/show_bug.cgi?id=37542
---
 contrib/src/ffmpeg/rules.mak | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 187d513aa14f..a932570ca8bf 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -242,6 +242,17 @@ ifdef USE_FFMPEG
 	$(APPLY) $(SRC)/ffmpeg/0001-avcodec-dxva2_hevc-add-support-for-parsing-HEVC-Rang.patch
 	$(APPLY) $(SRC)/ffmpeg/0002-avcodec-hevcdec-allow-HEVC-444-8-10-12-bits-decoding.patch
 	$(APPLY) $(SRC)/ffmpeg/0003-avcodec-hevcdec-allow-HEVC-422-10-12-bits-decoding-w.patch
+ifdef HAVE_WIN32
+ifdef HAVE_CLANG
+ifeq ($(ARCH),i386)
+	# Fixes compile error: inline assembly requires more registers than available
+	# See https://bugs.llvm.org/show_bug.cgi?id=37542
+	cd $(UNPACK_DIR) && sed -i.orig -e 's, HAVE_7REGS , defined(HAVE_7REGS_DISABLED) ,' libavcodec/x86/h264_cabac.c
+	cd $(UNPACK_DIR) && sed -i.orig -e 's, HAVE_7REGS , defined(HAVE_7REGS_DISABLED) ,' libswscale/x86/yuv2rgb_template.c
+	cd $(UNPACK_DIR) && sed -i.orig -e 's, HAVE_7REGS , defined(HAVE_7REGS_DISABLED) ,' libswscale/x86/yuv2rgb.c
+endif
+endif
+endif
 endif
 ifdef USE_LIBAV
 	$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch
-- 
2.26.2



More information about the vlc-devel mailing list