Home | History | Annotate | Download | only in dex2oat
      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 
     17 art_cc_defaults {
     18     name: "libart-dex2oat-defaults",
     19     defaults: ["art_defaults"],
     20     host_supported: true,
     21     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",
     27     ],
     28     target: {
     29         android: {
     30             // For atrace.
     31             shared_libs: ["libcutils"],
     32         },
     33     },
     34     generated_sources: ["art_dex2oat_operator_srcs"],
     35     shared_libs: [
     36         "libbase",
     37         "liblz4",
     38         "liblzma",
     39     ],
     40     include_dirs: [
     41         "external/lz4/lib",
     42         "external/zlib",
     43     ],
     44     export_include_dirs: ["."],
     45 
     46     // For SHA-1 checksumming of build ID
     47     static: {
     48         whole_static_libs: ["libcrypto"],
     49     },
     50     shared: {
     51         shared_libs: ["libcrypto"],
     52     },
     53 }
     54 
     55 gensrcs {
     56     name: "art_dex2oat_operator_srcs",
     57     cmd: "$(location generate_operator_out) art/dex2oat $(in) > $(out)",
     58     tools: ["generate_operator_out"],
     59     srcs: [
     60         "linker/image_writer.h",
     61     ],
     62     output_extension: "operator_out.cc",
     63 }
     64 
     65 art_cc_static_library {
     66     name: "libart-dex2oat",
     67     defaults: ["libart-dex2oat-defaults"],
     68     shared_libs: [
     69         "libart-compiler",
     70         "libart-dexlayout",
     71         "libart",
     72     ],
     73 }
     74 
     75 art_cc_static_library {
     76     name: "libartd-dex2oat",
     77     defaults: [
     78         "art_debug_defaults",
     79         "libart-dex2oat-defaults",
     80     ],
     81     shared_libs: [
     82         "libartd-compiler",
     83         "libartd-dexlayout",
     84         "libartd",
     85     ],
     86 }
     87 
     88 cc_library_headers {
     89     name: "dex2oat_headers",
     90     host_supported: true,
     91     export_include_dirs: ["include"],
     92 }
     93 
     94 cc_defaults {
     95     name: "dex2oat-defaults",
     96     host_supported: true,
     97     defaults: ["art_defaults"],
     98     srcs: [
     99         "dex2oat_options.cc",
    100         "dex2oat.cc",
    101     ],
    102 
    103     target: {
    104         android: {
    105             // Use the 32-bit version of dex2oat on devices
    106             compile_multilib: "prefer32",
    107         },
    108     },
    109     header_libs: [
    110         "dex2oat_headers",
    111         "art_cmdlineparser_headers",
    112     ],
    113 }
    114 
    115 cc_defaults {
    116     name: "dex2oat-pgo-defaults",
    117     pgo: {
    118         instrumentation: true,
    119         benchmarks: ["dex2oat"],
    120     },
    121     target: {
    122         android_arm64: {
    123             pgo: {
    124                 profile_file: "art/dex2oat_arm_arm64.profdata",
    125             },
    126         },
    127         android_arm: {
    128             pgo: {
    129                 profile_file: "art/dex2oat_arm_arm64.profdata",
    130             },
    131         },
    132         android_x86_64: {
    133             pgo: {
    134                 profile_file: "art/dex2oat_x86_x86_64.profdata",
    135             },
    136         },
    137         android_x86: {
    138             pgo: {
    139                 profile_file: "art/dex2oat_x86_x86_64.profdata",
    140             },
    141         },
    142         android_mips64: {
    143             pgo: {
    144                 profile_file: "art/dex2oat_mips_mips64.profdata",
    145             },
    146         },
    147         android_mips: {
    148             pgo: {
    149                 profile_file: "art/dex2oat_mips_mips64.profdata",
    150             },
    151         },
    152     },
    153 }
    154 
    155 art_cc_binary {
    156     name: "dex2oat",
    157     defaults: [
    158         "dex2oat-defaults",
    159         "dex2oat-pgo-defaults",
    160     ],
    161     shared_libs: [
    162         "libart-compiler",
    163         "libart-dexlayout",
    164         "libart",
    165         "libdexfile",
    166         "libbase",
    167         "liblz4",
    168         "libsigchain",
    169     ],
    170     static_libs: [
    171         "libart-dex2oat",
    172     ],
    173 
    174     pgo: {
    175         // Additional cflags just for dex2oat during PGO instrumentation
    176         cflags: [
    177             // Ignore frame-size increase resulting from instrumentation.
    178             "-Wno-frame-larger-than=",
    179             "-DART_PGO_INSTRUMENTATION",
    180         ],
    181     },
    182     target: {
    183         android: {
    184             lto: {
    185                  thin: true,
    186             },
    187         },
    188     },
    189 }
    190 
    191 art_cc_binary {
    192     name: "dex2oatd",
    193     defaults: [
    194         "art_debug_defaults",
    195         "dex2oat-defaults",
    196     ],
    197     shared_libs: [
    198         "libartd-compiler",
    199         "libartd-dexlayout",
    200         "libartd",
    201         "libdexfiled",
    202         "libbase",
    203         "liblz4",
    204         "libsigchain",
    205     ],
    206     static_libs: [
    207         "libartd-dex2oat",
    208     ],
    209 }
    210 
    211 art_cc_binary {
    212     name: "dex2oats",
    213     device_supported: false,
    214     static_executable: true,
    215     defaults: ["dex2oat-defaults"],
    216     target: {
    217         darwin: {
    218             enabled: false,
    219         },
    220     },
    221     ldflags: [
    222         // We need this because GC stress mode makes use of
    223         // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
    224         // defined in libgcc_eh.a(unwind-dw2.o)
    225         // TODO: Having this is not ideal as it might obscure errors.
    226         // Try to get rid of it.
    227         "-z muldefs",
    228     ],
    229     static_libs: [
    230         "libart-dex2oat",
    231         "libart-compiler",
    232         "libart-dexlayout",
    233         "libart",
    234         "libdexfile",
    235         "libvixl-arm",
    236         "libvixl-arm64",
    237     ] + art_static_dependencies,
    238 }
    239 
    240 art_cc_binary {
    241     name: "dex2oatds",
    242     device_supported: false,
    243     static_executable: true,
    244     defaults: [
    245         "art_debug_defaults",
    246         "dex2oat-defaults",
    247     ],
    248     target: {
    249         darwin: {
    250             enabled: false,
    251         },
    252     },
    253     ldflags: [
    254         // We need this because GC stress mode makes use of
    255         // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also
    256         // defined in libgcc_eh.a(unwind-dw2.o)
    257         // TODO: Having this is not ideal as it might obscure errors.
    258         // Try to get rid of it.
    259         "-z muldefs",
    260     ],
    261     static_libs: [
    262         "libartd-dex2oat",
    263         "libartd-compiler",
    264         "libartd-dexlayout",
    265         "libartd",
    266         "libdexfiled",
    267         "libvixld-arm",
    268         "libvixld-arm64",
    269     ] + art_static_dependencies,
    270 }
    271 
    272 art_cc_test {
    273     name: "art_dex2oat_tests",
    274     defaults: [
    275         "art_gtest_defaults",
    276     ],
    277     srcs: [
    278         "dex2oat_test.cc",
    279         "dex2oat_image_test.cc",
    280         "linker/elf_writer_test.cc",
    281         "linker/image_test.cc",
    282         "linker/image_write_read_test.cc",
    283         "linker/index_bss_mapping_encoder_test.cc",
    284         "linker/multi_oat_relative_patcher_test.cc",
    285         "linker/oat_writer_test.cc",
    286     ],
    287     header_libs: ["dex2oat_headers"],
    288     include_dirs: [
    289         "external/zlib",
    290     ],
    291     shared_libs: [
    292         "libartd-compiler",
    293         "libartd-dexlayout",
    294         "libbase",
    295         "liblz4",
    296         "libsigchain",
    297         "libziparchive",
    298     ],
    299     static_libs: [
    300         "libartd-dex2oat",
    301     ],
    302 }
    303