Chromium Code Reviews| 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/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 | 8 |
| 9 declare_args() { | 9 declare_args() { |
| 10 # Generate Syzygy optimized binaries. Syzygy optimize mode is a profile | 10 # Generate Syzygy optimized binaries. Syzygy optimize mode is a profile |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 if (syzygy_optimize) { | 22 if (syzygy_optimize) { |
| 23 # Generates a Syzygy optimize target. | 23 # Generates a Syzygy optimize target. |
| 24 # | 24 # |
| 25 # dll_name (required) | 25 # dll_name (required) |
| 26 # Name of the DLL to be instrumented, with no extension or path. This | 26 # Name of the DLL to be instrumented, with no extension or path. This |
| 27 # ${dll_name}.dll is assumed to be in the output directory and must be | 27 # ${dll_name}.dll is assumed to be in the output directory and must be |
| 28 # generated by a dependency of this target. | 28 # generated by a dependency of this target. |
| 29 # | 29 # |
| 30 # deps (required) | 30 # deps (required) |
| 31 # Normal meaning. | 31 # Normal meaning. |
| 32 # | |
| 33 # data_deps | |
| 34 # Normal meaning. | |
| 32 template("syzygy_optimize") { | 35 template("syzygy_optimize") { |
| 33 action(target_name) { | 36 action(target_name) { |
| 34 if (defined(invoker.visibility)) { | 37 if (defined(invoker.visibility)) { |
| 35 visibility = invoker.visibility | 38 visibility = invoker.visibility |
| 36 } | 39 } |
| 37 script = "//chrome/tools/build/win/syzygy/reorder.py" | 40 script = "//chrome/tools/build/win/syzygy/reorder.py" |
| 38 | 41 |
| 39 dll_name = invoker.dll_name | 42 dll_name = invoker.dll_name |
| 40 input_dll = "$root_out_dir/$dll_name.dll" | 43 input_dll = "$root_out_dir/$dll_name.dll" |
| 41 input_pdb = "$root_out_dir/$dll_name.dll.pdb" | 44 input_pdb = "$root_out_dir/$dll_name.dll.pdb" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 52 | 55 |
| 53 args = [ | 56 args = [ |
| 54 "--input_executable", | 57 "--input_executable", |
| 55 rebase_path(input_dll, root_build_dir), | 58 rebase_path(input_dll, root_build_dir), |
| 56 "--input_symbol", | 59 "--input_symbol", |
| 57 rebase_path(input_pdb, root_build_dir), | 60 rebase_path(input_pdb, root_build_dir), |
| 58 "--destination_dir", | 61 "--destination_dir", |
| 59 rebase_path(syzygy_dest_dir, root_build_dir), | 62 rebase_path(syzygy_dest_dir, root_build_dir), |
| 60 ] | 63 ] |
| 61 | 64 |
| 62 if (defined(invoker.deps)) { | 65 if (defined(invoker.deps)) { |
|
brettw
2016/06/24 23:51:43
You can replace both of these defined checks with:
Dirk Pranke
2016/06/25 22:53:57
Acknowledged.
| |
| 63 deps = invoker.deps | 66 deps = invoker.deps |
| 64 } | 67 } |
| 68 | |
| 69 if (defined(invoker.data_deps)) { | |
| 70 data_deps = invoker.data_deps | |
| 71 } | |
| 65 } | 72 } |
| 66 } | 73 } |
| 67 | 74 |
| 68 syzygy_optimize("chrome_dll_syzygy") { | 75 syzygy_optimize("chrome_dll_syzygy") { |
| 69 dll_name = "chrome" | 76 dll_name = "chrome" |
| 70 deps = [ | 77 deps = [ |
| 71 "//chrome:main_dll", | 78 "//chrome:main_dll", |
| 72 ] | 79 ] |
| 80 if (is_multi_dll_chrome) { | |
| 81 data_deps = [ | |
| 82 ":chrome_child_dll_syzygy", | |
| 83 ] | |
| 84 } | |
| 73 } | 85 } |
| 74 if (is_multi_dll_chrome) { | 86 if (is_multi_dll_chrome) { |
| 75 # Also instrument chrome_child.dll. | 87 # Also instrument chrome_child.dll. |
| 76 syzygy_optimize("chrome_child_dll_syzygy") { | 88 syzygy_optimize("chrome_child_dll_syzygy") { |
| 77 dll_name = "chrome_child" | 89 dll_name = "chrome_child" |
| 78 deps = [ | 90 deps = [ |
| 79 "//chrome:chrome_child", | 91 "//chrome:chrome_child", |
| 80 ] | 92 ] |
| 81 } | 93 } |
| 82 } | 94 } |
| 83 } else if (is_syzyasan) { | 95 } else if (is_syzyasan) { |
| 84 # Instruments a binary with SyzyAsan. | 96 # Instruments a binary with SyzyAsan. |
| 85 # | 97 # |
| 86 # dll_name (required) | 98 # binary_name (required) |
| 87 # Name of the DLL to be instrumented, with no extension or path. This | 99 # Name of the binary to be instrumented, with no extension or path. This |
| 88 # ${dll_name}.dll is assumed to be in the output directory and must be | 100 # ${binary_name} is assumed to be in the output directory and must be |
|
brettw
2016/06/24 23:51:43
Just delete the $ and {} on this now (before it wa
Dirk Pranke
2016/06/25 22:53:57
Acknowledged.
| |
| 89 # generated by a dependency of this target. | 101 # generated by a dependency of this target. |
| 90 # | 102 # |
| 103 # dest_dir (required) | |
| 104 # The destination directory where the instrumented image should be | |
| 105 # written. | |
| 106 # | |
| 91 # deps (required) | 107 # deps (required) |
| 92 # Normal meaning. | 108 # Normal meaning. |
| 109 # | |
| 110 # public_deps | |
| 111 # Normal meaning. | |
| 112 # | |
| 113 # data_deps | |
| 114 # Normal meaning. | |
| 93 template("syzygy_asan") { | 115 template("syzygy_asan") { |
| 94 action(target_name) { | 116 action(target_name) { |
| 95 if (defined(invoker.visibility)) { | 117 if (defined(invoker.visibility)) { |
| 96 visibility = invoker.visibility | 118 visibility = invoker.visibility |
| 97 } | 119 } |
| 98 script = "//chrome/tools/build/win/syzygy/instrument.py" | 120 script = "//chrome/tools/build/win/syzygy/instrument.py" |
| 99 | 121 |
| 100 filter = "syzyasan-instrumentation-filter.txt" | 122 filter = "syzyasan-instrumentation-filter.txt" |
| 101 | 123 |
| 102 dll_name = invoker.dll_name | 124 binary_name = invoker.binary_name |
| 103 input_dll = "$root_out_dir/$dll_name.dll" | 125 dest_dir = invoker.dest_dir |
| 104 input_pdb = "$root_out_dir/$dll_name.dll.pdb" | 126 input_image = "$root_out_dir/$binary_name" |
| 127 input_pdb = "$root_out_dir/$binary_name.pdb" | |
| 105 | 128 |
| 106 inputs = [ | 129 inputs = [ |
| 107 filter, | 130 filter, |
| 108 input_dll, | 131 input_image, |
| 109 | 132 |
| 110 #input_pdb, | 133 #input_pdb, |
| 111 ] | 134 ] |
| 112 | 135 |
| 113 output_filter = "$syzygy_dest_dir/win-syzyasan-filter-$dll_name.txt.json" | 136 output_filter = "$dest_dir/win-syzyasan-filter-$binary_name.txt.json" |
| 114 | 137 |
| 115 outputs = [ | 138 outputs = [ |
| 116 "$syzygy_dest_dir/$dll_name.dll", | 139 "$dest_dir/$input_image", |
| 117 "$syzygy_dest_dir/$dll_name.dll.pdb", | 140 "$dest_dir/$input_image.pdb", |
| 118 output_filter, | 141 output_filter, |
| 119 ] | 142 ] |
| 120 | 143 |
| 121 args = [ | 144 args = [ |
| 122 "--mode", | 145 "--mode", |
| 123 "asan", | 146 "asan", |
| 124 "--input_executable", | 147 "--input_executable", |
| 125 rebase_path(input_dll, root_build_dir), | 148 rebase_path(input_image, root_build_dir), |
| 126 "--input_symbol", | 149 "--input_symbol", |
| 127 rebase_path(input_pdb, root_build_dir), | 150 rebase_path(input_pdb, root_build_dir), |
| 128 "--filter", | 151 "--filter", |
| 129 rebase_path(filter, root_build_dir), | 152 rebase_path(filter, root_build_dir), |
| 130 "--output-filter-file", | 153 "--output-filter-file", |
| 131 rebase_path(output_filter, root_build_dir), | 154 rebase_path(output_filter, root_build_dir), |
| 132 "--destination_dir", | 155 "--destination_dir", |
| 133 rebase_path(syzygy_dest_dir, root_build_dir), | 156 rebase_path(dest_dir, root_build_dir), |
| 134 ] | 157 ] |
| 135 | 158 |
| 136 deps = [ | 159 deps = [ |
| 137 "//chrome/tools/build/win/syzygy:copy_syzyasan_binaries", | 160 "//chrome/tools/build/win/syzygy:copy_syzyasan_binaries", |
| 138 ] | 161 ] |
| 139 if (defined(invoker.deps)) { | 162 if (defined(invoker.deps)) { |
|
brettw
2016/06/24 23:51:43
Ditto for these three.
Dirk Pranke
2016/06/25 22:53:58
Acknowledged.
| |
| 140 deps += invoker.deps | 163 deps += invoker.deps |
| 141 } | 164 } |
| 142 if (defined(invoker.public_deps)) { | 165 if (defined(invoker.public_deps)) { |
| 143 public_deps = invoker.public_deps | 166 public_deps = invoker.public_deps |
| 144 } | 167 } |
| 168 if (defined(invoker.data_deps)) { | |
| 169 data_deps = invoker.data_deps | |
| 170 } | |
| 145 } | 171 } |
| 146 } | 172 } |
| 147 | 173 |
| 148 syzygy_asan("chrome_dll_syzygy") { | 174 syzygy_asan("chrome_dll_syzygy") { |
| 149 dll_name = "chrome" | 175 binary_name = "chrome.dll" |
| 176 dest_dir = syzygy_dest_dir | |
| 150 deps = [ | 177 deps = [ |
| 151 "//chrome:main_dll", | 178 "//chrome:main_dll", |
| 152 ] | 179 ] |
| 153 } | 180 } |
| 154 | 181 |
| 155 if (is_multi_dll_chrome) { | 182 if (is_multi_dll_chrome) { |
| 156 # Also instrument chrome_child.dll. | 183 # Also instrument chrome_child.dll. |
| 157 # | 184 # |
| 158 # For official builds, the instrumented version will be put into an | 185 # For official builds, the instrumented version will be put into an |
| 159 # "instrumented" subdirectory and the regular output will be | 186 # "instrumented" subdirectory and the regular output will be |
| 160 # uninstrumented. Otherwise, chrome_child is also instrumented to the | 187 # uninstrumented. Otherwise, chrome_child is also instrumented to the |
| 161 # normal place. | 188 # normal place. |
| 162 syzygy_asan("chrome_child_dll_syzygy") { | 189 syzygy_asan("chrome_child_dll_syzygy") { |
| 163 dll_name = "chrome_child" | 190 binary_name = "chrome_child.dll" |
| 164 deps = [ | 191 deps = [ |
| 165 "//chrome:chrome_child", | 192 "//chrome:chrome_child", |
| 166 ] | 193 ] |
| 167 | 194 |
| 168 if (is_official_build) { | 195 if (is_official_build) { |
| 169 dest_dir = "$syzygy_dest_dir/instrumented" | 196 dest_dir = "$syzygy_dest_dir/instrumented" |
| 170 deps += [ ":chrome_child_dll_syzygy_copy" ] | 197 deps += [ ":chrome_child_dll_syzygy_copy" ] |
| 171 } else { | 198 } else { |
| 172 dest_dir = syzygy_dest_dir | 199 dest_dir = syzygy_dest_dir |
| 173 } | 200 } |
| 174 } | |
| 175 | 201 |
| 176 if (is_official_build) { | 202 if (is_official_build) { |
| 177 # Copies the uninstrumented chrome_child.dll. | 203 # Copies the uninstrumented chrome_child.dll. |
| 178 # GYP version: chrome/chrome_syzygy.gyp:chrome_child_dll_syzygy_copy | 204 # GYP version: chrome/chrome_syzygy.gyp:chrome_child_dll_syzygy_copy |
| 179 copy("chrome_child_dll_syzygy_copy") { | 205 copy("chrome_child_dll_syzygy_copy") { |
|
brettw
2016/06/24 23:51:43
The copy target is defined inside the syzygy_asan
Dirk Pranke
2016/06/25 22:53:57
s/bested/nested :).
Ack.
| |
| 180 sources = [ | 206 sources = [ |
| 181 "$root_out_dir/chrome_child.dll", | 207 "$root_out_dir/chrome_child.dll", |
| 182 "$root_out_dir/chrome_child.dll.pdb", | 208 "$root_out_dir/chrome_child.dll.pdb", |
| 183 ] | 209 ] |
| 184 outputs = [ | 210 outputs = [ |
| 185 "$syzygy_dest_dir/{{source_file_part}}", | 211 "$dest_dir/{{source_file_part}}", |
| 186 ] | 212 ] |
| 187 deps = [ | 213 deps = [ |
| 188 "//chrome:chrome_child", | 214 "//chrome:chrome_child", |
| 189 ] | 215 ] |
| 216 } | |
| 190 } | 217 } |
| 218 data_deps = [ | |
| 219 ":chrome_child_dll_syzygy", | |
| 220 ] | |
| 191 } | 221 } |
| 192 } | 222 } |
| 193 } else { | 223 } else { |
| 194 # No syzygy. Generate dummy targets so other targets can unconditionally | 224 # No syzygy. Generate dummy targets so other targets can unconditionally |
| 195 # depend on these without having to duplicate our conditions. | 225 # depend on these without having to duplicate our conditions. |
| 196 group("chrome_dll_syzygy") { | 226 group("chrome_dll_syzygy") { |
| 197 } | 227 } |
| 198 if (is_multi_dll_chrome) { | 228 if (is_multi_dll_chrome) { |
| 199 group("chrome_child_dll_syzygy") { | 229 group("chrome_child_dll_syzygy") { |
| 200 } | 230 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 215 ] | 245 ] |
| 216 | 246 |
| 217 outputs = [ | 247 outputs = [ |
| 218 "$syzygy_dest_dir/{{source_file_part}}", | 248 "$syzygy_dest_dir/{{source_file_part}}", |
| 219 ] | 249 ] |
| 220 } | 250 } |
| 221 } | 251 } |
| 222 | 252 |
| 223 # Prevent unused variable warning for code paths where this is unused. | 253 # Prevent unused variable warning for code paths where this is unused. |
| 224 assert(syzygy_dest_dir != "") | 254 assert(syzygy_dest_dir != "") |
| OLD | NEW |