mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1141693 - Build and use a PIE plugin-container on Android 5.0+. Based on a patch by Mike Hommey. r=me,glandium
This commit is contained in:
parent
ab5c952e37
commit
0092d07156
@ -8585,7 +8585,9 @@ else
|
||||
# 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="lib/libplugin-container.so"
|
||||
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/"
|
||||
|
||||
|
@ -2,10 +2,6 @@
|
||||
# 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/.
|
||||
|
||||
ifneq ($(dir $(PROGRAM)),./)
|
||||
GENERATED_DIRS = $(dir $(PROGRAM))
|
||||
endif
|
||||
|
||||
ifndef MOZ_WINCONSOLE
|
||||
ifdef MOZ_DEBUG
|
||||
MOZ_WINCONSOLE = 1
|
||||
|
@ -4,11 +4,15 @@
|
||||
# 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:
|
||||
kwargs = {
|
||||
'linkage': None,
|
||||
|
32
ipc/app/pie/moz.build
Normal file
32
ipc/app/pie/moz.build
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; 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',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_SANDBOX']:
|
||||
USE_LIBS += [
|
||||
'mozsandbox',
|
||||
]
|
||||
|
||||
# gcc lto likes to put the top level asm in syscall.cc in a different partition
|
||||
# from the function using it which breaks the build. Work around that by
|
||||
# forcing there to be only one partition.
|
||||
if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
|
||||
LDFLAGS += ['--param lto-partitions=1']
|
||||
|
||||
LDFLAGS += ['-pie']
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
@ -57,6 +57,10 @@ using mozilla::ipc::GeckoChildProcessHost;
|
||||
static const int kMagicAndroidSystemPropFd = 5;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
#endif
|
||||
|
||||
static const bool kLowRightsSubprocesses =
|
||||
// We currently only attempt to drop privileges on gonk, because we
|
||||
// have no plugins or extensions to worry about breaking.
|
||||
@ -164,7 +168,17 @@ GeckoChildProcessHost::GetPathToBinary(FilePath& exePath)
|
||||
exePath = exePath.DirName();
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
exePath = exePath.AppendASCII("lib");
|
||||
|
||||
// We must use the PIE binary on 5.0 and higher
|
||||
const char* processName = mozilla::AndroidBridge::Bridge()->GetAPIVersion() >= 21 ?
|
||||
MOZ_CHILD_PROCESS_NAME_PIE : MOZ_CHILD_PROCESS_NAME;
|
||||
|
||||
exePath = exePath.AppendASCII(processName);
|
||||
#else
|
||||
exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
|
@ -157,8 +157,8 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_BUNDLE',
|
||||
'DLL_PREFIX', 'DLL_SUFFIX'):
|
||||
for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_NAME_PIE',
|
||||
'MOZ_CHILD_PROCESS_BUNDLE', 'DLL_PREFIX', 'DLL_SUFFIX'):
|
||||
DEFINES[var] = '"%s"' % CONFIG[var]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
@ -49,7 +49,7 @@ package: local.properties project.properties AndroidManifest.xml FORCE
|
||||
|
||||
# Copy the SOs. The latter should be $(MOZ_CHILD_PROCESS_NAME), but
|
||||
# it includes a "lib/" prefix.
|
||||
cp $(_ABS_DIST)/bin/libmozglue.so $(_ABS_DIST)/bin/libplugin-container.so libs/$(ANDROID_CPU_ARCH)/
|
||||
cp $(addprefix $(_ABS_DIST)/bin/,libmozglue.so $(MOZ_CHILD_PROCESS_NAME) $(MOZ_CHILD_PROCESS_NAME_PIE)) libs/$(ANDROID_CPU_ARCH)/
|
||||
|
||||
# Copy the resources
|
||||
$(RM) -rf res
|
||||
|
@ -23,6 +23,7 @@ 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)
|
||||
|
||||
|
@ -76,7 +76,8 @@
|
||||
[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@/@DLL_PREFIX@plugin-container@DLL_SUFFIX@
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME_PIE@
|
||||
|
||||
[xpcom]
|
||||
@BINPATH@/dependentlibs.list
|
||||
|
Loading…
Reference in New Issue
Block a user