Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/tools/build/win/syzygy/BUILD.gn

Issue 2129333002: Revert of Move the Syzygy scripts out of //chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/installer/mini_installer/BUILD.gn ('k') | chrome/tools/build/win/syzygy/instrument.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chrome_build.gni") 5 import("//build/config/chrome_build.gni")
6 import("//build/config/compiler/compiler.gni") 6 import("//build/config/compiler/compiler.gni")
7 import("//build/config/sanitizers/sanitizers.gni") 7 import("//build/config/sanitizers/sanitizers.gni")
8 import("//build/win/syzygy/syzygy.gni")
9 8
10 assert(!syzygy_optimize || !is_syzyasan, 9 assert(!syzygy_optimize || !is_syzyasan,
11 "Don't do both syzygy_optimize and is_syzyasan") 10 "Don't do both syzygy_optimize and is_syzyasan")
12 11
13 # Where the output binaries will be placed. 12 # Where the output binaries will be placed.
14 syzygy_dest_dir = "$root_out_dir/syzygy" 13 syzygy_dest_dir = "$root_out_dir/syzygy"
15 14
16 if (syzygy_optimize) { 15 if (syzygy_optimize) {
16 # Generates a Syzygy optimize target.
17 #
18 # dll_name (required)
19 # Name of the DLL to be instrumented, with no extension or path. This
20 # ${dll_name}.dll is assumed to be in the output directory and must be
21 # generated by a dependency of this target.
22 #
23 # deps (required)
24 # Normal meaning.
25 #
26 # data_deps
27 # Normal meaning.
28 template("syzygy_optimize") {
29 action(target_name) {
30 if (defined(invoker.visibility)) {
31 visibility = invoker.visibility
32 }
33 script = "//chrome/tools/build/win/syzygy/reorder.py"
34
35 dll_name = invoker.dll_name
36 input_dll = "$root_out_dir/$dll_name.dll"
37 input_pdb = "$root_out_dir/$dll_name.dll.pdb"
38
39 inputs = [
40 input_dll,
41 #input_pdb,
42 ]
43
44 outputs = [
45 "$syzygy_dest_dir/$dll_name.dll",
46 "$syzygy_dest_dir/$dll_name.dll.pdb",
47 ]
48
49 args = [
50 "--input_executable",
51 rebase_path(input_dll, root_build_dir),
52 "--input_symbol",
53 rebase_path(input_pdb, root_build_dir),
54 "--destination_dir",
55 rebase_path(syzygy_dest_dir, root_build_dir),
56 ]
57
58 forward_variables_from(invoker,
59 [
60 "deps",
61 "data_deps",
62 "public_deps",
63 ])
64 }
65 }
66
17 syzygy_optimize("chrome_dll_syzygy") { 67 syzygy_optimize("chrome_dll_syzygy") {
18 binary_name = "chrome.dll" 68 dll_name = "chrome"
19 deps = [ 69 deps = [
20 "//chrome:main_dll", 70 "//chrome:main_dll",
21 ] 71 ]
22 if (is_multi_dll_chrome) { 72 if (is_multi_dll_chrome) {
23 data_deps = [ 73 data_deps = [
24 ":chrome_child_dll_syzygy", 74 ":chrome_child_dll_syzygy",
25 ] 75 ]
26 } 76 }
27 } 77 }
28 if (is_multi_dll_chrome) { 78 if (is_multi_dll_chrome) {
29 # Also instrument chrome_child.dll. 79 # Also instrument chrome_child.dll.
30 syzygy_optimize("chrome_child_dll_syzygy") { 80 syzygy_optimize("chrome_child_dll_syzygy") {
31 binary_name = "chrome_child.dll" 81 dll_name = "chrome_child"
32 deps = [ 82 deps = [
33 "//chrome:chrome_child", 83 "//chrome:chrome_child",
34 ] 84 ]
35 } 85 }
36 } 86 }
37 } else if (is_syzyasan) { 87 } else if (is_syzyasan) {
88 # Instruments a binary with SyzyAsan.
89 #
90 # binary_name (required)
91 # Name of the binary to be instrumented, with no extension or path. This
92 # binary_name is assumed to be in the output directory and must be
93 # generated by a dependency of this target.
94 #
95 # dest_dir (required)
96 # The destination directory where the instrumented image should be
97 # written.
98 #
99 # deps (required)
100 # Normal meaning.
101 #
102 # public_deps
103 # Normal meaning.
104 #
105 # data_deps
106 # Normal meaning.
107 template("syzygy_asan") {
108 action(target_name) {
109 if (defined(invoker.visibility)) {
110 visibility = invoker.visibility
111 }
112 script = "//chrome/tools/build/win/syzygy/instrument.py"
113
114 filter = "syzyasan-instrumentation-filter.txt"
115
116 binary_name = invoker.binary_name
117 dest_dir = invoker.dest_dir
118 input_image = "$root_out_dir/$binary_name"
119 input_pdb = "$root_out_dir/$binary_name.pdb"
120
121 inputs = [
122 filter,
123 input_image,
124
125 #input_pdb,
126 ]
127
128 output_filter = "$dest_dir/win-syzyasan-filter-$binary_name.txt.json"
129
130 outputs = [
131 "$dest_dir/$input_image",
132 "$dest_dir/$input_image.pdb",
133 output_filter,
134 ]
135
136 args = [
137 "--mode",
138 "asan",
139 "--input_executable",
140 rebase_path(input_image, root_build_dir),
141 "--input_symbol",
142 rebase_path(input_pdb, root_build_dir),
143 "--filter",
144 rebase_path(filter, root_build_dir),
145 "--output-filter-file",
146 rebase_path(output_filter, root_build_dir),
147 "--destination_dir",
148 rebase_path(dest_dir, root_build_dir),
149 ]
150
151 deps = [
152 "//chrome/tools/build/win/syzygy:copy_syzyasan_binaries",
153 ]
154 if (defined(invoker.deps)) {
155 deps += invoker.deps
156 }
157 forward_variables_from(invoker,
158 [
159 "data_deps",
160 "public_deps",
161 ])
162 }
163 }
164
38 syzygy_asan("chrome_dll_syzygy") { 165 syzygy_asan("chrome_dll_syzygy") {
39 binary_name = "chrome.dll" 166 binary_name = "chrome.dll"
40 dest_dir = syzygy_dest_dir 167 dest_dir = syzygy_dest_dir
41 deps = [ 168 deps = [
42 "//chrome:main_dll", 169 "//chrome:main_dll",
43 ] 170 ]
44 if (is_multi_dll_chrome) {
45 data_deps = [
46 ":chrome_child_dll_syzygy",
47 ]
48 }
49 } 171 }
50 172
51 if (is_multi_dll_chrome) { 173 if (is_multi_dll_chrome) {
52 # Also instrument chrome_child.dll. 174 # Also instrument chrome_child.dll.
53 # 175 #
54 # For official builds, the instrumented version will be put into an 176 # For official builds, the instrumented version will be put into an
55 # "instrumented" subdirectory and the regular output will be 177 # "instrumented" subdirectory and the regular output will be
56 # uninstrumented. Otherwise, chrome_child is also instrumented to the 178 # uninstrumented. Otherwise, chrome_child is also instrumented to the
57 # normal place. 179 # normal place.
58 syzygy_asan("chrome_child_dll_syzygy") { 180 syzygy_asan("chrome_child_dll_syzygy") {
59 binary_name = "chrome_child.dll" 181 binary_name = "chrome_child.dll"
60 deps = [ 182 deps = [
61 "//chrome:chrome_child", 183 "//chrome:chrome_child",
62 ] 184 ]
63 185
64 if (is_official_build) { 186 if (is_official_build) {
65 dest_dir = "$syzygy_dest_dir/instrumented" 187 dest_dir = "$syzygy_dest_dir/instrumented"
66 deps += [ ":chrome_child_dll_syzygy_copy" ] 188 deps += [ ":chrome_child_dll_syzygy_copy" ]
67 } else { 189 } else {
68 dest_dir = syzygy_dest_dir 190 dest_dir = syzygy_dest_dir
69 } 191 }
192
193 data_deps = [
194 ":chrome_child_dll_syzygy",
195 ]
70 } 196 }
71 197
72 if (is_official_build) { 198 if (is_official_build) {
73 # Copies the uninstrumented chrome_child.dll. 199 # Copies the uninstrumented chrome_child.dll.
74 # GYP version: chrome/chrome_syzygy.gyp:chrome_child_dll_syzygy_copy 200 # GYP version: chrome/chrome_syzygy.gyp:chrome_child_dll_syzygy_copy
75 copy("chrome_child_dll_syzygy_copy") { 201 copy("chrome_child_dll_syzygy_copy") {
76 sources = [ 202 sources = [
77 "$root_out_dir/chrome_child.dll", 203 "$root_out_dir/chrome_child.dll",
204 "$root_out_dir/chrome_child.dll.pdb",
78 ] 205 ]
79 outputs = [ 206 outputs = [
80 "$syzygy_dest_dir/{{source_file_part}}", 207 "$dest_dir/{{source_file_part}}",
81 ] 208 ]
82 deps = [ 209 deps = [
83 "//chrome:chrome_child", 210 "//chrome:chrome_child",
84 ] 211 ]
85 } 212 }
86 } 213 }
87 } 214 }
88 } else { 215 } else {
89 # No syzygy. Generate dummy targets so other targets can unconditionally 216 # No syzygy. Generate dummy targets so other targets can unconditionally
90 # depend on these without having to duplicate our conditions. 217 # depend on these without having to duplicate our conditions.
91 group("chrome_dll_syzygy") { 218 group("chrome_dll_syzygy") {
92 } 219 }
93 if (is_multi_dll_chrome) { 220 if (is_multi_dll_chrome) {
94 group("chrome_child_dll_syzygy") { 221 group("chrome_child_dll_syzygy") {
95 } 222 }
96 } 223 }
97 } 224 }
98 225
226 if (is_syzyasan || syzygy_optimize) {
227 copy("copy_syzyasan_binaries") {
228 visibility = [ "//chrome/*" ]
229
230 source_dir = "//third_party/syzygy/binaries/exe"
231
232 sources = [
233 "$source_dir/agent_logger.exe",
234 "$source_dir/minidump_symbolizer.py",
235 "$source_dir/syzyasan_rtl.dll",
236 "$source_dir/syzyasan_rtl.dll.pdb",
237 ]
238
239 outputs = [
240 "$syzygy_dest_dir/{{source_file_part}}",
241 ]
242 }
243 }
244
99 # Prevent unused variable warning for code paths where this is unused. 245 # Prevent unused variable warning for code paths where this is unused.
100 assert(syzygy_dest_dir != "") 246 assert(syzygy_dest_dir != "")
OLDNEW
« no previous file with comments | « chrome/installer/mini_installer/BUILD.gn ('k') | chrome/tools/build/win/syzygy/instrument.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698