[Android] [PATCH 3/4] contrib: ffmpeg: Use --extra-cflags='-mincoming-stack-boundary=4'

Rafaël Carré funman at videolan.org
Thu Jul 26 12:35:07 CEST 2012


Le 2012-07-26 02:31, Edward Wang a écrit :
> The issue here is that android-x86 doesn't guarantee an aligned stack, which means some of the inline asm functions will waste an extra register on realigning the stack.
> 
> libavcodec does however have stuff in place in all entrypoints that realign the stack on all calls into the library. If you build with --extra-cflags='-mincoming-stack-boundary=4', gcc assumes that the stack actually is aligned already, which the entry points ensure, so this inline asm builds fine.
> 
> Pointed-out-by: Martin Storsjö <martin at martin.st>
> ---
>  contrib/src/ffmpeg/rules.mak |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
> index a1de6f8..0f559f2 100644
> --- a/contrib/src/ffmpeg/rules.mak
> +++ b/contrib/src/ffmpeg/rules.mak
> @@ -87,6 +87,17 @@ endif
>  # Linux
>  ifdef HAVE_LINUX
>  FFMPEGCONF += --target-os=linux --enable-pic
> +
> +ifeq ($(ANDROID_ABI), x86)
> +ifdef HAVE_ANDROID
> +# Android-x86 gcc doesn't guarantee an aligned stack, but this is
> +# handled by __attribute__((force_align_arg_pointer)) in libavcodec
> +# already, so we tell gcc to assume this alignment, so we don't need
> +# to waste a precious register in assembly functions to realign it.
> +FFMPEGCONF += --extra-cflags='-mincoming-stack-boundary=4'

-mincoming-stack-boundary=4 should be added to FFMPEG_CFLAGS, else we'll
run configure with 2 times --extra-cflags argument.

> +endif # HAVE_ANDROID
> +endif # x86
> +
>  endif
>  
>  # Windows
> 



More information about the Android mailing list