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/process_version_rc_template.gni") | 9 import("//chrome/process_version_rc_template.gni") |
10 import("//testing/test.gni") | 10 import("//testing/test.gni") |
(...skipping 25 matching lines...) Expand all Loading... |
36 "chrome_elf_main.cc", | 36 "chrome_elf_main.cc", |
37 "chrome_elf_main.h", | 37 "chrome_elf_main.h", |
38 ] | 38 ] |
39 deps = [ | 39 deps = [ |
40 ":blacklist", | 40 ":blacklist", |
41 ":chrome_elf_manifest", | 41 ":chrome_elf_manifest", |
42 ":chrome_elf_resources", | 42 ":chrome_elf_resources", |
43 ":constants", | 43 ":constants", |
44 ":crash", | 44 ":crash", |
45 ":hook_util", | 45 ":hook_util", |
| 46 ":nt_registry", |
46 ":security", | 47 ":security", |
47 "//build/config/sanitizers:deps", | 48 "//build/config/sanitizers:deps", |
48 "//chrome/install_static:install_static_util", | 49 "//chrome/install_static:install_static_util", |
49 "//chrome_elf/nt_registry:nt_registry", | |
50 ] | 50 ] |
51 configs += [ "//build/config/win:windowed" ] | 51 configs += [ "//build/config/win:windowed" ] |
52 configs -= [ "//build/config/win:console" ] | 52 configs -= [ "//build/config/win:console" ] |
53 | 53 |
54 # Delay loads in this list will prevent user32.dll | 54 # Delay loads in this list will prevent user32.dll |
55 # from loading too early. | 55 # from loading too early. |
56 ldflags = [ | 56 ldflags = [ |
57 "/DELAYLOAD:advapi32.dll", | 57 "/DELAYLOAD:advapi32.dll", |
58 "/DELAYLOAD:dbghelp.dll", | 58 "/DELAYLOAD:dbghelp.dll", |
59 "/DELAYLOAD:rpcrt4.dll", | 59 "/DELAYLOAD:rpcrt4.dll", |
60 "/DELAYLOAD:winmm.dll", | 60 "/DELAYLOAD:winmm.dll", |
61 ] | 61 ] |
62 if (current_cpu == "x86") { | 62 if (current_cpu == "x86") { |
63 # Don"t set an x64 base address (to avoid breaking HE-ASLR). | 63 # Don"t set an x64 base address (to avoid breaking HE-ASLR). |
64 ldflags += [ "/BASE:0x01c20000" ] | 64 ldflags += [ "/BASE:0x01c20000" ] |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 ##------------------------------------------------------------------------------ | 68 ##------------------------------------------------------------------------------ |
69 ## source sets | 69 ## source sets |
70 ##------------------------------------------------------------------------------ | 70 ##------------------------------------------------------------------------------ |
71 | 71 |
72 source_set("security") { | 72 source_set("security") { |
73 sources = [ | 73 sources = [ |
74 "chrome_elf_security.cc", | 74 "chrome_elf_security.cc", |
75 "chrome_elf_security.h", | 75 "chrome_elf_security.h", |
76 ] | 76 ] |
77 deps = [ | 77 deps = [ |
78 ":constants", | 78 ":constants", |
79 "//chrome_elf/nt_registry:nt_registry", | 79 ":nt_registry", |
80 ] | 80 ] |
81 } | 81 } |
82 | 82 |
83 source_set("constants") { | 83 source_set("constants") { |
84 sources = [ | 84 sources = [ |
85 "chrome_elf_constants.cc", | 85 "chrome_elf_constants.cc", |
86 "chrome_elf_constants.h", | 86 "chrome_elf_constants.h", |
87 ] | 87 ] |
88 } | 88 } |
89 | 89 |
(...skipping 29 matching lines...) Expand all Loading... |
119 "blacklist/blacklist_interceptions.cc", | 119 "blacklist/blacklist_interceptions.cc", |
120 "blacklist/blacklist_interceptions.h", | 120 "blacklist/blacklist_interceptions.h", |
121 ] | 121 ] |
122 public_deps = [ | 122 public_deps = [ |
123 "//sandbox", | 123 "//sandbox", |
124 ] | 124 ] |
125 deps = [ | 125 deps = [ |
126 ":constants", | 126 ":constants", |
127 ":crash", | 127 ":crash", |
128 ":hook_util", | 128 ":hook_util", |
| 129 ":nt_registry", |
129 "//base:base_static", # pe_image | 130 "//base:base_static", # pe_image |
130 "//chrome/install_static:install_static_util", | 131 "//chrome/install_static:install_static_util", |
131 "//chrome_elf/nt_registry:nt_registry", | |
132 ] | 132 ] |
133 } | 133 } |
134 | 134 |
135 static_library("crash") { | 135 static_library("crash") { |
136 sources = [ | 136 sources = [ |
137 "../chrome/app/chrome_crash_reporter_client_win.cc", | 137 "../chrome/app/chrome_crash_reporter_client_win.cc", |
138 "../chrome/app/chrome_crash_reporter_client_win.h", | 138 "../chrome/app/chrome_crash_reporter_client_win.h", |
139 "../chrome/common/chrome_result_codes.h", | 139 "../chrome/common/chrome_result_codes.h", |
140 "crash/crash_helper.cc", | 140 "crash/crash_helper.cc", |
141 "crash/crash_helper.h", | 141 "crash/crash_helper.h", |
(...skipping 15 matching lines...) Expand all Loading... |
157 "../base/macros.h", | 157 "../base/macros.h", |
158 "hook_util/hook_util.cc", | 158 "hook_util/hook_util.cc", |
159 "hook_util/hook_util.h", | 159 "hook_util/hook_util.h", |
160 ] | 160 ] |
161 deps = [ | 161 deps = [ |
162 "//base:base_static", # pe_image | 162 "//base:base_static", # pe_image |
163 "//sandbox", | 163 "//sandbox", |
164 ] | 164 ] |
165 } | 165 } |
166 | 166 |
| 167 # This target contains utility functions which must only depend on |
| 168 # kernel32. Please don't add dependencies on other system libraries. |
| 169 static_library("nt_registry") { |
| 170 sources = [ |
| 171 "../sandbox/win/src/nt_internals.h", |
| 172 "nt_registry/nt_registry.cc", |
| 173 "nt_registry/nt_registry.h", |
| 174 ] |
| 175 |
| 176 libs = [ "kernel32.lib" ] |
| 177 } |
| 178 |
167 ##------------------------------------------------------------------------------ | 179 ##------------------------------------------------------------------------------ |
168 ## tests | 180 ## tests |
169 ##------------------------------------------------------------------------------ | 181 ##------------------------------------------------------------------------------ |
170 | 182 |
171 test("chrome_elf_unittests") { | 183 test("chrome_elf_unittests") { |
172 output_name = "chrome_elf_unittests" | 184 output_name = "chrome_elf_unittests" |
173 sources = [ | 185 sources = [ |
174 "blacklist/test/blacklist_test.cc", | 186 "blacklist/test/blacklist_test.cc", |
175 "chrome_elf_util_unittest.cc", | 187 "chrome_elf_util_unittest.cc", |
176 "elf_imports_unittest.cc", | 188 "elf_imports_unittest.cc", |
177 "hook_util/test/hook_util_test.cc", | 189 "hook_util/test/hook_util_test.cc", |
| 190 "nt_registry/nt_registry_unittest.cc", |
178 "run_all_unittests.cc", | 191 "run_all_unittests.cc", |
179 ] | 192 ] |
180 include_dirs = [ "$target_gen_dir" ] | 193 include_dirs = [ "$target_gen_dir" ] |
181 deps = [ | 194 deps = [ |
182 ":blacklist", | 195 ":blacklist", |
183 ":blacklist_test_main_dll", | 196 ":blacklist_test_main_dll", |
184 ":constants", | 197 ":constants", |
185 ":crash", | 198 ":crash", |
186 ":hook_util", | 199 ":hook_util", |
187 ":hook_util_test_dll", | 200 ":hook_util_test_dll", |
| 201 ":nt_registry", |
188 ":security", | 202 ":security", |
189 "//base", | 203 "//base", |
190 "//base/test:test_support", | 204 "//base/test:test_support", |
191 "//chrome", | 205 "//chrome", |
192 "//chrome/common:version_header", | 206 "//chrome/common:version_header", |
193 "//chrome/install_static:install_static_util", | 207 "//chrome/install_static:install_static_util", |
194 "//chrome_elf/nt_registry:nt_registry", | |
195 "//sandbox", | 208 "//sandbox", |
196 "//testing/gtest", | 209 "//testing/gtest", |
197 ] | 210 ] |
198 | 211 |
199 # It's not easily possible to have //chrome in data_deps without changing | 212 # It's not easily possible to have //chrome in data_deps without changing |
200 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. | 213 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. |
201 # As a workaround, explicitly include a data dep on just chrome.exe, and | 214 # As a workaround, explicitly include a data dep on just chrome.exe, and |
202 # add //chrome to deps above to make sure it's been built. | 215 # add //chrome to deps above to make sure it's been built. |
203 data = [ | 216 data = [ |
204 "$root_out_dir/chrome.exe", | 217 "$root_out_dir/chrome.exe", |
(...skipping 10 matching lines...) Expand all Loading... |
215 ldflags = [ | 228 ldflags = [ |
216 "/DELAYLOAD:advapi32.dll", | 229 "/DELAYLOAD:advapi32.dll", |
217 "/DELAYLOAD:ole32.dll", | 230 "/DELAYLOAD:ole32.dll", |
218 "/DELAYLOAD:shell32.dll", | 231 "/DELAYLOAD:shell32.dll", |
219 "/DELAYLOAD:user32.dll", | 232 "/DELAYLOAD:user32.dll", |
220 "/DELAYLOAD:winmm.dll", | 233 "/DELAYLOAD:winmm.dll", |
221 ] | 234 ] |
222 } | 235 } |
223 | 236 |
224 shared_library("blacklist_test_main_dll") { | 237 shared_library("blacklist_test_main_dll") { |
| 238 testonly = true |
225 sources = [ | 239 sources = [ |
226 "blacklist/test/blacklist_test_main_dll.cc", | 240 "blacklist/test/blacklist_test_main_dll.cc", |
227 "blacklist/test/blacklist_test_main_dll.def", | 241 "blacklist/test/blacklist_test_main_dll.def", |
228 ] | 242 ] |
229 deps = [ | 243 deps = [ |
230 ":blacklist", | 244 ":blacklist", |
| 245 ":nt_registry", |
231 "//base", | 246 "//base", |
232 "//build/config/sanitizers:deps", | 247 "//build/config/sanitizers:deps", |
233 "//chrome/install_static:install_static_util", | 248 "//chrome/install_static:install_static_util", |
234 "//chrome_elf/nt_registry:nt_registry", | |
235 ] | 249 ] |
236 } | 250 } |
237 | 251 |
238 loadable_module("blacklist_test_dll_1") { | 252 loadable_module("blacklist_test_dll_1") { |
| 253 testonly = true |
239 sources = [ | 254 sources = [ |
240 "blacklist/test/blacklist_test_dll_1.cc", | 255 "blacklist/test/blacklist_test_dll_1.cc", |
241 "blacklist/test/blacklist_test_dll_1.def", | 256 "blacklist/test/blacklist_test_dll_1.def", |
242 ] | 257 ] |
243 deps = [ | 258 deps = [ |
244 "//build/config/sanitizers:deps", | 259 "//build/config/sanitizers:deps", |
245 ] | 260 ] |
246 } | 261 } |
247 | 262 |
248 loadable_module("blacklist_test_dll_2") { | 263 loadable_module("blacklist_test_dll_2") { |
| 264 testonly = true |
249 sources = [ | 265 sources = [ |
250 "blacklist/test/blacklist_test_dll_2.cc", | 266 "blacklist/test/blacklist_test_dll_2.cc", |
251 "blacklist/test/blacklist_test_dll_2.def", | 267 "blacklist/test/blacklist_test_dll_2.def", |
252 ] | 268 ] |
253 deps = [ | 269 deps = [ |
254 "//build/config/sanitizers:deps", | 270 "//build/config/sanitizers:deps", |
255 ] | 271 ] |
256 } | 272 } |
257 | 273 |
258 # As-is, this does not generate a .lib file because there are no exports and no | 274 # As-is, this does not generate a .lib file because there are no exports and no |
259 # .def file. The current definition of loadable_module does not declare a .lib | 275 # .def file. The current definition of loadable_module does not declare a .lib |
260 # file as an output, so this is OK. If it did (or if this used shared_library | 276 # file as an output, so this is OK. If it did (or if this used shared_library |
261 # which does), Ninja would get confused and always rebuild this target because | 277 # which does), Ninja would get confused and always rebuild this target because |
262 # it sees a declared output file but that file doesn't exist on disk. | 278 # it sees a declared output file but that file doesn't exist on disk. |
263 loadable_module("blacklist_test_dll_3") { | 279 loadable_module("blacklist_test_dll_3") { |
| 280 testonly = true |
264 sources = [ | 281 sources = [ |
265 "blacklist/test/blacklist_test_dll_3.cc", | 282 "blacklist/test/blacklist_test_dll_3.cc", |
266 ] | 283 ] |
267 deps = [ | 284 deps = [ |
268 "//build/config/sanitizers:deps", | 285 "//build/config/sanitizers:deps", |
269 ] | 286 ] |
270 } | 287 } |
271 | 288 |
272 shared_library("hook_util_test_dll") { | 289 shared_library("hook_util_test_dll") { |
| 290 testonly = true |
273 sources = [ | 291 sources = [ |
274 "hook_util/test/hook_util_test_dll.cc", | 292 "hook_util/test/hook_util_test_dll.cc", |
275 "hook_util/test/hook_util_test_dll.h", | 293 "hook_util/test/hook_util_test_dll.h", |
276 ] | 294 ] |
277 deps = [ | 295 deps = [ |
278 "//build/config/sanitizers:deps", | 296 "//build/config/sanitizers:deps", |
279 ] | 297 ] |
280 } | 298 } |
OLD | NEW |