blob: 88e69cdb2aa3e444c957bae6b7e00ddde719d98e [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: [
Vladimir Marko74527972016-11-29 15:57:32 +000073 "libbase",
74 "liblz4",
75 "liblzma",
76 ],
Andreas Gampef24dfb02017-11-01 15:41:25 -070077 include_dirs: [
78 "external/lz4/lib",
Andreas Gampe238e8fc2017-11-01 17:10:10 -070079 "external/zlib",
Andreas Gampef24dfb02017-11-01 15:41:25 -070080 ],
Vladimir Marko74527972016-11-29 15:57:32 +000081 export_include_dirs: ["."],
82
83 // For SHA-1 checksumming of build ID
84 static: {
85 whole_static_libs: ["libcrypto"],
86 },
87 shared: {
88 shared_libs: ["libcrypto"],
89 },
90}
91
92gensrcs {
93 name: "art_dex2oat_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -080094 cmd: "$(location generate_operator_out) art/dex2oat $(in) > $(out)",
95 tools: ["generate_operator_out"],
Vladimir Marko74527972016-11-29 15:57:32 +000096 srcs: [
97 "linker/image_writer.h",
98 ],
99 output_extension: "operator_out.cc",
100}
101
102art_cc_static_library {
103 name: "libart-dex2oat",
104 defaults: ["libart-dex2oat-defaults"],
105 shared_libs: [
106 "libart-compiler",
Andreas Gampe772bd2f2018-01-26 12:56:22 -0800107 "libart-dexlayout",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700108 "libart",
Andreas Gampe11bf2652018-07-10 14:21:15 -0700109 "libprofile",
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",
Andreas Gampe11bf2652018-07-10 14:21:15 -0700123 "libprofiled",
Vladimir Marko74527972016-11-29 15:57:32 +0000124 ],
125}
126
Andreas Gampe7b565912017-03-20 15:48:52 -0700127cc_library_headers {
128 name: "dex2oat_headers",
129 host_supported: true,
130 export_include_dirs: ["include"],
131}
132
Colin Crossc7376e02016-09-08 12:52:18 -0700133cc_defaults {
134 name: "dex2oat-defaults",
135 host_supported: true,
136 defaults: ["art_defaults"],
Andreas Gampe097f34c2017-08-23 08:57:51 -0700137 srcs: [
138 "dex2oat_options.cc",
139 "dex2oat.cc",
140 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700141
142 target: {
143 android: {
144 // Use the 32-bit version of dex2oat on devices
145 compile_multilib: "prefer32",
Colin Crossc7376e02016-09-08 12:52:18 -0700146 },
Colin Crossc7376e02016-09-08 12:52:18 -0700147 },
Andreas Gampe3157fc22017-08-23 09:43:46 -0700148 header_libs: [
149 "dex2oat_headers",
150 "art_cmdlineparser_headers",
Colin Crossc7376e02016-09-08 12:52:18 -0700151 ],
152}
153
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700154cc_defaults {
155 name: "dex2oat-pgo-defaults",
156 pgo: {
157 instrumentation: true,
158 benchmarks: ["dex2oat"],
159 },
160 target: {
161 android_arm64: {
162 pgo: {
163 profile_file: "art/dex2oat_arm_arm64.profdata",
164 },
165 },
166 android_arm: {
167 pgo: {
168 profile_file: "art/dex2oat_arm_arm64.profdata",
169 },
170 },
171 android_x86_64: {
172 pgo: {
173 profile_file: "art/dex2oat_x86_x86_64.profdata",
174 },
175 },
176 android_x86: {
177 pgo: {
178 profile_file: "art/dex2oat_x86_x86_64.profdata",
179 },
180 },
Pirama Arumuga Nainarfc1de872018-04-20 14:11:12 -0700181 android_mips64: {
182 pgo: {
183 profile_file: "art/dex2oat_mips_mips64.profdata",
184 },
185 },
186 android_mips: {
187 pgo: {
188 profile_file: "art/dex2oat_mips_mips64.profdata",
189 },
190 },
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700191 },
192}
193
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100194art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700195 name: "dex2oat",
196 defaults: [
197 "dex2oat-defaults",
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700198 "dex2oat-pgo-defaults",
Colin Crossc7376e02016-09-08 12:52:18 -0700199 ],
200 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700201 "libprofile",
Colin Crossc7376e02016-09-08 12:52:18 -0700202 "libart-compiler",
Vladimir Marko74527972016-11-29 15:57:32 +0000203 "libart-dexlayout",
204 "libart",
David Sehr0225f8e2018-01-31 08:52:24 +0000205 "libdexfile",
David Sehr1f010162018-05-15 08:59:32 -0700206 "libartbase",
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700207 "libbase",
Vladimir Marko74527972016-11-29 15:57:32 +0000208 "liblz4",
Colin Crossc7376e02016-09-08 12:52:18 -0700209 "libsigchain",
210 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000211 static_libs: [
212 "libart-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700213 ],
Pirama Arumuga Nainar02f6ed62018-01-04 10:52:42 -0800214
215 pgo: {
Pirama Arumuga Nainar42d58052018-04-18 22:59:36 -0700216 // Additional cflags just for dex2oat during PGO instrumentation
Pirama Arumuga Nainar02f6ed62018-01-04 10:52:42 -0800217 cflags: [
218 // Ignore frame-size increase resulting from instrumentation.
219 "-Wno-frame-larger-than=",
220 "-DART_PGO_INSTRUMENTATION",
221 ],
Yi Kong1d894d92018-01-19 22:01:14 -0800222 },
223 target: {
224 android: {
225 lto: {
226 thin: true,
227 },
228 },
229 },
Colin Crossc7376e02016-09-08 12:52:18 -0700230}
231
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100232art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700233 name: "dex2oatd",
234 defaults: [
235 "art_debug_defaults",
236 "dex2oat-defaults",
237 ],
238 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700239 "libprofiled",
Colin Crossc7376e02016-09-08 12:52:18 -0700240 "libartd-compiler",
Vladimir Marko74527972016-11-29 15:57:32 +0000241 "libartd-dexlayout",
242 "libartd",
David Sehrfcbe15c2018-02-15 09:41:13 -0800243 "libdexfiled",
David Sehr1f010162018-05-15 08:59:32 -0700244 "libartbased",
Andreas Gampe3fec9ac2016-09-13 10:47:28 -0700245 "libbase",
Vladimir Marko74527972016-11-29 15:57:32 +0000246 "liblz4",
Colin Crossc7376e02016-09-08 12:52:18 -0700247 "libsigchain",
248 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000249 static_libs: [
250 "libartd-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700251 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700252}
253
Andreas Gampe11bf2652018-07-10 14:21:15 -0700254cc_defaults {
255 name: "dex2oats-defaults",
Colin Crossc7376e02016-09-08 12:52:18 -0700256 device_supported: false,
257 static_executable: true,
258 defaults: ["dex2oat-defaults"],
Colin Crossaa63aa22016-09-13 14:07:00 -0700259 target: {
260 darwin: {
261 enabled: false,
262 },
263 },
Colin Cross2cfc4ba2016-09-13 16:55:55 -0700264 ldflags: [
265 // We need this because GC stress mode makes use of
266 // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
267 // defined in libgcc_eh.a(unwind-dw2.o)
268 // TODO: Having this is not ideal as it might obscure errors.
269 // Try to get rid of it.
270 "-z muldefs",
271 ],
Andreas Gampe11bf2652018-07-10 14:21:15 -0700272 static_libs: art_static_dependencies,
273}
274
275art_cc_binary {
276 name: "dex2oats",
277 defaults: ["dex2oats-defaults"],
Colin Crossc7376e02016-09-08 12:52:18 -0700278 static_libs: [
Vladimir Marko74527972016-11-29 15:57:32 +0000279 "libart-dex2oat",
Colin Crossc7376e02016-09-08 12:52:18 -0700280 "libart-compiler",
Jeff Hao608f2ce2016-10-19 11:17:11 -0700281 "libart-dexlayout",
Colin Crossc7376e02016-09-08 12:52:18 -0700282 "libart",
David Sehr1f010162018-05-15 08:59:32 -0700283 "libartbase",
David Sehrfcbe15c2018-02-15 09:41:13 -0800284 "libdexfile",
David Sehr1f010162018-05-15 08:59:32 -0700285 "libprofile",
Colin Crossc7376e02016-09-08 12:52:18 -0700286 "libvixl-arm",
287 "libvixl-arm64",
Andreas Gampe11bf2652018-07-10 14:21:15 -0700288 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700289}
290
Nicolas Geoffrayafa7e452016-09-14 10:26:56 +0100291art_cc_binary {
Colin Crossc7376e02016-09-08 12:52:18 -0700292 name: "dex2oatds",
Colin Crossc7376e02016-09-08 12:52:18 -0700293 defaults: [
294 "art_debug_defaults",
Andreas Gampe11bf2652018-07-10 14:21:15 -0700295 "dex2oats-defaults",
Colin Crossc7376e02016-09-08 12:52:18 -0700296 ],
Colin Crossaa63aa22016-09-13 14:07:00 -0700297 target: {
Pirama Arumuga Nainar6f5b4d22018-04-20 12:02:02 -0700298 linux_glibc_x86_64: {
299 use_clang_lld: true,
300 },
Colin Crossaa63aa22016-09-13 14:07:00 -0700301 },
Chih-Hung Hsieh238c9632018-05-08 10:22:52 -0700302 // b/79417743, oatdump 32-bit tests failed with clang lld
303 use_clang_lld: false,
Colin Crossc7376e02016-09-08 12:52:18 -0700304 static_libs: [
Vladimir Marko74527972016-11-29 15:57:32 +0000305 "libartd-dex2oat",
Colin Crossc7376e02016-09-08 12:52:18 -0700306 "libartd-compiler",
Jeff Hao608f2ce2016-10-19 11:17:11 -0700307 "libartd-dexlayout",
Colin Crossc7376e02016-09-08 12:52:18 -0700308 "libartd",
David Sehr1f010162018-05-15 08:59:32 -0700309 "libartbased",
David Sehr82d046e2018-04-23 08:14:19 -0700310 "libprofiled",
David Sehrfcbe15c2018-02-15 09:41:13 -0800311 "libdexfiled",
Colin Crossc7376e02016-09-08 12:52:18 -0700312 "libvixld-arm",
313 "libvixld-arm64",
Andreas Gampe11bf2652018-07-10 14:21:15 -0700314 ],
Colin Crossc7376e02016-09-08 12:52:18 -0700315}
Colin Cross6e95dd52016-09-12 15:37:10 -0700316
317art_cc_test {
318 name: "art_dex2oat_tests",
319 defaults: [
Colin Crossafd3c9e2016-09-16 13:47:21 -0700320 "art_gtest_defaults",
Colin Cross6e95dd52016-09-12 15:37:10 -0700321 ],
Mathieu Chartierf70fe3d2017-06-21 15:24:02 -0700322 srcs: [
323 "dex2oat_test.cc",
324 "dex2oat_image_test.cc",
Vladimir Marko74527972016-11-29 15:57:32 +0000325 "linker/elf_writer_test.cc",
326 "linker/image_test.cc",
327 "linker/image_write_read_test.cc",
Vladimir Markof3c52b42017-11-17 17:32:12 +0000328 "linker/index_bss_mapping_encoder_test.cc",
Vladimir Marko74527972016-11-29 15:57:32 +0000329 "linker/multi_oat_relative_patcher_test.cc",
330 "linker/oat_writer_test.cc",
Mathieu Chartierf70fe3d2017-06-21 15:24:02 -0700331 ],
Vladimir Marko6d66fcf2018-04-12 13:15:27 +0100332
333 codegen: {
334 arm: {
335 srcs: [
336 "linker/arm/relative_patcher_thumb2_test.cc",
337 ],
338 },
339 arm64: {
340 srcs: [
341 "linker/arm64/relative_patcher_arm64_test.cc",
342 ],
343 },
344 mips: {
345 srcs: [
346 "linker/mips/relative_patcher_mips_test.cc",
347 "linker/mips/relative_patcher_mips32r6_test.cc",
348 ],
349 },
350 mips64: {
351 srcs: [
352 "linker/mips64/relative_patcher_mips64_test.cc",
353 ],
354 },
355 x86: {
356 srcs: [
357 "linker/x86/relative_patcher_x86_test.cc",
358 ],
359 },
360 x86_64: {
361 srcs: [
362 "linker/x86_64/relative_patcher_x86_64_test.cc",
363 ],
364 },
365 },
366
Andreas Gampef7882972017-03-20 16:35:24 -0700367 header_libs: ["dex2oat_headers"],
Andreas Gampe238e8fc2017-11-01 17:10:10 -0700368 include_dirs: [
369 "external/zlib",
370 ],
Vladimir Marko74527972016-11-29 15:57:32 +0000371 shared_libs: [
David Sehr82d046e2018-04-23 08:14:19 -0700372 "libprofiled",
Vladimir Marko74527972016-11-29 15:57:32 +0000373 "libartd-compiler",
374 "libartd-dexlayout",
375 "libbase",
376 "liblz4",
377 "libsigchain",
Mathieu Chartier792111c2018-02-15 13:02:15 -0800378 "libziparchive",
Vladimir Marko74527972016-11-29 15:57:32 +0000379 ],
380 static_libs: [
381 "libartd-dex2oat",
Dan Willemsen2ca27802017-09-27 14:57:43 -0700382 ],
Colin Cross6e95dd52016-09-12 15:37:10 -0700383}