[vlc-commits] contrib: ffmpeg: Use -mincoming-stack-boundary=4

Edward Wang git at videolan.org
Thu Jul 26 13:30:42 CEST 2012

vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Jul 26 07:28:21 2012 -0400| [b6c82f0a4de142a03ec07adbf85d9d2218487e45] | committer: Rafaël Carré

contrib: ffmpeg: Use -mincoming-stack-boundary=4

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>

Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b6c82f0a4de142a03ec07adbf85d9d2218487e45

 contrib/src/ffmpeg/rules.mak |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index a1de6f8..032c4a1 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -87,6 +87,17 @@ endif
 # Linux
 FFMPEGCONF += --target-os=linux --enable-pic
+ifeq ($(ANDROID_ABI), x86)
+# 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.
+FFMPEG_CFLAGS += -mincoming-stack-boundary=4
+endif # x86
 # Windows

More information about the vlc-commits mailing list