[FFmpeg-devel] [PATCH] x86: cabac: Disable the inline asm on clang on windows on i386

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat May 30 00:52:20 EEST 2020



> Am 28.05.2020 um 12:37 schrieb Martin Storsjö <martin at martin.st>:
> 
>> On Mon, 25 May 2020, Martin Storsjö wrote:
>> 
>>> On Sun, 24 May 2020, Carl Eugen Hoyos wrote:
>>> 
>>> Am So., 24. Mai 2020 um 21:53 Uhr schrieb Martin Storsjö 
>> <martin at martin.st>:
>>> 
>>>> configure --enable-gpl --arch=i686 --cc=clang-cl --ld=lld-link
>>>> --target-os=win32 --toolchain=msvc --enable-cross-compile --ar=llvm-ar
>>>> --nm=llvm-nm --disable-stripping --extra-cflags=-m32
>>> 
>>> Why are you cross-compiling?
>>> On which system are you testing this?
>> 
>> Because I normally only ever cross compile for windows.
>> 
>> There seems to be a subtle difference in this case, between using clang-cl and "clang -target i686-win32-msvc"; clang-cl passes "-mdisable-fp-elim" to the compiler internals, while "clang -target i686-win32-msvc" doesn't.
>> 
>> And cross compiling does seem to affect this particular case; there's a check for whether ebp is available, which requires running the built executable. When cross compiling, it's assumed the built executable is ok and it isn't test run.
>> 
>> So with clang-cl running on windows, you'll end up with "#define HAVE_EBP_AVAILABLE 0" in config.h, and the x86 cabac code won't end up used at all - i.e. this patch wouldn't make any difference.
>> 
>> With clang-cl in cross compilation, and other invocations of "clang" instead of "clang-cl", targeting i686 windows, you'll end up with ebp_available enabled.
>> 
>> For a case where it does make a difference, in the same setup, try configuring this way instead:
>> 
>> --cc='clang -target i686-win32-msvc' --ld=lld-link --extra-ldflags='msvcrt.lib oldnames.lib' --toolchain=msvc
>> 
>> In this case, the ebp_available test will succeed, it will proceed to trying to build the x86 inline cabac code, which fails.
> 
> Any further comments on this patch?

Please wait a few days more, I am not happy about the patch and at least I’d like to understand better why this is a good and why there is no alternative.

Carl Eugen


More information about the ffmpeg-devel mailing list