diff options
author | 2024-04-05 22:09:46 +0100 | |
---|---|---|
committer | 2024-04-12 14:24:26 +0000 | |
commit | 245509c7a7f3e4d9578564b2663e282c60a7ed3c (patch) | |
tree | c2b25ecdca6c48e42d7474223003c38d036b3f80 | |
parent | 2b963f984fc6f7aed7a367bca4a8aeb9aee2fec7 (diff) |
Fix standalone tests to only link NDK and module exported libraries
dynamically.
libc++ is left out for now, due to problems using
`stl: "libc++_static"` in some tests (b/333438055).
Introduce a defaults for statically linking libunwindstack, to fix its
dependencies in one place.
Test: mmm art libnativehelper libcore
find out/target/product/vsoc_x86_64/testcases/ -type f -regex '.*\(_standalone_\|libnativebridge\(_cts\|-lazy\)\|libnativeloader\).*_tests?\(32\|64\)?' | xargs readelf -d | grep 'File:\|NEEDED' | grep -v 'lib\(c\|m\|dl\|dl_android\|z\|log\|binder_ndk\|selinux\|nativeloader\|nativehelper\|nativebridge\|dexfile\|statspull\|statssocket\).so\|heapprofd_client_api.so'
Check that no NEEDED dependencies are reported.
Test: atest art_libnativebridge_cts_tests art_standalone_artd_tests art_standalone_cmdline_tests art_standalone_compiler_tests art_standalone_dex2oat_cts_tests art_standalone_dex2oat_tests art_standalone_dexdump_tests art_standalone_dexlist_tests art_standalone_dexopt_chroot_setup_tests art_standalone_dexoptanalyzer_tests art_standalone_dexpreopt_tests art_standalone_disassembler_tests art_standalone_libartbase_tests art_standalone_libartpalette_tests art_standalone_libartservice_tests art_standalone_libarttools_tests art_standalone_libdexfile_external_tests art_standalone_libdexfile_support_tests art_standalone_libdexfile_tests art_standalone_libprofile_tests art_standalone_oatdump_tests art_standalone_odrefresh_tests art_standalone_profman_tests art_standalone_runtime_tests art_standalone_sigchain_tests libnativeloader_lazy_test libnativeloader_test
Bug: 247108425
Change-Id: I082bc88d8605b58981f43ba0677068de2ca3abea
-rw-r--r-- | artd/Android.bp | 5 | ||||
-rw-r--r-- | dex2oat/Android.bp | 6 | ||||
-rw-r--r-- | dexopt_chroot_setup/Android.bp | 3 | ||||
-rw-r--r-- | dexoptanalyzer/Android.bp | 4 | ||||
-rw-r--r-- | libartservice/service/Android.bp | 5 | ||||
-rw-r--r-- | libarttools/Android.bp | 4 | ||||
-rw-r--r-- | libdexfile/Android.bp | 8 | ||||
-rw-r--r-- | libnativeloader/Android.bp | 7 | ||||
-rw-r--r-- | odrefresh/Android.bp | 4 | ||||
-rw-r--r-- | runtime/Android.bp | 38 | ||||
-rw-r--r-- | tools/signal_dumper/Android.bp | 24 |
11 files changed, 57 insertions, 51 deletions
diff --git a/artd/Android.bp b/artd/Android.bp index dadb394c57..2cfaae826b 100644 --- a/artd/Android.bp +++ b/artd/Android.bp @@ -36,7 +36,6 @@ cc_defaults { "profman_headers", ], shared_libs: [ - "libbase", "libbinder_ndk", "libselinux", ], @@ -57,6 +56,7 @@ art_cc_binary { "libartbase", "libartservice", "libarttools", // Contains "libc++fs". + "libbase", "libdexfile", ], apex_available: [ @@ -97,6 +97,7 @@ art_cc_test { shared_libs: [ "libartservice", "libarttools", + "libbase", "libdexfile", ], } @@ -112,6 +113,7 @@ art_cc_test { static_libs: [ "libartservice", "libarttools", + "libbase", "libdexfile", ], test_config_template: "art_standalone_artd_tests.xml", @@ -137,6 +139,7 @@ cc_fuzz { "libartbase", "libartservice", "libarttools", + "libbase", "libdexfile", "liblog", ], diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp index 7da21ea8c9..0153d6a647 100644 --- a/dex2oat/Android.bp +++ b/dex2oat/Android.bp @@ -496,10 +496,12 @@ art_cc_defaults { }, shared_libs: [ - "libcrypto", - "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. "liblog", ], + static_libs: [ + "libcrypto_static", // Must be statically linked in standalone tests + "liblz4", // libart(d)-dex2oat dependency; must be repeated here since it's a static lib. + ], } // Version of ART gtest `art_dex2oat_tests` bundled with the ART APEX on target. diff --git a/dexopt_chroot_setup/Android.bp b/dexopt_chroot_setup/Android.bp index 4f22fdf984..20085ee5a4 100644 --- a/dexopt_chroot_setup/Android.bp +++ b/dexopt_chroot_setup/Android.bp @@ -32,7 +32,6 @@ cc_defaults { "libarttools_binder_utils", ], shared_libs: [ - "libbase", "libbinder_ndk", ], static_libs: [ @@ -51,6 +50,7 @@ art_cc_binary { "libart", "libartbase", "libarttools", // Contains "libc++fs". + "libbase", ], apex_available: [ "com.android.art", @@ -76,6 +76,7 @@ art_cc_test { ], static_libs: [ "libarttools", // Contains "libc++fs". + "libbase", "libgmock", ], test_config_template: "art_standalone_dexopt_chroot_setup_tests.xml", diff --git a/dexoptanalyzer/Android.bp b/dexoptanalyzer/Android.bp index 43953da901..64967191f6 100644 --- a/dexoptanalyzer/Android.bp +++ b/dexoptanalyzer/Android.bp @@ -83,8 +83,8 @@ art_cc_binary { art_cc_defaults { name: "art_dexoptanalyzer_tests_defaults", - shared_libs: [ - "libunwindstack", + defaults: [ + "art_libunwindstack_static_defaults", // Must be statically linked in standalone tests ], data: [ ":art-gtest-jars-LinkageTest", diff --git a/libartservice/service/Android.bp b/libartservice/service/Android.bp index 8de7ebe704..fe0c3af5e0 100644 --- a/libartservice/service/Android.bp +++ b/libartservice/service/Android.bp @@ -32,7 +32,6 @@ cc_defaults { ], export_include_dirs: ["native"], shared_libs: [ - "libbase", "libnativehelper", ], } @@ -48,6 +47,7 @@ cc_library { "libart", "libartbase", "libarttools", // Contains "libc++fs". + "libbase", ], } @@ -65,6 +65,7 @@ cc_library { "libartd", "libartbased", "libarttools", // Contains "libc++fs". + "libbase", ], } @@ -203,6 +204,7 @@ art_cc_test { ], shared_libs: [ "libarttools", + "libbase", ], } @@ -216,6 +218,7 @@ art_cc_test { ], static_libs: [ "libarttools", + "libbase", ], } diff --git a/libarttools/Android.bp b/libarttools/Android.bp index 0b1790770e..a8e3dbf51f 100644 --- a/libarttools/Android.bp +++ b/libarttools/Android.bp @@ -79,7 +79,7 @@ art_cc_defaults { "tools_test.cc", ], shared_libs: [ - "libbase", + "liblog", // libbase dependency ], static_libs: [ "libgmock", @@ -101,6 +101,7 @@ art_cc_test { ], shared_libs: [ "libarttools", + "libbase", ], } @@ -123,6 +124,7 @@ art_cc_test { ], static_libs: [ "libarttools", + "libbase", "libfstab", ], } diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp index b51456c6d9..fa76bbeebb 100644 --- a/libdexfile/Android.bp +++ b/libdexfile/Android.bp @@ -278,6 +278,9 @@ art_cc_library { art_cc_defaults { name: "art_libdexfile_tests_defaults", + defaults: [ + "art_libunwindstack_static_defaults", // Must be statically linked in standalone tests + ], tidy_timeout_srcs: [ "dex/dex_file_verifier_test.cc", ], @@ -310,9 +313,6 @@ art_cc_defaults { ":art-gtest-jars-VerifierDeps", ], header_libs: ["jni_headers"], - shared_libs: [ - "libunwindstack", - ], } // Version of ART gtest `art_libdexfile_tests` bundled with the ART APEX on target. @@ -466,11 +466,11 @@ art_cc_defaults { "external/dex_file_supp_test.cc", ], shared_libs: [ - "libbase", "libdexfile", "liblog", ], static_libs: [ + "libbase", // Must be statically linked in standalone tests "libdexfile_support", ], } diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp index 9e298f5400..3b685747aa 100644 --- a/libnativeloader/Android.bp +++ b/libnativeloader/Android.bp @@ -146,11 +146,12 @@ cc_defaults { "libnativebridge-headers", "libnativehelper_header_only", ], - static_libs: [ - "libgmock", - ], shared_libs: [ + "liblog", // libbase dependency + ], + static_libs: [ "libbase", + "libgmock", ], test_for: [ diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp index 761c8eff0b..e57a340caf 100644 --- a/odrefresh/Android.bp +++ b/odrefresh/Android.bp @@ -41,7 +41,6 @@ cc_defaults { "art-odrefresh-operator-srcs", ], shared_libs: [ - "libbase", "liblog", "libselinux", ], @@ -65,6 +64,7 @@ cc_defaults { srcs: ["odrefresh_main.cc"], shared_libs: [ "libarttools", // Contains "libc++fs". + "libbase", "libdexfile", ], target: { @@ -232,6 +232,7 @@ art_cc_test { host_supported: false, shared_libs: [ "libarttools", + "libbase", ], // 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 @@ -250,6 +251,7 @@ art_cc_test { ], static_libs: [ "libarttools", + "libbase", ], } diff --git a/runtime/Android.bp b/runtime/Android.bp index 72879e8929..e48ac46f6b 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -620,8 +620,30 @@ cc_defaults { ], } +// A defaults to link libunwindstack statically with necessary dependencies, +// where all non-NDK dependencies are static as well. +cc_defaults { + name: "art_libunwindstack_static_defaults", + whole_static_libs: [ + "libunwindstack", + "libbase", + "liblzma", + ], + exclude_static_libs: [ + // This library comes from the static version of libunwindstack. + "libz", + ], + shared_libs: [ + "liblog", + "libz", + ], +} + cc_defaults { name: "libart_static_base_defaults", + defaults: [ + "art_libunwindstack_static_defaults", + ], whole_static_libs: [ "libartpalette", "libbase", @@ -630,11 +652,6 @@ cc_defaults { "liblzma", // libelffile dependency; must be repeated here since it's a static lib. "libnativebridge", "libodrstatslog", - "libunwindstack", - ], - exclude_static_libs: [ - // This library comes from the static version of libunwindstack. - "libz", ], target: { host: { @@ -643,11 +660,6 @@ cc_defaults { "-Wno-unused-command-line-argument", ], }, - bionic: { - whole_static_libs: [ - "libasync_safe", // libunwindstack dependency on Bionic. - ], - }, }, } @@ -949,6 +961,9 @@ art_cc_library_static { art_cc_defaults { name: "art_runtime_tests_defaults", + defaults: [ + "art_libunwindstack_static_defaults", // Must be statically linked in standalone tests + ], target: { host: { cflags: [ @@ -1098,9 +1113,6 @@ art_cc_defaults { "verifier/method_verifier_test.cc", "verifier/reg_type_test.cc", ], - shared_libs: [ - "libunwindstack", - ], static_libs: [ "libgmock", ], diff --git a/tools/signal_dumper/Android.bp b/tools/signal_dumper/Android.bp index 00948b8aad..20960db5c1 100644 --- a/tools/signal_dumper/Android.bp +++ b/tools/signal_dumper/Android.bp @@ -28,26 +28,6 @@ cc_defaults { static_libs: ["liblog"], } -cc_defaults { - name: "signal_dumper_libunwindstack_static_deps", - defaults: [ - "libdexfile_support_static_defaults", - "signal_dumper_libbase_static_deps", - ], - static_libs: [ - "libbase", - "liblog", - "liblzma", - ], - target: { - bionic: { - whole_static_libs: [ - "libasync_safe", - ], - }, - }, -} - art_cc_binary { name: "signal_dumper", @@ -61,14 +41,14 @@ art_cc_binary { defaults: [ "art_defaults", + "libdexfile_support_static_defaults", + "art_libunwindstack_static_defaults", "signal_dumper_libbase_static_deps", - "signal_dumper_libunwindstack_static_deps", ], srcs: ["signal_dumper.cc"], static_libs: [ "libbase", - "libunwindstack", ], } |