diff options
author | 2023-06-12 18:51:58 +0000 | |
---|---|---|
committer | 2023-06-12 20:25:01 +0000 | |
commit | b89b62d8ca79c1a8d349c6c30f43bfa8b9a43ed3 (patch) | |
tree | 16529ffeef91802ec7fd28efd2f161fff12d0ed0 | |
parent | 56fd682c0523a99991b04f8714d174492e6908ce (diff) |
Revert "Static link gtests with ART libraries"
This reverts commit 66244e2af2e9ee54b57022eeeabb7230109a98fa.
Reason for revert: broken tests on art-gtest-asan32
Change-Id: I069a6a177a8eb95a383719e3fdadc698dd2fb4b8
-rwxr-xr-x | build/apex/art_apex_test.py | 5 | ||||
-rw-r--r-- | compiler/Android.bp | 250 | ||||
-rw-r--r-- | dex2oat/Android.bp | 56 | ||||
-rw-r--r-- | dexoptanalyzer/Android.bp | 4 | ||||
-rw-r--r-- | libartbase/Android.bp | 66 | ||||
-rw-r--r-- | libartpalette/Android.bp | 4 | ||||
-rw-r--r-- | libdexfile/Android.bp | 4 | ||||
-rw-r--r-- | libprofile/Android.bp | 14 | ||||
-rw-r--r-- | odrefresh/Android.bp | 6 | ||||
-rw-r--r-- | profman/Android.bp | 6 | ||||
-rw-r--r-- | runtime/Android.bp | 132 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 10 | ||||
-rw-r--r-- | runtime/monitor-inl.h | 12 | ||||
-rw-r--r-- | simulator/Android.bp | 24 | ||||
-rw-r--r-- | test/Android.bp | 168 | ||||
-rw-r--r-- | tools/art_verifier/Android.bp | 4 | ||||
-rw-r--r-- | tools/fuzzer/Android.bp | 7 |
17 files changed, 441 insertions, 331 deletions
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py index 0c813d11de..891fd0f0a5 100755 --- a/build/apex/art_apex_test.py +++ b/build/apex/art_apex_test.py @@ -697,6 +697,11 @@ class TestingTargetChecker: self._checker.check_art_test_executable('art_runtime_tests') self._checker.check_art_test_executable('art_sigchain_tests') + # Check ART test (internal) libraries. + self._checker.check_native_library('libartd-gtest') + self._checker.check_native_library('libartd-simulator-container') + self._checker.check_native_library('libartbased-testing') + # Check ART test tools. self._checker.check_executable('signal_dumper') diff --git a/compiler/Android.bp b/compiler/Android.bp index 3e279e40be..00e1bb9713 100644 --- a/compiler/Android.bp +++ b/compiler/Android.bp @@ -28,89 +28,6 @@ package { default_applicable_licenses: ["art_license"], } -// Common dependencies for libart-compiler_deps and libartd-compiler_deps. -cc_defaults { - name: "libart-compiler_common_deps", - shared_libs: [ - "libbase", - "liblzma", // libelffile(d) dependency; must be repeated here since it's a static lib. - "libartpalette", - ], - header_libs: [ - "libart_generated_headers", - ], -} - -// Dependencies of libart-compiler, used to propagate libart-compiler deps when static linking. -art_cc_defaults { - name: "libart-compiler_deps", - defaults: ["libart-compiler_common_deps"], - shared_libs: [ - "libartbase", - "libprofile", - "libdexfile", - ], - static_libs: ["libelffile"], - codegen: { - arm: { - // VIXL assembly support for ARM targets. - static_libs: [ - "libvixl", - ], - }, - arm64: { - // VIXL assembly support for ARM64 targets. - static_libs: [ - "libvixl", - ], - }, - }, - runtime_libs: [ - // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load - // `libart-disassembler.so`. - "libart-disassembler", - ], -} - -// Dependencies of libartd-compiler, used to propagate libartd-compiler deps when static linking. -art_cc_defaults { - name: "libartd-compiler_deps", - defaults: ["libart-compiler_common_deps"], - shared_libs: [ - "libartbased", - "libprofiled", - "libdexfiled", - ], - static_libs: ["libelffiled"], - codegen: { - arm: { - // VIXL assembly support for ARM targets. - static_libs: [ - "libvixld", - ], - // Export vixl headers as they are included in this library's headers used by tests. - export_static_lib_headers: [ - "libvixld", - ], - }, - arm64: { - // VIXL assembly support for ARM64 targets. - static_libs: [ - "libvixld", - ], - // Export vixl headers as they are included in this library's headers used by tests. - export_static_lib_headers: [ - "libvixld", - ], - }, - }, - runtime_libs: [ - // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load - // `libartd-disassembler.so`. - "libartd-disassembler", - ], -} - art_cc_defaults { name: "libart-compiler-defaults", defaults: ["art_defaults"], @@ -294,13 +211,35 @@ art_cc_library { "libart-compiler-defaults", "dex2oat-pgo-defaults", "art_hugepage_defaults", - "libart-compiler_deps", ], + codegen: { + arm: { + // VIXL assembly support for ARM targets. + static_libs: [ + "libvixl", + ], + }, + arm64: { + // VIXL assembly support for ARM64 targets. + static_libs: [ + "libvixl", + ], + }, + }, shared_libs: [ - // libart is not included in libart-compiler_deps to allow libart-compiler(-for-test) - // select suitable libart library (either with or without LTO). "libart", + "libartbase", + "libartpalette", + "libprofile", + "libdexfile", ], + static_libs: ["libelffile"], + runtime_libs: [ + // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load + // `libart-disassembler.so`. + "libart-disassembler", + ], + target: { android: { lto: { @@ -315,22 +254,6 @@ art_cc_library { ], } -// For static linking with gtests. Same as `libart-compiler`, but without LTO. -// When gtests static link a library with LTO enabled, they are also built with LTO. -// This makes the build process use a lot of memory. b/277207452 -art_cc_library_static { - name: "libart-compiler-for-test", - defaults: [ - "libart-compiler-defaults", - "dex2oat-pgo-defaults", - "art_hugepage_defaults", - "libart-compiler_deps", - ], - header_libs: [ - "libart_headers", - ], -} - cc_defaults { name: "libart-compiler_static_defaults", defaults: [ @@ -344,32 +267,48 @@ cc_defaults { whole_static_libs: ["libart-compiler"], } -// libart-compiler_static_defaults for standalone gtests. -// Uses libart-for-test_static_defaults instead of libart_static_defaults. -// Uses libart-compiler-for-test instead of libart-compiler. -cc_defaults { - name: "libart-compiler-for-test_static_defaults", - defaults: [ - "libart-compiler_static_base_defaults", - "libart-disassembler_static_defaults", - "libart-for-test_static_defaults", - "libartbase_static_defaults", - "libdexfile_static_defaults", - "libprofile_static_defaults", - ], - whole_static_libs: ["libart-compiler-for-test"], -} - art_cc_library { name: "libartd-compiler", defaults: [ "art_debug_defaults", "libart-compiler-defaults", - "libartd-compiler_deps", ], + codegen: { + arm: { + // VIXL assembly support for ARM targets. + static_libs: [ + "libvixld", + ], + // Export vixl headers as they are included in this library's headers used by tests. + export_static_lib_headers: [ + "libvixld", + ], + }, + arm64: { + // VIXL assembly support for ARM64 targets. + static_libs: [ + "libvixld", + ], + // Export vixl headers as they are included in this library's headers used by tests. + export_static_lib_headers: [ + "libvixld", + ], + }, + }, shared_libs: [ + "libartbased", "libartd", + "libartpalette", + "libprofiled", + "libdexfiled", ], + static_libs: ["libelffiled"], + runtime_libs: [ + // `art::HGraphVisualizerDisassembler::HGraphVisualizerDisassembler` may dynamically load + // `libartd-disassembler.so`. + "libartd-disassembler", + ], + apex_available: [ "com.android.art.debug", // TODO(b/183882457): This lib doesn't go into com.android.art, but @@ -392,45 +331,42 @@ cc_defaults { whole_static_libs: ["libartd-compiler"], } -// libartd-compiler_static_defaults for standalone gtests. -// Uses libartd-for-test_static_defaults instead of libart_static_defaults. -cc_defaults { - name: "libartd-compiler-for-test_static_defaults", - defaults: [ - "libart-compiler_static_base_defaults", - "libartbased_static_defaults", - "libartd-disassembler_static_defaults", - "libartd-for-test_static_defaults", - "libdexfiled_static_defaults", - "libprofiled_static_defaults", - ], - whole_static_libs: ["libartd-compiler"], -} - // Properties common to `libart-compiler-gtest` and `libartd-compiler-gtest`. art_cc_defaults { name: "libart-compiler-gtest-common", srcs: [ "common_compiler_test.cc", ], + shared_libs: [ + "libbase", + ], } -art_cc_library_static { +art_cc_library { name: "libart-compiler-gtest", defaults: [ "libart-gtest-defaults", "libart-compiler-gtest-common", - "libart-compiler-for-test_static_defaults", + ], + shared_libs: [ + "libart-compiler", + "libart-disassembler", + "libartbase-art-gtest", + "libart-runtime-gtest", ], } -art_cc_library_static { +art_cc_library { name: "libartd-compiler-gtest", defaults: [ - "art_debug_defaults", - "libart-gtest-defaults", + "libartd-gtest-defaults", "libart-compiler-gtest-common", - "libartd-compiler-for-test_static_defaults", + ], + shared_libs: [ + "libartd-compiler", + "libartd-disassembler", + "libartbased-art-gtest", + "libartd-runtime-gtest", ], } @@ -539,6 +475,11 @@ art_cc_defaults { "libnativehelper_header_only", ], + shared_libs: [ + "libnativeloader", + "libunwindstack", + ], + target: { host: { shared_libs: [ @@ -556,8 +497,15 @@ art_cc_test { "art_gtest_defaults", "art_compiler_tests_defaults", ], - static_libs: [ + shared_libs: [ + "libprofiled", "libartd-simulator-container", + "liblzma", + ], + static_libs: [ + "libartd-compiler", + "libelffiled", + "libvixld", ], } @@ -569,8 +517,21 @@ art_cc_test { "art_compiler_tests_defaults", ], data: [":generate-boot-image"], + shared_libs: [ + "libprofile", + "liblzma", + "libartpalette", + ], static_libs: [ + // For now, link `libart-simulator-container` statically for simplicity, + // to save the added complexity to package it in test suites (along with + // other test artifacts) and install it on device during tests. + // TODO(b/192070541): Consider linking `libart-simulator-container` + // dynamically. "libart-simulator-container", + "libart-compiler", + "libelffile", + "libvixl", ], test_config: "art_standalone_compiler_tests.xml", } @@ -591,7 +552,7 @@ art_cc_test { "utils/assembler_thumb_test.cc", ], }, - riscv64: { + riscv64 : { srcs: [ "utils/riscv64/assembler_riscv64_test.cc", ], @@ -607,7 +568,12 @@ art_cc_test { ], }, }, + shared_libs: [ + "liblzma", + ], static_libs: [ + "libartd-compiler", + "libelffiled", "libvixld", ], } diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp index 761b073063..7341774889 100644 --- a/dex2oat/Android.bp +++ b/dex2oat/Android.bp @@ -440,24 +440,37 @@ art_cc_library_static { srcs: [ "common_compiler_driver_test.cc", ], + shared_libs: [ + "libart-compiler-gtest", + "libart-runtime-gtest", + "libart-compiler", + "libart-disassembler", + "libbase", + "liblz4", // libart-dex2oat dependency; must be repeated here since it's a static lib. + "liblog", + ], static_libs: [ "libart-dex2oat", - "libart-gtest", ], } art_cc_library_static { name: "libartd-dex2oat-gtest", - defaults: [ - "art_debug_defaults", - "libart-gtest-defaults", - ], + defaults: ["libartd-gtest-defaults"], srcs: [ "common_compiler_driver_test.cc", ], + shared_libs: [ + "libartd-compiler-gtest", + "libartd-runtime-gtest", + "libartd-compiler", + "libartd-disassembler", + "libbase", + "liblz4", // libartd-dex2oat dependency; must be repeated here since it's a static lib. + "liblog", + ], static_libs: [ "libartd-dex2oat", - "libartd-gtest", ], } @@ -543,10 +556,17 @@ art_cc_defaults { }, }, + static_libs: [ + "libziparchive", + ], shared_libs: [ + "libartpalette", + "libbase", "libcrypto", "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. "liblog", + "libsigchain", + "libz", // libziparchive dependency; must be repeated here since it's a static lib. ], } @@ -558,11 +578,18 @@ art_cc_test { "art_gtest_defaults", "art_dex2oat_tests_defaults", ], + shared_libs: [ + "libartbased", + "libartd-dexlayout", + "liblzma", + "libprofiled", + ], static_libs: [ + "libartd-compiler", "libartd-dex2oat", "libartd-dex2oat-gtest", + "libelffiled", "libvixld", - "libartd-dexlayout", ], } @@ -574,11 +601,18 @@ art_cc_test { "art_dex2oat_tests_defaults", ], data: [":generate-boot-image"], + shared_libs: [ + "libart-dexlayout", + "libartbase", + "liblzma", + "libprofile", + ], static_libs: [ + "libart-compiler", "libart-dex2oat", "libart-dex2oat-gtest", + "libelffile", "libvixl", - "libart-dexlayout", ], test_config: "art_standalone_dex2oat_tests.xml", } @@ -597,6 +631,12 @@ art_cc_test { ":art-gtest-jars-Nested", ":generate-boot-image", ], + shared_libs: [ + "libz", // libziparchive dependency; must be repeated here since it's a static lib. + ], + static_libs: [ + "libziparchive", + ], test_config: "art_standalone_dex2oat_cts_tests.xml", test_suites: ["cts"], } diff --git a/dexoptanalyzer/Android.bp b/dexoptanalyzer/Android.bp index 43953da901..82f0c1a70f 100644 --- a/dexoptanalyzer/Android.bp +++ b/dexoptanalyzer/Android.bp @@ -83,8 +83,12 @@ art_cc_binary { art_cc_defaults { name: "art_dexoptanalyzer_tests_defaults", + static_libs: [ + "libziparchive", + ], shared_libs: [ "libunwindstack", + "libz", // libziparchive dependency; must be repeated here since it's a static lib. ], data: [ ":art-gtest-jars-LinkageTest", diff --git a/libartbase/Android.bp b/libartbase/Android.bp index 7cd15324bb..951599d847 100644 --- a/libartbase/Android.bp +++ b/libartbase/Android.bp @@ -254,10 +254,12 @@ art_cc_defaults { srcs: [ "base/common_art_test.cc", ], + shared_libs: [ + "libbase", + "libunwindstack", + ], header_libs: [ "libnativehelper_header_only", - // Required for "base/mutex.h" in common_art_test.cc - "libart_headers", ], static: { whole_static_libs: [ @@ -273,29 +275,34 @@ art_cc_defaults { }, } -art_cc_library_static { +art_cc_library { name: "libartbase-art-gtest", defaults: [ "libart-gtest-defaults", "libartbase-art-gtest-defaults", - "libartbase_static_defaults", - "libdexfile_static_defaults", + ], + shared_libs: [ + "libartbase", + "libartbase-testing", + "libdexfile", ], } -art_cc_library_static { +art_cc_library { name: "libartbased-art-gtest", defaults: [ - "art_debug_defaults", - "libart-gtest-defaults", + "libartd-gtest-defaults", "libartbase-art-gtest-defaults", - "libartbased_static_defaults", - "libdexfiled_static_defaults", + ], + shared_libs: [ + "libartbased", + "libartbased-testing", + "libdexfiled", ], } -art_cc_library_static { - name: "libartbase-testing", +art_cc_defaults { + name: "libartbase-testing-defaults", defaults: [ "art_defaults", ], @@ -303,9 +310,35 @@ art_cc_library_static { srcs: [ "base/testing.cc", ], - header_libs: [ - "libbase_headers", - "art_libartbase_headers", + shared_libs: [ + "libbase", + ], + apex_available: [ + "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled and others. + "com.android.art", + ], +} + +art_cc_library { + name: "libartbase-testing", + defaults: [ + "libartbase-testing-defaults", + ], + shared_libs: [ + "libartbase", + ], +} + +art_cc_library { + name: "libartbased-testing", + defaults: [ + "libartbase-testing-defaults", + ], + shared_libs: [ + "libartbased", ], } @@ -351,6 +384,9 @@ art_cc_defaults { "base/variant_map_test.cc", "base/zip_archive_test.cc", ], + shared_libs: [ + "libbase", + ], static_libs: [ "libgmock", ], diff --git a/libartpalette/Android.bp b/libartpalette/Android.bp index 301ef89990..9ac9091fae 100644 --- a/libartpalette/Android.bp +++ b/libartpalette/Android.bp @@ -111,6 +111,10 @@ art_cc_library { art_cc_defaults { name: "art_libartpalette_tests_defaults", srcs: ["apex/palette_test.cc"], + shared_libs: [ + "libartpalette", + "libnativehelper", + ], target: { android: { static_libs: ["libmodules-utils-build"], diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp index 9d2a219e3b..9c2acac060 100644 --- a/libdexfile/Android.bp +++ b/libdexfile/Android.bp @@ -306,8 +306,12 @@ art_cc_defaults { ":art-gtest-jars-VerifierDeps", ], header_libs: ["jni_headers"], + static_libs: [ + "libziparchive", + ], shared_libs: [ "libunwindstack", + "libz", // libziparchive dependency; must be repeated here since it's a static lib. ], } diff --git a/libprofile/Android.bp b/libprofile/Android.bp index c7e3cb8d72..beae8a9863 100644 --- a/libprofile/Android.bp +++ b/libprofile/Android.bp @@ -188,6 +188,12 @@ art_cc_defaults { "profile/profile_boot_info_test.cc", "profile/profile_compilation_info_test.cc", ], + static_libs: [ + "libziparchive", + ], + shared_libs: [ + "libz", // libziparchive dependency; must be repeated here since it's a static lib. + ], } // Version of ART gtest `art_libprofile_tests` bundled with the ART APEX on target. @@ -198,6 +204,10 @@ art_cc_test { "art_gtest_defaults", "art_libprofile_tests_defaults", ], + shared_libs: [ + "libartbased", + "libdexfiled", + ], } // Standalone version of ART gtest `art_libprofile_tests`, not bundled with the ART APEX on target. @@ -207,5 +217,9 @@ art_cc_test { "art_standalone_gtest_defaults", "art_libprofile_tests_defaults", ], + shared_libs: [ + "libartbase", + "libdexfile", + ], test_config: "art_standalone_libprofile_tests.xml", } diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp index 97fec58853..809e18d2bb 100644 --- a/odrefresh/Android.bp +++ b/odrefresh/Android.bp @@ -207,6 +207,9 @@ art_cc_test { "art_odrefresh_tests_defaults", ], host_supported: false, + shared_libs: [ + "libdexfiled", + ], // The test config template is needed even though it's not used by the test // runner. Otherwise, Soong will generate a test config, which is adding // `art-host-test` as a test tag, while this test does not support running @@ -222,6 +225,9 @@ art_cc_test { "art_standalone_gtest_defaults", "art_odrefresh_tests_defaults", ], + shared_libs: [ + "libdexfile", + ], } genrule { diff --git a/profman/Android.bp b/profman/Android.bp index 7eff771c60..ac80641fae 100644 --- a/profman/Android.bp +++ b/profman/Android.bp @@ -199,6 +199,9 @@ art_cc_test { "art_gtest_defaults", "art_profman_tests_defaults", ], + shared_libs: [ + "libprofiled", + ], target: { host: { required: ["profmand"], @@ -214,6 +217,9 @@ art_cc_test { "art_profman_tests_defaults", ], data: [":generate-boot-image"], + shared_libs: [ + "libprofile", + ], target: { host: { required: ["profman"], diff --git a/runtime/Android.bp b/runtime/Android.bp index 657076b311..1d42ccdd1e 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -87,14 +87,8 @@ cc_library_headers { // ART's macros.h depends on libbase's macros.h. // Note: runtime_options.h depends on cmdline. But we don't really want to export this // generically. dex2oat takes care of it itself. - header_libs: [ - "art_libartbase_headers", - "dlmalloc", - ], - export_header_lib_headers: [ - "art_libartbase_headers", - "dlmalloc", - ], + header_libs: ["art_libartbase_headers"], + export_header_lib_headers: ["art_libartbase_headers"], // We optimize Thread::Current() with a direct TLS access. This requires // access to a platform specific Bionic header. @@ -115,23 +109,6 @@ cc_library_headers { ], } -// Generated headers target required by libart. -cc_library_headers { - name: "libart_generated_headers", - defaults: ["art_defaults"], - host_supported: true, - - // asm_support_gen.h (used by asm_support.h) is generated with cpp-define-generator - generated_headers: ["cpp-define-generator-asm-support"], - // export our headers so the libart(d)-gtest targets can use it as well. - export_generated_headers: ["cpp-define-generator-asm-support"], - - apex_available: [ - "com.android.art", - "com.android.art.debug", - ], -} - cc_defaults { name: "libart_defaults", defaults: ["art_defaults"], @@ -502,23 +479,26 @@ cc_defaults { ], }, }, - static: { - cflags: ["-DART_STATIC_LIBART"], - }, + generated_sources: [ "art_operator_srcs", ], + // asm_support_gen.h (used by asm_support.h) is generated with cpp-define-generator + generated_headers: ["cpp-define-generator-asm-support"], + // export our headers so the libart(d)-gtest targets can use it as well. + export_generated_headers: ["cpp-define-generator-asm-support"], + header_libs: [ "art_cmdlineparser_headers", "cpp-define-generator-definitions", + "dlmalloc", "jni_platform_headers", "libart_headers", "libnativehelper_header_only", - "libart_generated_headers", ], export_header_lib_headers: [ + "dlmalloc", "libart_headers", - "libart_generated_headers", ], whole_static_libs: [ "libcpu_features", @@ -559,7 +539,9 @@ cc_defaults { "liblz4", "liblzma", // libelffile dependency; must be repeated here since it's a static lib. "libnativebridge", + "libnativeloader", "libodrstatslog", + "libsigchain_fake", "libunwindstack", "libz", ], @@ -590,8 +572,6 @@ cc_defaults { whole_static_libs: [ "libart", "libelffile", - "libsigchain_fake", - "libnativeloader", ], } @@ -607,43 +587,6 @@ cc_defaults { whole_static_libs: [ "libartd", "libelffiled", - "libsigchain_fake", - "libnativeloader", - ], -} - -// libart_static_defaults for standalone gtests. -// Doesn't link libsigchain_fake. -// Uses libart-for-test instead of libart. -cc_defaults { - name: "libart-for-test_static_defaults", - defaults: [ - "libart_static_base_defaults", - "libartbase_static_defaults", - "libdexfile_static_defaults", - "libdexfile_support_static_defaults", - "libprofile_static_defaults", - ], - whole_static_libs: [ - "libart-for-test", - "libelffile", - ], -} - -// libartd_static_defaults for gtests. -// Doesn't link libsigchain_fake. -cc_defaults { - name: "libartd-for-test_static_defaults", - defaults: [ - "libart_static_base_defaults", - "libartbased_static_defaults", - "libdexfiled_static_defaults", - "libdexfiled_support_static_defaults", - "libprofiled_static_defaults", - ], - whole_static_libs: [ - "libartd", - "libelffiled", ], } @@ -710,6 +653,13 @@ art_cc_defaults { export_shared_lib_headers: [ "libdexfile", ], + target: { + android: { + lto: { + thin: true, + }, + }, + }, } // Release version of the ART runtime library. @@ -727,13 +677,6 @@ art_cc_library { "test_broken_com.android.art", ], afdo: true, - target: { - android: { - lto: { - thin: true, - }, - }, - }, } // "Broken" version of the ART runtime library, used only for testing. @@ -753,19 +696,6 @@ art_cc_test_library { ], } -// For static linking with gtests. Same as `libart`, but without LTO. -// When gtests static link a library with LTO enabled, they are also built with LTO. -// This makes the build process use a lot of memory. b/277207452 -art_cc_library_static { - name: "libart-for-test", - defaults: ["libart_common_defaults"], - shared_libs: [ - "libartbase", - "libdexfile", - "libprofile", - ], -} - // Debug version of the ART runtime library. art_cc_library { name: "libartd", @@ -813,30 +743,40 @@ art_cc_defaults { "common_runtime_test.cc", "dexopt_test.cc", ], + shared_libs: [ + "libbase", + "libz", // libziparchive dependency; must be repeated here since it's a static lib. + ], static_libs: [ "libprocinfo", + "libziparchive", ], header_libs: [ "libnativehelper_header_only", ], } -art_cc_library_static { +art_cc_library { name: "libart-runtime-gtest", defaults: [ "libart-runtime-gtest-defaults", "libart-gtest-defaults", - "libart-for-test_static_defaults", + ], + shared_libs: [ + "libart", + "libartbase-art-gtest", ], } -art_cc_library_static { +art_cc_library { name: "libartd-runtime-gtest", defaults: [ - "art_debug_defaults", "libart-runtime-gtest-defaults", - "libart-gtest-defaults", - "libartd-for-test_static_defaults", + "libartd-gtest-defaults", + ], + shared_libs: [ + "libartd", + "libartbased-art-gtest", ], } @@ -992,9 +932,11 @@ art_cc_defaults { ], shared_libs: [ "libunwindstack", + "libz", // libziparchive dependency; must be repeated here since it's a static lib. ], static_libs: [ "libgmock", + "libziparchive", ], header_libs: [ "art_cmdlineparser_headers", // For parsed_options_test. diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index ecaf6791f9..3d7ba535c2 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -242,16 +242,7 @@ bool Jit::LoadSymbol(T* address, const char* name, std::string* error_msg) { return true; } -#ifdef ART_STATIC_LIBART -extern "C" JitCompilerInterface* jit_load(); -#endif - bool Jit::LoadCompilerLibrary(std::string* error_msg) { -#ifdef ART_STATIC_LIBART - (void)error_msg; - jit_load_ = &jit_load; - return true; -#else jit_library_handle_ = dlopen( kIsDebugBuild ? "libartd-compiler.so" : "libart-compiler.so", RTLD_NOW); if (jit_library_handle_ == nullptr) { @@ -265,7 +256,6 @@ bool Jit::LoadCompilerLibrary(std::string* error_msg) { return false; } return true; -#endif } bool Jit::CompileMethodInternal(ArtMethod* method, diff --git a/runtime/monitor-inl.h b/runtime/monitor-inl.h index 3b1a998c99..f7e31a0842 100644 --- a/runtime/monitor-inl.h +++ b/runtime/monitor-inl.h @@ -30,7 +30,7 @@ inline ObjPtr<mirror::Object> Monitor::GetObject() REQUIRES_SHARED(Locks::mutato } // Check for request to set lock owner info. -inline void Monitor::CheckLockOwnerRequest(Thread* self) { +void Monitor::CheckLockOwnerRequest(Thread* self) { DCHECK(self != nullptr); Thread* request_thread = lock_owner_request_.load(std::memory_order_relaxed); if (request_thread == self) { @@ -40,13 +40,13 @@ inline void Monitor::CheckLockOwnerRequest(Thread* self) { } } -inline uintptr_t Monitor::LockOwnerInfoChecksum(ArtMethod* m, uint32_t dex_pc, Thread* t) { +uintptr_t Monitor::LockOwnerInfoChecksum(ArtMethod* m, uint32_t dex_pc, Thread* t) { uintptr_t dpc_and_thread = static_cast<uintptr_t>(dex_pc << 8) ^ reinterpret_cast<uintptr_t>(t); return reinterpret_cast<uintptr_t>(m) ^ dpc_and_thread ^ (dpc_and_thread << (/* ptr_size / 2 */ (sizeof m) << 2)); } -inline void Monitor::SetLockOwnerInfo(ArtMethod* method, uint32_t dex_pc, Thread* t) { +void Monitor::SetLockOwnerInfo(ArtMethod* method, uint32_t dex_pc, Thread* t) { lock_owner_method_.store(method, std::memory_order_relaxed); lock_owner_dex_pc_.store(dex_pc, std::memory_order_relaxed); lock_owner_.store(t, std::memory_order_relaxed); @@ -54,9 +54,8 @@ inline void Monitor::SetLockOwnerInfo(ArtMethod* method, uint32_t dex_pc, Thread lock_owner_sum_.store(sum, std::memory_order_relaxed); } -inline void Monitor::GetLockOwnerInfo(/*out*/ ArtMethod** method, - /*out*/ uint32_t* dex_pc, - Thread* t) { +void Monitor::GetLockOwnerInfo(/*out*/ArtMethod** method, /*out*/uint32_t* dex_pc, + Thread* t) { ArtMethod* owners_method; uint32_t owners_dex_pc; Thread* owner; @@ -80,6 +79,7 @@ inline void Monitor::GetLockOwnerInfo(/*out*/ ArtMethod** method, } } + } // namespace art #endif // ART_RUNTIME_MONITOR_INL_H_ diff --git a/simulator/Android.bp b/simulator/Android.bp index 043a1bc28f..d29319a688 100644 --- a/simulator/Android.bp +++ b/simulator/Android.bp @@ -83,24 +83,34 @@ cc_defaults { srcs: [ "code_simulator_container.cc", ], - header_libs: [ - "libart_simulator_headers", - "libbase_headers", - "libart_headers", - "art_libartbase_headers", + shared_libs: [ + "libbase", ], + + header_libs: ["libart_simulator_headers"], export_include_dirs: ["."], // TODO: Consider a proper separation. } -art_cc_library_static { +art_cc_library { name: "libart-simulator-container", defaults: ["libart_simulator_container_defaults"], + shared_libs: [ + "libartbase", + "libart", + ], } -art_cc_library_static { +art_cc_library { name: "libartd-simulator-container", defaults: [ "art_debug_defaults", "libart_simulator_container_defaults", ], + shared_libs: [ + "libartbased", + "libartd", + ], + apex_available: [ + "com.android.art.debug", + ], } diff --git a/test/Android.bp b/test/Android.bp index efff429c62..836beb8675 100644 --- a/test/Android.bp +++ b/test/Android.bp @@ -65,10 +65,6 @@ art_module_cc_defaults { ], }, }, - // Reduce test executable size by disabling automatic export of static lib symbols. - ldflags: [ - "-Wl,--exclude-libs=ALL", - ], } art_module_cc_defaults { @@ -208,33 +204,12 @@ art_cc_defaults { gtest: false, shared_libs: [ - // `libsigchain` must be shared for art_standalone_libsigchain_tests to work. - "libsigchain", - // `libnativeloader` must be shared, otherwise host gtests can't load libraries from - // "art_common/out/host", which is present in `libnativeloader` RUNPATH. - // TODO(b/247108425): modify gtests RUNPATH so that `libnativeloader` can be static linked. - "libnativeloader", - - // `libart(d)` (`art/runtime/jni/java_vm_ext.cc`) and `libnativehelper` - // (`libnativehelper/JniInvocation.c`) define symbols with the same name - // (e.g. `JNI_GetDefaultJavaVMInitArgs`). - // `JavaVmExtTest#*` tests require `libart(d)` implementation of these symbols. - // At the moment `libart(d)` is linked statically (through `libart(d)-gtest`) - // and these symbols are correctly resolved to `libart(d)`. - // If `libnativehelper` and `libart(d)` are both linked dynamically, - // `libart(d)` must be specified in shared_libs list before `libnativehelper`, - // so that its symbols have precedence over `libnativehelper`. - "libnativehelper", + "libbase", + "liblog", + "libz", ], + target: { - android: { - shared_libs: [ - // Dependencies of `libart(d)`, that are not included in *static_defaults. - "libdl_android", - "libstatssocket", - "heapprofd_client_api", - ], - }, linux: { ldflags: [ // Allow jni_compiler_test to find Java_MyClassNatives_bar @@ -252,15 +227,15 @@ art_cc_defaults { ], }, host: { + shared_libs: [ + "libziparchive", + ], cflags: [ "-fsanitize-address-use-after-return=never", "-Wno-unused-command-line-argument", ], }, }, - static_libs: [ - "libartbase-testing", - ], } art_cc_defaults { @@ -270,12 +245,33 @@ art_cc_defaults { "art_gtest_common_defaults", "art_debug_defaults", ], + test_suites: ["art-host-tests"], test_options: { test_suite_tag: ["art-host-gtest"], }, - static_libs: [ + + shared_libs: [ + "libartd", + "libartd-disassembler", "libartd-gtest", + "libdexfiled", + "libprofiled", + "libartbased", + "libartbased-testing", + + // Library `libnativehelper` needs to appear after `libartd` here, + // otherwise the following tests from module `libartd-runtime-gtest` + // will fail because `art/runtime/jni/java_vm_ext.cc` and + // `libnativehelper/JniInvocation.c` define symbols with the same name + // (e.g. `JNI_GetDefaultJavaVMInitArgs`) and the link order does matter + // for these tests: + // - JavaVmExtTest#JNI_GetDefaultJavaVMInitArgs + // - JavaVmExtTest#JNI_GetCreatedJavaVMs + // - JavaVmExtTest#AttachCurrentThread + // - JavaVmExtTest#AttachCurrentThreadAsDaemon + // - JavaVmExtTest#AttachCurrentThread_SmallStack + "libnativehelper", ], } @@ -289,10 +285,12 @@ art_cc_defaults { "art_standalone_test_defaults", "art_gtest_common_defaults", ], + test_suites: [ "general-tests", "mts-art", ], + // Support multilib variants (using different suffix per sub-architecture), which is needed on // build targets with secondary architectures, as the MTS test suite packaging logic flattens // all test artifacts into a single `testcases` directory. @@ -305,17 +303,49 @@ art_cc_defaults { suffix: "64", }, }, + + // We use the "non-d" variants of libraries, as the Release ART APEX does + // not contain the "d" (debug) variants. + shared_libs: [ + "libart", + "libart-compiler", + "libart-disassembler", + "libdexfile", + "libprofile", + "libartbase", + + // Library `libnativehelper` needs to appear after `libart` here, + // otherwise the following tests from module `libart-runtime-gtest` + // will fail because `art/runtime/jni/java_vm_ext.cc` and + // `libnativehelper/JniInvocation.c` define symbols with the same name + // (e.g. `JNI_GetDefaultJavaVMInitArgs`) and the link order does matter + // for these tests: + // - JavaVmExtTest#JNI_GetDefaultJavaVMInitArgs + // - JavaVmExtTest#JNI_GetCreatedJavaVMs + // - JavaVmExtTest#AttachCurrentThread + // - JavaVmExtTest#AttachCurrentThreadAsDaemon + // - JavaVmExtTest#AttachCurrentThread_SmallStack + "libnativehelper", + ], static_libs: [ + // For now, link `libart-gtest` and `libartbase-testing` statically for + // simplicity, to save the added complexity to package it in test suites + // (along with other test artifacts) and install it on device during + // tests. + // TODO(b/192070541): Consider linking `libart-gtest` dynamically. "libart-gtest", + "libartbase-testing", ], + test_for: [ "com.android.art", "com.android.art.debug", ], } +// Properties common to `libart-gtest-defaults` and `libartd-gtest-defaults`. art_cc_defaults { - name: "libart-gtest-defaults", + name: "libart-gtest-common-defaults", defaults: [ "art_defaults", ], @@ -351,6 +381,43 @@ art_cc_defaults { enabled: false, }, }, + apex_available: [ + "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled and others. + "com.android.art", + "test_broken_com.android.art", + ], +} + +art_cc_defaults { + name: "libart-gtest-defaults", + defaults: [ + "libart-gtest-common-defaults", + ], + shared_libs: [ + "libart", + "libart-compiler", + "libdexfile", + "libprofile", + "libartbase", + ], +} + +art_cc_defaults { + name: "libartd-gtest-defaults", + defaults: [ + "art_debug_defaults", + "libart-gtest-common-defaults", + ], + shared_libs: [ + "libartd", + "libartd-compiler", + "libdexfiled", + "libprofiled", + "libartbased", + ], } // Properties common to `libart-gtest` and `libartd-gtest`. @@ -367,6 +434,7 @@ art_cc_defaults { "libgtest_isolated", ], shared_libs: [ + "libbase", "liblog", ], target: { @@ -380,9 +448,17 @@ art_cc_defaults { enabled: false, }, }, + apex_available: [ + "com.android.art.debug", + // TODO(b/183882457): This lib doesn't go into com.android.art, but + // apex_available lists need to be the same for internal libs to avoid + // stubs, and this depends on libdexfiled and others. + "com.android.art", + "test_broken_com.android.art", + ], } -art_cc_library_static { +art_cc_library { name: "libart-gtest", defaults: [ "libart-gtest-common", @@ -392,9 +468,17 @@ art_cc_library_static { "libart-runtime-gtest", "libartbase-art-gtest", ], + shared_libs: [ + "libart", + "libart-compiler", + "libdexfile", + "libprofile", + "libartbase", + "libartbase-testing", + ], } -art_cc_library_static { +art_cc_library { name: "libartd-gtest", defaults: [ "art_debug_defaults", @@ -405,6 +489,14 @@ art_cc_library_static { "libartd-runtime-gtest", "libartbased-art-gtest", ], + shared_libs: [ + "libartd", + "libartd-compiler", + "libdexfiled", + "libprofiled", + "libartbased", + "libartbased-testing", + ], } // ART run-tests. @@ -660,7 +752,7 @@ art_cc_defaults { "2005-pause-all-redefine-multithreaded/pause-all.cc", "2009-structural-local-ref/local-ref.cc", "2035-structural-native-method/structural-native.cc", - "2243-single-step-default/single_step_helper.cc", + "2243-single-step-default/single_step_helper.cc" ], // Use NDK-compatible headers for ctstiagent. header_libs: [ @@ -899,7 +991,7 @@ cc_defaults { "2040-huge-native-alloc/huge_native_buf.cc", "2048-bad-native-registry/native_finalizer.cc", "2235-JdkUnsafeTest/unsafe_test.cc", - "2262-miranda-methods/jni_invoke.cc", + "2262-miranda-methods/jni_invoke.cc", "common/runtime_state.cc", "common/stack_inspect.cc", ], diff --git a/tools/art_verifier/Android.bp b/tools/art_verifier/Android.bp index 19498e0f1f..5d19215f8a 100644 --- a/tools/art_verifier/Android.bp +++ b/tools/art_verifier/Android.bp @@ -59,8 +59,6 @@ art_cc_binary { defaults: [ "art_verifier-defaults", "libart_static_defaults", - // TODO(b/186902856): remove once libart-compiler is merged into libart - "libart-compiler_static_defaults", ], } @@ -70,7 +68,5 @@ art_cc_binary { "art_debug_defaults", "art_verifier-defaults", "libartd_static_defaults", - // TODO(b/186902856): remove once libart-compiler is merged into libart - "libartd-compiler_static_defaults", ], } diff --git a/tools/fuzzer/Android.bp b/tools/fuzzer/Android.bp index c3f35d29e8..0d99943642 100644 --- a/tools/fuzzer/Android.bp +++ b/tools/fuzzer/Android.bp @@ -30,8 +30,6 @@ cc_fuzz { defaults: [ // Run in release mode since debug is too slow. "libart_static_defaults", - // TODO(b/186902856): remove once libart-compiler is merged into libart - "libart-compiler_static_defaults", // To allow the ART module to build correctly. "art_module_source_build_defaults", ], @@ -52,10 +50,7 @@ cc_fuzz { dictionary: "dex.dict", fuzz_config: { triage_assignee: "art-perf-team@google.com", - cc: [ - "solanes@google.com", - "art-bugs@google.com", - ], + cc: ["solanes@google.com", "art-bugs@google.com"], componentid: 86431, acknowledgement: [ "Santiago Aboy Solanes of Google", |