| Index: chrome/tools/build/win/syzygy/BUILD.gn
|
| diff --git a/chrome/tools/build/win/syzygy/BUILD.gn b/chrome/tools/build/win/syzygy/BUILD.gn
|
| index 0d065470b83e561fac0848cdec3c57b8cdd6e86b..822a645f3e48861f54f23cc2bb265db4978cd0d7 100644
|
| --- a/chrome/tools/build/win/syzygy/BUILD.gn
|
| +++ b/chrome/tools/build/win/syzygy/BUILD.gn
|
| @@ -5,7 +5,6 @@
|
| import("//build/config/chrome_build.gni")
|
| import("//build/config/compiler/compiler.gni")
|
| import("//build/config/sanitizers/sanitizers.gni")
|
| -import("//build/win/syzygy/syzygy.gni")
|
|
|
| assert(!syzygy_optimize || !is_syzyasan,
|
| "Don't do both syzygy_optimize and is_syzyasan")
|
| @@ -14,8 +13,59 @@
|
| syzygy_dest_dir = "$root_out_dir/syzygy"
|
|
|
| if (syzygy_optimize) {
|
| + # Generates a Syzygy optimize target.
|
| + #
|
| + # dll_name (required)
|
| + # Name of the DLL to be instrumented, with no extension or path. This
|
| + # ${dll_name}.dll 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 = "//chrome/tools/build/win/syzygy/reorder.py"
|
| +
|
| + dll_name = invoker.dll_name
|
| + input_dll = "$root_out_dir/$dll_name.dll"
|
| + input_pdb = "$root_out_dir/$dll_name.dll.pdb"
|
| +
|
| + inputs = [
|
| + input_dll,
|
| + #input_pdb,
|
| + ]
|
| +
|
| + outputs = [
|
| + "$syzygy_dest_dir/$dll_name.dll",
|
| + "$syzygy_dest_dir/$dll_name.dll.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",
|
| + ])
|
| + }
|
| + }
|
| +
|
| syzygy_optimize("chrome_dll_syzygy") {
|
| - binary_name = "chrome.dll"
|
| + dll_name = "chrome"
|
| deps = [
|
| "//chrome:main_dll",
|
| ]
|
| @@ -28,24 +78,96 @@
|
| if (is_multi_dll_chrome) {
|
| # Also instrument chrome_child.dll.
|
| syzygy_optimize("chrome_child_dll_syzygy") {
|
| - binary_name = "chrome_child.dll"
|
| + dll_name = "chrome_child"
|
| deps = [
|
| "//chrome:chrome_child",
|
| ]
|
| }
|
| }
|
| } else if (is_syzyasan) {
|
| + # 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 = "//chrome/tools/build/win/syzygy/instrument.py"
|
| +
|
| + filter = "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/$input_image",
|
| + "$dest_dir/$input_image.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 = [
|
| + "//chrome/tools/build/win/syzygy:copy_syzyasan_binaries",
|
| + ]
|
| + if (defined(invoker.deps)) {
|
| + deps += invoker.deps
|
| + }
|
| + forward_variables_from(invoker,
|
| + [
|
| + "data_deps",
|
| + "public_deps",
|
| + ])
|
| + }
|
| + }
|
| +
|
| syzygy_asan("chrome_dll_syzygy") {
|
| binary_name = "chrome.dll"
|
| dest_dir = syzygy_dest_dir
|
| deps = [
|
| "//chrome:main_dll",
|
| ]
|
| - if (is_multi_dll_chrome) {
|
| - data_deps = [
|
| - ":chrome_child_dll_syzygy",
|
| - ]
|
| - }
|
| }
|
|
|
| if (is_multi_dll_chrome) {
|
| @@ -67,6 +189,10 @@
|
| } else {
|
| dest_dir = syzygy_dest_dir
|
| }
|
| +
|
| + data_deps = [
|
| + ":chrome_child_dll_syzygy",
|
| + ]
|
| }
|
|
|
| if (is_official_build) {
|
| @@ -75,9 +201,10 @@
|
| copy("chrome_child_dll_syzygy_copy") {
|
| sources = [
|
| "$root_out_dir/chrome_child.dll",
|
| + "$root_out_dir/chrome_child.dll.pdb",
|
| ]
|
| outputs = [
|
| - "$syzygy_dest_dir/{{source_file_part}}",
|
| + "$dest_dir/{{source_file_part}}",
|
| ]
|
| deps = [
|
| "//chrome:chrome_child",
|
| @@ -96,5 +223,24 @@
|
| }
|
| }
|
|
|
| +if (is_syzyasan || syzygy_optimize) {
|
| + copy("copy_syzyasan_binaries") {
|
| + visibility = [ "//chrome/*" ]
|
| +
|
| + source_dir = "//third_party/syzygy/binaries/exe"
|
| +
|
| + sources = [
|
| + "$source_dir/agent_logger.exe",
|
| + "$source_dir/minidump_symbolizer.py",
|
| + "$source_dir/syzyasan_rtl.dll",
|
| + "$source_dir/syzyasan_rtl.dll.pdb",
|
| + ]
|
| +
|
| + outputs = [
|
| + "$syzygy_dest_dir/{{source_file_part}}",
|
| + ]
|
| + }
|
| +}
|
| +
|
| # Prevent unused variable warning for code paths where this is unused.
|
| assert(syzygy_dest_dir != "")
|
|
|