From bb2afff5c1496f3de90a3fa543dea1897c651717 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 11 Jan 2018 10:42:15 +0900 Subject: [PATCH] Bug 1425381 - Always enable PIE on Android now that we support only >= 4.1. r=froydnj --HG-- extra : rebase_source : c73d77ab1274b2dd54a3785a6d77c6e8dcb69f87 --- build/autoconf/compiler-opts.m4 | 8 ++++++-- ipc/app/moz.build | 4 ---- ipc/app/pie/moz.build | 19 ------------------- ipc/glue/moz.build | 4 ++-- js/xpconnect/shell/moz.build | 3 --- mobile/android/installer/Makefile.in | 1 - mobile/android/installer/package-manifest.in | 1 - old-configure.in | 2 -- 8 files changed, 8 insertions(+), 34 deletions(-) delete mode 100644 ipc/app/pie/moz.build diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4 index 02b57eae9ba9..3d9dc5a80032 100644 --- a/build/autoconf/compiler-opts.m4 +++ b/build/autoconf/compiler-opts.m4 @@ -198,10 +198,14 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then 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], diff --git a/ipc/app/moz.build b/ipc/app/moz.build index 8aaaed8e1404..290a540121b2 100644 --- a/ipc/app/moz.build +++ b/ipc/app/moz.build @@ -4,15 +4,11 @@ # 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') diff --git a/ipc/app/pie/moz.build b/ipc/app/pie/moz.build deleted file mode 100644 index 6924199b5e1a..000000000000 --- 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'] diff --git a/ipc/glue/moz.build b/ipc/glue/moz.build index 89639e03cb21..6bef52aed403 100644 --- a/ipc/glue/moz.build +++ b/ipc/glue/moz.build @@ -219,8 +219,8 @@ 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': diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build index 0875f0cf51e0..c9f1137bdab5 100644 --- a/js/xpconnect/shell/moz.build +++ b/js/xpconnect/shell/moz.build @@ -50,9 +50,6 @@ if CONFIG['OS_ARCH'] == 'WINNT': 'xul.dll', ] -if CONFIG['OS_TARGET'] == 'Android': - LDFLAGS += ['-pie'] - CFLAGS += CONFIG['TK_CFLAGS'] CXXFLAGS += CONFIG['TK_CFLAGS'] OS_LIBS += CONFIG['TK_LIBS'] diff --git a/mobile/android/installer/Makefile.in b/mobile/android/installer/Makefile.in index 7274ec73047b..8ff3dac7ed8a 100644 --- a/mobile/android/installer/Makefile.in +++ b/mobile/android/installer/Makefile.in @@ -27,7 +27,6 @@ DEFINES += \ -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) diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index e64ca9292e87..16fc2c152fd2 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -74,7 +74,6 @@ @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@ diff --git a/old-configure.in b/old-configure.in index be46750d3840..e55340651208 100644 --- a/old-configure.in +++ b/old-configure.in @@ -4431,8 +4431,6 @@ else # 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"