| 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 # Chrome elf targets (excepting tests) should only link in kernel32. | 5 # Chrome elf targets (excepting tests) should only link in kernel32. |
| 6 # Please don't add dependencies on any other system libraries. | 6 # Please don't add dependencies on any other system libraries. |
| 7 | 7 |
| 8 import("//build/config/win/manifest.gni") | 8 import("//build/config/win/manifest.gni") |
| 9 import("//chrome/version.gni") | 9 import("//chrome/version.gni") |
| 10 import("//testing/test.gni") | 10 import("//testing/test.gni") |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 sources = [ | 26 sources = [ |
| 27 as_invoker_manifest, | 27 as_invoker_manifest, |
| 28 ] | 28 ] |
| 29 type = "dll" | 29 type = "dll" |
| 30 } | 30 } |
| 31 | 31 |
| 32 # We should move chrome_result_codes.h to another target which does not bring | 32 # We should move chrome_result_codes.h to another target which does not bring |
| 33 # in the world. | 33 # in the world. |
| 34 shared_library("chrome_elf") { | 34 shared_library("chrome_elf") { |
| 35 sources = [ | 35 sources = [ |
| 36 "//chrome/app/chrome_crash_reporter_client_win.cc", |
| 37 "//chrome/app/chrome_crash_reporter_client_win.h", |
| 38 "//chrome/common/chrome_result_codes.h", |
| 36 "chrome_elf.def", | 39 "chrome_elf.def", |
| 37 "chrome_elf_main.cc", | 40 "chrome_elf_main.cc", |
| 38 "chrome_elf_main.h", | 41 "chrome_elf_main.h", |
| 39 ] | 42 ] |
| 40 deps = [ | 43 deps = [ |
| 41 ":blacklist", | 44 ":blacklist", |
| 42 ":chrome_elf_manifest", | 45 ":chrome_elf_manifest", |
| 43 ":chrome_elf_resources", | 46 ":chrome_elf_resources", |
| 47 ":chrome_elf_security", |
| 44 ":constants", | 48 ":constants", |
| 45 ":crash", | |
| 46 ":hook_util", | 49 ":hook_util", |
| 47 ":security", | 50 "//base", |
| 48 "//build/config/sanitizers:deps", | 51 "//build/config/sanitizers:deps", |
| 49 "//chrome/install_static:install_static_util", | 52 "//chrome/install_static:install_static_util", |
| 50 "//chrome_elf/nt_registry:nt_registry", | 53 "//chrome_elf/nt_registry:nt_registry", |
| 54 "//components/crash/content/app", |
| 55 "//components/crash/core/common", |
| 56 "//content/public/common:result_codes", |
| 57 "//third_party/crashpad/crashpad/client:client", |
| 51 ] | 58 ] |
| 52 configs += [ "//build/config/win:windowed" ] | 59 configs += [ "//build/config/win:windowed" ] |
| 53 configs -= [ "//build/config/win:console" ] | 60 configs -= [ "//build/config/win:console" ] |
| 54 | |
| 55 # Delay loads in this list will prevent user32.dll | |
| 56 # from loading too early. | |
| 57 ldflags = [ | 61 ldflags = [ |
| 58 "/DELAYLOAD:advapi32.dll", | 62 "/NODEFAULTLIB:user32.lib", |
| 59 "/DELAYLOAD:dbghelp.dll", | 63 "/DELAYLOAD:dbghelp.dll", |
| 64 "/DELAYLOAD:ole32.dll", |
| 65 "/DELAYLOAD:psapi.dll", |
| 60 "/DELAYLOAD:rpcrt4.dll", | 66 "/DELAYLOAD:rpcrt4.dll", |
| 67 "/DELAYLOAD:shell32.dll", |
| 68 "/DELAYLOAD:user32.dll", |
| 69 "/DELAYLOAD:winhttp.dll", |
| 61 "/DELAYLOAD:winmm.dll", | 70 "/DELAYLOAD:winmm.dll", |
| 71 "/DELAYLOAD:ws2_32.dll", |
| 62 ] | 72 ] |
| 63 if (current_cpu == "x86") { | 73 if (current_cpu == "x86") { |
| 64 # Don"t set an x64 base address (to avoid breaking HE-ASLR). | 74 # Don"t set an x64 base address (to avoid breaking HE-ASLR). |
| 65 ldflags += [ "/BASE:0x01c20000" ] | 75 ldflags += [ "/BASE:0x01c20000" ] |
| 66 } | 76 } |
| 67 } | 77 } |
| 68 | 78 |
| 69 ##------------------------------------------------------------------------------ | 79 ##------------------------------------------------------------------------------ |
| 70 ## source sets | 80 ## source sets |
| 71 ##------------------------------------------------------------------------------ | 81 ##------------------------------------------------------------------------------ |
| 72 | 82 |
| 73 source_set("security") { | 83 source_set("chrome_elf_security") { |
| 74 sources = [ | 84 sources = [ |
| 75 "chrome_elf_security.cc", | 85 "chrome_elf_security.cc", |
| 76 "chrome_elf_security.h", | 86 "chrome_elf_security.h", |
| 77 ] | 87 ] |
| 78 deps = [ | 88 deps = [ |
| 79 ":constants", | 89 ":constants", |
| 80 "//chrome_elf/nt_registry:nt_registry", | 90 "//chrome_elf/nt_registry:nt_registry", |
| 81 ] | 91 ] |
| 82 } | 92 } |
| 83 | 93 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 112 "//build/win:default_exe_manifest", | 122 "//build/win:default_exe_manifest", |
| 113 ] | 123 ] |
| 114 } | 124 } |
| 115 | 125 |
| 116 static_library("blacklist") { | 126 static_library("blacklist") { |
| 117 sources = [ | 127 sources = [ |
| 118 "blacklist/blacklist.cc", | 128 "blacklist/blacklist.cc", |
| 119 "blacklist/blacklist.h", | 129 "blacklist/blacklist.h", |
| 120 "blacklist/blacklist_interceptions.cc", | 130 "blacklist/blacklist_interceptions.cc", |
| 121 "blacklist/blacklist_interceptions.h", | 131 "blacklist/blacklist_interceptions.h", |
| 132 "blacklist/crashpad_helper.cc", |
| 133 "blacklist/crashpad_helper.h", |
| 122 ] | 134 ] |
| 123 public_deps = [ | 135 public_deps = [ |
| 124 "//sandbox", | 136 "//sandbox", |
| 125 ] | 137 ] |
| 126 deps = [ | 138 deps = [ |
| 127 ":constants", | 139 ":constants", |
| 128 ":crash", | |
| 129 ":hook_util", | 140 ":hook_util", |
| 130 "//base:base_static", # pe_image | |
| 131 "//chrome/install_static:install_static_util", | 141 "//chrome/install_static:install_static_util", |
| 132 "//chrome_elf/nt_registry:nt_registry", | 142 "//chrome_elf/nt_registry:nt_registry", |
| 133 ] | |
| 134 } | |
| 135 | 143 |
| 136 static_library("crash") { | 144 # Still uses base/win/pe_image.h |
| 137 sources = [ | 145 "//base", |
| 138 "../chrome/app/chrome_crash_reporter_client_win.cc", | 146 "//third_party/crashpad/crashpad/client:client", |
| 139 "../chrome/app/chrome_crash_reporter_client_win.h", | |
| 140 "../chrome/common/chrome_result_codes.h", | |
| 141 "crash/crash_helper.cc", | |
| 142 "crash/crash_helper.h", | |
| 143 ] | |
| 144 deps = [ | |
| 145 ":hook_util", | |
| 146 "//base:base", # This needs to go. DEP of app, crash_keys, client. | |
| 147 "//base:base_static", # pe_image | |
| 148 "//chrome/install_static:install_static_util", | |
| 149 "//components/crash/content/app:app", | |
| 150 "//components/crash/core/common", # crash_keys | |
| 151 "//content/public/common:result_codes", | |
| 152 "//third_party/crashpad/crashpad/client:client", # DumpWithoutCrash | |
| 153 ] | 147 ] |
| 154 } | 148 } |
| 155 | 149 |
| 156 static_library("hook_util") { | 150 static_library("hook_util") { |
| 157 sources = [ | 151 sources = [ |
| 158 "../base/macros.h", | 152 "hook_util/thunk_getter.cc", |
| 159 "hook_util/hook_util.cc", | 153 "hook_util/thunk_getter.h", |
| 160 "hook_util/hook_util.h", | |
| 161 ] | 154 ] |
| 162 deps = [ | 155 deps = [ |
| 163 "//base:base_static", # pe_image | |
| 164 "//sandbox", | 156 "//sandbox", |
| 165 ] | 157 ] |
| 166 } | 158 } |
| 167 | 159 |
| 168 ##------------------------------------------------------------------------------ | 160 ##------------------------------------------------------------------------------ |
| 169 ## tests | 161 ## tests |
| 170 ##------------------------------------------------------------------------------ | 162 ##------------------------------------------------------------------------------ |
| 171 | 163 |
| 172 test("chrome_elf_unittests") { | 164 test("chrome_elf_unittests") { |
| 173 output_name = "chrome_elf_unittests" | 165 output_name = "chrome_elf_unittests" |
| 174 sources = [ | 166 sources = [ |
| 175 "blacklist/test/blacklist_test.cc", | 167 "blacklist/test/blacklist_test.cc", |
| 176 "chrome_elf_util_unittest.cc", | 168 "chrome_elf_util_unittest.cc", |
| 177 "elf_imports_unittest.cc", | 169 "elf_imports_unittest.cc", |
| 178 "hook_util/test/hook_util_test.cc", | |
| 179 "run_all_unittests.cc", | 170 "run_all_unittests.cc", |
| 180 ] | 171 ] |
| 181 include_dirs = [ "$target_gen_dir" ] | 172 include_dirs = [ "$target_gen_dir" ] |
| 182 deps = [ | 173 deps = [ |
| 183 ":blacklist", | 174 ":blacklist", |
| 184 ":blacklist_test_main_dll", | 175 ":blacklist_test_main_dll", |
| 176 ":chrome_elf_security", |
| 185 ":constants", | 177 ":constants", |
| 186 ":crash", | |
| 187 ":hook_util", | 178 ":hook_util", |
| 188 ":hook_util_test_dll", | |
| 189 ":security", | |
| 190 "//base", | 179 "//base", |
| 191 "//base/test:test_support", | 180 "//base/test:test_support", |
| 192 "//chrome", | 181 "//chrome", |
| 193 "//chrome/common:version_header", | 182 "//chrome/common:version_header", |
| 194 "//chrome/install_static:install_static_util", | 183 "//chrome/install_static:install_static_util", |
| 195 "//chrome_elf/nt_registry:nt_registry", | 184 "//chrome_elf/nt_registry:nt_registry", |
| 196 "//sandbox", | 185 "//sandbox", |
| 197 "//testing/gtest", | 186 "//testing/gtest", |
| 198 ] | 187 ] |
| 199 | 188 |
| 200 # It's not easily possible to have //chrome in data_deps without changing | 189 # It's not easily possible to have //chrome in data_deps without changing |
| 201 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. | 190 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. |
| 202 # As a workaround, explicitly include a data dep on just chrome.exe, and | 191 # As a workaround, explicitly include a data dep on just chrome.exe, and |
| 203 # add //chrome to deps above to make sure it's been built. | 192 # add //chrome to deps above to make sure it's been built. |
| 204 data = [ | 193 data = [ |
| 205 "$root_out_dir/chrome.exe", | 194 "$root_out_dir/chrome.exe", |
| 206 ] | 195 ] |
| 207 data_deps = [ | 196 data_deps = [ |
| 208 ":blacklist_test_dll_1", | 197 ":blacklist_test_dll_1", |
| 209 ":blacklist_test_dll_2", | 198 ":blacklist_test_dll_2", |
| 210 ":blacklist_test_dll_3", | 199 ":blacklist_test_dll_3", |
| 211 ":chrome_elf", | 200 ":chrome_elf", |
| 212 ] | 201 ] |
| 213 | |
| 214 # Don't want the test-specific dependencies to affect ChromeElfLoadSanityTest. | |
| 215 # In particular, a few system DLLs cause user32 to be loaded, which is bad. | |
| 216 ldflags = [ | 202 ldflags = [ |
| 217 "/DELAYLOAD:advapi32.dll", | 203 "/DELAYLOAD:dbghelp.dll", |
| 218 "/DELAYLOAD:ole32.dll", | 204 "/DELAYLOAD:ole32.dll", |
| 205 "/DELAYLOAD:psapi.dll", |
| 206 "/DELAYLOAD:rpcrt4.dll", |
| 219 "/DELAYLOAD:shell32.dll", | 207 "/DELAYLOAD:shell32.dll", |
| 208 "/DELAYLOAD:shlwapi.dll", |
| 220 "/DELAYLOAD:user32.dll", | 209 "/DELAYLOAD:user32.dll", |
| 210 "/DELAYLOAD:winhttp.dll", |
| 221 "/DELAYLOAD:winmm.dll", | 211 "/DELAYLOAD:winmm.dll", |
| 212 "/DELAYLOAD:ws2_32.dll", |
| 222 ] | 213 ] |
| 223 } | 214 } |
| 224 | 215 |
| 225 shared_library("blacklist_test_main_dll") { | 216 shared_library("blacklist_test_main_dll") { |
| 226 sources = [ | 217 sources = [ |
| 227 "blacklist/test/blacklist_test_main_dll.cc", | 218 "blacklist/test/blacklist_test_main_dll.cc", |
| 228 "blacklist/test/blacklist_test_main_dll.def", | 219 "blacklist/test/blacklist_test_main_dll.def", |
| 229 ] | 220 ] |
| 230 deps = [ | 221 deps = [ |
| 231 ":blacklist", | 222 ":blacklist", |
| 232 "//base", | 223 "//base", |
| 233 "//build/config/sanitizers:deps", | 224 "//build/config/sanitizers:deps", |
| 234 "//chrome/install_static:install_static_util", | 225 "//chrome/install_static:install_static_util", |
| 235 "//chrome_elf/nt_registry:nt_registry", | 226 "//chrome_elf/nt_registry:nt_registry", |
| 236 ] | 227 ] |
| 228 ldflags = [ |
| 229 "/NODEFAULTLIB:user32.lib", |
| 230 "/DELAYLOAD:dbghelp.dll", |
| 231 "/DELAYLOAD:ole32.dll", |
| 232 "/DELAYLOAD:psapi.dll", |
| 233 "/DELAYLOAD:rpcrt4.dll", |
| 234 "/DELAYLOAD:shell32.dll", |
| 235 "/DELAYLOAD:user32.dll", |
| 236 "/DELAYLOAD:winhttp.dll", |
| 237 "/DELAYLOAD:winmm.dll", |
| 238 "/DELAYLOAD:ws2_32.dll", |
| 239 ] |
| 237 } | 240 } |
| 238 | 241 |
| 239 loadable_module("blacklist_test_dll_1") { | 242 loadable_module("blacklist_test_dll_1") { |
| 240 sources = [ | 243 sources = [ |
| 241 "blacklist/test/blacklist_test_dll_1.cc", | 244 "blacklist/test/blacklist_test_dll_1.cc", |
| 242 "blacklist/test/blacklist_test_dll_1.def", | 245 "blacklist/test/blacklist_test_dll_1.def", |
| 243 ] | 246 ] |
| 244 deps = [ | 247 deps = [ |
| 245 "//build/config/sanitizers:deps", | 248 "//build/config/sanitizers:deps", |
| 246 ] | 249 ] |
| (...skipping 15 matching lines...) Expand all Loading... |
| 262 # which does), Ninja would get confused and always rebuild this target because | 265 # which does), Ninja would get confused and always rebuild this target because |
| 263 # it sees a declared output file but that file doesn't exist on disk. | 266 # it sees a declared output file but that file doesn't exist on disk. |
| 264 loadable_module("blacklist_test_dll_3") { | 267 loadable_module("blacklist_test_dll_3") { |
| 265 sources = [ | 268 sources = [ |
| 266 "blacklist/test/blacklist_test_dll_3.cc", | 269 "blacklist/test/blacklist_test_dll_3.cc", |
| 267 ] | 270 ] |
| 268 deps = [ | 271 deps = [ |
| 269 "//build/config/sanitizers:deps", | 272 "//build/config/sanitizers:deps", |
| 270 ] | 273 ] |
| 271 } | 274 } |
| 272 | |
| 273 shared_library("hook_util_test_dll") { | |
| 274 sources = [ | |
| 275 "hook_util/test/hook_util_test_dll.cc", | |
| 276 "hook_util/test/hook_util_test_dll.h", | |
| 277 ] | |
| 278 deps = [ | |
| 279 "//build/config/sanitizers:deps", | |
| 280 ] | |
| 281 } | |
| OLD | NEW |