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 10 matching lines...) Expand all Loading... |
152 ] | 152 ] |
153 } | 153 } |
154 | 154 |
155 static_library("hook_util") { | 155 static_library("hook_util") { |
156 sources = [ | 156 sources = [ |
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 ":nt_registry", # utils |
162 "//base:base_static", # pe_image | 163 "//base:base_static", # pe_image |
163 "//sandbox", | 164 "//sandbox", |
164 ] | 165 ] |
165 } | 166 } |
166 | 167 |
| 168 # This target contains utility functions which must only depend on |
| 169 # kernel32. Please don't add dependencies on other system libraries. |
| 170 static_library("nt_registry") { |
| 171 sources = [ |
| 172 "../sandbox/win/src/nt_internals.h", |
| 173 "nt_registry/nt_registry.cc", |
| 174 "nt_registry/nt_registry.h", |
| 175 ] |
| 176 |
| 177 libs = [ "kernel32.lib" ] |
| 178 } |
| 179 |
167 ##------------------------------------------------------------------------------ | 180 ##------------------------------------------------------------------------------ |
168 ## tests | 181 ## tests |
169 ##------------------------------------------------------------------------------ | 182 ##------------------------------------------------------------------------------ |
170 | 183 |
171 test("chrome_elf_unittests") { | 184 test("chrome_elf_unittests") { |
172 output_name = "chrome_elf_unittests" | 185 output_name = "chrome_elf_unittests" |
173 sources = [ | 186 sources = [ |
174 "blacklist/test/blacklist_test.cc", | 187 "blacklist/test/blacklist_test.cc", |
175 "chrome_elf_util_unittest.cc", | 188 "chrome_elf_util_unittest.cc", |
176 "elf_imports_unittest.cc", | 189 "elf_imports_unittest.cc", |
177 "hook_util/test/hook_util_test.cc", | 190 "hook_util/test/hook_util_test.cc", |
| 191 "nt_registry/nt_registry_unittest.cc", |
178 "run_all_unittests.cc", | 192 "run_all_unittests.cc", |
179 ] | 193 ] |
180 include_dirs = [ "$target_gen_dir" ] | 194 include_dirs = [ "$target_gen_dir" ] |
181 deps = [ | 195 deps = [ |
182 ":blacklist", | 196 ":blacklist", |
183 ":blacklist_test_main_dll", | 197 ":blacklist_test_main_dll", |
184 ":constants", | 198 ":constants", |
185 ":crash", | 199 ":crash", |
186 ":hook_util", | 200 ":hook_util", |
187 ":hook_util_test_dll", | 201 ":hook_util_test_dll", |
| 202 ":nt_registry", |
188 ":security", | 203 ":security", |
189 "//base", | 204 "//base", |
190 "//base/test:test_support", | 205 "//base/test:test_support", |
191 "//chrome", | 206 "//chrome", |
192 "//chrome/common:version_header", | 207 "//chrome/common:version_header", |
193 "//chrome/install_static:install_static_util", | 208 "//chrome/install_static:install_static_util", |
194 "//chrome_elf/nt_registry:nt_registry", | |
195 "//sandbox", | 209 "//sandbox", |
196 "//testing/gtest", | 210 "//testing/gtest", |
197 ] | 211 ] |
198 | 212 |
199 # It's not easily possible to have //chrome in data_deps without changing | 213 # 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. | 214 # 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 | 215 # 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. | 216 # add //chrome to deps above to make sure it's been built. |
203 data = [ | 217 data = [ |
204 "$root_out_dir/chrome.exe", | 218 "$root_out_dir/chrome.exe", |
(...skipping 10 matching lines...) Expand all Loading... |
215 ldflags = [ | 229 ldflags = [ |
216 "/DELAYLOAD:advapi32.dll", | 230 "/DELAYLOAD:advapi32.dll", |
217 "/DELAYLOAD:ole32.dll", | 231 "/DELAYLOAD:ole32.dll", |
218 "/DELAYLOAD:shell32.dll", | 232 "/DELAYLOAD:shell32.dll", |
219 "/DELAYLOAD:user32.dll", | 233 "/DELAYLOAD:user32.dll", |
220 "/DELAYLOAD:winmm.dll", | 234 "/DELAYLOAD:winmm.dll", |
221 ] | 235 ] |
222 } | 236 } |
223 | 237 |
224 shared_library("blacklist_test_main_dll") { | 238 shared_library("blacklist_test_main_dll") { |
| 239 testonly = true |
225 sources = [ | 240 sources = [ |
226 "blacklist/test/blacklist_test_main_dll.cc", | 241 "blacklist/test/blacklist_test_main_dll.cc", |
227 "blacklist/test/blacklist_test_main_dll.def", | 242 "blacklist/test/blacklist_test_main_dll.def", |
228 ] | 243 ] |
229 deps = [ | 244 deps = [ |
230 ":blacklist", | 245 ":blacklist", |
| 246 ":nt_registry", |
231 "//base", | 247 "//base", |
232 "//build/config/sanitizers:deps", | 248 "//build/config/sanitizers:deps", |
233 "//chrome/install_static:install_static_util", | 249 "//chrome/install_static:install_static_util", |
234 "//chrome_elf/nt_registry:nt_registry", | |
235 ] | 250 ] |
236 } | 251 } |
237 | 252 |
238 loadable_module("blacklist_test_dll_1") { | 253 loadable_module("blacklist_test_dll_1") { |
| 254 testonly = true |
239 sources = [ | 255 sources = [ |
240 "blacklist/test/blacklist_test_dll_1.cc", | 256 "blacklist/test/blacklist_test_dll_1.cc", |
241 "blacklist/test/blacklist_test_dll_1.def", | 257 "blacklist/test/blacklist_test_dll_1.def", |
242 ] | 258 ] |
243 deps = [ | 259 deps = [ |
244 "//build/config/sanitizers:deps", | 260 "//build/config/sanitizers:deps", |
245 ] | 261 ] |
246 } | 262 } |
247 | 263 |
248 loadable_module("blacklist_test_dll_2") { | 264 loadable_module("blacklist_test_dll_2") { |
| 265 testonly = true |
249 sources = [ | 266 sources = [ |
250 "blacklist/test/blacklist_test_dll_2.cc", | 267 "blacklist/test/blacklist_test_dll_2.cc", |
251 "blacklist/test/blacklist_test_dll_2.def", | 268 "blacklist/test/blacklist_test_dll_2.def", |
252 ] | 269 ] |
253 deps = [ | 270 deps = [ |
254 "//build/config/sanitizers:deps", | 271 "//build/config/sanitizers:deps", |
255 ] | 272 ] |
256 } | 273 } |
257 | 274 |
258 # As-is, this does not generate a .lib file because there are no exports and no | 275 # 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 | 276 # .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 | 277 # 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 | 278 # 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. | 279 # it sees a declared output file but that file doesn't exist on disk. |
263 loadable_module("blacklist_test_dll_3") { | 280 loadable_module("blacklist_test_dll_3") { |
| 281 testonly = true |
264 sources = [ | 282 sources = [ |
265 "blacklist/test/blacklist_test_dll_3.cc", | 283 "blacklist/test/blacklist_test_dll_3.cc", |
266 ] | 284 ] |
267 deps = [ | 285 deps = [ |
268 "//build/config/sanitizers:deps", | 286 "//build/config/sanitizers:deps", |
269 ] | 287 ] |
270 } | 288 } |
271 | 289 |
272 shared_library("hook_util_test_dll") { | 290 shared_library("hook_util_test_dll") { |
| 291 testonly = true |
273 sources = [ | 292 sources = [ |
274 "hook_util/test/hook_util_test_dll.cc", | 293 "hook_util/test/hook_util_test_dll.cc", |
275 "hook_util/test/hook_util_test_dll.h", | 294 "hook_util/test/hook_util_test_dll.h", |
276 ] | 295 ] |
277 deps = [ | 296 deps = [ |
278 "//build/config/sanitizers:deps", | 297 "//build/config/sanitizers:deps", |
279 ] | 298 ] |
280 } | 299 } |
OLD | NEW |