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