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

Martin Storsjö martin at martin.st
Tue Feb 18 08:35:04 CET 2014


On Mon, 17 Feb 2014, Brad Smith wrote:

> On 04/02/14 5:04 PM, Loren Merritt wrote:
>> On Tue, 4 Feb 2014, Martin Storsjö wrote:
>>> On Mon, 3 Feb 2014, Dimitry Andric wrote:
>>>> On 03 Feb 2014, at 18:39, Loren Merritt <lorenm at u.washington.edu> wrote:
>>>> ...
>>>> The reason is that gcc assumes a 16 byte stack alignment on i386, which
>>>> is only valid for Linux after ~2006, not most BSDs.  If you force gcc to
>>>> assume a 4 byte stack alignment, it also cannot compile the inline
>>>> assembly:
>>> 
>>> FWIW, the similar cases within libav are handled by adding
>>> __attribute__((force_align_arg_pointer)) to all public entry points into 
>>> the
>>> libraries, which adds a special prologue to these functions that realign 
>>> the
>>> stack to 16 bytes, and adding -mincoming-stack-boundary=4 to the cflags,
>>> telling the compiler to assume a 16 byte aligned stack in all functions, 
>>> so
>>> only the public ones need to care about fixing the alignment.
>> 
>> x264 does in fact realign the stack at all entrypoints (using yasm rather
>> than force_align_arg_pointer since we added that feature before
>> force_align_arg_pointer existed). And yes we do that so that we can
>> tell the compiler to assume aligned stack even if the OS doesn't provide
>> it. I didn't previously know that about BSD, but Win32 also doesn't.
>
> Still looking for any possible options that could result in being able
> to build x264 on i386. I haven't seen any suggestions yet that would
> help.

Did you try adding -mincoming-stack-boundary=4 to the cflags?

// Martin


More information about the x264-devel mailing list