blob: e74947ad6a53b8e945c80cf036eaae5faba62bb8 [file] [log] [blame]
Colin Crossc7376e02016-09-08 12:52:18 -07001//
2// Copyright (C) 2011 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
Vladimir Marko74527972016-11-29 15:57:32 +000017art_cc_defaults {
18 name: "libart-dex2oat-defaults",
19 defaults: ["art_defaults"],
20 host_supported: true,
Vladimir Marko74527972016-11-29 15:57:32 +000021 srcs: [
22 "linker/elf_writer.cc",
23 "linker/elf_writer_quick.cc",
24 "linker/image_writer.cc",
25 "linker/multi_oat_relative_patcher.cc",
26 "linker/oat_writer.cc",
Vladimir Marko6d66fcf2018-04-12 13:15:27 +010027 "linker/relative_patcher.cc",
Vladimir Marko74527972016-11-29 15:57:32 +000028 ],
Vladimir Marko6d66fcf2018-04-12 13:15:27 +010029
30 codegen: {
31 arm: {
32 srcs: [
33 "linker/arm/relative_patcher_arm_base.cc",
34 "linker/arm/relative_patcher_thumb2.cc",
35 ],
36 },
37 arm64: {
38 srcs: [
39 "linker/arm64/relative_patcher_arm64.cc",
40 ],
41 },
42 mips: {
43 srcs: [
44 "linker/mips/relative_patcher_mips.cc",
45 ],
46 },
47 mips64: {
48 srcs: [
49 "linker/mips64/relative_patcher_mips64.cc",
50 ],
51 },
52 x86: {
53 srcs: [
54 "linker/x86/relative_patcher_x86.cc",
55 "linker/x86/relative_patcher_x86_base.cc",
56 ],
57 },
58 x86_64: {
59 srcs: [
60 "linker/x86_64/relative_patcher_x86_64.cc",
61 ],
62 },
63 },
64
Vladimir Marko74527972016-11-29 15:57:32 +000065 target: {
Vladimir Marko74527972016-11-29 15:57:32 +000066 android: {
67 // For atrace.
68 shared_libs: ["libcutils"],
69 },
70 },
71 generated_sources: ["art_dex2oat_operator_srcs"],
72 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -070073 "libprofile",
Vladimir Marko74527972016-11-29 15:57:32 +000074 "libbase",
75 "liblz4",
76 "liblzma",
77 ],
Andreas Gampef24dfb02017-11-01 15:41:25 -070078 include_dirs: [
79 "external/lz4/lib",
Andreas Gampe238e8fc2017-11-01 17:10:10 -070080 "external/zlib",
Andreas Gampef24dfb02017-11-01 15:41:25 -070081 ],
Vladimir Marko74527972016-11-29 15:57:32 +000082 export_include_dirs: ["."],
83
84 // For SHA-1 checksumming of build ID
85 static: {
86 whole_static_libs: ["libcrypto"],
87 },
88 shared: {
89 shared_libs: ["libcrypto"],
90 },
91}
92
93gensrcs {
94 name: "art_dex2oat_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -080095 cmd: "$(location generate_operator_out) art/dex2oat $(in) > $(out)",
96 tools: ["generate_operator_out"],
Vladimir Marko74527972016-11-29 15:57:32 +000097 srcs: [
98 "linker/image_writer.h",
99 ],
100 output_extension: "operator_out.cc",
101}
102
103art_cc_static_library {
104 name: "libart-dex2oat",
105 defaults: ["libart-dex2oat-defaults"],
106 shared_libs: [
107 "libart-compiler",
Andreas Gampe772bd2f2018-01-26 12:56:22 -0800108 "libart-dexlayout",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700109 "libart",
Vladimir Marko74527972016-11-29 15:57:32 +0000110 ],
111}
112
113art_cc_static_library {
114 name: "libartd-dex2oat",
115 defaults: [
116 "art_debug_defaults",
117 "libart-dex2oat-defaults",
118 ],
119 shared_libs: [
120 "libartd-compiler",
Andreas Gampe772bd2f2018-01-26 12:56:22 -0800121 "libartd-dexlayout",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700122 "libartd",
Vladimir Marko74527972016-11-29 15:57:32 +0000123 ],
124}
125
Andreas Gampe7b565912017-03-20 15:48:52 -0700126cc_library_headers {
127 name: "dex2oat_headers",
128 host_supported: true,
129 export_include_dirs: ["include"],
130}
131
Colin Crossc7376e02016-09-08 12:52:18 -0700132cc_defaults {
133 name: "dex2oat-defaults",
134 host_supported: true,
135 defaults: ["art_defaults"],
Andreas Gampe097f34c2017-08-23 08:57:51 -0700136 srcs: [
137 "dex2oat_options.cc",
138 "dex2oat.cc",
139 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700140
141 target: {
142 android: {
143 // Use the 32-bit version of dex2oat on devices
144 compile_multilib: "prefer32",
Colin Crossc7376e02016-09-08 12:52:18 -0700145 },
Colin Crossc7376e02016-09-08 12:52:18 -0700146 },
Andreas Gampe3157fc22017-08-23 09:43:46 -0700147 header_libs: [
148 "dex2oat_headers",
149 "art_cmdlineparser_headers",
Colin Crossc7376e02016-09-08 12:52:18 -0700150 ],
151}
152
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700153cc_defaults {
154 name: "dex2oat-pgo-defaults",
155 pgo: {
156 instrumentation: true,
157 benchmarks: ["dex2oat"],
158 },
159 target: {
160 android_arm64: {
161 pgo: {
162 profile_file: "art/dex2oat_arm_arm64.profdata",
163 },
164 },
165 android_arm: {
166 pgo: {
167 profile_file: "art/dex2oat_arm_arm64.profdata",
168 },
169 },
170 android_x86_64: {
171 pgo: {
172 profile_file: "art/dex2oat_x86_x86_64.profdata",
173 },
174 },
175 android_x86: {
176 pgo: {
177 profile_file: "art/dex2oat_x86_x86_64.profdata",
178 },
179 },
Pirama Arumuga Nainarfc1de872018-04-20 14:11:12 -0700180 android_mips64: {
181 pgo: {
182 profile_file: "art/dex2oat_mips_mips64.profdata",
183 },
184 },
185 android_mips: {
186 pgo: {
187 profile_file: "art/dex2oat_mips_mips64.profdata",
188 },
189 },
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700190 },
191}
192
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100193art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700194 name: "dex2oat",
195 defaults: [
196 "dex2oat-defaults",
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700197 "dex2oat-pgo-defaults",
Colin Crossc7376e02016-09-08 12:52:18 -0700198 ],
199 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700200 "libprofile",
Colin Crossc7376e02016-09-08 12:52:18 -0700201 "libart-compiler",
Vladimir Marko74527972016-11-29 15:57:32 +0000202 "libart-dexlayout",
203 "libart",
David Sehr0225f8e2018-01-31 08:52:24 +0000204 "libdexfile",
David Sehr1f010162018-05-15 08:59:32 -0700205 "libartbase",
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700206 "libbase",
Vladimir Marko74527972016-11-29 15:57:32 +0000207 "liblz4",
Colin Crossc7376e02016-09-08 12:52:18 -0700208 "libsigchain",
209 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000210 static_libs: [
211 "libart-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700212 ],
Pirama Arumuga Nainar02f6ed62018-01-04 10:52:42 -0800213
214 pgo: {
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700215 // Additional cflags just for dex2oat during PGO instrumentation
Pirama Arumuga Nainar02f6ed62018-01-04 10:52:42 -0800216 cflags: [
217 // Ignore frame-size increase resulting from instrumentation.
218 "-Wno-frame-larger-than=",
219 "-DART_PGO_INSTRUMENTATION",
220 ],
Yi Kong1d894d92018-01-19 22:01:14 -0800221 },
222 target: {
223 android: {
224 lto: {
225 thin: true,
226 },
227 },
228 },
Colin Crossc7376e02016-09-08 12:52:18 -0700229}
230
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100231art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700232 name: "dex2oatd",
233 defaults: [
234 "art_debug_defaults",
235 "dex2oat-defaults",
236 ],
237 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700238 "libprofiled",
Colin Crossc7376e02016-09-08 12:52:18 -0700239 "libartd-compiler",
Vladimir Marko74527972016-11-29 15:57:32 +0000240 "libartd-dexlayout",
241 "libartd",
David Sehrfcbe15c2018-02-15 09:41:13 -0800242 "libdexfiled",
David Sehr1f010162018-05-15 08:59:32 -0700243 "libartbased",
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700244 "libbase",
Vladimir Marko74527972016-11-29 15:57:32 +0000245 "liblz4",
Colin Crossc7376e02016-09-08 12:52:18 -0700246 "libsigchain",
247 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000248 static_libs: [
249 "libartd-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700250 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700251}
252
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100253art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700254 name: "dex2oats",
255 device_supported: false,
256 static_executable: true,
257 defaults: ["dex2oat-defaults"],
Colin Crossaa63aa22016-09-13 14:07:00 -0700258 target: {
259 darwin: {
260 enabled: false,
261 },
262 },
Colin Cross2cfc4ba2016-09-13 16:55:55 -0700263 ldflags: [
264 // We need this because GC stress mode makes use of
265 // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
266 // defined in libgcc_eh.a(unwind-dw2.o)
267 // TODO: Having this is not ideal as it might obscure errors.
268 // Try to get rid of it.
269 "-z muldefs",
270 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700271 static_libs: [
Vladimir Marko74527972016-11-29 15:57:32 +0000272 "libart-dex2oat",
Colin Crossc7376e02016-09-08 12:52:18 -0700273 "libart-compiler",
Jeff Hao608f2ce2016-10-19 11:17:11 -0700274 "libart-dexlayout",
Colin Crossc7376e02016-09-08 12:52:18 -0700275 "libart",
David Sehr1f010162018-05-15 08:59:32 -0700276 "libartbase",
David Sehrfcbe15c2018-02-15 09:41:13 -0800277 "libdexfile",
David Sehr1f010162018-05-15 08:59:32 -0700278 "libprofile",
Colin Crossc7376e02016-09-08 12:52:18 -0700279 "libvixl-arm",
280 "libvixl-arm64",
281 ] + art_static_dependencies,
282}
283
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100284art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700285 name: "dex2oatds",
286 device_supported: false,
287 static_executable: true,
288 defaults: [
289 "art_debug_defaults",
290 "dex2oat-defaults",
291 ],
Colin Crossaa63aa22016-09-13 14:07:00 -0700292 target: {
293 darwin: {
294 enabled: false,
295 },
Pirama Arumuga Nainar6f5b4d22018-04-20 12:02:02 -0700296 linux_glibc_x86_64: {
297 use_clang_lld: true,
298 },
Colin Crossaa63aa22016-09-13 14:07:00 -0700299 },
Chih-Hung Hsieh238c9632018-05-08 10:22:52 -0700300 // b/79417743, oatdump 32-bit tests failed with clang lld
301 use_clang_lld: false,
Colin Cross2cfc4ba2016-09-13 16:55:55 -0700302 ldflags: [
303 // We need this because GC stress mode makes use of
304 // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
305 // defined in libgcc_eh.a(unwind-dw2.o)
306 // TODO: Having this is not ideal as it might obscure errors.
307 // Try to get rid of it.
308 "-z muldefs",
309 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700310 static_libs: [
Vladimir Marko74527972016-11-29 15:57:32 +0000311 "libartd-dex2oat",
Colin Crossc7376e02016-09-08 12:52:18 -0700312 "libartd-compiler",
Jeff Hao608f2ce2016-10-19 11:17:11 -0700313 "libartd-dexlayout",
Colin Crossc7376e02016-09-08 12:52:18 -0700314 "libartd",
David Sehr1f010162018-05-15 08:59:32 -0700315 "libartbased",
David Sehr82d046e2018-04-23 08:14:19 -0700316 "libprofiled",
David Sehrfcbe15c2018-02-15 09:41:13 -0800317 "libdexfiled",
Colin Crossc7376e02016-09-08 12:52:18 -0700318 "libvixld-arm",
319 "libvixld-arm64",
320 ] + art_static_dependencies,
321}
Colin Cross6e95dd52016-09-12 15:37:10 -0700322
323art_cc_test {
324 name: "art_dex2oat_tests",
325 defaults: [
Colin Crossafd3c9e2016-09-16 13:47:21 -0700326 "art_gtest_defaults",
Colin Cross6e95dd52016-09-12 15:37:10 -0700327 ],
Mathieu Chartierf70fe3d2017-06-21 15:24:02 -0700328 srcs: [
329 "dex2oat_test.cc",
330 "dex2oat_image_test.cc",
Vladimir Marko74527972016-11-29 15:57:32 +0000331 "linker/elf_writer_test.cc",
332 "linker/image_test.cc",
333 "linker/image_write_read_test.cc",
Vladimir Markof3c52b42017-11-17 17:32:12 +0000334 "linker/index_bss_mapping_encoder_test.cc",
Vladimir Marko74527972016-11-29 15:57:32 +0000335 "linker/multi_oat_relative_patcher_test.cc",
336 "linker/oat_writer_test.cc",
Mathieu Chartierf70fe3d2017-06-21 15:24:02 -0700337 ],
Vladimir Marko6d66fcf2018-04-12 13:15:27 +0100338
339 codegen: {
340 arm: {
341 srcs: [
342 "linker/arm/relative_patcher_thumb2_test.cc",
343 ],
344 },
345 arm64: {
346 srcs: [
347 "linker/arm64/relative_patcher_arm64_test.cc",
348 ],
349 },
350 mips: {
351 srcs: [
352 "linker/mips/relative_patcher_mips_test.cc",
353 "linker/mips/relative_patcher_mips32r6_test.cc",
354 ],
355 },
356 mips64: {
357 srcs: [
358 "linker/mips64/relative_patcher_mips64_test.cc",
359 ],
360 },
361 x86: {
362 srcs: [
363 "linker/x86/relative_patcher_x86_test.cc",
364 ],
365 },
366 x86_64: {
367 srcs: [
368 "linker/x86_64/relative_patcher_x86_64_test.cc",
369 ],
370 },
371 },
372
Andreas Gampef7882972017-03-20 16:35:24 -0700373 header_libs: ["dex2oat_headers"],
Andreas Gampe238e8fc2017-11-01 17:10:10 -0700374 include_dirs: [
375 "external/zlib",
376 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000377 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700378 "libprofiled",
Vladimir Marko74527972016-11-29 15:57:32 +0000379 "libartd-compiler",
380 "libartd-dexlayout",
381 "libbase",
382 "liblz4",
383 "libsigchain",
Mathieu Chartier792111c2018-02-15 13:02:15 -0800384 "libziparchive",
Vladimir Marko74527972016-11-29 15:57:32 +0000385 ],
386 static_libs: [
387 "libartd-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700388 ],
Colin Cross6e95dd52016-09-12 15:37:10 -0700389}