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. |
| 6 # Please don't add dependencies on any other system libraries. |
| 7 |
5 import("//build/config/win/manifest.gni") | 8 import("//build/config/win/manifest.gni") |
6 import("//chrome/version.gni") | 9 import("//chrome/version.gni") |
7 import("//testing/test.gni") | 10 import("//testing/test.gni") |
8 | 11 |
| 12 ##------------------------------------------------------------------------------ |
| 13 ## chrome_elf |
| 14 ##------------------------------------------------------------------------------ |
| 15 |
9 process_version("chrome_elf_resources") { | 16 process_version("chrome_elf_resources") { |
10 template_file = chrome_version_rc_template | 17 template_file = chrome_version_rc_template |
11 sources = [ | 18 sources = [ |
12 "chrome_elf.ver", | 19 "chrome_elf.ver", |
13 ] | 20 ] |
14 output = "$target_gen_dir/chrome_elf_version.rc" | 21 output = "$target_gen_dir/chrome_elf_version.rc" |
15 } | 22 } |
16 | 23 |
17 # This manifest matches what GYP produces. It may not even be necessary. | 24 # This manifest matches what GYP produces. It may not even be necessary. |
18 windows_manifest("chrome_elf_manifest") { | 25 windows_manifest("chrome_elf_manifest") { |
(...skipping 12 matching lines...) Expand all Loading... |
31 "//chrome/common/chrome_result_codes.h", | 38 "//chrome/common/chrome_result_codes.h", |
32 "chrome_elf.def", | 39 "chrome_elf.def", |
33 "chrome_elf_main.cc", | 40 "chrome_elf_main.cc", |
34 "chrome_elf_main.h", | 41 "chrome_elf_main.h", |
35 ] | 42 ] |
36 deps = [ | 43 deps = [ |
37 ":blacklist", | 44 ":blacklist", |
38 ":breakpad", | 45 ":breakpad", |
39 ":chrome_elf_manifest", | 46 ":chrome_elf_manifest", |
40 ":chrome_elf_resources", | 47 ":chrome_elf_resources", |
41 ":common", | 48 ":hook_util", |
42 "//base", | 49 "//base", |
43 "//build/config/sanitizers:deps", | 50 "//build/config/sanitizers:deps", |
44 "//chrome/install_static:install_static_util", | 51 "//chrome/install_static:install_static_util", |
| 52 "//chrome_elf/nt_registry:nt_registry", |
45 "//components/crash/content/app", | 53 "//components/crash/content/app", |
46 "//components/crash/core/common", | 54 "//components/crash/core/common", |
47 "//content/public/common:result_codes", | 55 "//content/public/common:result_codes", |
48 ] | 56 ] |
49 configs += [ "//build/config/win:windowed" ] | 57 configs += [ "//build/config/win:windowed" ] |
50 configs -= [ "//build/config/win:console" ] | 58 configs -= [ "//build/config/win:console" ] |
51 ldflags = [ | 59 ldflags = [ |
52 "/NODEFAULTLIB:user32.lib", | 60 "/NODEFAULTLIB:user32.lib", |
53 "/DELAYLOAD:dbghelp.dll", | 61 "/DELAYLOAD:dbghelp.dll", |
54 "/DELAYLOAD:ole32.dll", | 62 "/DELAYLOAD:ole32.dll", |
55 "/DELAYLOAD:psapi.dll", | 63 "/DELAYLOAD:psapi.dll", |
56 "/DELAYLOAD:rpcrt4.dll", | 64 "/DELAYLOAD:rpcrt4.dll", |
57 "/DELAYLOAD:shell32.dll", | 65 "/DELAYLOAD:shell32.dll", |
58 "/DELAYLOAD:user32.dll", | 66 "/DELAYLOAD:user32.dll", |
59 "/DELAYLOAD:winhttp.dll", | 67 "/DELAYLOAD:winhttp.dll", |
60 "/DELAYLOAD:winmm.dll", | 68 "/DELAYLOAD:winmm.dll", |
61 "/DELAYLOAD:ws2_32.dll", | 69 "/DELAYLOAD:ws2_32.dll", |
62 ] | 70 ] |
63 if (current_cpu == "x86") { | 71 if (current_cpu == "x86") { |
64 # Don"t set an x64 base address (to avoid breaking HE-ASLR). | 72 # Don"t set an x64 base address (to avoid breaking HE-ASLR). |
65 ldflags += [ "/BASE:0x01c20000" ] | 73 ldflags += [ "/BASE:0x01c20000" ] |
66 } | 74 } |
67 } | 75 } |
68 | 76 |
| 77 ##------------------------------------------------------------------------------ |
| 78 ## source sets |
| 79 ##------------------------------------------------------------------------------ |
| 80 |
69 source_set("constants") { | 81 source_set("constants") { |
70 sources = [ | 82 sources = [ |
71 "chrome_elf_constants.cc", | 83 "chrome_elf_constants.cc", |
72 "chrome_elf_constants.h", | 84 "chrome_elf_constants.h", |
73 ] | 85 ] |
74 } | 86 } |
75 | 87 |
76 source_set("common") { | |
77 public_deps = [ | |
78 ":constants", | |
79 ] | |
80 deps = [ | |
81 "//base", | |
82 "//sandbox", | |
83 ] | |
84 sources = [ | |
85 "thunk_getter.cc", | |
86 "thunk_getter.h", | |
87 ] | |
88 } | |
89 | |
90 source_set("breakpad") { | |
91 include_dirs = [ "$target_gen_dir" ] | |
92 sources = [ | |
93 "breakpad.cc", | |
94 "breakpad.h", | |
95 ] | |
96 deps = [ | |
97 ":common", | |
98 "//base", | |
99 "//breakpad:breakpad_handler", | |
100 "//chrome/common:version_header", | |
101 "//chrome/install_static:install_static_util", | |
102 ] | |
103 } | |
104 | |
105 source_set("dll_hash") { | 88 source_set("dll_hash") { |
106 deps = [ | 89 deps = [ |
107 "//base", | 90 "//base", |
108 ] | 91 ] |
109 sources = [ | 92 sources = [ |
110 "dll_hash/dll_hash.cc", | 93 "dll_hash/dll_hash.cc", |
111 "dll_hash/dll_hash.h", | 94 "dll_hash/dll_hash.h", |
112 ] | 95 ] |
113 } | 96 } |
114 | 97 |
| 98 ##------------------------------------------------------------------------------ |
| 99 ## chrome_elf sub targets |
| 100 ##------------------------------------------------------------------------------ |
| 101 |
115 executable("dll_hash_main") { | 102 executable("dll_hash_main") { |
116 sources = [ | 103 sources = [ |
117 "dll_hash/dll_hash_main.cc", | 104 "dll_hash/dll_hash_main.cc", |
118 ] | 105 ] |
119 deps = [ | 106 deps = [ |
120 ":dll_hash", | 107 ":dll_hash", |
121 "//build/config/sanitizers:deps", | 108 "//build/config/sanitizers:deps", |
122 "//build/win:default_exe_manifest", | 109 "//build/win:default_exe_manifest", |
123 ] | 110 ] |
124 } | 111 } |
125 | 112 |
126 static_library("blacklist") { | 113 static_library("blacklist") { |
127 sources = [ | 114 sources = [ |
128 "blacklist/blacklist.cc", | 115 "blacklist/blacklist.cc", |
129 "blacklist/blacklist.h", | 116 "blacklist/blacklist.h", |
130 "blacklist/blacklist_interceptions.cc", | 117 "blacklist/blacklist_interceptions.cc", |
131 "blacklist/blacklist_interceptions.h", | 118 "blacklist/blacklist_interceptions.h", |
132 ] | 119 ] |
133 public_deps = [ | 120 public_deps = [ |
134 "//sandbox", | 121 "//sandbox", |
135 ] | 122 ] |
136 deps = [ | 123 deps = [ |
137 ":breakpad", | 124 ":breakpad", |
138 ":common", | |
139 ":constants", | 125 ":constants", |
| 126 ":hook_util", |
| 127 "//chrome/install_static:install_static_util", |
| 128 "//chrome_elf/nt_registry:nt_registry", |
| 129 |
| 130 # Still uses base/win/pe_image.h |
140 "//base", | 131 "//base", |
141 "//chrome/install_static:install_static_util", | |
142 ] | 132 ] |
143 } | 133 } |
144 | 134 |
| 135 static_library("breakpad") { |
| 136 include_dirs = [ "$target_gen_dir" ] |
| 137 sources = [ |
| 138 "breakpad/breakpad.cc", |
| 139 "breakpad/breakpad.h", |
| 140 ] |
| 141 deps = [ |
| 142 "//breakpad:breakpad_handler", |
| 143 "//chrome/common:version_header", |
| 144 "//chrome/install_static:install_static_util", |
| 145 "//chrome_elf/nt_registry:nt_registry", |
| 146 ] |
| 147 } |
| 148 |
| 149 static_library("hook_util") { |
| 150 sources = [ |
| 151 "hook_util/thunk_getter.cc", |
| 152 "hook_util/thunk_getter.h", |
| 153 ] |
| 154 deps = [ |
| 155 "//sandbox", |
| 156 ] |
| 157 } |
| 158 |
| 159 ##------------------------------------------------------------------------------ |
| 160 ## tests |
| 161 ##------------------------------------------------------------------------------ |
| 162 |
145 test("chrome_elf_unittests") { | 163 test("chrome_elf_unittests") { |
146 output_name = "chrome_elf_unittests" | 164 output_name = "chrome_elf_unittests" |
147 sources = [ | 165 sources = [ |
148 "blacklist/test/blacklist_test.cc", | 166 "blacklist/test/blacklist_test.cc", |
149 "chrome_elf_util_unittest.cc", | 167 "chrome_elf_util_unittest.cc", |
150 "elf_imports_unittest.cc", | 168 "elf_imports_unittest.cc", |
151 "run_all_unittests.cc", | 169 "run_all_unittests.cc", |
152 ] | 170 ] |
153 include_dirs = [ "$target_gen_dir" ] | 171 include_dirs = [ "$target_gen_dir" ] |
154 deps = [ | 172 deps = [ |
155 ":blacklist", | 173 ":blacklist", |
156 ":blacklist_test_main_dll", | 174 ":blacklist_test_main_dll", |
157 ":common", | 175 ":constants", |
| 176 ":hook_util", |
158 "//base", | 177 "//base", |
159 "//base/test:test_support", | 178 "//base/test:test_support", |
160 "//chrome", | 179 "//chrome", |
161 "//chrome/common:version_header", | 180 "//chrome/common:version_header", |
162 "//chrome/install_static:install_static_util", | 181 "//chrome/install_static:install_static_util", |
| 182 "//chrome_elf/nt_registry:nt_registry", |
163 "//sandbox", | 183 "//sandbox", |
164 "//testing/gtest", | 184 "//testing/gtest", |
165 ] | 185 ] |
166 | 186 |
167 # It's not easily possible to have //chrome in data_deps without changing | 187 # It's not easily possible to have //chrome in data_deps without changing |
168 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. | 188 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. |
169 # As a workaround, explicitly include a data dep on just chrome.exe, and | 189 # As a workaround, explicitly include a data dep on just chrome.exe, and |
170 # add //chrome to deps above to make sure it's been built. | 190 # add //chrome to deps above to make sure it's been built. |
171 data = [ | 191 data = [ |
172 "$root_out_dir/chrome.exe", | 192 "$root_out_dir/chrome.exe", |
(...skipping 18 matching lines...) Expand all Loading... |
191 ] | 211 ] |
192 } | 212 } |
193 | 213 |
194 shared_library("blacklist_test_main_dll") { | 214 shared_library("blacklist_test_main_dll") { |
195 sources = [ | 215 sources = [ |
196 "blacklist/test/blacklist_test_main_dll.cc", | 216 "blacklist/test/blacklist_test_main_dll.cc", |
197 "blacklist/test/blacklist_test_main_dll.def", | 217 "blacklist/test/blacklist_test_main_dll.def", |
198 ] | 218 ] |
199 deps = [ | 219 deps = [ |
200 ":blacklist", | 220 ":blacklist", |
201 ":common", | |
202 "//base", | 221 "//base", |
203 "//build/config/sanitizers:deps", | 222 "//build/config/sanitizers:deps", |
204 "//chrome/install_static:install_static_util", | 223 "//chrome/install_static:install_static_util", |
| 224 "//chrome_elf/nt_registry:nt_registry", |
205 ] | 225 ] |
206 } | 226 } |
207 | 227 |
208 loadable_module("blacklist_test_dll_1") { | 228 loadable_module("blacklist_test_dll_1") { |
209 sources = [ | 229 sources = [ |
210 "blacklist/test/blacklist_test_dll_1.cc", | 230 "blacklist/test/blacklist_test_dll_1.cc", |
211 "blacklist/test/blacklist_test_dll_1.def", | 231 "blacklist/test/blacklist_test_dll_1.def", |
212 ] | 232 ] |
213 deps = [ | 233 deps = [ |
214 "//build/config/sanitizers:deps", | 234 "//build/config/sanitizers:deps", |
(...skipping 16 matching lines...) Expand all Loading... |
231 # which does), Ninja would get confused and always rebuild this target because | 251 # which does), Ninja would get confused and always rebuild this target because |
232 # it sees a declared output file but that file doesn't exist on disk. | 252 # it sees a declared output file but that file doesn't exist on disk. |
233 loadable_module("blacklist_test_dll_3") { | 253 loadable_module("blacklist_test_dll_3") { |
234 sources = [ | 254 sources = [ |
235 "blacklist/test/blacklist_test_dll_3.cc", | 255 "blacklist/test/blacklist_test_dll_3.cc", |
236 ] | 256 ] |
237 deps = [ | 257 deps = [ |
238 "//build/config/sanitizers:deps", | 258 "//build/config/sanitizers:deps", |
239 ] | 259 ] |
240 } | 260 } |
OLD | NEW |