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

Sérgio Basto sergio at serjux.com
Mon Feb 24 04:17:07 CET 2014


On Ter, 2014-02-18 at 14:00 -0500, Brad Smith wrote: 
> On 18/02/14 2:35 AM, Martin Storsjö wrote:
> > 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?
> 
> $ clang -mincoming-stack-boundary=4
> clang-3.5: error: unknown argument: '-mincoming-stack-boundary=4'

Hi, 
I checked how rpmfusion package it for Fedora 20 , and 3 produce 3 .so

repoquery -q x264-libs.i686 -l
/usr/lib/libx264.so.138
/usr/lib/libx26410b.so.138
/usr/lib/sse2/libx264.so.138

first is made with disable-asm [1]
second with disable-asm and --bit-depth=10 
third , with asm and with --libdir=/usr/lib/sse2, seems that compiles 

[1]
./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--includedir=/usr/include '--extra-cflags=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686
-mtune=atom -fasynchronous-unwind-tables' --disable-ffms --enable-debug
--enable-shared --system-libx264 --enable-pic
--host=i686-redhat-linux-gnu --libdir=/usr/lib --disable-asm

[2]
./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--includedir=/usr/include '--extra-cflags=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686
-mtune=atom -fasynchronous-unwind-tables' --disable-ffms --enable-debug
--enable-shared --system-libx264 --enable-pic
--host=i686-redhat-linux-gnu --libdir=/usr/lib --disable-asm
--bit-depth=10

[3]
./configure --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin
--includedir=/usr/include '--extra-cflags=-O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches  -m32 -march=i686
-mtune=atom -fasynchronous-unwind-tables' --disable-ffms --enable-debug
--enable-shared --system-libx264 --enable-pic
--host=i686-redhat-linux-gnu --libdir=/usr/lib/sse2


-- 
Sérgio M. B.



More information about the x264-devel mailing list