diff options
author | sammc <sammc@chromium.org> | 2015-05-31 18:09:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-01 01:10:10 +0000 |
commit | 74f1d187956e64c25724b116ed06ca7d00b89917 (patch) | |
tree | 06691d49eb471280c56b0a4d6bf8374954b957f1 /third_party/instrumented_libraries/BUILD.gn | |
parent | b45962be3b0ac2a4133290e4e02b4f9fdec012a6 (diff) | |
download | chromium_src-74f1d187956e64c25724b116ed06ca7d00b89917.zip chromium_src-74f1d187956e64c25724b116ed06ca7d00b89917.tar.gz chromium_src-74f1d187956e64c25724b116ed06ca7d00b89917.tar.bz2 |
GN: Add support for prebuilt instrumented libraries.
TBR=glider@chromium.org
Review URL: https://codereview.chromium.org/1150193002
Cr-Commit-Position: refs/heads/master@{#332148}
Diffstat (limited to 'third_party/instrumented_libraries/BUILD.gn')
-rw-r--r-- | third_party/instrumented_libraries/BUILD.gn | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/third_party/instrumented_libraries/BUILD.gn b/third_party/instrumented_libraries/BUILD.gn new file mode 100644 index 0000000..8d113ef --- /dev/null +++ b/third_party/instrumented_libraries/BUILD.gn @@ -0,0 +1,67 @@ +# 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. + +import("//build/config/sanitizers/sanitizers.gni") + +prebuilt_available = + is_msan && (msan_track_origins == 0 || msan_track_origins == 2) + +group("deps") { + if (use_prebuilt_instrumented_libraries) { + assert(prebuilt_available, + "Prebuilt instrumented libraries are only available when " + + "is_msan = true and msan_track_origins = {0, 2}") + deps = [ + ":prebuilt", + ] + } +} + +if (prebuilt_available) { + group("prebuilt") { + visibility = [ ":deps" ] + public_configs = [ ":prebuilt_link_helper" ] + deps = [ + ":extract_prebuilt_instrumented_libraries", + ] + } + + if (is_msan) { + sanitizer_type = "msan" + if (msan_track_origins == 0) { + archive_prefix = "msan-no-origins" + } else if (msan_track_origins == 2) { + archive_prefix = "msan-chained-origins" + } + } + + # TODO(GYP): scripts/download_binaries.py uses GYP_DEFINES to decide whether + # to download the archives extracted here. + # Note: This requires a clobber whenever Ubuntu version changes. + action("extract_prebuilt_instrumented_libraries") { + visibility = [ ":prebuilt" ] + script = "scripts/unpack_binaries.py" + depfile = "$target_out_dir/$archive_prefix.d" + args = [ + archive_prefix, + rebase_path("binaries"), + rebase_path(root_build_dir + "/instrumented_libraries_prebuilt"), + rebase_path(target_out_dir, root_build_dir), + ] + outputs = [ + "$target_out_dir/$archive_prefix.txt", + ] + } + + config("prebuilt_link_helper") { + visibility = [ ":prebuilt" ] + 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/lib", + "-Wl,-z,origin", + ] + } +} +# TODO(GYP): Support building instrumented libraries from source. |