Skip to content

Commit

Permalink
Add untrusted NaCl build for PPAPI proxy.
Browse files Browse the repository at this point in the history
This patch refactors ppapi_shared.gypi and ppapi_proxy.gypi into proper includes, adds ppapi_shared_untrusted and ppapi_proxy_untrusted .gyp files, and integrates them into the nacl_irt build (ppapi/native_client/native_client.gyp). In order to build without link errors, it includes our plugin side initialization of PluginDispatcher, and a PpapiPluginMain definition. When the 'build_ppapi_ipc_proxy_untrusted' gyp flag is set to '1', this will build a working NaCl IRT using the Chrome IPC proxy.
BUG=116317
TEST=compiles, runs HelloWorld and GetURL SDK examples.

Review URL: https://chromiumcodereview.appspot.com/10565015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142540 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
bbudge@chromium.org committed Jun 16, 2012
1 parent 8df26d4 commit 21f9775
Show file tree
Hide file tree
Showing 16 changed files with 945 additions and 927 deletions.
3 changes: 2 additions & 1 deletion base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@
'property_bag.h',
'rand_util.cc',
'rand_util.h',
'rand_util_nacl.cc',
'rand_util_posix.cc',
'rand_util_win.cc',
'safe_strerror_posix.cc',
Expand Down Expand Up @@ -525,6 +524,8 @@
'process_posix.cc',
'process_util.cc',
'process_util_posix.cc',
'rand_util.cc',
'rand_util_posix.cc',
'scoped_native_library.cc',
'scoped_temp_dir.cc',
'shared_memory_posix.cc',
Expand Down
4 changes: 1 addition & 3 deletions base/base_untrusted.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'base.gypi',
],
'conditions': [
['disable_nacl_untrusted==0', {
['disable_nacl==0 and disable_nacl_untrusted==0', {
'targets': [
{
'target_name': 'base_untrusted',
Expand All @@ -32,8 +32,6 @@
},
'dependencies': [
'<(DEPTH)/native_client/tools.gyp:prep_toolchain',
'<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib',
'<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib_newlib',
],
},
],
Expand Down
53 changes: 0 additions & 53 deletions base/rand_util_nacl.cc

This file was deleted.

19 changes: 14 additions & 5 deletions build/all.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
'../gpu/gpu.gyp:*',
'../gpu/tools/tools.gyp:*',
'../ipc/ipc.gyp:*',
'../ipc/ipc_untrusted.gyp:*',
'../jingle/jingle.gyp:*',
'../media/media.gyp:*',
'../net/net.gyp:*',
'../ppapi/ppapi.gyp:*',
'../ppapi/ppapi_internal.gyp:*',
'../ppapi/ppapi_proxy_untrusted.gyp:*',
'../printing/printing.gyp:*',
'../sdch/sdch.gyp:*',
'../skia/skia.gyp:*',
Expand Down Expand Up @@ -145,6 +143,14 @@
'../net/third_party/nss/ssl.gyp:*',
],
}],
['disable_nacl==0 and disable_nacl_untrusted==0', {
'dependencies': [
'../base/base_untrusted.gyp:*',
'../ipc/ipc_untrusted.gyp:*',
'../ppapi/ppapi_proxy_untrusted.gyp:*',
'../ppapi/ppapi_shared_untrusted.gyp:*',
],
}],
],
}, # target_name: All
{
Expand Down Expand Up @@ -187,9 +193,6 @@
'../gpu/gpu.gyp:gpu_unittests',
'../gpu/gles2_conform_support/gles2_conform_support.gyp:gles2_conform_support',
'../ipc/ipc.gyp:ipc_tests',
# TODO(bbudge): drop this when something meaningful depends on
# ipc_untrusted.
'../ipc/ipc_untrusted.gyp:ipc_untrusted',
'../jingle/jingle.gyp:jingle_unittests',
'../media/media.gyp:media_unittests',
'../net/net.gyp:net_unittests',
Expand Down Expand Up @@ -224,6 +227,12 @@
'../webkit/webkit.gyp:test_shell_common',
],
}],
['disable_nacl==0 and disable_nacl_untrusted==0', {
'dependencies': [
# TODO(bbudge): drop this when we have switched the NaCl proxy to IPC.
'../ppapi/ppapi_proxy_untrusted.gyp:ppapi_proxy_untrusted',
],
}],
],
}, # target_name: chromium_builder_tests
{
Expand Down
9 changes: 4 additions & 5 deletions ipc/ipc_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@ std::string Channel::GenerateUniqueRandomChannelID() {
// component. The strong random component prevents other processes from
// hijacking or squatting on predictable channel names.

int process_id;
#if !defined(OS_NACL)
process_id = base::GetCurrentProcId();
#else
process_id = 0;
#endif
int process_id = base::GetCurrentProcId();
return base::StringPrintf("%d.%u.%d",
process_id,
g_last_id.GetNext(),
base::RandInt(0, std::numeric_limits<int32>::max()));
#else
return std::string();
#endif
}

} // namespace IPC
Expand Down
4 changes: 1 addition & 3 deletions ipc/ipc_untrusted.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'ipc.gypi',
],
'conditions': [
['disable_nacl_untrusted==0', {
['disable_nacl==0 and disable_nacl_untrusted==0', {
'targets': [
{
'target_name': 'ipc_untrusted',
Expand All @@ -25,8 +25,6 @@
},
'dependencies': [
'<(DEPTH)/native_client/tools.gyp:prep_toolchain',
'<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib',
'<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib_newlib',
'../base/base_untrusted.gyp:base_untrusted',
],
},
Expand Down
163 changes: 162 additions & 1 deletion ppapi/native_client/native_client.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
'includes': [
'../../native_client/build/common.gypi',
'../../native_client/build/untrusted.gypi',
],
'conditions': [
['disable_nacl==0 and disable_nacl_untrusted==0', {
Expand Down Expand Up @@ -53,6 +53,12 @@
},
],
},
],
}],
# TODO(bbudge) Remove the build_ppapi_ipc_proxy_untrusted flag, factor out common
# properties from both IRT flavors, and build them side by side.
['disable_nacl==0 and disable_nacl_untrusted==0 and build_ppapi_ipc_proxy_untrusted==0', {
'targets': [
{
'target_name': 'nacl_irt',
'type': 'none',
Expand Down Expand Up @@ -179,5 +185,160 @@
},
],
}],
['disable_nacl==0 and disable_nacl_untrusted==0 and build_ppapi_ipc_proxy_untrusted==1', {
'targets': [
{
'target_name': 'nacl_irt',
'type': 'none',
'variables': {
'nexe_target': 'nacl_irt',
# These out_* fields override the default filenames, which
# include a "_newlib" suffix.
'out_newlib64': '<(PRODUCT_DIR)/nacl_irt_x86_64.nexe',
'out_newlib32': '<(PRODUCT_DIR)/nacl_irt_x86_32.nexe',
'out_newlib_arm': '<(PRODUCT_DIR)/nacl_irt_arm.nexe',
'build_glibc': 0,
'build_newlib': 1,
'include_dirs': [
'lib/gl/include',
'..',
],
'link_flags': [
'-Wl,--start-group',
'-lirt_browser',
'-lppapi_proxy_untrusted',
'-lppapi_shared_untrusted',
'-lipc_untrusted',
'-lbase_untrusted',
'-lsrpc',
'-limc_syscalls',
'-lplatform',
'-lgio',
'-Wl,--end-group',
'-lm',
],
# See http://code.google.com/p/nativeclient/issues/detail?id=2691.
# The PNaCl linker (gold) does not implement the "-Ttext-segment"
# option. However, with the linker for x86, the "-Ttext" option
# does not affect the executable's base address.
# TODO(olonho): simplify flags handling and avoid duplication
# with NaCl logic.
'conditions': [
['target_arch!="arm"',
{
'link_flags': [
'-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
'-Wl,-Ttext-segment=<(NACL_IRT_TEXT_START)',
]
}, { # target_arch == "arm"
'link_flags': [
'-Wl,--section-start,.rodata=<(NACL_IRT_DATA_START)',
'-Wl,-Ttext=<(NACL_IRT_TEXT_START)',
'--pnacl-allow-native',
'-arch', 'arm',
'-Wt,-mtls-use-call',
],
},
],
],
'sources': [
],
'extra_args': [
'--strip-debug',
],
# TODO(bradchen): get rid of extra_deps64 and extra_deps32
# once native_client/build/untrusted.gypi no longer needs them.
'extra_deps64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
],
'extra_deps32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
],
'extra_deps_newlib64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib64/libgio.a',
],
'extra_deps_newlib32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/lib32/libgio.a',
],
'extra_deps_glibc64': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib64/libgio.a',
],
'extra_deps_glibc32': [
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_glibc/lib32/libgio.a',
],
'extra_deps_arm': [
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi_proxy_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libppapi_shared_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libipc_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libbase_untrusted.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libirt_browser.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libsrpc.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libplatform.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libimc_syscalls.a',
'<(SHARED_INTERMEDIATE_DIR)/tc_newlib/libarm/libgio.a',
],
},
'dependencies': [
'../ppapi_proxy_untrusted.gyp:ppapi_proxy_untrusted',
'../ppapi_shared_untrusted.gyp:ppapi_shared_untrusted',
'../../ipc/ipc_untrusted.gyp:ipc_untrusted',
'../../base/base_untrusted.gyp:base_untrusted',
'../../native_client/src/untrusted/irt/irt.gyp:irt_browser_lib',
'../../native_client/src/shared/srpc/srpc.gyp:srpc_lib',
'../../native_client/src/shared/platform/platform.gyp:platform_lib',
'../../native_client/src/untrusted/nacl/nacl.gyp:imc_syscalls_lib',
'../../native_client/src/shared/gio/gio.gyp:gio_lib',
],
},
],
}],
],
}
Loading

0 comments on commit 21f9775

Please sign in to comment.