[vlc-devel] [PATCH] build: disable non-PIC assembly when building for Android.

=?UTF-8?q?Diego=20Elio=20Petten=C3?= flameeyes at flameeyes.eu
Sat Dec 5 17:38:01 CET 2015


From: Diego Elio Pettenà <flameeyes at flameeyes.eu>

This disables MMX/MMXEXT code for ffmpeg/postproc, and all assembly for mpg123 and libass.

It has performance implications but it avoids all TEXTRELs in the output, which makes it possible to use W^X techniques. The code can probably be ported to be PIC-compatible in the future so that these can be re-enabled, but even Gentoo Linux has no better solutions for this at the moment.
---
 contrib/src/ass/rules.mak      | 5 +++++
 contrib/src/ffmpeg/rules.mak   | 4 ++++
 contrib/src/mpg123/rules.mak   | 4 ++++
 contrib/src/postproc/rules.mak | 4 ++++
 4 files changed, 17 insertions(+)

diff --git a/contrib/src/ass/rules.mak b/contrib/src/ass/rules.mak
index a9c2603..d2337aa 100644
--- a/contrib/src/ass/rules.mak
+++ b/contrib/src/ass/rules.mak
@@ -10,6 +10,7 @@ endif
 ifdef HAVE_ANDROID
 WITH_FONTCONFIG = 0
 WITH_HARFBUZZ = 0
+WITH_ASM = 0
 else
 ifdef HAVE_TIZEN
 WITH_FONTCONFIG = 0
@@ -59,6 +60,10 @@ else
 ASS_CONF += --disable-harfbuzz
 endif
 
+ifeq ($(WITH_ASM), 0)
+ASS_CONF += --disable-asm
+endif
+
 ifdef WITH_OPTIMIZATION
 ASS_CFLAGS += -O3
 else
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 032d66a..3bdf1ad 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -138,6 +138,10 @@ FFMPEGCONF += --target-os=linux --enable-pic
 
 endif
 
+ifdef HAVE_ANDROID
+FFMPEGCONF +=  --disable-mmx --disable-mmxext
+endif
+
 # Windows
 ifdef HAVE_WIN32
 ifndef HAVE_MINGW_W64
diff --git a/contrib/src/mpg123/rules.mak b/contrib/src/mpg123/rules.mak
index 1f90f79..66a82a3 100644
--- a/contrib/src/mpg123/rules.mak
+++ b/contrib/src/mpg123/rules.mak
@@ -7,6 +7,10 @@ ifeq ($(call need_pkg,"mpg123"),)
 PKGS_FOUND += mpg123
 endif
 
+ifdef HAVE_ANDROID
+HOSTCONF += --with-cpu=generic_fpu
+endif
+
 $(TARBALLS)/mpg123-$(MPG123_VERSION).tar.bz2:
 	$(call download,$(MPG123_URL))
 
diff --git a/contrib/src/postproc/rules.mak b/contrib/src/postproc/rules.mak
index a132e57..90cdf86 100644
--- a/contrib/src/postproc/rules.mak
+++ b/contrib/src/postproc/rules.mak
@@ -73,6 +73,10 @@ ifdef HAVE_LINUX
 POSTPROCCONF += --target-os=linux --enable-pic
 endif
 
+ifdef HAVE_ANDROID
+POSTPROCCONF +=  --disable-mmx --disable-mmxext
+endif
+
 # Windows
 ifdef HAVE_WIN32
 POSTPROCCONF += --target-os=mingw32
-- 
2.6.1



More information about the vlc-devel mailing list