Commit 3f04f1b9 authored by earthdok's avatar earthdok Committed by Commit bot

Re-land: 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
TBR=glider@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/1003273006

Cr-Commit-Position: refs/heads/master@{#321846}
parent aa41e91e
...@@ -450,10 +450,16 @@ ...@@ -450,10 +450,16 @@
# -fsanitize=vptr only works with clang, but ubsan_vptr=1 implies clang=1 # -fsanitize=vptr only works with clang, but ubsan_vptr=1 implies clang=1
'ubsan_vptr%': 0, 'ubsan_vptr%': 0,
# Use the dynamic libraries instrumented by one of the sanitizers # Use dynamic libraries instrumented by one of the sanitizers
# instead of the standard system libraries. # instead of the standard system libraries. Set this flag to build the
# libraries from source.
'use_instrumented_libraries%': 0, 'use_instrumented_libraries%': 0,
# Use dynamic libraries instrumented by one of the sanitizers
# instead of the standard system libraries. Set this flag to download
# prebuilt binaries from GCS.
'use_prebuilt_instrumented_libraries%': 0,
# Use libc++ (third_party/libc++ and third_party/libc++abi) instead of # Use libc++ (third_party/libc++ and third_party/libc++abi) instead of
# stdlibc++ as standard library. This is intended to use for instrumented # stdlibc++ as standard library. This is intended to use for instrumented
# builds. # builds.
...@@ -1153,6 +1159,7 @@ ...@@ -1153,6 +1159,7 @@
'ubsan_blacklist%': '<(ubsan_blacklist)', 'ubsan_blacklist%': '<(ubsan_blacklist)',
'ubsan_vptr%': '<(ubsan_vptr)', 'ubsan_vptr%': '<(ubsan_vptr)',
'use_instrumented_libraries%': '<(use_instrumented_libraries)', 'use_instrumented_libraries%': '<(use_instrumented_libraries)',
'use_prebuilt_instrumented_libraries%': '<(use_prebuilt_instrumented_libraries)',
'use_custom_libcxx%': '<(use_custom_libcxx)', 'use_custom_libcxx%': '<(use_custom_libcxx)',
'use_system_libcxx%': '<(use_system_libcxx)', 'use_system_libcxx%': '<(use_system_libcxx)',
'clang_type_profiler%': '<(clang_type_profiler)', 'clang_type_profiler%': '<(clang_type_profiler)',
...@@ -4413,6 +4420,11 @@ ...@@ -4413,6 +4420,11 @@
'<(DEPTH)/third_party/instrumented_libraries/instrumented_libraries.gyp:instrumented_libraries', '<(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', { ['use_custom_libcxx==1', {
'dependencies': [ 'dependencies': [
'<(DEPTH)/buildtools/third_party/libc++/libc++.gyp:libcxx_proxy', '<(DEPTH)/buildtools/third_party/libc++/libc++.gyp:libcxx_proxy',
......
...@@ -81,6 +81,57 @@ ...@@ -81,6 +81,57 @@
}, },
'targets': [ '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', 'target_name': 'instrumented_libraries',
'type': 'none', 'type': 'none',
...@@ -174,7 +225,9 @@ ...@@ -174,7 +225,9 @@
'target_conditions': [ 'target_conditions': [
['_toolset=="target"', { ['_toolset=="target"', {
'ldflags': [ '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,-R,\$$ORIGIN/instrumented_libraries/<(_sanitizer_type)/<(_libdir)/',
'-Wl,-z,origin', '-Wl,-z,origin',
], ],
......
#!/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}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment