Bug 1425381 - Always enable PIE on Android now that we support only >= 4.1. r?build
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -193,20 +193,24 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -
if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
fi
else
DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
fi
fi
-# bionic in Android < 4.1 doesn't support PIE
# On OSX, the linker defaults to building PIE programs when targeting OSX 10.7.
# On other Unix systems, some file managers (Nautilus) can't start PIE programs
-MOZ_PIE=
+if test "$OS_TARGET" = Android; then
+ # bionic in Android >= 4.1 supports PIE, and we target those versions.
+ MOZ_PIE=1
+else
+ MOZ_PIE=
+fi
MOZ_ARG_ENABLE_BOOL(pie,
[ --enable-pie Enable Position Independent Executables],
MOZ_PIE=1,
MOZ_PIE= )
if test "$GNU_CC$CLANG_CC" -a -n "$MOZ_PIE"; then
AC_MSG_CHECKING([for PIE support])
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -1,23 +1,19 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-# Any changes that affect Android need to be made in pie/moz.build as well.
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
Program(CONFIG['MOZ_CHILD_PROCESS_NAME'])
SOURCES += [
'MozillaRuntimeMainAndroid.cpp',
]
-
- DIRS += ['pie']
else:
GeckoProgram(CONFIG['MOZ_CHILD_PROCESS_NAME'], linkage='dependent')
SOURCES += [
'MozillaRuntimeMain.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
deleted file mode 100644
--- a/ipc/app/pie/moz.build
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-Program(CONFIG['MOZ_CHILD_PROCESS_NAME_PIE'])
-SOURCES += [
- '../MozillaRuntimeMainAndroid.cpp',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-LOCAL_INCLUDES += [
- '/toolkit/xre',
- '/xpcom/base',
-]
-
-LDFLAGS += ['-pie']
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -214,18 +214,18 @@ LOCAL_INCLUDES += [
'/toolkit/xre',
'/xpcom/threads',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
-for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_NAME_PIE',
- 'MOZ_CHILD_PROCESS_BUNDLE', 'DLL_PREFIX', 'DLL_SUFFIX'):
+for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_BUNDLE',
+ 'DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
LOCAL_INCLUDES += [
'/security/sandbox/chromium',
'/security/sandbox/chromium-shim',
'/security/sandbox/win/src/sandboxbroker',
]
--- a/js/xpconnect/shell/moz.build
+++ b/js/xpconnect/shell/moz.build
@@ -45,14 +45,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
'winmm.dll',
'user32.dll',
]
DELAYLOAD_DLLS += [
'xul.dll',
]
-if CONFIG['OS_TARGET'] == 'Android':
- LDFLAGS += ['-pie']
-
CFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
OS_LIBS += CONFIG['TK_LIBS']
--- a/mobile/android/installer/Makefile.in
+++ b/mobile/android/installer/Makefile.in
@@ -22,17 +22,16 @@ MOZ_PKG_DUPEFLAGS = -f $(srcdir)/allowed
DEFINES += -DPKG_LOCALE_MANIFEST=$(topobjdir)/mobile/android/installer/locale-manifest.in
MOZ_CHROME_LOCALE_ENTRIES=@BINPATH@/chrome/
DEFINES += \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DPREF_DIR=$(PREF_DIR) \
-DJAREXT= \
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
- -DMOZ_CHILD_PROCESS_NAME_PIE=$(MOZ_CHILD_PROCESS_NAME_PIE) \
-DANDROID_CPU_ARCH=$(ANDROID_CPU_ARCH) \
$(NULL)
ifdef MOZ_DEBUG
DEFINES += -DMOZ_DEBUG=1
endif
ifdef MOZ_ANDROID_EXCLUDE_FONTS
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -69,17 +69,16 @@
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
[lib destdir="lib/@ANDROID_CPU_ARCH@"]
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
# This should be MOZ_CHILD_PROCESS_NAME, but that has a "lib/" prefix.
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
-@BINPATH@/@MOZ_CHILD_PROCESS_NAME_PIE@
#ifdef MOZ_ANDROID_GOOGLE_VR
@BINPATH@/@DLL_PREFIX@gvr@DLL_SUFFIX@
#endif
[xpcom]
@BINPATH@/package-name.txt
@BINPATH@/classes.dex
--- a/old-configure.in
+++ b/old-configure.in
@@ -4426,18 +4426,16 @@ dnl ====================================
if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
else
# We want to let Android unpack the file at install time, but it only does
# so if the file is named libsomething.so. The lib/ path is also required
# because the unpacked file will be under the lib/ subdirectory and will
# need to be executed from that path.
MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
- MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
- AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
fi
MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
AC_SUBST(MOZ_CHILD_PROCESS_NAME)
AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)