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