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