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