[x264-devel] Failure to build x264 with ASM on i386

Brad Smith brad at comstyle.com
Mon Feb 3 03:47:28 CET 2014


On 02/02/14 8:22 AM, Dimitry Andric wrote:
> On 02 Feb 2014, at 11:24, Brad Smith <brad at comstyle.com> wrote:
>> I am trying to build x264 with ASM on i386 but running into an issue with two functions within common/x86/util.h not building, the two
>> functions in question are x264_predictor_clip_mmx2() and x264_predictor_roundclip_mmx2(). This code builds fine on amd64.
>> I tried without and with -fomit-frame-pointer but that did not
>> help. The rest of x264 builds just fine.
>>
>> Looking for any assistance with trying to fix the build.
>>
>> $ clang -Wshadow -ffast-math -O2 -pipe -fomit-frame-pointer -Wall -I. -I. -std=gnu99 -fno-tree-vectorize -fPIC -c -o encoder/me.so encoder/me.c
>> In file included from encoder/me.c:28:
>> In file included from ./common/common.h:1014:
>> ./common/x86/util.h:131:9: error: inline assembly requires more registers than available
>>         "movq       (%2), %%mm5 \n"
>>         ^
>> ./common/x86/util.h:194:9: error: inline assembly requires more registers than available
>>         "movq       (%2), %%mm5 \n"
>>         ^
>> 2 errors generated.
>
> If this is on OpenBSD or equivalent, you are running out of registers,
> due to PIC, and possibly stack realignment.  If you try to compile this
> without PIC, it will most likely work.  This is what is used for the
> FreeBSD port on i386.

The OS isn't a factor in this issue. It's the architecture and the way
the ASM code is written. You can't build a shared library without PIC.
I can quite clearly see this is not the case for FreeBSD/i386.

> If you must use PIC, you need to free up one other register, for example
> by assuming 16 byte stack alignment throughout.  The code will not be
> ABI compatible with the rest of system, in that case.

Neither of these suggestions are even close to being realistic. Using a
car analogy it would be like saying to fix your car you have to take off
one of the wheels or remove the engine.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the x264-devel mailing list