diff options
author | bradchen@google.com <bradchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-07 22:03:33 +0000 |
---|---|---|
committer | bradchen@google.com <bradchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-07 22:03:33 +0000 |
commit | 9ddb68283018679bcadbce2f4e2e7171883069da (patch) | |
tree | 6f975a38ffb4b24c7663dab47f975e5affe66ceb /chrome | |
parent | 1b62f9017e442d98474e0fc46bc40d31f4704167 (diff) | |
download | chromium_src-9ddb68283018679bcadbce2f4e2e7171883069da.zip chromium_src-9ddb68283018679bcadbce2f4e2e7171883069da.tar.gz chromium_src-9ddb68283018679bcadbce2f4e2e7171883069da.tar.bz2 |
Modify the build recipe for nacl_helper_bootstrap to invoke the linker explicitly via an action rather than invoking via g++. This addresses build problems that occurred on certain developer machines.
Also, modified tools/ld_bfd/ld script to find the loader within the Chrome OS build chroot.
Also re-enable the nacl_helper.
BUG=92964,nativeclient:480
TEST=nacl_integration tests on bots
Review URL: http://codereview.chromium.org/7841008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/chrome_exe.gypi | 11 | ||||
-rw-r--r-- | chrome/nacl.gypi | 95 | ||||
-rw-r--r-- | chrome/nacl/nacl_fork_delegate_linux.cc | 1 |
3 files changed, 77 insertions, 30 deletions
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi index c8a9175..74445a8 100644 --- a/chrome/chrome_exe.gypi +++ b/chrome/chrome_exe.gypi @@ -452,6 +452,17 @@ '../third_party/adobe/flash/flash_player.gyp:flash_player', ], }], + ['OS=="linux"', { + 'conditions': [ + # For now, do not build nacl_helper on ARM or when disable_nacl=1 + ['disable_nacl!=1 and target_arch!="arm"', { + 'dependencies': [ + 'nacl_helper_bootstrap', + 'nacl_helper', + ], + }], + ], + }], ['OS=="mac"', { 'dependencies': [ # On Mac, make sure we've built chrome_dll, which contains all of diff --git a/chrome/nacl.gypi b/chrome/nacl.gypi index 000c5dc..da5f81b 100644 --- a/chrome/nacl.gypi +++ b/chrome/nacl.gypi @@ -236,18 +236,15 @@ ], }, { - 'target_name': 'nacl_helper_bootstrap_raw', - 'type': 'executable', + 'target_name': 'nacl_helper_bootstrap_lib', + 'type': 'static_library', + 'product_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', + 'hard_depencency': 1, 'include_dirs': [ '..', ], 'sources': [ 'nacl/nacl_helper_bootstrap_linux.c', - # We list the linker script here for documentation purposes. - # But even this doesn't make gyp treat it as a dependency, - # so incremental builds won't relink when the script changes. - # TODO(bradnelson): Fix the dependency handling. - 'nacl/nacl_helper_bootstrap_linux.x', ], 'cflags': [ # The tiny standalone bootstrap program is incompatible with @@ -263,27 +260,67 @@ '-fno-pic', '-fno-PIC', '-fno-pie', '-fno-PIE', ], - 'link_settings': { - 'ldflags': [ - # TODO(bradchen): Delete the -B argument when Gold is verified - # to produce good results with our custom linker script. - # Until then use ld.bfd. - '-B', '<(PRODUCT_DIR)/../../tools/ld_bfd', - # This programs is (almost) entirely standalone. It has - # its own startup code, so no crt1.o for it. It is - # statically linked, and on x86 it actually does not use - # libc at all. However, on ARM it needs a few (safe) - # things from libc, so we don't use '-nostdlib' here. - '-static', '-nostartfiles', - # Link with our custom linker script to get out special layout. - '-Wl,--script=<(PRODUCT_DIR)/../../chrome/nacl/nacl_helper_bootstrap_linux.x', - # On x86-64, the default page size with some - # linkers is 2M rather than the real Linux page - # size of 4K. A larger page size is incompatible - # with our custom linker script's special layout. - '-Wl,-z,max-page-size=0x1000', - ], - }, + }, + { + 'target_name': 'nacl_helper_bootstrap_raw', + 'type': 'none', + 'dependencies': [ + 'nacl_helper_bootstrap_lib', + ], + 'actions': [ + { + 'action_name': 'link_with_ld_bfd', + 'variables': { + 'bootstrap_lib': '<(SHARED_INTERMEDIATE_DIR)/chrome/<(STATIC_LIB_PREFIX)nacl_helper_bootstrap_lib<(STATIC_LIB_SUFFIX)', + 'linker_script': 'nacl/nacl_helper_bootstrap_linux.x', + }, + 'inputs': [ + '<(linker_script)', + '<(bootstrap_lib)', + '../tools/ld_bfd/ld', + ], + 'outputs': [ + '<(PRODUCT_DIR)/nacl_helper_bootstrap_raw', + ], + 'message': 'Linking nacl_helper_bootstrap_raw', + 'conditions': [ + ['target_arch=="x64"', { + 'variables': { + 'linker_emulation': 'elf_x86_64', + } + }], + ['target_arch=="ia32"', { + 'variables': { + 'linker_emulation': 'elf_i386', + } + }], + ['target_arch=="arm"', { + 'variables': { + 'linker_emulation': 'armelf_linux_eabi', + } + }], + ], + 'action': ['../tools/ld_bfd/ld', + '-m', '<(linker_emulation)', + # This program is (almost) entirely standalone. It + # has its own startup code, so no crt1.o for it. It is + # statically linked, and on x86 it does not use + # libc at all. However, on ARM it needs a few (safe) + # things from libc. + '-static', + # Link with custom linker script for special layout. + '--script=<(linker_script)', + '-o', '<@(_outputs)', + # On x86-64, the default page size with some + # linkers is 2M rather than the real Linux page + # size of 4K. A larger page size is incompatible + # with our custom linker script's special layout. + '-z', 'max-page-size=0x1000', + '--whole-archive', '<(bootstrap_lib)', + '--no-whole-archive', + ], + } + ], }, { 'target_name': 'nacl_helper_bootstrap', @@ -301,7 +338,7 @@ 'message': 'Munging ELF program header', 'action': ['python', '<@(_inputs)', '<@(_outputs)'] }], - } + }, ], }], ], diff --git a/chrome/nacl/nacl_fork_delegate_linux.cc b/chrome/nacl/nacl_fork_delegate_linux.cc index 1577975..828cb6e 100644 --- a/chrome/nacl/nacl_fork_delegate_linux.cc +++ b/chrome/nacl/nacl_fork_delegate_linux.cc @@ -46,7 +46,6 @@ void NaClForkDelegate::Init(const bool sandboxed, fds_to_map.push_back(std::make_pair(fds[1], kNaClZygoteDescriptor)); fds_to_map.push_back(std::make_pair(sandboxdesc, kNaClSandboxDescriptor)); ready_ = false; - return; // disabling nacl_helper for now FilePath helper_exe; FilePath helper_bootstrap_exe; if (PathService::Get(chrome::FILE_NACL_HELPER, &helper_exe) && |