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 17package { 18 // See: http://go/android-license-faq 19 // A large-scale-change added 'default_applicable_licenses' to import 20 // all of the 'license_kinds' from "art_license" 21 // to get the below license kinds: 22 // SPDX-license-identifier-Apache-2.0 23 default_applicable_licenses: ["art_license"], 24} 25 26art_cc_defaults { 27 name: "libart-dex2oat-defaults", 28 defaults: ["art_defaults"], 29 host_supported: true, 30 srcs: [ 31 "dex/quick_compiler_callbacks.cc", 32 "dex/verification_results.cc", 33 "driver/compiled_method.cc", 34 "driver/compiled_method_storage.cc", 35 "driver/compiler_driver.cc", 36 "linker/code_info_table_deduper.cc", 37 "linker/elf_writer.cc", 38 "linker/elf_writer_quick.cc", 39 "linker/image_writer.cc", 40 "linker/multi_oat_relative_patcher.cc", 41 "linker/oat_writer.cc", 42 "linker/relative_patcher.cc", 43 "utils/swap_space.cc", 44 ], 45 46 codegen: { 47 arm: { 48 srcs: [ 49 "linker/arm/relative_patcher_arm_base.cc", 50 "linker/arm/relative_patcher_thumb2.cc", 51 ], 52 }, 53 arm64: { 54 srcs: [ 55 "linker/arm64/relative_patcher_arm64.cc", 56 ], 57 }, 58 x86: { 59 srcs: [ 60 "linker/x86/relative_patcher_x86.cc", 61 "linker/x86/relative_patcher_x86_base.cc", 62 ], 63 }, 64 x86_64: { 65 srcs: [ 66 "linker/x86_64/relative_patcher_x86_64.cc", 67 ], 68 }, 69 }, 70 71 generated_sources: ["art_dex2oat_operator_srcs"], 72 shared_libs: [ 73 "libbase", 74 "libcrypto", // For SHA-1 checksumming of build ID 75 "liblog", 76 "liblz4", 77 "libz", 78 ], 79 export_include_dirs: ["."], 80} 81 82cc_defaults { 83 name: "libart-dex2oat_static_base_defaults", 84 whole_static_libs: [ 85 "libbase", 86 "libcrypto", 87 "liblog", 88 "liblz4", 89 "libz", 90 ], 91} 92 93gensrcs { 94 name: "art_dex2oat_operator_srcs", 95 cmd: "$(location generate_operator_out) art/dex2oat $(in) > $(out)", 96 tools: ["generate_operator_out"], 97 srcs: [ 98 "linker/image_writer.h", 99 ], 100 output_extension: "operator_out.cc", 101} 102 103art_cc_library_static { 104 name: "libart-dex2oat", 105 defaults: ["libart-dex2oat-defaults"], 106 shared_libs: [ 107 "libart-compiler", 108 "libart-dexlayout", 109 "libart", 110 "libartpalette", 111 "libprofile", 112 ], 113 static_libs: [ 114 "libelffile", 115 ], 116 apex_available: [ 117 "com.android.art", 118 "com.android.art.debug", 119 ], 120} 121 122cc_defaults { 123 name: "libart-dex2oat_static_defaults", 124 defaults: [ 125 "libart-dex2oat_static_base_defaults", 126 "libart_static_defaults", 127 "libprofile_static_defaults", 128 ], 129 whole_static_libs: [ 130 "libart-compiler", 131 "libart-dexlayout", 132 "libart-dex2oat", 133 ], 134} 135 136// Collect all the static defaults and build a host-only static library, which 137// is then used for the (mostly) static host dex2oat binary. 138art_cc_library_static { 139 name: "libdex2oat_static", 140 device_supported: false, 141 host_supported: true, 142 defaults: [ 143 "art_defaults", 144 "libart-compiler_static_defaults", 145 "libart-dex2oat_static_defaults", 146 "libart-dexlayout_static_defaults", 147 "libart_static_defaults", 148 "libartbase_static_defaults", 149 "libdexfile_static_defaults", 150 "libprofile_static_defaults", 151 ], 152} 153 154art_cc_library_static { 155 name: "libartd-dex2oat", 156 defaults: [ 157 "art_debug_defaults", 158 "libart-dex2oat-defaults", 159 ], 160 shared_libs: [ 161 "libartd-compiler", 162 "libartd-dexlayout", 163 "libartd", 164 "libartpalette", 165 "libprofiled", 166 ], 167 static_libs: [ 168 "libelffiled", 169 ], 170 apex_available: [ 171 "com.android.art.debug", 172 ], 173} 174 175cc_defaults { 176 name: "libartd-dex2oat_static_defaults", 177 defaults: [ 178 "libart-dex2oat_static_base_defaults", 179 "libartd_static_defaults", 180 "libprofiled_static_defaults", 181 ], 182 whole_static_libs: [ 183 "libartd-compiler", 184 "libartd-dexlayout", 185 "libartd-dex2oat", 186 ], 187} 188 189art_cc_library_static { 190 name: "libdex2oatd_static", 191 device_supported: false, 192 host_supported: true, 193 defaults: [ 194 "art_debug_defaults", 195 "libartbased_static_defaults", 196 "libartd-compiler_static_defaults", 197 "libartd-dex2oat_static_defaults", 198 "libartd-dexlayout_static_defaults", 199 "libartd_static_defaults", 200 "libdexfiled_static_defaults", 201 "libprofiled_static_defaults", 202 ], 203} 204 205cc_defaults { 206 name: "dex2oat-defaults", 207 host_supported: true, 208 defaults: ["art_defaults"], 209 210 srcs: [ 211 "dex2oat_options.cc", 212 "dex2oat.cc", 213 ], 214 header_libs: [ 215 "art_cmdlineparser_headers", 216 ], 217 218 target: { 219 android: { 220 compile_multilib: "both", 221 shared_libs: [ 222 "libartpalette", 223 "libbase", 224 "libcrypto", 225 "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. 226 "liblog", 227 "libsigchain", 228 "libz", 229 ], 230 }, 231 }, 232} 233 234cc_defaults { 235 name: "dex2oat-pgo-defaults", 236 defaults_visibility: [ 237 "//art:__subpackages__", 238 "//external/vixl", 239 ], 240 pgo: { 241 instrumentation: true, 242 benchmarks: ["dex2oat"], 243 }, 244 target: { 245 android_arm64: { 246 pgo: { 247 profile_file: "art/dex2oat_arm_arm64.profdata", 248 }, 249 }, 250 android_arm: { 251 pgo: { 252 profile_file: "art/dex2oat_arm_arm64.profdata", 253 }, 254 }, 255 android_riscv64: { 256 pgo: { 257 enable_profile_use: false, 258 profile_file: "", 259 }, 260 }, 261 android_x86_64: { 262 pgo: { 263 profile_file: "art/dex2oat_x86_x86_64.profdata", 264 }, 265 }, 266 android_x86: { 267 pgo: { 268 profile_file: "art/dex2oat_x86_x86_64.profdata", 269 }, 270 }, 271 }, 272} 273 274art_cc_binary { 275 name: "dex2oat", 276 defaults: [ 277 "dex2oat-defaults", 278 "dex2oat-pgo-defaults", 279 ], 280 // Modules that do dexpreopting, e.g. android_app, depend implicitly on 281 // either dex2oat or dex2oatd in ART source builds. 282 visibility: ["//visibility:public"], 283 284 multilib: { 285 lib32: { 286 suffix: "32", 287 }, 288 lib64: { 289 suffix: "64", 290 }, 291 }, 292 symlink_preferred_arch: true, 293 294 pgo: { 295 // Additional cflags just for dex2oat during PGO instrumentation 296 cflags: [ 297 // Ignore frame-size increase resulting from instrumentation. 298 "-Wno-frame-larger-than=", 299 "-DART_PGO_INSTRUMENTATION", 300 ], 301 }, 302 303 target: { 304 android: { 305 shared_libs: [ 306 "libart", 307 "libart-compiler", 308 "libart-dexlayout", 309 "libartbase", 310 "libdexfile", 311 "libprofile", 312 ], 313 static_libs: [ 314 "libart-dex2oat", 315 "libelffile", 316 ], 317 lto: { 318 thin: true, 319 }, 320 }, 321 host: { 322 // Make the host binary static, except for system libraries. This 323 // avoids having to bundle host dynamic libs in prebuilts. 324 static_libs: ["libdex2oat_static"], 325 stl: "c++_static", 326 // Override the prefer32 added by art_cc_binary when 327 // HOST_PREFER_32_BIT is in use. Necessary because the logic in 328 // Soong for setting ctx.Config().BuildOSTarget (used in 329 // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into 330 // account. Note that this override cannot be in cc_defaults because 331 // it'd get overridden by the load hook even when it uses 332 // PrependProperties. 333 compile_multilib: "64", 334 }, 335 }, 336 337 apex_available: [ 338 "com.android.art", 339 "com.android.art.debug", 340 "test_broken_com.android.art", 341 ], 342} 343 344art_cc_binary { 345 name: "dex2oatd", 346 defaults: [ 347 "art_debug_defaults", 348 "dex2oat-defaults", 349 ], 350 // Modules that do dexpreopting, e.g. android_app, depend implicitly on 351 // either dex2oat or dex2oatd in ART source builds. 352 visibility: ["//visibility:public"], 353 354 multilib: { 355 lib32: { 356 suffix: "32", 357 }, 358 lib64: { 359 suffix: "64", 360 }, 361 }, 362 symlink_preferred_arch: true, 363 364 target: { 365 android: { 366 shared_libs: [ 367 "libartbased", 368 "libartd", 369 "libartd-compiler", 370 "libartd-dexlayout", 371 "libdexfiled", 372 "libprofiled", 373 ], 374 static_libs: [ 375 "libartd-dex2oat", 376 "libelffiled", 377 ], 378 }, 379 host: { 380 // Make the host binary static, except for system libraries. This 381 // avoids having to bundle host dynamic libs in prebuilts. 382 static_libs: ["libdex2oatd_static"], 383 stl: "c++_static", 384 // Override the prefer32 added by art_cc_binary when 385 // HOST_PREFER_32_BIT is in use. Necessary because the logic in 386 // Soong for setting ctx.Config().BuildOSTarget (used in 387 // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into 388 // account. Note that this override cannot be in cc_defaults because 389 // it'd get overridden by the load hook even when it uses 390 // PrependProperties. 391 compile_multilib: "64", 392 }, 393 }, 394 395 apex_available: [ 396 "com.android.art.debug", 397 ], 398} 399 400cc_defaults { 401 name: "dex2oats-defaults", 402 device_supported: false, 403 static_executable: true, 404 defaults: [ 405 "dex2oat-defaults", 406 ], 407 target: { 408 darwin: { 409 enabled: false, 410 }, 411 }, 412 ldflags: [ 413 // We need this because GC stress mode makes use of 414 // _Unwind_GetIP and _Unwind_Backtrace and the symbols are also 415 // defined in libgcc_eh.a(unwind-dw2.o) 416 // TODO: Having this is not ideal as it might obscure errors. 417 // Try to get rid of it. 418 "-z muldefs", 419 ], 420} 421 422art_cc_binary { 423 name: "dex2oats", 424 defaults: ["dex2oats-defaults"], 425 static_libs: ["libdex2oat_static"], 426} 427 428art_cc_binary { 429 name: "dex2oatds", 430 defaults: [ 431 "art_debug_defaults", 432 "dex2oats-defaults", 433 ], 434 static_libs: ["libdex2oatd_static"], 435} 436 437art_cc_library_static { 438 name: "libart-dex2oat-gtest", 439 defaults: ["libart-gtest-defaults"], 440 srcs: [ 441 "common_compiler_driver_test.cc", 442 ], 443 shared_libs: [ 444 "libart-compiler-gtest", 445 "libart-runtime-gtest", 446 "libart-compiler", 447 "libart-disassembler", 448 "libbase", 449 "liblz4", // libart-dex2oat dependency; must be repeated here since it's a static lib. 450 "liblog", 451 ], 452 static_libs: [ 453 "libart-dex2oat", 454 ], 455} 456 457art_cc_library_static { 458 name: "libartd-dex2oat-gtest", 459 defaults: ["libartd-gtest-defaults"], 460 srcs: [ 461 "common_compiler_driver_test.cc", 462 ], 463 shared_libs: [ 464 "libartd-compiler-gtest", 465 "libartd-runtime-gtest", 466 "libartd-compiler", 467 "libartd-disassembler", 468 "libbase", 469 "liblz4", // libartd-dex2oat dependency; must be repeated here since it's a static lib. 470 "liblog", 471 ], 472 static_libs: [ 473 "libartd-dex2oat", 474 ], 475} 476 477art_cc_defaults { 478 name: "art_dex2oat_tests_defaults", 479 data: [ 480 ":art-gtest-jars-AbstractMethod", 481 ":art-gtest-jars-ArrayClassWithUnresolvedComponent", 482 ":art-gtest-jars-DefaultMethods", 483 ":art-gtest-jars-Dex2oatVdexPublicSdkDex", 484 ":art-gtest-jars-Dex2oatVdexTestDex", 485 ":art-gtest-jars-ImageLayoutA", 486 ":art-gtest-jars-ImageLayoutB", 487 ":art-gtest-jars-LinkageTest", 488 ":art-gtest-jars-Main", 489 ":art-gtest-jars-MainEmptyUncompressed", 490 ":art-gtest-jars-MainEmptyUncompressedAligned", 491 ":art-gtest-jars-MainStripped", 492 ":art-gtest-jars-MainUncompressedAligned", 493 ":art-gtest-jars-ManyMethods", 494 ":art-gtest-jars-MultiDex", 495 ":art-gtest-jars-MultiDexModifiedSecondary", 496 ":art-gtest-jars-MultiDexUncompressedAligned", 497 ":art-gtest-jars-MyClassNatives", 498 ":art-gtest-jars-Nested", 499 ":art-gtest-jars-ProfileTestMultiDex", 500 ":art-gtest-jars-StaticLeafMethods", 501 ":art-gtest-jars-Statics", 502 ":art-gtest-jars-StringLiterals", 503 ":art-gtest-jars-SuperWithAccessChecks", 504 ":art-gtest-jars-VerifierDeps", 505 ":art-gtest-jars-VerifierDepsMulti", 506 ":art-gtest-jars-VerifySoftFailDuringClinit", 507 ], 508 tidy_timeout_srcs: [ 509 "dex2oat_test.cc", 510 "verifier_deps_test.cc", 511 "linker/arm/relative_patcher_thumb2_test.cc", 512 "linker/arm64/relative_patcher_arm64_test.cc", 513 ], 514 srcs: [ 515 "dex2oat_test.cc", 516 "dex2oat_vdex_test.cc", 517 "dex2oat_image_test.cc", 518 "driver/compiled_method_storage_test.cc", 519 "driver/compiler_driver_test.cc", 520 "linker/code_info_table_deduper_test.cc", 521 "linker/elf_writer_test.cc", 522 "linker/image_test.cc", 523 "linker/image_write_read_test.cc", 524 "linker/index_bss_mapping_encoder_test.cc", 525 "linker/multi_oat_relative_patcher_test.cc", 526 "linker/oat_writer_test.cc", 527 "verifier_deps_test.cc", 528 "utils/swap_space_test.cc", 529 ], 530 target: { 531 host: { 532 required: ["dex2oatd"], 533 }, 534 }, 535 536 codegen: { 537 arm: { 538 srcs: [ 539 "linker/arm/relative_patcher_thumb2_test.cc", 540 ], 541 }, 542 arm64: { 543 srcs: [ 544 "linker/arm64/relative_patcher_arm64_test.cc", 545 ], 546 }, 547 x86: { 548 srcs: [ 549 "linker/x86/relative_patcher_x86_test.cc", 550 ], 551 }, 552 x86_64: { 553 srcs: [ 554 "linker/x86_64/relative_patcher_x86_64_test.cc", 555 ], 556 }, 557 }, 558 559 static_libs: [ 560 "libziparchive", 561 ], 562 shared_libs: [ 563 "libartpalette", 564 "libbase", 565 "libcrypto", 566 "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. 567 "liblog", 568 "libsigchain", 569 "libz", // libziparchive dependency; must be repeated here since it's a static lib. 570 ], 571} 572 573// Version of ART gtest `art_dex2oat_tests` bundled with the ART APEX on target. 574// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. 575art_cc_test { 576 name: "art_dex2oat_tests", 577 defaults: [ 578 "art_gtest_defaults", 579 "art_dex2oat_tests_defaults", 580 ], 581 shared_libs: [ 582 "libartbased", 583 "libartd-dexlayout", 584 "liblzma", 585 "libprofiled", 586 ], 587 static_libs: [ 588 "libartd-compiler", 589 "libartd-dex2oat", 590 "libartd-dex2oat-gtest", 591 "libelffiled", 592 "libvixld", 593 ], 594} 595 596// Standalone version of ART gtest `art_dex2oat_tests`, not bundled with the ART APEX on target. 597art_cc_test { 598 name: "art_standalone_dex2oat_tests", 599 defaults: [ 600 "art_standalone_gtest_defaults", 601 "art_dex2oat_tests_defaults", 602 ], 603 data: [":generate-boot-image"], 604 shared_libs: [ 605 "libart-dexlayout", 606 "libartbase", 607 "liblzma", 608 "libprofile", 609 ], 610 static_libs: [ 611 "libart-compiler", 612 "libart-dex2oat", 613 "libart-dex2oat-gtest", 614 "libelffile", 615 "libvixl", 616 ], 617 test_config: "art_standalone_dex2oat_tests.xml", 618} 619 620// Counterpart to art_standalone_dex2oat_tests for tests that go into CTS. 621art_cc_test { 622 name: "art_standalone_dex2oat_cts_tests", 623 defaults: ["art_standalone_gtest_defaults"], 624 srcs: ["dex2oat_cts_test.cc"], 625 data: [ 626 ":art-gtest-jars-Main", 627 ":art-gtest-jars-MainStripped", 628 ":art-gtest-jars-MultiDex", 629 ":art-gtest-jars-MultiDexModifiedSecondary", 630 ":art-gtest-jars-MultiDexUncompressedAligned", 631 ":art-gtest-jars-Nested", 632 ":generate-boot-image", 633 ], 634 shared_libs: [ 635 "libz", // libziparchive dependency; must be repeated here since it's a static lib. 636 ], 637 static_libs: [ 638 "libziparchive", 639 ], 640 test_config: "art_standalone_dex2oat_cts_tests.xml", 641 test_suites: ["cts"], 642} 643