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

Edward Wang edward.c.wang at compdigitec.com
Wed Jul 25 04:51:44 CEST 2012


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 |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index ed6d8e8..fb069a3 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -82,6 +82,15 @@ endif
 # Linux
 ifdef HAVE_LINUX
 FFMPEGCONF += --target-os=linux --enable-pic
+
+ifeq ($(ANDROID_ABI), x86)
+ifdef HAVE_ANDROID
+# Android-x86 doesn't guarantee an aligned stack, so we tell gcc to
+# assume that the stack actually is aligned already
+FFMPEGCONF += --extra-cflags='-mincoming-stack-boundary=4'
+endif # HAVE_ANDROID
+endif # x86
+
 endif
 
 # Windows
-- 
1.7.5.4



More information about the Android mailing list