Roll src/third_party/WebKit 10b2b4a:a6818f9 (svn 202548:202549)
[chromium-blink-merge.git] / chrome_elf / BUILD.gn
blob64f5b7b32f3fc4bca74c5836e04223c14e6e355a
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
3 # found in the LICENSE file.
5 import("//build/config/win/manifest.gni")
6 import("//chrome/version.gni")
7 import("//testing/test.gni")
9 process_version("chrome_elf_resources") {
10   template_file = chrome_version_rc_template
11   sources = [
12     "chrome_elf.ver",
13   ]
14   output = "$target_gen_dir/chrome_elf_version.rc"
17 # This manifest matches what GYP produces. It may not even be necessary.
18 windows_manifest("chrome_elf_manifest") {
19   sources = [
20     as_invoker_manifest,
21   ]
22   type = "dll"
25 shared_library("chrome_elf") {
26   sources = [
27     "chrome_elf_main.cc",
28     "chrome_elf_main.h",
29   ]
30   deps = [
31     ":blacklist",
32     ":breakpad",
33     ":chrome_elf_manifest",
34     ":lib",
35     ":chrome_elf_resources",
36     "//build/config/sanitizers:deps",
37   ]
38   configs += [ "//build/config/win:windowed" ]
39   configs -= [ "//build/config/win:console" ]
40   ldflags = [
41     "/NODEFAULTLIB:user32.lib",
42     "/DEF:" + rebase_path("chrome_elf.def"),
43   ]
44   if (current_cpu == "x86") {
45     # Don"t set an x64 base address (to avoid breaking HE-ASLR).
46     ldflags += [ "/BASE:0x01c20000" ]
47   }
50 source_set("lib") {
51   sources = [
52     "create_file/chrome_create_file.cc",
53     "create_file/chrome_create_file.h",
54     "ntdll_cache.cc",
55     "ntdll_cache.h",
56   ]
57   deps = [
58     ":common",
59     "//base:base_static",
60     "//sandbox",
61   ]
64 source_set("constants") {
65   sources = [
66     "chrome_elf_constants.cc",
67     "chrome_elf_constants.h",
68   ]
71 source_set("common") {
72   deps = [
73     ":constants",
74   ]
75   sources = [
76     "chrome_elf_types.h",
77     "chrome_elf_util.cc",
78     "chrome_elf_util.h",
79     "thunk_getter.cc",
80     "thunk_getter.h",
81   ]
84 source_set("breakpad") {
85   include_dirs = [ "$target_gen_dir" ]
86   sources = [
87     "breakpad.cc",
88     "breakpad.h",
89   ]
90   deps = [
91     ":common",
92     "//breakpad:breakpad_handler",
93     "//chrome:version_header",
94   ]
97 if (is_component_build) {
98   shared_library("chrome_redirects") {
99     sources = [
100       "chrome_redirects_main.cc",
101     ]
102     deps = [
103       ":lib",
104       "//build/config/sanitizers:deps",
105     ]
106     configs += [ "//build/config/win:windowed" ]
107     ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
109     if (current_cpu == "x86") {
110       # Don't set an x64 base address (to avoid breaking HE-ASLR).
111       ldflags += [ "/BASE:0x01c20000" ]
112     }
113   }
116 source_set("dll_hash") {
117   deps = [
118     "//base",
119   ]
120   sources = [
121     "dll_hash/dll_hash.cc",
122     "dll_hash/dll_hash.h",
123   ]
126 executable("dll_hash_main") {
127   sources = [
128     "dll_hash/dll_hash_main.cc",
129   ]
130   deps = [
131     ":dll_hash",
132     "//build/config/sanitizers:deps",
133   ]
136 static_library("blacklist") {
137   sources = [
138     "blacklist/blacklist.cc",
139     "blacklist/blacklist.h",
140     "blacklist/blacklist_interceptions.cc",
141     "blacklist/blacklist_interceptions.h",
142   ]
143   deps = [
144     # Depend on base_static, but do NOT take a dependency on base.gyp:base
145     # as that would risk pulling in base's link-time dependencies which
146     # chrome_elf cannot do.
147     ":breakpad",
148     ":constants",
149     "//base:base_static",
150     "//sandbox:sandbox",
151   ]
154 test("chrome_elf_unittests") {
155   output_name = "chrome_elf_unittests"
156   sources = [
157     "blacklist/test/blacklist_test.cc",
158     "chrome_elf_util_unittest.cc",
159     "create_file/chrome_create_file_unittest.cc",
160     "elf_imports_unittest.cc",
161     "ntdll_cache_unittest.cc",
162   ]
163   include_dirs = [ "$target_gen_dir" ]
164   deps = [
165     ":blacklist",
166     ":blacklist_test_main_dll",
167     ":lib",
168     "//base",
169     "//base/test:run_all_unittests",
170     "//base/test:test_support",
171     "//sandbox",
172     "//testing/gtest",
173   ]
174   data_deps = [
175     ":blacklist_test_dll_1",
176     ":blacklist_test_dll_2",
177     ":blacklist_test_dll_3",
178     ":chrome_elf",
179     "//chrome",
180   ]
183 shared_library("blacklist_test_main_dll") {
184   sources = [
185     "blacklist/test/blacklist_test_main_dll.cc",
186   ]
187   deps = [
188     ":blacklist",
189     "//base",
190     "//build/config/sanitizers:deps",
191   ]
192   ldflags =
193       [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
194                               root_build_dir) ]
197 shared_library("blacklist_test_dll_1") {
198   sources = [
199     "blacklist/test/blacklist_test_dll_1.cc",
200   ]
201   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
202                                     root_build_dir) ]
203   deps = [
204     "//build/config/sanitizers:deps",
205   ]
208 shared_library("blacklist_test_dll_2") {
209   sources = [
210     "blacklist/test/blacklist_test_dll_2.cc",
211   ]
212   ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
213                                     root_build_dir) ]
214   deps = [
215     "//build/config/sanitizers:deps",
216   ]
219 shared_library("blacklist_test_dll_3") {
220   sources = [
221     "blacklist/test/blacklist_test_dll_3.cc",
222   ]
223   deps = [
224     "//build/config/sanitizers:deps",
225   ]