Move the Syzygy scripts out of //chrome/
Also move the syzygy_optimize and syzygy_asan GN templates to //build/win/syzygy so they can be reused in //content (without adding a dependency with //chrome). BUG=619086 Committed: https://crrev.com/71a43cab53042f33d77fe8eebe8c2463a92f9758 Review-Url: https://codereview.chromium.org/2126673002 Cr-Original-Commit-Position: refs/heads/master@{#404503} Cr-Commit-Position: refs/heads/master@{#404672}
This commit is contained in:
BUILD.gn
build/win/syzygy
BUILD.gnOWNERSinstrument.pyreorder.pysyzyasan-allocation-filter.txtsyzyasan-instrumentation-filter.txtsyzygy.gni
chrome
content
third_party/kasko
3
BUILD.gn
3
BUILD.gn
@@ -988,9 +988,6 @@ if (!is_ios && !is_android && !is_chromecast) {
|
||||
# TODO(GYP): Add this once it exists, https://crbug.com/619086
|
||||
# "//content/shell:content_shell_syzyasan
|
||||
]
|
||||
if (is_multi_dll_chrome) {
|
||||
deps += [ "//chrome/tools/build/win/syzygy:chrome_child_dll_syzygy" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
build/win/syzygy/BUILD.gn
Normal file
23
build/win/syzygy/BUILD.gn
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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.
|
||||
|
||||
copy("copy_syzyasan_binaries") {
|
||||
visibility = [
|
||||
"//chrome/*",
|
||||
"//content/*",
|
||||
]
|
||||
|
||||
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 = [
|
||||
"$root_out_dir/syzygy/{{source_file_part}}",
|
||||
]
|
||||
}
|
3
build/win/syzygy/OWNERS
Normal file
3
build/win/syzygy/OWNERS
Normal file
@@ -0,0 +1,3 @@
|
||||
chrisha@chromium.org
|
||||
sebmarchand@chromiun.org
|
||||
siggi@chromium.org
|
@@ -16,7 +16,7 @@ import sys
|
||||
|
||||
# The default directory containing the Syzygy toolchain.
|
||||
_DEFAULT_SYZYGY_DIR = os.path.abspath(os.path.join(
|
||||
os.path.dirname(__file__), '../../../../..',
|
||||
os.path.dirname(__file__), '../../..',
|
||||
'third_party/syzygy/binaries/exe/'))
|
||||
|
||||
# Basenames of various tools.
|
@@ -14,7 +14,7 @@ import sys
|
||||
|
||||
# The default relink executable to use to reorder binaries.
|
||||
_DEFAULT_RELINKER = os.path.join(
|
||||
os.path.join(os.path.dirname(__file__), '../../../../..'),
|
||||
os.path.join(os.path.dirname(__file__), '../../..'),
|
||||
'third_party/syzygy/binaries/exe/relink.exe')
|
||||
|
||||
_LOGGER = logging.getLogger()
|
137
build/win/syzygy/syzygy.gni
Normal file
137
build/win/syzygy/syzygy.gni
Normal file
@@ -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",
|
||||
])
|
||||
}
|
||||
}
|
@@ -23,7 +23,7 @@
|
||||
{
|
||||
'action_name': 'Reorder Chrome with Syzygy',
|
||||
'inputs': [
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/reorder.py',
|
||||
'<(DEPTH)/build/win/syzygy/reorder.py',
|
||||
'<(PRODUCT_DIR)/<(dll_name).dll',
|
||||
'<(PRODUCT_DIR)/<(dll_name).dll.pdb',
|
||||
],
|
||||
@@ -33,7 +33,7 @@
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/reorder.py',
|
||||
'<(DEPTH)/build/win/syzygy/reorder.py',
|
||||
'--input_executable', '<(PRODUCT_DIR)/<(dll_name).dll',
|
||||
'--input_symbol', '<(PRODUCT_DIR)/<(dll_name).dll.pdb',
|
||||
'--destination_dir', '<(dest_dir)',
|
||||
@@ -47,8 +47,8 @@
|
||||
{
|
||||
'action_name': 'Instrument Chrome with SyzyAsan',
|
||||
'inputs': [
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/instrument.py',
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/'
|
||||
'<(DEPTH)/build/win/syzygy/instrument.py',
|
||||
'<(DEPTH)/build/win/syzygy/'
|
||||
'syzyasan-instrumentation-filter.txt',
|
||||
'<(PRODUCT_DIR)/<(dll_name).dll',
|
||||
],
|
||||
@@ -59,13 +59,12 @@
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/instrument.py',
|
||||
'<(DEPTH)/build/win/syzygy/instrument.py',
|
||||
'--mode', 'asan',
|
||||
'--input_executable', '<(PRODUCT_DIR)/<(dll_name).dll',
|
||||
'--input_symbol', '<(PRODUCT_DIR)/<(dll_name).dll.pdb',
|
||||
'--filter',
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/'
|
||||
'syzyasan-instrumentation-filter.txt',
|
||||
'<(DEPTH)/build/win/syzygy/syzyasan-instrumentation-filter.txt',
|
||||
'--output-filter-file',
|
||||
'<(dest_dir)/win-syzyasan-filter-<(dll_name).txt.json',
|
||||
'--destination_dir', '<(dest_dir)',
|
||||
|
@@ -262,7 +262,7 @@ generate_mini_installer("mini_installer") {
|
||||
chrome_dll_target = "//chrome:main_dll"
|
||||
}
|
||||
|
||||
if (syzygy_optimize) {
|
||||
if (syzygy_optimize || is_syzyasan) {
|
||||
generate_mini_installer("mini_installer_syzygy") {
|
||||
out_dir = "$root_out_dir/syzygy/"
|
||||
chrome_dll_file = "$root_out_dir/syzygy/chrome.dll"
|
||||
|
@@ -5,6 +5,7 @@
|
||||
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")
|
||||
@@ -13,59 +14,8 @@ assert(!syzygy_optimize || !is_syzyasan,
|
||||
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") {
|
||||
dll_name = "chrome"
|
||||
binary_name = "chrome.dll"
|
||||
deps = [
|
||||
"//chrome:main_dll",
|
||||
]
|
||||
@@ -78,96 +28,24 @@ if (syzygy_optimize) {
|
||||
if (is_multi_dll_chrome) {
|
||||
# Also instrument chrome_child.dll.
|
||||
syzygy_optimize("chrome_child_dll_syzygy") {
|
||||
dll_name = "chrome_child"
|
||||
binary_name = "chrome_child.dll"
|
||||
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) {
|
||||
@@ -189,10 +67,6 @@ if (syzygy_optimize) {
|
||||
} else {
|
||||
dest_dir = syzygy_dest_dir
|
||||
}
|
||||
|
||||
data_deps = [
|
||||
":chrome_child_dll_syzygy",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_official_build) {
|
||||
@@ -201,10 +75,9 @@ if (syzygy_optimize) {
|
||||
copy("chrome_child_dll_syzygy_copy") {
|
||||
sources = [
|
||||
"$root_out_dir/chrome_child.dll",
|
||||
"$root_out_dir/chrome_child.dll.pdb",
|
||||
]
|
||||
outputs = [
|
||||
"$dest_dir/{{source_file_part}}",
|
||||
"$syzygy_dest_dir/{{source_file_part}}",
|
||||
]
|
||||
deps = [
|
||||
"//chrome:chrome_child",
|
||||
@@ -223,24 +96,5 @@ if (syzygy_optimize) {
|
||||
}
|
||||
}
|
||||
|
||||
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 != "")
|
||||
|
@@ -905,7 +905,7 @@
|
||||
],
|
||||
'action': [
|
||||
'python',
|
||||
'<(DEPTH)/chrome/tools/build/win/syzygy/instrument.py',
|
||||
'<(DEPTH)/build/win/syzygy/instrument.py',
|
||||
'--mode', 'asan',
|
||||
'--input_executable', '<(PRODUCT_DIR)/content_shell.exe',
|
||||
'--input_symbol', '<(PRODUCT_DIR)/content_shell.exe.pdb',
|
||||
|
7
third_party/kasko/BUILD.gn
vendored
7
third_party/kasko/BUILD.gn
vendored
@@ -15,8 +15,11 @@ buildflag_header("kasko_features") {
|
||||
if (enable_kasko) {
|
||||
assert(is_win, "Kasko only support Windows.")
|
||||
assert(target_cpu == "x86", "Kasko only support 32 bits.")
|
||||
assert(is_chrome_branded,
|
||||
"The Kasko client is only initialized in Chrome-branded builds.")
|
||||
|
||||
# TODO(sebmarchand): Fix this once the Kasko dependency in SyzyAsan has been
|
||||
# removed for the non-official builds.
|
||||
#assert(is_chrome_branded,
|
||||
# "The Kasko client is only initialized in Chrome-branded builds.")
|
||||
|
||||
config("kasko_config") {
|
||||
visibility = [ ":*" ]
|
||||
|
Reference in New Issue
Block a user