| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
| 6 | 6 |
| 7 prebuilt_available = | 7 prebuilt_available = |
| 8 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) | 8 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) |
| 9 | 9 |
| 10 group("deps") { | 10 group("deps") { |
| 11 if (use_prebuilt_instrumented_libraries) { | 11 if (use_prebuilt_instrumented_libraries) { |
| 12 assert(prebuilt_available, | 12 assert(prebuilt_available, |
| 13 "Prebuilt instrumented libraries are only available when " + | 13 "Prebuilt instrumented libraries are only available when " + |
| 14 "is_msan = true and msan_track_origins = {0, 2}") | 14 "is_msan = true and msan_track_origins = {0, 2}") |
| 15 deps = [ | 15 deps = [ |
| 16 ":prebuilt", | 16 ":prebuilt", |
| 17 ] | 17 ] |
| 18 data_deps = [ |
| 19 ":prebuilt", |
| 20 ] |
| 18 } | 21 } |
| 19 } | 22 } |
| 20 | 23 |
| 21 if (prebuilt_available) { | 24 if (prebuilt_available) { |
| 22 group("prebuilt") { | 25 group("prebuilt") { |
| 23 visibility = [ ":deps" ] | 26 visibility = [ ":deps" ] |
| 24 all_dependent_configs = [ ":prebuilt_link_helper" ] | 27 |
| 25 deps = [ | 28 deps = [ |
| 26 ":extract_prebuilt_instrumented_libraries", | 29 ":extract_prebuilt_instrumented_libraries", |
| 27 ] | 30 ] |
| 31 data_deps = [ |
| 32 ":extract_prebuilt_instrumented_libraries", |
| 33 ] |
| 28 } | 34 } |
| 29 | 35 |
| 30 if (is_msan) { | 36 if (is_msan) { |
| 31 sanitizer_type = "msan" | 37 sanitizer_type = "msan" |
| 32 if (msan_track_origins == 0) { | 38 if (msan_track_origins == 0) { |
| 33 archive_prefix = "msan-no-origins" | 39 archive_prefix = "msan-no-origins" |
| 34 } else if (msan_track_origins == 2) { | 40 } else if (msan_track_origins == 2) { |
| 35 archive_prefix = "msan-chained-origins" | 41 archive_prefix = "msan-chained-origins" |
| 36 } | 42 } |
| 37 } | 43 } |
| 38 | 44 |
| 39 # TODO(GYP): scripts/download_binaries.py uses GYP_DEFINES to decide whether | 45 # TODO(GYP): scripts/download_binaries.py uses GYP_DEFINES to decide whether |
| 40 # to download the archives extracted here. | 46 # to download the archives extracted here. |
| 41 # Note: This requires a clobber whenever Ubuntu version changes. | 47 # Note: This requires a clobber whenever Ubuntu version changes. |
| 42 action("extract_prebuilt_instrumented_libraries") { | 48 action("extract_prebuilt_instrumented_libraries") { |
| 43 visibility = [ ":prebuilt" ] | 49 visibility = [ ":prebuilt" ] |
| 44 script = "scripts/unpack_binaries.py" | 50 script = "scripts/unpack_binaries.py" |
| 45 depfile = "$target_out_dir/$archive_prefix.d" | 51 depfile = "$target_out_dir/$archive_prefix.d" |
| 46 args = [ | 52 args = [ |
| 47 archive_prefix, | 53 archive_prefix, |
| 48 rebase_path("binaries"), | 54 rebase_path("binaries"), |
| 49 rebase_path(root_build_dir + "/instrumented_libraries_prebuilt"), | 55 rebase_path(root_build_dir + "/instrumented_libraries_prebuilt"), |
| 50 rebase_path(target_out_dir, root_build_dir), | 56 rebase_path(target_out_dir, root_build_dir), |
| 51 ] | 57 ] |
| 52 outputs = [ | 58 outputs = [ |
| 53 "$target_out_dir/$archive_prefix.txt", | 59 "$target_out_dir/$archive_prefix.txt", |
| 54 ] | 60 ] |
| 61 data = [ |
| 62 "$root_out_dir/instrumented_libraries_prebuilt/", |
| 63 ] |
| 55 } | 64 } |
| 56 | 65 |
| 57 config("prebuilt_link_helper") { | 66 config("prebuilt_instrumented_libraries_ldflags") { |
| 58 visibility = [ ":prebuilt" ] | |
| 59 ldflags = [ | 67 ldflags = [ |
| 60 # Add a relative RPATH entry to Chromium binaries. This puts instrumented | 68 # Add a relative RPATH entry to Chromium binaries. This puts instrumented |
| 61 # DSOs before system-installed versions in library search path. | 69 # DSOs before system-installed versions in library search path. |
| 62 "-Wl,-R,\$ORIGIN/instrumented_libraries_prebuilt/$sanitizer_type/lib", | 70 "-Wl,-R,\$ORIGIN/instrumented_libraries_prebuilt/$sanitizer_type/lib", |
| 63 "-Wl,-z,origin", | 71 "-Wl,-z,origin", |
| 64 ] | 72 ] |
| 65 } | 73 } |
| 74 } else { |
| 75 config("prebuilt_instrumented_libraries_ldflags") { |
| 76 } |
| 66 } | 77 } |
| 67 # TODO(GYP): Support building instrumented libraries from source. | 78 # TODO(GYP): Support building instrumented libraries from source. |
| OLD | NEW |