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