diff options
author | earthdok <earthdok@chromium.org> | 2015-03-23 10:50:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-23 17:50:58 +0000 |
commit | 744256e2f3933feaa05c967541afac36825056fa (patch) | |
tree | 2c5952f73ecfa43a0b87979081694fb4235efc9e | |
parent | 88f4fa3f1874945019604aa1e88af6ebe61c1c1f (diff) | |
download | chromium_src-744256e2f3933feaa05c967541afac36825056fa.zip chromium_src-744256e2f3933feaa05c967541afac36825056fa.tar.gz chromium_src-744256e2f3933feaa05c967541afac36825056fa.tar.bz2 |
Instrumented libraries: add a target for pre-built libraries.
With use_prebuilt_instrumented_libraries=1 in GYP_DEFINES, binaries are now
unpacked from archive and placed into output dir.
BUG=462636
R=glider@chromium.org
TBR=thakis@chromium.org
NOTRY=true
Review URL: https://codereview.chromium.org/1017053003
Cr-Commit-Position: refs/heads/master@{#321804}
-rw-r--r-- | build/common.gypi | 5 | ||||
-rw-r--r-- | third_party/instrumented_libraries/instrumented_libraries.gyp | 55 | ||||
-rwxr-xr-x | third_party/instrumented_libraries/scripts/unpack_binaries.sh | 15 |
3 files changed, 74 insertions, 1 deletions
diff --git a/build/common.gypi b/build/common.gypi index 663eb0d..f9b9bdf 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -4419,6 +4419,11 @@ '<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:instrumented_libraries', ], }], + ['use_prebuilt_instrumented_libraries==1', { + 'dependencies': [ + '<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:prebuilt_instrumented_libraries', + ], + }], ['use_custom_libcxx==1', { 'dependencies': [ '<(DEPTH)/buildtools/third_party/libc++/libc++.gyp:libcxx_proxy', diff --git a/third_party/instrumented_libraries/instrumented_libraries.gyp b/third_party/instrumented_libraries/instrumented_libraries.gyp index 28fa65f..2d61a3b 100644 --- a/third_party/instrumented_libraries/instrumented_libraries.gyp +++ b/third_party/instrumented_libraries/instrumented_libraries.gyp @@ -82,6 +82,57 @@ 'targets': [ { + 'target_name': 'prebuilt_instrumented_libraries', + 'type': 'none', + 'variables': { + 'prune_self_dependency': 1, + # Don't add this target to the dependencies of targets with type=none. + 'link_dependency': 1, + 'conditions': [ + ['msan==1', { + 'conditions': [ + ['msan_track_origins==2', { + 'archive_name': 'msan-chained-origins-<(_ubuntu_release)', + }, { + 'archive_name': 'UNSUPPORTED_CONFIGURATION' + }], + ]}, { + 'archive_name': 'UNSUPPORTED_CONFIGURATION' + }], + ], + }, + 'actions': [ + { + 'action_name': 'unpack_<(archive_name).tgz', + 'inputs': [ + 'binaries/<(archive_name).tgz', + ], + 'outputs': [ + '<(PRODUCT_DIR)/instrumented_libraries_prebuilt/<(archive_name).txt', + ], + 'action': [ + 'scripts/unpack_binaries.sh', + 'binaries/<(archive_name).tgz', + '<(PRODUCT_DIR)/instrumented_libraries_prebuilt/', + '<(PRODUCT_DIR)/instrumented_libraries_prebuilt/<(archive_name).txt', + ], + }, + ], + 'direct_dependent_settings': { + 'target_conditions': [ + ['_toolset=="target"', { + 'ldflags': [ + # Add a relative RPATH entry to Chromium binaries. This puts + # instrumented DSOs before system-installed versions in library + # search path. + '-Wl,-R,\$$ORIGIN/instrumented_libraries_prebuilt/<(_sanitizer_type)/<(_libdir)/', + '-Wl,-z,origin', + ], + }], + ], + }, + }, + { 'target_name': 'instrumented_libraries', 'type': 'none', 'variables': { @@ -174,7 +225,9 @@ 'target_conditions': [ ['_toolset=="target"', { 'ldflags': [ - # Add RPATH to result binary to make it linking instrumented libraries ($ORIGIN means relative RPATH) + # Add a relative RPATH entry to Chromium binaries. This puts + # instrumented DSOs before system-installed versions in library + # search path. '-Wl,-R,\$$ORIGIN/instrumented_libraries/<(_sanitizer_type)/<(_libdir)/', '-Wl,-z,origin', ], diff --git a/third_party/instrumented_libraries/scripts/unpack_binaries.sh b/third_party/instrumented_libraries/scripts/unpack_binaries.sh new file mode 100755 index 0000000..12af6ad --- /dev/null +++ b/third_party/instrumented_libraries/scripts/unpack_binaries.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright 2015 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. + +# Unpacks an archive containing prebuilt instrumented libraries into output dir. + +archive_file=$1 +target_dir=$2 +stamp_file=$3 + +rm ${target_dir}/* -rf +tar -zxf ${archive_file} -C ${target_dir} + +touch ${stamp_file} |