Index: build/win/syzygy/syzygy.gni |
diff --git a/build/win/syzygy/syzygy.gni b/build/win/syzygy/syzygy.gni |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1ae2ebef828b4708de29460773c02aa798abe3b3 |
--- /dev/null |
+++ b/build/win/syzygy/syzygy.gni |
@@ -0,0 +1,137 @@ |
+# Copyright 2016 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+assert(is_win) |
+ |
+# Where the output binaries will be placed. |
+syzygy_dest_dir = "$root_out_dir/syzygy" |
+ |
+# Generates a Syzygy optimize target. |
+# |
+# binary_name (required) |
+# Name of the binary to be instrumented, with no extension or path. This |
+# binary_name is assumed to be in the output directory and must be |
+# generated by a dependency of this target. |
+# |
+# deps (required) |
+# Normal meaning. |
+# |
+# data_deps |
+# Normal meaning. |
+template("syzygy_optimize") { |
+ action(target_name) { |
+ if (defined(invoker.visibility)) { |
+ visibility = invoker.visibility |
+ } |
+ script = "//build/win/syzygy/reorder.py" |
+ |
+ binary_name = invoker.binary_name |
+ input_dll = "$root_out_dir/$binary_name" |
+ input_pdb = "$root_out_dir/$binary_name.pdb" |
+ |
+ inputs = [ |
+ input_dll, |
+ #input_pdb, |
+ ] |
+ |
+ outputs = [ |
+ "$syzygy_dest_dir/$binary_name", |
+ "$syzygy_dest_dir/$binary_name.pdb", |
+ ] |
+ |
+ args = [ |
+ "--input_executable", |
+ rebase_path(input_dll, root_build_dir), |
+ "--input_symbol", |
+ rebase_path(input_pdb, root_build_dir), |
+ "--destination_dir", |
+ rebase_path(syzygy_dest_dir, root_build_dir), |
+ ] |
+ |
+ forward_variables_from(invoker, |
+ [ |
+ "deps", |
+ "data_deps", |
+ "public_deps", |
+ ]) |
+ } |
+} |
+ |
+# Instruments a binary with SyzyAsan. |
+# |
+# binary_name (required) |
+# Name of the binary to be instrumented, with no extension or path. This |
+# binary_name is assumed to be in the output directory and must be |
+# generated by a dependency of this target. |
+# |
+# dest_dir (required) |
+# The destination directory where the instrumented image should be |
+# written. |
+# |
+# deps (required) |
+# Normal meaning. |
+# |
+# public_deps |
+# Normal meaning. |
+# |
+# data_deps |
+# Normal meaning. |
+template("syzygy_asan") { |
+ action(target_name) { |
+ if (defined(invoker.visibility)) { |
+ visibility = invoker.visibility |
+ } |
+ script = "//build/win/syzygy/instrument.py" |
+ |
+ filter = "//build/win/syzygy/syzyasan-instrumentation-filter.txt" |
+ |
+ binary_name = invoker.binary_name |
+ dest_dir = invoker.dest_dir |
+ input_image = "$root_out_dir/$binary_name" |
+ input_pdb = "$root_out_dir/$binary_name.pdb" |
+ |
+ inputs = [ |
+ filter, |
+ input_image, |
+ |
+ #input_pdb, |
+ ] |
+ |
+ output_filter = "$dest_dir/win-syzyasan-filter-$binary_name.txt.json" |
+ |
+ outputs = [ |
+ "$dest_dir/$binary_name", |
+ "$dest_dir/$binary_name.pdb", |
+ output_filter, |
+ ] |
+ |
+ args = [ |
+ "--mode", |
+ "asan", |
+ "--input_executable", |
+ rebase_path(input_image, root_build_dir), |
+ "--input_symbol", |
+ rebase_path(input_pdb, root_build_dir), |
+ "--filter", |
+ rebase_path(filter, root_build_dir), |
+ "--output-filter-file", |
+ rebase_path(output_filter, root_build_dir), |
+ "--destination_dir", |
+ rebase_path(dest_dir, root_build_dir), |
+ ] |
+ |
+ deps = [ |
+ "//build/win/syzygy:copy_syzyasan_binaries", |
+ ] |
+ if (defined(invoker.deps)) { |
+ deps += invoker.deps |
+ } |
+ forward_variables_from(invoker, |
+ [ |
+ "data_deps", |
+ "public_deps", |
+ "testonly", |
+ ]) |
+ } |
+} |