• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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
17art_cc_defaults {
18    name: "libart-dex2oat-defaults",
19    defaults: ["art_defaults"],
20    host_supported: true,
21    srcs: [
22        "dex/dex_to_dex_compiler.cc",
23        "dex/quick_compiler_callbacks.cc",
24        "driver/compiler_driver.cc",
25        "linker/elf_writer.cc",
26        "linker/elf_writer_quick.cc",
27        "linker/image_writer.cc",
28        "linker/multi_oat_relative_patcher.cc",
29        "linker/oat_writer.cc",
30        "linker/relative_patcher.cc",
31    ],
32
33    codegen: {
34        arm: {
35            srcs: [
36                "linker/arm/relative_patcher_arm_base.cc",
37                "linker/arm/relative_patcher_thumb2.cc",
38            ],
39        },
40        arm64: {
41            srcs: [
42                "linker/arm64/relative_patcher_arm64.cc",
43            ],
44        },
45        x86: {
46            srcs: [
47                "linker/x86/relative_patcher_x86.cc",
48                "linker/x86/relative_patcher_x86_base.cc",
49            ],
50        },
51        x86_64: {
52            srcs: [
53                "linker/x86_64/relative_patcher_x86_64.cc",
54            ],
55        },
56    },
57
58    target: {
59        android: {
60            static_libs: [
61                "libz",
62            ],
63        },
64        host: {
65            shared_libs: [
66                "libz",
67            ],
68        },
69    },
70    generated_sources: ["art_dex2oat_operator_srcs"],
71    shared_libs: [
72        "libbase",
73
74        // For SHA-1 checksumming of build ID
75        "libcrypto",
76    ],
77    export_include_dirs: ["."],
78}
79
80cc_defaults {
81    name: "libart-dex2oat_static_base_defaults",
82    static_libs: [
83        "libbase",
84        "libcrypto",
85        "libz",
86    ],
87}
88
89gensrcs {
90    name: "art_dex2oat_operator_srcs",
91    cmd: "$(location generate_operator_out) art/dex2oat $(in) > $(out)",
92    tools: ["generate_operator_out"],
93    srcs: [
94        "dex/dex_to_dex_compiler.h",
95        "driver/compiler_driver.h",
96        "linker/image_writer.h",
97    ],
98    output_extension: "operator_out.cc",
99}
100
101art_cc_library_static {
102    name: "libart-dex2oat",
103    defaults: ["libart-dex2oat-defaults"],
104    shared_libs: [
105        "libart-compiler",
106        "libart-dexlayout",
107        "libart",
108        "libartpalette",
109        "libprofile",
110    ],
111    apex_available: [
112        "com.android.art.release",
113        "com.android.art.debug",
114    ],
115}
116
117cc_defaults {
118    name: "libart-dex2oat_static_defaults",
119    defaults: [
120        "libart-dex2oat_static_base_defaults",
121        "libart_static_defaults",
122        "libprofile_static_defaults",
123    ],
124    static_libs: [
125        "libart-compiler",
126        "libart-dexlayout",
127        "libart-dex2oat",
128    ],
129}
130
131art_cc_library_static {
132    name: "libartd-dex2oat",
133    defaults: [
134        "art_debug_defaults",
135        "libart-dex2oat-defaults",
136    ],
137    shared_libs: [
138        "libartd-compiler",
139        "libartd-dexlayout",
140        "libartd",
141        "libartpalette",
142        "libprofiled",
143    ],
144    apex_available: [
145        "com.android.art.debug",
146    ],
147}
148
149cc_defaults {
150    name: "libartd-dex2oat_static_defaults",
151    defaults: [
152        "libart-dex2oat_static_base_defaults",
153        "libartd_static_defaults",
154        "libprofiled_static_defaults",
155    ],
156    static_libs: [
157        "libartd-compiler",
158        "libartd-dexlayout",
159        "libartd-dex2oat",
160    ],
161}
162
163cc_library_headers {
164    name: "dex2oat_headers",
165    visibility: [
166        // TODO(b/133140750): Clean this up.
167        "//frameworks/native/cmds/installd",
168    ],
169    host_supported: true,
170    export_include_dirs: ["include"],
171
172    apex_available: [
173        "//apex_available:platform",
174        "com.android.art.release",
175        "com.android.art.debug",
176    ],
177}
178
179cc_defaults {
180    name: "dex2oat-defaults",
181    host_supported: true,
182    defaults: ["art_defaults"],
183    srcs: [
184        "dex2oat_options.cc",
185        "dex2oat.cc",
186    ],
187
188    target: {
189        android: {
190            compile_multilib: "both",
191        },
192    },
193    header_libs: [
194        "dex2oat_headers",
195        "art_cmdlineparser_headers",
196    ],
197}
198
199cc_defaults {
200    name: "dex2oat-pgo-defaults",
201    defaults_visibility: [
202        "//art:__subpackages__",
203        "//external/vixl",
204    ],
205    pgo: {
206        instrumentation: true,
207        benchmarks: ["dex2oat"],
208    },
209    target: {
210        android_arm64: {
211            pgo: {
212                profile_file: "art/dex2oat_arm_arm64.profdata",
213            },
214        },
215        android_arm: {
216            pgo: {
217                profile_file: "art/dex2oat_arm_arm64.profdata",
218            },
219        },
220        android_x86_64: {
221            pgo: {
222                profile_file: "art/dex2oat_x86_x86_64.profdata",
223            },
224        },
225        android_x86: {
226            pgo: {
227                profile_file: "art/dex2oat_x86_x86_64.profdata",
228            },
229        },
230    },
231}
232
233art_cc_binary {
234    name: "dex2oat",
235    defaults: [
236        "dex2oat-defaults",
237        "dex2oat-pgo-defaults",
238    ],
239    // Modules that do dexpreopting, e.g. android_app, depend implicitly on
240    // either dex2oat or dex2oatd in ART source builds.
241    visibility: ["//visibility:public"],
242    shared_libs: [
243        "libprofile",
244        "libart-compiler",
245        "libart-dexlayout",
246        "libart",
247        "libcrypto",
248        "libdexfile",
249        "libartbase",
250        "libartpalette",
251        "libbase",
252        "libsigchain",
253    ],
254    static_libs: [
255        "libart-dex2oat",
256    ],
257
258    multilib: {
259        lib32: {
260            suffix: "32",
261        },
262        lib64: {
263            suffix: "64",
264        },
265    },
266
267    pgo: {
268        // Additional cflags just for dex2oat during PGO instrumentation
269        cflags: [
270            // Ignore frame-size increase resulting from instrumentation.
271            "-Wno-frame-larger-than=",
272            "-DART_PGO_INSTRUMENTATION",
273        ],
274    },
275    target: {
276        android: {
277            lto: {
278                thin: true,
279            },
280            static_libs: [
281                "libz",
282            ],
283        },
284        host: {
285            shared_libs: [
286                "libz",
287            ],
288            // Override the prefer32 added by art_cc_binary when
289            // HOST_PREFER_32_BIT is in use. Necessary because the logic in
290            // Soong for setting ctx.Config().BuildOSTarget (used in
291            // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into
292            // account. Note that this override cannot be in cc_default because
293            // it'd get overridden by the load hook even when it uses
294            // PrependProperties.
295            compile_multilib: "64",
296            symlink_preferred_arch: true,
297        },
298    },
299    apex_available: [
300        "com.android.art.release",
301        "com.android.art.debug",
302    ],
303}
304
305art_cc_binary {
306    name: "dex2oatd",
307    defaults: [
308        "art_debug_defaults",
309        "dex2oat-defaults",
310    ],
311    // Modules that do dexpreopting, e.g. android_app, depend implicitly on
312    // either dex2oat or dex2oatd in ART source builds.
313    visibility: ["//visibility:public"],
314    shared_libs: [
315        "libprofiled",
316        "libartd-compiler",
317        "libartd-dexlayout",
318        "libartd",
319        "libcrypto",
320        "libdexfiled",
321        "libartbased",
322        "libartpalette",
323        "libbase",
324        "libsigchain",
325    ],
326    static_libs: [
327        "libartd-dex2oat",
328    ],
329    target: {
330        android: {
331            static_libs: [
332                "libz",
333            ],
334        },
335        host: {
336            shared_libs: [
337                "libz",
338            ],
339            // Override the prefer32 added by art_cc_binary when
340            // HOST_PREFER_32_BIT is in use. Necessary because the logic in
341            // Soong for setting ctx.Config().BuildOSTarget (used in
342            // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into
343            // account. Note that this override cannot be in cc_default because
344            // it'd get overridden by the load hook even when it uses
345            // PrependProperties.
346            compile_multilib: "64",
347            symlink_preferred_arch: true,
348        },
349    },
350    apex_available: [
351        "com.android.art.debug",
352    ],
353
354    multilib: {
355        lib32: {
356            suffix: "32",
357        },
358        lib64: {
359            suffix: "64",
360        },
361    },
362}
363
364cc_defaults {
365    name: "dex2oats-defaults",
366    device_supported: false,
367    static_executable: true,
368    defaults: [
369        "dex2oat-defaults",
370    ],
371    target: {
372        darwin: {
373            enabled: false,
374        },
375    },
376    ldflags: [
377        // We need this because GC stress mode makes use of
378        // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
379        // defined in libgcc_eh.a(unwind-dw2.o)
380        // TODO: Having this is not ideal as it might obscure errors.
381        // Try to get rid of it.
382        "-z muldefs",
383    ],
384    static_libs: [
385        "libbase",
386        "libsigchain_dummy",
387        "libz",
388    ],
389}
390
391art_cc_binary {
392    name: "dex2oats",
393    defaults: [
394        "dex2oats-defaults",
395        "libart_static_defaults",
396        "libart-compiler_static_defaults",
397        "libart-dexlayout_static_defaults",
398        "libartbase_static_defaults",
399        "libdexfile_static_defaults",
400        "libprofile_static_defaults",
401        "libart-dex2oat_static_defaults",
402    ],
403}
404
405art_cc_binary {
406    name: "dex2oatds",
407    defaults: [
408        "art_debug_defaults",
409        "dex2oats-defaults",
410        "libartd_static_defaults",
411        "libartd-compiler_static_defaults",
412        "libartd-dexlayout_static_defaults",
413        "libartbased_static_defaults",
414        "libdexfiled_static_defaults",
415        "libprofiled_static_defaults",
416        "libartd-dex2oat_static_defaults",
417    ],
418    target: {
419        linux_glibc_x86_64: {
420            use_clang_lld: true,
421        },
422    },
423}
424
425art_cc_library_static {
426    name: "libart-dex2oat-gtest",
427    defaults: ["libart-gtest-defaults"],
428    srcs: [
429        "common_compiler_driver_test.cc",
430    ],
431    shared_libs: [
432        "libartd-compiler",
433        "libartd-disassembler",
434        "libart-compiler-gtest",
435        "libart-runtime-gtest",
436        "libbase",
437    ],
438    static_libs: [
439        "libartd-dex2oat",
440    ],
441}
442
443art_cc_test {
444    name: "art_dex2oat_tests",
445    defaults: [
446        "art_gtest_defaults",
447    ],
448    srcs: [
449        "dex2oat_test.cc",
450        "dex2oat_vdex_test.cc",
451        "dex2oat_image_test.cc",
452        "dex/dex_to_dex_decompiler_test.cc",
453        "driver/compiler_driver_test.cc",
454        "linker/elf_writer_test.cc",
455        "linker/image_test.cc",
456        "linker/image_write_read_test.cc",
457        "linker/index_bss_mapping_encoder_test.cc",
458        "linker/multi_oat_relative_patcher_test.cc",
459        "linker/oat_writer_test.cc",
460        "verifier_deps_test.cc",
461    ],
462
463    codegen: {
464        arm: {
465            srcs: [
466                "linker/arm/relative_patcher_thumb2_test.cc",
467            ],
468        },
469        arm64: {
470            srcs: [
471                "linker/arm64/relative_patcher_arm64_test.cc",
472            ],
473        },
474        x86: {
475            srcs: [
476                "linker/x86/relative_patcher_x86_test.cc",
477            ],
478        },
479        x86_64: {
480            srcs: [
481                "linker/x86_64/relative_patcher_x86_64_test.cc",
482            ],
483        },
484    },
485
486    header_libs: ["dex2oat_headers"],
487    shared_libs: [
488        "libartbased",
489        "libartd-compiler",
490        "libartd-dexlayout",
491        "libartpalette",
492        "libbase",
493        "libcrypto",
494        "libprofiled",
495        "libsigchain",
496        "libziparchive",
497    ],
498    static_libs: [
499        "libart-dex2oat-gtest",
500        "libartd-dex2oat",
501    ],
502}
503