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