summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorjvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-09 02:00:24 +0000
committerjvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-09 02:00:24 +0000
commit27630a3ee5c41c0c8b6c78d75ed6df54c5ff64a2 (patch)
treefbbdfb1a92ba1e003ae4afa49342d2d726fa3648 /ppapi
parent85cfc8e7c581e960596a604f791a661f7538b78b (diff)
downloadchromium_src-27630a3ee5c41c0c8b6c78d75ed6df54c5ff64a2.zip
chromium_src-27630a3ee5c41c0c8b6c78d75ed6df54c5ff64a2.tar.gz
chromium_src-27630a3ee5c41c0c8b6c78d75ed6df54c5ff64a2.tar.bz2
Split the PNaCl IRT shim into 3 pieces, and include one piece into IRT.
(*) A "for irt" library, that will get linked into the IRT. That library just has the auto-generated pnacl_shim.c file. Also modify ppapi_proxy to include a "irt_shim_ppapi.c", which makes use of the pnacl_shim.c file to define a private hook, parallel to the hook provided by irt_ppapi.c. (*) A "for the browser" library, that the browser-tester and the PNaCl packager will include for PNaCl-in-the-browser. This is still called "libpnacl_irt_shim.a" so that we don't need to change the in-browser linker's commandline. However, it will be placed in a different directory so that the Chrome PNaCl packager can pick it up separately from the AOT library. This for-browser library uses the new hook. (*) A "AOT" library, that will go into the SDK for offline pexe -> nexe translation. Still called "libpnacl_irt_shim.a" as well, confusingly enough, so that we don't need to change the pnacl-nativeld.py commandlines. Placed in a different directory from the for-browser library. Does not use the new hook, so that it only depends on stable interfaces. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3783 R=binji@chromium.org, dmichael@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/164373010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255807 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/native_client.gyp6
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.c79
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h30
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp66
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c6
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c77
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h15
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp26
-rw-r--r--ppapi/ppapi_nacl.gyp4
-rw-r--r--ppapi/proxy/DEPS2
-rw-r--r--ppapi/proxy/irt_ppapi.c16
11 files changed, 247 insertions, 80 deletions
diff --git a/ppapi/native_client/native_client.gyp b/ppapi/native_client/native_client.gyp
index d8db2ad..5621cbc 100644
--- a/ppapi/native_client/native_client.gyp
+++ b/ppapi/native_client/native_client.gyp
@@ -119,6 +119,7 @@
'link_flags': [
'-Wl,--start-group',
'-lirt_browser',
+ '-lpnacl_irt_shim_for_irt',
'-lppapi_proxy_nacl',
'-lppapi_ipc_nacl',
'-lppapi_shared_nacl',
@@ -172,6 +173,7 @@
'>(tc_lib_dir_irt64)/libipc_nacl.a',
'>(tc_lib_dir_irt64)/libbase_nacl.a',
'>(tc_lib_dir_irt64)/libirt_browser.a',
+ '>(tc_lib_dir_irt64)/libpnacl_irt_shim_for_irt.a',
'>(tc_lib_dir_irt64)/libshared_memory_support_nacl.a',
'>(tc_lib_dir_irt64)/libsrpc.a',
'>(tc_lib_dir_irt64)/libplatform.a',
@@ -192,6 +194,7 @@
'>(tc_lib_dir_irt32)/libipc_nacl.a',
'>(tc_lib_dir_irt32)/libbase_nacl.a',
'>(tc_lib_dir_irt32)/libirt_browser.a',
+ '>(tc_lib_dir_irt32)/libpnacl_irt_shim_for_irt.a',
'>(tc_lib_dir_irt32)/libshared_memory_support_nacl.a',
'>(tc_lib_dir_irt32)/libsrpc.a',
'>(tc_lib_dir_irt32)/libplatform.a',
@@ -214,6 +217,7 @@
'>(tc_lib_dir_irt_arm)/libipc_nacl.a',
'>(tc_lib_dir_irt_arm)/libbase_nacl.a',
'>(tc_lib_dir_irt_arm)/libirt_browser.a',
+ '>(tc_lib_dir_irt_arm)/libpnacl_irt_shim_for_irt.a',
'>(tc_lib_dir_irt_arm)/libshared_memory_support_nacl.a',
'>(tc_lib_dir_irt_arm)/libsrpc.a',
'>(tc_lib_dir_irt_arm)/libplatform.a',
@@ -236,6 +240,7 @@
'>(tc_lib_dir_irt_mips)/libipc_nacl.a',
'>(tc_lib_dir_irt_mips)/libbase_nacl.a',
'>(tc_lib_dir_irt_mips)/libirt_browser.a',
+ '>(tc_lib_dir_irt_mips)/libpnacl_irt_shim_for_irt.a',
'>(tc_lib_dir_irt_mips)/libshared_memory_support_nacl.a',
'>(tc_lib_dir_irt_mips)/libsrpc.a',
'>(tc_lib_dir_irt_mips)/libplatform.a',
@@ -246,6 +251,7 @@
],
},
'dependencies': [
+ 'src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim_for_irt',
'../ppapi_proxy_nacl.gyp:ppapi_proxy_nacl',
'../ppapi_ipc_nacl.gyp:ppapi_ipc_nacl',
'../ppapi_shared_nacl.gyp:ppapi_shared_nacl',
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.c
new file mode 100644
index 0000000..eeca8cf
--- /dev/null
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h"
+
+#include "native_client/src/untrusted/irt/irt.h"
+#include "ppapi/nacl_irt/irt_ppapi.h"
+#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.h"
+#include "ppapi/proxy/plugin_main_irt.h"
+
+/*
+ * Defines a version of the version irt_ppapi_start and of the irt_ppapihook
+ * that returns a shimmed GetInterface for PNaCl.
+ *
+ * The hook will be linked into the IRT but it is considered unstable.
+ * Stable nexes should not use that IRT hook (and a filter prevents
+ * it from being used). Instead PNaCl nexes should embed the
+ * irt_shim_ppapi_start and the shim functions directly into the nexe
+ * for ABI stability.
+ */
+
+static struct PP_StartFunctions g_user_start_functions;
+
+static int32_t shim_PPPInitializeModule(PP_Module module_id,
+ PPB_GetInterface get_browser_intf) {
+ /* Record the original PPB_GetInterface and provide a shimmed one. */
+ __set_real_Pnacl_PPBGetInterface(get_browser_intf);
+ return (*g_user_start_functions.PPP_InitializeModule)(
+ module_id,
+ &__Pnacl_PPBGetInterface);
+}
+
+static void shim_PPPShutdownModule() {
+ (*g_user_start_functions.PPP_ShutdownModule)();
+}
+
+#ifdef PNACL_SHIM_AOT
+ /*
+ * This will be discovered and set by the shim, since we cannot link
+ * against the IRT directly in the AOT library.
+ */
+int (*real_irt_ppapi_start)(const struct PP_StartFunctions *) = NULL;
+#else
+ /*
+ * Otherwise, when linking directly into the IRT, we can refer to the
+ * real irt_ppapi_start from irt_ppapi.
+ */
+extern int irt_ppapi_start(const struct PP_StartFunctions *);
+static int (* const real_irt_ppapi_start)(const struct PP_StartFunctions *) =
+ &irt_ppapi_start;
+#endif
+
+int irt_shim_ppapi_start(const struct PP_StartFunctions *funcs) {
+ g_user_start_functions = *funcs;
+ /*
+ * Record the original PPP_GetInterface and provide a shimmed one
+ * via wrapped_ppapi_methods.
+ */
+ const struct PP_StartFunctions wrapped_ppapi_methods = {
+ shim_PPPInitializeModule,
+ shim_PPPShutdownModule,
+ __Pnacl_PPPGetInterface
+ };
+ __set_real_Pnacl_PPPGetInterface(g_user_start_functions.PPP_GetInterface);
+ /*
+ * Invoke the IRT's ppapi_start interface with the wrapped interface.
+ */
+ return (*real_irt_ppapi_start)(&wrapped_ppapi_methods);
+}
+
+#ifndef PNACL_SHIM_AOT
+const struct nacl_irt_ppapihook nacl_irt_ppapihook_pnacl_private = {
+ irt_shim_ppapi_start,
+ PpapiPluginRegisterThreadCreator,
+};
+#endif
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h b/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h
new file mode 100644
index 0000000..5654dce
--- /dev/null
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef PPAPI_NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_IRT_SHIM_PPAPI_H_
+#define PPAPI_NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_IRT_SHIM_PPAPI_H_
+
+#include "ppapi/nacl_irt/irt_ppapi.h"
+
+#ifdef PNACL_SHIM_AOT
+
+/* Given a hook for the real irt ppapi start, get a shimmed ppapi_start. */
+extern int (*real_irt_ppapi_start)(const struct PP_StartFunctions *);
+extern int irt_shim_ppapi_start(const struct PP_StartFunctions *funcs);
+
+#else
+
+/*
+ * A private version of the NACL_IRT_PPAPIHOOK_v0_1, which provides
+ * PNaCl with shimmed IRT interfaces.
+ */
+#define NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1 \
+ "nacl-irt-ppapihook-pnacl-private-0.1"
+extern const struct nacl_irt_ppapihook nacl_irt_ppapihook_pnacl_private;
+
+#endif
+
+#endif
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
index 7f2b677..ba115dd 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp
@@ -8,7 +8,8 @@
],
'targets': [
{
- 'target_name': 'pnacl_irt_shim',
+ # The full library, which PNaCl uses for offline .pexe -> .nexe.
+ 'target_name': 'pnacl_irt_shim_aot',
'type': 'none',
'variables': {
'nlib_target': 'libpnacl_irt_shim.a',
@@ -25,6 +26,7 @@
'enable_arm': 1,
'enable_mips': 1,
'sources': [
+ 'irt_shim_ppapi.c',
'pnacl_shim.c',
'shim_entry.c',
'shim_ppapi.c',
@@ -32,6 +34,68 @@
'extra_args': [
'--strip-debug',
],
+ # Indicate that shim should not depend on unstable IRT hook interface.
+ 'compile_flags': [
+ '-DPNACL_SHIM_AOT',
+ ],
+ },
+ 'dependencies': [
+ '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
+ ],
+ },
+ # Smaller shim library for PNaCl in-browser translation.
+ # Uses an unstable IRT hook interface to get the shim from the IRT itself.
+ # If we ever change that hook interface or change the in-IRT shim's ABI,
+ # we would need to clear the translation cache to match the new IRT.
+ {
+ 'target_name': 'pnacl_irt_shim_browser',
+ 'type': 'none',
+ 'variables': {
+ # Same name as pnacl_irt_shim_aot, so that we don't need to change
+ # the linker commandlines, but output to the "for_browser" directory,
+ # and have the pnacl_support_extension copy from that directory.
+ 'nlib_target': 'libpnacl_irt_shim.a',
+ 'out_pnacl_newlib_arm': '>(tc_lib_dir_pnacl_translate)/lib-arm/for_browser/>(nlib_target)',
+ 'out_pnacl_newlib_x86_32': '>(tc_lib_dir_pnacl_translate)/lib-x86-32/for_browser/>(nlib_target)',
+ 'out_pnacl_newlib_x86_64': '>(tc_lib_dir_pnacl_translate)/lib-x86-64/for_browser/>(nlib_target)',
+ 'out_pnacl_newlib_mips': '>(tc_lib_dir_pnacl_translate)/lib-mips32/for_browser/>(nlib_target)',
+ 'build_glibc': 0,
+ 'build_newlib': 0,
+ 'build_pnacl_newlib': 1,
+ 'pnacl_native_biased': 1,
+ 'enable_x86_32': 1,
+ 'enable_x86_64': 1,
+ 'enable_arm': 1,
+ 'enable_mips': 1,
+ 'sources': [
+ 'shim_entry.c',
+ 'shim_ppapi.c',
+ ],
+ 'extra_args': [
+ '--strip-debug',
+ ],
+ },
+ 'dependencies': [
+ '<(DEPTH)/native_client/tools.gyp:prep_toolchain',
+ ],
+ },
+ {
+ # Second half of shim library for PNaCl in-browser translation.
+ # This half goes into the IRT and is returned by the unstable
+ # IRT hook interface.
+ 'target_name': 'pnacl_irt_shim_for_irt',
+ 'type': 'none',
+ 'variables': {
+ 'nlib_target': 'libpnacl_irt_shim_for_irt.a',
+ 'build_glibc': 0,
+ 'build_newlib': 0,
+ # Unlike the above, build this the way the IRT is built so that the
+ # output library directories match the IRT linking search paths.
+ 'build_irt': 1,
+ 'sources': [
+ 'irt_shim_ppapi.c',
+ 'pnacl_shim.c',
+ ],
},
'dependencies': [
'<(DEPTH)/native_client/tools.gyp:prep_toolchain',
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
index 4c93c9e..561b0cc 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_entry.c
@@ -28,15 +28,15 @@ void _pnacl_wrapper_start(uint32_t *info) {
if (entry != NULL) {
/*
- * Save the real irt interface.
+ * Save the real irt interface query function.
*/
- __pnacl_real_irt_interface = (TYPE_nacl_irt_query) entry->a_un.a_val;
+ __pnacl_real_irt_query_func = (TYPE_nacl_irt_query) entry->a_un.a_val;
/*
* Overwrite the auxv slot with the pnacl IRT shim query function.
*/
entry->a_type = AT_SYSINFO;
- entry->a_un.a_val = (uintptr_t) __pnacl_irt_interface_wrapper;
+ entry->a_un.a_val = (uintptr_t) __pnacl_wrap_irt_query_func;
}
/* If entry is NULL still allow startup to continue. It may be the case
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
index 5e111c1..76952af 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.c
@@ -10,6 +10,7 @@
#include "native_client/src/untrusted/irt/irt.h"
#include "ppapi/nacl_irt/irt_ppapi.h"
#include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"
+#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h"
#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.h"
/* Use local strcmp to avoid dependency on libc. */
@@ -18,55 +19,9 @@ static int mystrcmp(const char* s1, const char *s2) {
return *(--s1) - *(--s2);
}
-TYPE_nacl_irt_query __pnacl_real_irt_interface = NULL;
+TYPE_nacl_irt_query __pnacl_real_irt_query_func = NULL;
-/*
- * These remember the interface pointers the user registers by calling the
- * IRT entry point.
- */
-static struct PP_StartFunctions user_start_functions;
-
-static int32_t wrap_PPPInitializeModule(PP_Module module_id,
- PPB_GetInterface get_browser_intf) {
- __set_real_Pnacl_PPBGetInterface(get_browser_intf);
- /*
- * Calls from user code to the PPB interfaces pass through here and may
- * require shims to convert the ABI.
- */
- return (*user_start_functions.PPP_InitializeModule)(module_id,
- &__Pnacl_PPBGetInterface);
-}
-
-static void wrap_PPPShutdownModule() {
- (*user_start_functions.PPP_ShutdownModule)();
-}
-
-static const struct PP_StartFunctions wrapped_ppapi_methods = {
- wrap_PPPInitializeModule,
- wrap_PPPShutdownModule,
- /*
- * Calls from the IRT to the user plugin pass through here and may require
- * shims to convert the ABI.
- */
- __Pnacl_PPPGetInterface
-};
-
-static struct nacl_irt_ppapihook real_irt_ppapi_hook;
-
-static int wrap_ppapi_start(const struct PP_StartFunctions *funcs) {
- /*
- * Save the user's real bindings for the start functions.
- */
- user_start_functions = *funcs;
- __set_real_Pnacl_PPPGetInterface(user_start_functions.PPP_GetInterface);
-
- /*
- * Invoke the IRT's ppapi_start interface with the wrapped interface.
- */
- return (*real_irt_ppapi_hook.ppapi_start)(&wrapped_ppapi_methods);
-}
-
-size_t __pnacl_irt_interface_wrapper(const char *interface_ident,
+size_t __pnacl_wrap_irt_query_func(const char *interface_ident,
void *table, size_t tablesize) {
/*
* Note there is a benign race in initializing the wrapper.
@@ -79,23 +34,39 @@ size_t __pnacl_irt_interface_wrapper(const char *interface_ident,
/*
* The interface is not wrapped, so use the real interface.
*/
- return (*__pnacl_real_irt_interface)(interface_ident, table, tablesize);
+ return (*__pnacl_real_irt_query_func)(interface_ident, table, tablesize);
}
- if ((*__pnacl_real_irt_interface)(NACL_IRT_PPAPIHOOK_v0_1,
- &real_irt_ppapi_hook,
- sizeof real_irt_ppapi_hook) !=
+#ifndef PNACL_SHIM_AOT
+ /*
+ * For PNaCl in-the-browser, redirect to using
+ * NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1 instead of NACL_IRT_PPAPIHOOK_v0_1.
+ */
+ return (*__pnacl_real_irt_query_func)(NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1,
+ table, tablesize);
+#else
+ /*
+ * For offline generated nexes, avoid depending on the private
+ * NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1 interface, and just do the
+ * overriding here manually.
+ */
+ struct nacl_irt_ppapihook real_irt_ppapi_hook;
+ if ((*__pnacl_real_irt_query_func)(NACL_IRT_PPAPIHOOK_v0_1,
+ &real_irt_ppapi_hook,
+ sizeof real_irt_ppapi_hook) !=
sizeof real_irt_ppapi_hook) {
return 0;
}
+ real_irt_ppapi_start = real_irt_ppapi_hook.ppapi_start;
/*
* Copy the interface structure into the client.
*/
struct nacl_irt_ppapihook *dest = table;
if (sizeof *dest <= tablesize) {
- dest->ppapi_start = wrap_ppapi_start;
+ dest->ppapi_start = irt_shim_ppapi_start;
dest->ppapi_register_thread_creator =
real_irt_ppapi_hook.ppapi_register_thread_creator;
return sizeof *dest;
}
return 0;
+#endif
}
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h
index d5b7e32..6231196 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/shim_ppapi.h
@@ -4,8 +4,8 @@
* found in the LICENSE file.
*/
-#ifndef NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_
-#define NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_ 1
+#ifndef PPAPI_NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_
+#define PPAPI_NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_ 1
#include <stddef.h>
#include "native_client/src/untrusted/irt/irt.h"
@@ -13,9 +13,12 @@
/*
* Remembers the IRT's true interface query function.
*/
-extern TYPE_nacl_irt_query __pnacl_real_irt_interface;
+extern TYPE_nacl_irt_query __pnacl_real_irt_query_func;
-size_t __pnacl_irt_interface_wrapper(const char *interface_ident,
- void *table, size_t tablesize);
+/*
+ * Provides a wrapped query function.
+ */
+size_t __pnacl_wrap_irt_query_func(const char *interface_ident,
+ void *table, size_t tablesize);
-#endif /* NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_ */
+#endif /* PPAPI_NATIVE_CLIENT_SRC_UNTRUSTED_PNACL_IRT_SHIM_SHIM_PPAPI_H_ */
diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
index fa57030..0657e58 100644
--- a/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
+++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp
@@ -15,7 +15,7 @@
'conditions': [
['disable_nacl==0 and disable_pnacl==0 and disable_nacl_untrusted==0', {
'dependencies': [
- '../../../../../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+ '../../../../../ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim_browser',
'../../../../../native_client/tools.gyp:prep_toolchain',
],
'sources': [
@@ -54,14 +54,14 @@
'<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_pnacl_llc_nexe',
],
'inputs': [
- '>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim.a',
- '>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-x86-32/for_browser/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-x86-64/for_browser/libpnacl_irt_shim.a',
],
'variables': {
'lib_overrides': [
# Use the two freshly generated shims.
- '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim.a',
- '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim.a',
+ '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/for_browser/libpnacl_irt_shim.a',
+ '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/for_browser/libpnacl_irt_shim.a',
],
},
}],
@@ -80,12 +80,12 @@
'<(PRODUCT_DIR)/pnacl/pnacl_public_arm_pnacl_llc_nexe',
],
'inputs': [
- '>(tc_lib_dir_pnacl_translate)/lib-arm/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-arm/for_browser/libpnacl_irt_shim.a',
],
'variables': {
'lib_overrides': [
# Use the freshly generated shim.
- '--lib_override=arm,>(tc_lib_dir_pnacl_translate)/lib-arm/libpnacl_irt_shim.a',
+ '--lib_override=arm,>(tc_lib_dir_pnacl_translate)/lib-arm/for_browser/libpnacl_irt_shim.a',
],
},
}],
@@ -101,12 +101,12 @@
'<(PRODUCT_DIR)/pnacl/pnacl_public_mips32_llc_nexe',
],
'inputs': [
- '>(tc_lib_dir_pnacl_translate)/lib-mips32/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-mips32/for_browser/libpnacl_irt_shim.a',
],
'variables': {
'lib_overrides': [
# Use the freshly generated shim.
- '--lib_override=mipsel,>(tc_lib_dir_pnacl_translate)/lib-mips32/libpnacl_irt_shim.a',
+ '--lib_override=mipsel,>(tc_lib_dir_pnacl_translate)/lib-mips32/for_browser/libpnacl_irt_shim.a',
],
},
}],
@@ -122,12 +122,12 @@
'<(PRODUCT_DIR)/pnacl/pnacl_public_x86_32_pnacl_llc_nexe',
],
'inputs': [
- '>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-x86-32/for_browser/libpnacl_irt_shim.a',
],
'variables': {
'lib_overrides': [
# Use the freshly generated shim.
- '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/libpnacl_irt_shim.a',
+ '--lib_override=ia32,>(tc_lib_dir_pnacl_translate)/lib-x86-32/for_browser/libpnacl_irt_shim.a',
],
},
}],
@@ -143,12 +143,12 @@
'<(PRODUCT_DIR)/pnacl/pnacl_public_x86_64_pnacl_llc_nexe',
],
'inputs': [
- '>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim.a',
+ '>(tc_lib_dir_pnacl_translate)/lib-x86-64/for_browser/libpnacl_irt_shim.a',
],
'variables': {
'lib_overrides': [
# Use the freshly generated shim.
- '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/libpnacl_irt_shim.a',
+ '--lib_override=x64,>(tc_lib_dir_pnacl_translate)/lib-x86-64/for_browser/libpnacl_irt_shim.a',
],
},
}],
diff --git a/ppapi/ppapi_nacl.gyp b/ppapi/ppapi_nacl.gyp
index ca016ed1..20d40c3 100644
--- a/ppapi/ppapi_nacl.gyp
+++ b/ppapi/ppapi_nacl.gyp
@@ -186,7 +186,7 @@
},
# Shim is a dependency for the nexe because we pre-translate.
'dependencies': [
- '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+ '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim_aot',
],
'actions': [
{
@@ -214,7 +214,7 @@
},
# Shim is a dependency for the nexe because we pre-translate.
'dependencies': [
- '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim',
+ '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:pnacl_irt_shim_aot',
],
'actions': [
{
diff --git a/ppapi/proxy/DEPS b/ppapi/proxy/DEPS
index 3920896..0c13d6b 100644
--- a/ppapi/proxy/DEPS
+++ b/ppapi/proxy/DEPS
@@ -20,5 +20,7 @@ include_rules = [
"+native_client/src/shared/srpc/nacl_srpc.h",
"+native_client/src/untrusted/irt/irt.h",
"+native_client/src/untrusted/irt/irt_private.h",
+ # The IRT also needs to know the sysconf enums.
+ "+native_client/src/trusted/service_runtime/include/sys/unistd.h",
]
diff --git a/ppapi/proxy/irt_ppapi.c b/ppapi/proxy/irt_ppapi.c
index 24dafdb..8bf1233 100644
--- a/ppapi/proxy/irt_ppapi.c
+++ b/ppapi/proxy/irt_ppapi.c
@@ -5,14 +5,16 @@
*/
#include "native_client/src/public/irt_core.h"
+#include "native_client/src/trusted/service_runtime/include/sys/unistd.h"
#include "native_client/src/untrusted/irt/irt.h"
#include "native_client/src/untrusted/irt/irt_private.h"
#include "ppapi/nacl_irt/irt_ppapi.h"
+#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h"
#include "ppapi/proxy/plugin_main_irt.h"
-struct PP_StartFunctions g_pp_functions;
+static struct PP_StartFunctions g_pp_functions;
-static int irt_ppapi_start(const struct PP_StartFunctions* funcs) {
+int irt_ppapi_start(const struct PP_StartFunctions* funcs) {
/* Disable NaCl's open_resource() interface on this thread. */
g_is_main_thread = 1;
@@ -38,9 +40,19 @@ static const struct nacl_irt_ppapihook nacl_irt_ppapihook = {
PpapiPluginRegisterThreadCreator,
};
+static int ppapihook_pnacl_private_filter(void) {
+ int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE);
+ if (pnacl_mode == -1)
+ return 0;
+ return pnacl_mode;
+}
+
static const struct nacl_irt_interface irt_interfaces[] = {
{ NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook),
NULL },
+ { NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1,
+ &nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private),
+ ppapihook_pnacl_private_filter },
};
static size_t chrome_irt_query(const char* interface_ident,