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") { |
19 sources = [ | 26 sources = [ |
20 as_invoker_manifest, | 27 as_invoker_manifest, |
21 ] | 28 ] |
22 type = "dll" | 29 type = "dll" |
23 } | 30 } |
24 | 31 |
25 shared_library("chrome_elf") { | 32 shared_library("chrome_elf") { |
26 sources = [ | 33 sources = [ |
27 "chrome_elf.def", | 34 "chrome_elf.def", |
28 "chrome_elf_main.cc", | 35 "chrome_elf_main.cc", |
29 "chrome_elf_main.h", | 36 "chrome_elf_main.h", |
30 ] | 37 ] |
31 deps = [ | 38 deps = [ |
32 ":blacklist", | 39 ":blacklist", |
33 ":breakpad", | 40 ":breakpad", |
34 ":chrome_elf_manifest", | 41 ":chrome_elf_manifest", |
35 ":chrome_elf_resources", | 42 ":chrome_elf_resources", |
36 ":common", | 43 ":hook_util", |
37 "//build/config/sanitizers:deps", | 44 "//build/config/sanitizers:deps", |
38 "//chrome/install_static:install_static_util", | 45 "//chrome/install_static:install_static_util", |
| 46 "//chrome_elf/nt_registry:nt_registry", |
39 ] | 47 ] |
40 configs += [ "//build/config/win:windowed" ] | 48 configs += [ "//build/config/win:windowed" ] |
41 configs -= [ "//build/config/win:console" ] | 49 configs -= [ "//build/config/win:console" ] |
42 ldflags = [ "/NODEFAULTLIB:user32.lib" ] | 50 ldflags = [ "/NODEFAULTLIB:user32.lib" ] |
43 if (current_cpu == "x86") { | 51 if (current_cpu == "x86") { |
44 # Don"t set an x64 base address (to avoid breaking HE-ASLR). | 52 # Don"t set an x64 base address (to avoid breaking HE-ASLR). |
45 ldflags += [ "/BASE:0x01c20000" ] | 53 ldflags += [ "/BASE:0x01c20000" ] |
46 } | 54 } |
47 } | 55 } |
48 | 56 |
| 57 ##------------------------------------------------------------------------------ |
| 58 ## source sets |
| 59 ##------------------------------------------------------------------------------ |
| 60 |
49 source_set("constants") { | 61 source_set("constants") { |
50 sources = [ | 62 sources = [ |
51 "chrome_elf_constants.cc", | 63 "chrome_elf_constants.cc", |
52 "chrome_elf_constants.h", | 64 "chrome_elf_constants.h", |
53 ] | 65 ] |
54 } | 66 } |
55 | 67 |
56 source_set("common") { | |
57 public_deps = [ | |
58 ":constants", | |
59 ] | |
60 deps = [ | |
61 "//base", | |
62 "//sandbox", | |
63 ] | |
64 sources = [ | |
65 "thunk_getter.cc", | |
66 "thunk_getter.h", | |
67 ] | |
68 } | |
69 | |
70 source_set("breakpad") { | |
71 include_dirs = [ "$target_gen_dir" ] | |
72 sources = [ | |
73 "breakpad.cc", | |
74 "breakpad.h", | |
75 ] | |
76 deps = [ | |
77 ":common", | |
78 "//base", | |
79 "//breakpad:breakpad_handler", | |
80 "//chrome/common:version_header", | |
81 "//chrome/install_static:install_static_util", | |
82 ] | |
83 } | |
84 | |
85 source_set("dll_hash") { | 68 source_set("dll_hash") { |
86 deps = [ | 69 deps = [ |
87 "//base", | 70 "//base", |
88 ] | 71 ] |
89 sources = [ | 72 sources = [ |
90 "dll_hash/dll_hash.cc", | 73 "dll_hash/dll_hash.cc", |
91 "dll_hash/dll_hash.h", | 74 "dll_hash/dll_hash.h", |
92 ] | 75 ] |
93 } | 76 } |
94 | 77 |
| 78 ##------------------------------------------------------------------------------ |
| 79 ## chrome_elf sub targets |
| 80 ##------------------------------------------------------------------------------ |
| 81 |
95 executable("dll_hash_main") { | 82 executable("dll_hash_main") { |
96 sources = [ | 83 sources = [ |
97 "dll_hash/dll_hash_main.cc", | 84 "dll_hash/dll_hash_main.cc", |
98 ] | 85 ] |
99 deps = [ | 86 deps = [ |
100 ":dll_hash", | 87 ":dll_hash", |
101 "//build/config/sanitizers:deps", | 88 "//build/config/sanitizers:deps", |
102 "//build/win:default_exe_manifest", | 89 "//build/win:default_exe_manifest", |
103 ] | 90 ] |
104 } | 91 } |
105 | 92 |
106 static_library("blacklist") { | 93 static_library("blacklist") { |
107 sources = [ | 94 sources = [ |
108 "blacklist/blacklist.cc", | 95 "blacklist/blacklist.cc", |
109 "blacklist/blacklist.h", | 96 "blacklist/blacklist.h", |
110 "blacklist/blacklist_interceptions.cc", | 97 "blacklist/blacklist_interceptions.cc", |
111 "blacklist/blacklist_interceptions.h", | 98 "blacklist/blacklist_interceptions.h", |
112 ] | 99 ] |
113 public_deps = [ | 100 public_deps = [ |
114 "//sandbox", | 101 "//sandbox", |
115 ] | 102 ] |
116 deps = [ | 103 deps = [ |
117 ":breakpad", | 104 ":breakpad", |
118 ":common", | |
119 ":constants", | 105 ":constants", |
| 106 ":hook_util", |
| 107 "//chrome/install_static:install_static_util", |
| 108 "//chrome_elf/nt_registry:nt_registry", |
| 109 |
| 110 # Still uses base/win/pe_image.h |
120 "//base", | 111 "//base", |
121 "//chrome/install_static:install_static_util", | |
122 ] | 112 ] |
123 } | 113 } |
124 | 114 |
| 115 static_library("breakpad") { |
| 116 include_dirs = [ "$target_gen_dir" ] |
| 117 sources = [ |
| 118 "breakpad/breakpad.cc", |
| 119 "breakpad/breakpad.h", |
| 120 ] |
| 121 deps = [ |
| 122 "//breakpad:breakpad_handler", |
| 123 "//chrome/common:version_header", |
| 124 "//chrome/install_static:install_static_util", |
| 125 "//chrome_elf/nt_registry:nt_registry", |
| 126 ] |
| 127 } |
| 128 |
| 129 static_library("hook_util") { |
| 130 sources = [ |
| 131 "hook_util/thunk_getter.cc", |
| 132 "hook_util/thunk_getter.h", |
| 133 ] |
| 134 deps = [ |
| 135 "//sandbox", |
| 136 ] |
| 137 } |
| 138 |
| 139 ##------------------------------------------------------------------------------ |
| 140 ## tests |
| 141 ##------------------------------------------------------------------------------ |
| 142 |
125 test("chrome_elf_unittests") { | 143 test("chrome_elf_unittests") { |
126 output_name = "chrome_elf_unittests" | 144 output_name = "chrome_elf_unittests" |
127 sources = [ | 145 sources = [ |
128 "blacklist/test/blacklist_test.cc", | 146 "blacklist/test/blacklist_test.cc", |
129 "chrome_elf_util_unittest.cc", | 147 "chrome_elf_util_unittest.cc", |
130 "elf_imports_unittest.cc", | 148 "elf_imports_unittest.cc", |
131 ] | 149 ] |
132 include_dirs = [ "$target_gen_dir" ] | 150 include_dirs = [ "$target_gen_dir" ] |
133 deps = [ | 151 deps = [ |
134 ":blacklist", | 152 ":blacklist", |
135 ":blacklist_test_main_dll", | 153 ":blacklist_test_main_dll", |
136 ":common", | 154 ":constants", |
| 155 ":hook_util", |
137 "//base", | 156 "//base", |
138 "//base/test:run_all_unittests", | 157 "//base/test:run_all_unittests", |
139 "//base/test:test_support", | 158 "//base/test:test_support", |
140 "//chrome", | 159 "//chrome", |
141 "//chrome/common:version_header", | 160 "//chrome/common:version_header", |
142 "//chrome/install_static:install_static_util", | 161 "//chrome/install_static:install_static_util", |
| 162 "//chrome_elf/nt_registry:nt_registry", |
143 "//sandbox", | 163 "//sandbox", |
144 "//testing/gtest", | 164 "//testing/gtest", |
145 ] | 165 ] |
146 | 166 |
147 # It's not easily possible to have //chrome in data_deps without changing | 167 # It's not easily possible to have //chrome in data_deps without changing |
148 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. | 168 # the //chrome target to bundle up both initial/chrome.exe and chrome.exe. |
149 # As a workaround, explicitly include a data dep on just chrome.exe, and | 169 # As a workaround, explicitly include a data dep on just chrome.exe, and |
150 # add //chrome to deps above to make sure it's been built. | 170 # add //chrome to deps above to make sure it's been built. |
151 data = [ | 171 data = [ |
152 "$root_out_dir/chrome.exe", | 172 "$root_out_dir/chrome.exe", |
153 ] | 173 ] |
154 data_deps = [ | 174 data_deps = [ |
155 ":blacklist_test_dll_1", | 175 ":blacklist_test_dll_1", |
156 ":blacklist_test_dll_2", | 176 ":blacklist_test_dll_2", |
157 ":blacklist_test_dll_3", | 177 ":blacklist_test_dll_3", |
158 ":chrome_elf", | 178 ":chrome_elf", |
159 ] | 179 ] |
160 } | 180 } |
161 | 181 |
162 shared_library("blacklist_test_main_dll") { | 182 shared_library("blacklist_test_main_dll") { |
163 sources = [ | 183 sources = [ |
164 "blacklist/test/blacklist_test_main_dll.cc", | 184 "blacklist/test/blacklist_test_main_dll.cc", |
165 "blacklist/test/blacklist_test_main_dll.def", | 185 "blacklist/test/blacklist_test_main_dll.def", |
166 ] | 186 ] |
167 deps = [ | 187 deps = [ |
168 ":blacklist", | 188 ":blacklist", |
169 ":common", | |
170 "//base", | 189 "//base", |
171 "//build/config/sanitizers:deps", | 190 "//build/config/sanitizers:deps", |
172 "//chrome/install_static:install_static_util", | 191 "//chrome/install_static:install_static_util", |
| 192 "//chrome_elf/nt_registry:nt_registry", |
173 ] | 193 ] |
174 } | 194 } |
175 | 195 |
176 loadable_module("blacklist_test_dll_1") { | 196 loadable_module("blacklist_test_dll_1") { |
177 sources = [ | 197 sources = [ |
178 "blacklist/test/blacklist_test_dll_1.cc", | 198 "blacklist/test/blacklist_test_dll_1.cc", |
179 "blacklist/test/blacklist_test_dll_1.def", | 199 "blacklist/test/blacklist_test_dll_1.def", |
180 ] | 200 ] |
181 deps = [ | 201 deps = [ |
182 "//build/config/sanitizers:deps", | 202 "//build/config/sanitizers:deps", |
(...skipping 16 matching lines...) Expand all Loading... |
199 # which does), Ninja would get confused and always rebuild this target because | 219 # which does), Ninja would get confused and always rebuild this target because |
200 # it sees a declared output file but that file doesn't exist on disk. | 220 # it sees a declared output file but that file doesn't exist on disk. |
201 loadable_module("blacklist_test_dll_3") { | 221 loadable_module("blacklist_test_dll_3") { |
202 sources = [ | 222 sources = [ |
203 "blacklist/test/blacklist_test_dll_3.cc", | 223 "blacklist/test/blacklist_test_dll_3.cc", |
204 ] | 224 ] |
205 deps = [ | 225 deps = [ |
206 "//build/config/sanitizers:deps", | 226 "//build/config/sanitizers:deps", |
207 ] | 227 ] |
208 } | 228 } |
OLD | NEW |