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