| OLD | NEW |
| (Empty) |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 assert(is_win) | |
| 6 | |
| 7 # Where the output binaries will be placed. | |
| 8 syzygy_dest_dir = "$root_out_dir/syzygy" | |
| 9 | |
| 10 # Generates a Syzygy optimize target. | |
| 11 # | |
| 12 # binary_name (required) | |
| 13 # Name of the binary to be instrumented, with no extension or path. This | |
| 14 # binary_name is assumed to be in the output directory and must be | |
| 15 # generated by a dependency of this target. | |
| 16 # | |
| 17 # deps (required) | |
| 18 # Normal meaning. | |
| 19 # | |
| 20 # data_deps | |
| 21 # Normal meaning. | |
| 22 template("syzygy_optimize") { | |
| 23 action(target_name) { | |
| 24 if (defined(invoker.visibility)) { | |
| 25 visibility = invoker.visibility | |
| 26 } | |
| 27 script = "//build/win/syzygy/reorder.py" | |
| 28 | |
| 29 binary_name = invoker.binary_name | |
| 30 input_dll = "$root_out_dir/$binary_name" | |
| 31 input_pdb = "$root_out_dir/$binary_name.pdb" | |
| 32 | |
| 33 inputs = [ | |
| 34 input_dll, | |
| 35 #input_pdb, | |
| 36 ] | |
| 37 | |
| 38 outputs = [ | |
| 39 "$syzygy_dest_dir/$binary_name", | |
| 40 "$syzygy_dest_dir/$binary_name.pdb", | |
| 41 ] | |
| 42 | |
| 43 args = [ | |
| 44 "--input_executable", | |
| 45 rebase_path(input_dll, root_build_dir), | |
| 46 "--input_symbol", | |
| 47 rebase_path(input_pdb, root_build_dir), | |
| 48 "--destination_dir", | |
| 49 rebase_path(syzygy_dest_dir, root_build_dir), | |
| 50 ] | |
| 51 | |
| 52 forward_variables_from(invoker, | |
| 53 [ | |
| 54 "deps", | |
| 55 "data_deps", | |
| 56 "public_deps", | |
| 57 ]) | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 # Instruments a binary with SyzyAsan. | |
| 62 # | |
| 63 # binary_name (required) | |
| 64 # Name of the binary to be instrumented, with no extension or path. This | |
| 65 # binary_name is assumed to be in the output directory and must be | |
| 66 # generated by a dependency of this target. | |
| 67 # | |
| 68 # dest_dir (required) | |
| 69 # The destination directory where the instrumented image should be | |
| 70 # written. | |
| 71 # | |
| 72 # deps (required) | |
| 73 # Normal meaning. | |
| 74 # | |
| 75 # public_deps | |
| 76 # Normal meaning. | |
| 77 # | |
| 78 # data_deps | |
| 79 # Normal meaning. | |
| 80 template("syzygy_asan") { | |
| 81 action(target_name) { | |
| 82 if (defined(invoker.visibility)) { | |
| 83 visibility = invoker.visibility | |
| 84 } | |
| 85 script = "//build/win/syzygy/instrument.py" | |
| 86 | |
| 87 filter = "//build/win/syzygy/syzyasan-instrumentation-filter.txt" | |
| 88 | |
| 89 binary_name = invoker.binary_name | |
| 90 dest_dir = invoker.dest_dir | |
| 91 input_image = "$root_out_dir/$binary_name" | |
| 92 input_pdb = "$root_out_dir/$binary_name.pdb" | |
| 93 | |
| 94 inputs = [ | |
| 95 filter, | |
| 96 input_image, | |
| 97 | |
| 98 #input_pdb, | |
| 99 ] | |
| 100 | |
| 101 output_filter = "$dest_dir/win-syzyasan-filter-$binary_name.txt.json" | |
| 102 | |
| 103 outputs = [ | |
| 104 "$dest_dir/$binary_name", | |
| 105 "$dest_dir/$binary_name.pdb", | |
| 106 output_filter, | |
| 107 ] | |
| 108 | |
| 109 args = [ | |
| 110 "--mode", | |
| 111 "asan", | |
| 112 "--input_executable", | |
| 113 rebase_path(input_image, root_build_dir), | |
| 114 "--input_symbol", | |
| 115 rebase_path(input_pdb, root_build_dir), | |
| 116 "--filter", | |
| 117 rebase_path(filter, root_build_dir), | |
| 118 "--output-filter-file", | |
| 119 rebase_path(output_filter, root_build_dir), | |
| 120 "--destination_dir", | |
| 121 rebase_path(dest_dir, root_build_dir), | |
| 122 ] | |
| 123 | |
| 124 deps = [ | |
| 125 "//build/win/syzygy:copy_syzyasan_binaries", | |
| 126 ] | |
| 127 if (defined(invoker.deps)) { | |
| 128 deps += invoker.deps | |
| 129 } | |
| 130 forward_variables_from(invoker, | |
| 131 [ | |
| 132 "data_deps", | |
| 133 "public_deps", | |
| 134 "testonly", | |
| 135 ]) | |
| 136 } | |
| 137 } | |
| OLD | NEW |