| // |
| // Copyright (C) 2012 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| // |
| |
| package { |
| default_team: "trendy_team_native_tools_libraries", |
| default_applicable_licenses: ["bionic_tests_license"], |
| } |
| |
| cc_defaults { |
| name: "bionic_testlib_defaults", |
| host_supported: true, |
| cflags: [ |
| "-Wall", |
| "-Werror", |
| ], |
| ldflags: [ |
| "-Wl,--rpath,${ORIGIN}", |
| "-Wl,--enable-new-dtags", |
| ], |
| static_libs: ["libbase"], |
| relative_install_path: "bionic-loader-test-libs", |
| gtest: false, |
| sanitize: { |
| address: false, |
| }, |
| stl: "libc++_static", |
| target: { |
| darwin: { |
| enabled: false, |
| }, |
| }, |
| strip: { |
| none: true, |
| }, |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Test library ELFs for linker page size related tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_elf_max_page_size_4kib", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elf_max_page_size.c"], |
| ldflags: ["-z max-page-size=0x1000"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries and helper binaries for ELF TLS |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_elftls_shared_var", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_shared_var.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_shared_var_ie", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_shared_var_ie.cpp"], |
| shared_libs: ["libtest_elftls_shared_var"], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_tprel", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_tprel.cpp"], |
| } |
| |
| cc_test { |
| name: "elftls_dlopen_ie_error_helper", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dlopen_ie_error_helper.cpp"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic.cpp"], |
| shared_libs: ["libtest_elftls_shared_var"], |
| } |
| |
| cc_test { |
| name: "thread_exit_cb_helper", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["thread_exit_cb_helper.cpp"], |
| } |
| |
| cc_test { |
| name: "tls_properties_helper", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["tls_properties_helper.cpp"], |
| shared_libs: ["libtest_elftls_shared_var"], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic_filler_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic_filler.cpp"], |
| cflags: [ |
| "-DTLS_FILLER=100", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic_filler_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic_filler.cpp"], |
| cflags: [ |
| "-DTLS_FILLER=200", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic_filler_3", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic_filler.cpp"], |
| cflags: [ |
| "-DTLS_FILLER=300", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic_filler_4", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic_filler.cpp"], |
| cflags: [ |
| "-DTLS_FILLER=400", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_elftls_dynamic_filler_5", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_dynamic_filler.cpp"], |
| cflags: [ |
| "-DTLS_FILLER=500", |
| ], |
| } |
| |
| cc_test { |
| name: "elftls_dtv_resize_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["elftls_dtv_resize_helper.cpp"], |
| include_dirs: [ |
| "bionic/libc", |
| ], |
| static_libs: [ |
| "libbase", |
| ], |
| } |
| |
| cc_test { |
| name: "elftls_align_test_helper", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_align_test_helper.cpp"], |
| stl: "none", // avoid including extra TLS variables in the executable |
| } |
| |
| cc_test { |
| name: "elftls_skew_align_test_helper", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["elftls_skew_align_test_helper.cpp"], |
| stl: "none", // avoid including extra TLS variables in the executable |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library to test gnu-styled hash |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libgnu-hash-table-library", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,--hash-style=gnu"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library to test sysv-styled hash |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libsysv-hash-table-library", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,--hash-style=sysv"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext tests - with GNU RELRO program header |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,-z,relro"], |
| shared_libs: ["libtest_simple"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext tests - without GNU RELRO program header |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test_norelro", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,-z,norelro"], |
| shared_libs: ["libtest_simple"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext tests - recursive use of RELRO sharing |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test_recursive", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_recursive_library.cpp"], |
| ldflags: ["-Wl,-z,relro"], |
| shared_libs: ["libdlext_test"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext tests - different name non-default location |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test_fd", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| relative_install_path: "bionic-loader-test-libs/libdlext_test_fd", |
| shared_libs: ["libtest_simple"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries used by dlext tests for open from a zip-file |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test_zip", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["dlext_test_library.cpp"], |
| shared_libs: ["libatest_simple_zip"], |
| relative_install_path: "bionic-loader-test-libs/libdlext_test_zip", |
| } |
| |
| cc_test_library { |
| name: "libatest_simple_zip", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["dlopen_testlib_simple.cpp"], |
| relative_install_path: "bionic-loader-test-libs/libatest_simple_zip", |
| } |
| |
| // ---------------------------------------------------------------------------- |
| // Library with soname which does not match filename |
| // ---------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdlext_test_different_soname", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlext_test_library.cpp"], |
| ldflags: ["-Wl,-soname=libdlext_test_soname.so"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext tests - zipped and aligned |
| // ----------------------------------------------------------------------------- |
| // In Android.mk to support zipped and aligned tests |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlfcn tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_simple", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_simple.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries and binaries used by memtag_stack_dlopen_test tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_simple_memtag_stack", |
| sanitize: { |
| memtag_stack: true, |
| }, |
| srcs: ["dlopen_testlib_simple.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libtest_depends_on_simple_memtag_stack", |
| sanitize: { |
| memtag_stack: false, |
| }, |
| shared_libs: [ |
| "libtest_simple_memtag_stack", |
| ], |
| srcs: ["dlopen_testlib_depends_on_simple.cpp"], |
| } |
| |
| cc_binary { |
| name: "testbinary_is_stack_mte_after_dlopen", |
| sanitize: { |
| memtag_stack: false, |
| memtag_heap: true, |
| }, |
| srcs: ["testbinary_is_stack_mte_after_dlopen.cpp"], |
| } |
| |
| cc_binary { |
| name: "testbinary_depends_on_simple_memtag_stack", |
| sanitize: { |
| memtag_stack: false, |
| memtag_heap: true, |
| }, |
| shared_libs: [ |
| "libtest_simple_memtag_stack", |
| ], |
| srcs: ["testbinary_is_stack_mte.cpp"], |
| } |
| |
| cc_binary { |
| name: "testbinary_depends_on_depends_on_simple_memtag_stack", |
| sanitize: { |
| memtag_stack: false, |
| memtag_heap: true, |
| }, |
| shared_libs: [ |
| "libtest_depends_on_simple_memtag_stack", |
| ], |
| srcs: ["testbinary_is_stack_mte.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries used by hwasan_test |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_simple_hwasan", |
| arch: { |
| arm64: { |
| enabled: true, |
| }, |
| }, |
| sanitize: { |
| hwaddress: true, |
| }, |
| relative_install_path: "hwasan", |
| enabled: false, |
| srcs: ["dlopen_testlib_simple_hwasan.cpp"], |
| } |
| |
| cc_test_library { |
| // A weird name. This is the vanilla (non-HWASan) copy of the library that |
| // is used for the hwasan test. |
| name: "libtest_simple_hwasan_nohwasan", |
| arch: { |
| arm64: { |
| enabled: true, |
| }, |
| }, |
| stem: "libtest_simple_hwasan", |
| enabled: false, |
| srcs: ["dlopen_testlib_simple_hwasan.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext direct unload on the namespace boundary tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_missing_symbol", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_missing_symbol.cpp"], |
| allow_undefined_symbols: true, |
| relative_install_path: "bionic-loader-test-libs/public_namespace_libs", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlext indirect unload on the namespace boundary tests |
| // |
| // These libraries produce following dependency graph: |
| // libtest_missing_symbol_root (private ns) |
| // +-> libbnstest_public (public ns) |
| // +-> libtest_missing_symbol_child_public (public ns) |
| // +-> libnstest_public (public ns) |
| // +-> libtest_missing_symbol_child_private (private_ns) |
| // +-> libnstest_public (public_ns) |
| // |
| // All libraries except libtest_missing_symbol are located in |
| // private_namespace_libs/ |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_missing_symbol_child_public", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| relative_install_path: "bionic-loader-test-libs/public_namespace_libs", |
| shared_libs: ["libnstest_public"], |
| } |
| |
| cc_test_library { |
| name: "libtest_missing_symbol_child_private", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| shared_libs: ["libnstest_public"], |
| } |
| |
| cc_test_library { |
| name: "libtest_missing_symbol_root", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_missing_symbol.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| allow_undefined_symbols: true, |
| shared_libs: [ |
| "libnstest_public", |
| "libtest_missing_symbol_child_public", |
| "libtest_missing_symbol_child_private", |
| ], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // ----------------------------------------------------------------------------- |
| // Library used by dlfcn nodelete tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_nodelete_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_nodelete_1.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlfcn nodelete tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_nodelete_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_nodelete_2.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by dlfcn nodelete tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_nodelete_dt_flags_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_nodelete_dt_flags_1.cpp"], |
| ldflags: ["-Wl,-z,nodelete"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build test helper libraries for linker namespaces |
| // |
| // This set of libraries is used to verify linker namespaces. |
| // |
| // Test cases |
| // 1. Check that private libraries loaded in different namespaces are |
| // different. Check that dlsym does not confuse them. |
| // 2. Check that public libraries loaded in different namespaces are shared |
| // between them. |
| // 3. Check that namespace sticks on dlopen |
| // 4. Check that having access to shared library (libnstest_public.so) |
| // does not expose symbols from dependent library (libnstest_public_internal.so) |
| // |
| // Dependency tree (visibility) |
| // libnstest_root.so (this should be local to the namespace) |
| // +-> libnstest_public.so |
| // +-> libnstest_public_internal.so |
| // +-> libnstest_private.so |
| // |
| // libnstest_dlopened.so (library in private namespace dlopened from libnstest_root.so) |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libnstest_root", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["namespaces_root.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| shared_libs: [ |
| "libnstest_public", |
| "libnstest_private", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libnstest_public_internal", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["namespaces_public_internal.cpp"], |
| relative_install_path: "bionic-loader-test-libs/public_namespace_libs", |
| } |
| |
| cc_test_library { |
| name: "libnstest_public", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["namespaces_public.cpp"], |
| relative_install_path: "bionic-loader-test-libs/public_namespace_libs", |
| shared_libs: ["libnstest_public_internal"], |
| } |
| |
| cc_test_library { |
| name: "libnstest_private", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["namespaces_private.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| } |
| |
| cc_test_library { |
| name: "libnstest_dlopened", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["namespaces_dlopened.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build test helper libraries for linker namespaces for allow all shared libs |
| // |
| // This set of libraries is used to verify linker namespaces for allow all |
| // shared libs. |
| // |
| // Test cases |
| // 1. Check that namespace a exposes libnstest_ns_a_public1 to |
| // namespace b while keeping libnstest_ns_a_public1_internal as an |
| // internal lib. |
| // 2. Check that namespace b exposes all libraries to namespace a. |
| // |
| // Dependency tree (visibility) |
| // libnstest_ns_b_public2.so (ns:b) |
| // +-> libnstest_ns_a_public1.so (ns:a) |
| // +-> libnstest_ns_a_public2_internal.so (ns:a) |
| // +-> libnstest_ns_b_public3.so (ns:b) |
| // |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libnstest_ns_a_public1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["libnstest_ns_a_public1.cpp"], |
| relative_install_path: "bionic-loader-test-libs/ns_a", |
| shared_libs: [ |
| "libnstest_ns_a_public1_internal", |
| "libnstest_ns_b_public3", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libnstest_ns_a_public1_internal", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["libnstest_ns_a_public1_internal.cpp"], |
| relative_install_path: "bionic-loader-test-libs/ns_a", |
| } |
| |
| cc_test_library { |
| name: "libnstest_ns_b_public2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["libnstest_ns_b_public2.cpp"], |
| relative_install_path: "bionic-loader-test-libs/ns_b", |
| shared_libs: ["libnstest_ns_a_public1"], |
| } |
| |
| cc_test_library { |
| name: "libnstest_ns_b_public3", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["libnstest_ns_b_public3.cpp"], |
| relative_install_path: "bionic-loader-test-libs/ns_b", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build test helper libraries for linker namespaces |
| // |
| // This set of libraries is to test isolated namespaces |
| // |
| // Isolated namespaces do not allow loading of the library outside of |
| // the search paths. |
| // |
| // This library cannot be loaded in isolated namespace because one of DT_NEEDED |
| // libraries is outside of the search paths. |
| // |
| // libnstest_root_not_isolated.so (DT_RUNPATH = $ORIGIN/../private_namespace_libs_external/) |
| // +-> libnstest_public.so |
| // +-> libnstest_private_external.so (located in $ORIGIN/../private_namespace_libs_external/) |
| // |
| // Search path: $NATIVE_TESTS/private_namespace_libs/ |
| // |
| // ----------------------------------------------------------------------------- |
| |
| cc_test_library { |
| name: "libnstest_root_not_isolated", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["namespaces_root.cpp"], |
| shared_libs: [ |
| "libnstest_public", |
| "libnstest_private_external", |
| ], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs", |
| ldflags: ["-Wl,--rpath,$ORIGIN/../private_namespace_libs_external"], |
| } |
| |
| cc_test_library { |
| name: "libnstest_private_external", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["namespaces_private.cpp"], |
| relative_install_path: "bionic-loader-test-libs/private_namespace_libs_external", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // ns_hidden_child linker namespace test |
| // ----------------------------------------------------------------------------- |
| |
| cc_test { |
| name: "ns_hidden_child_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ns_hidden_child_helper.cpp"], |
| shared_libs: [ |
| "libns_hidden_child_internal", |
| "libns_hidden_child_global", |
| "libdl_android", |
| ], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test_library { |
| name: "libns_hidden_child_global", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["ns_hidden_child_global.cpp"], |
| shared_libs: ["libns_hidden_child_internal"], |
| ldflags: ["-Wl,-z,global"], |
| } |
| |
| cc_test_library { |
| name: "libns_hidden_child_internal", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["ns_hidden_child_internal.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libns_hidden_child_public", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["ns_hidden_child_public.cpp"], |
| shared_libs: ["libns_hidden_child_internal"], |
| } |
| |
| cc_test_library { |
| name: "libns_hidden_child_app", |
| defaults: ["bionic_testlib_defaults"], |
| host_supported: false, |
| srcs: ["ns_hidden_child_app.cpp"], |
| shared_libs: ["libns_hidden_child_public"], |
| relative_install_path: "bionic-loader-test-libs/ns_hidden_child_app", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build DT_RUNPATH test helper libraries |
| // |
| // Dependencies |
| // |
| // libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB} |
| // |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a |
| // | |-> dt_runpath_a/libtest_dt_runpath_a.so |
| // |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath |
| // | |-> libtest_dt_runpath_a.so (soname) |
| // |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so |
| // |
| // This one is used to test dlopen |
| // dt_runpath_b_c_x/libtest_dt_runpath_x.so |
| // |
| // ----------------------------------------------------------------------------- |
| |
| // A leaf library in a non-standard directory. |
| cc_test_library { |
| name: "libtest_dt_runpath_a", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_a", |
| } |
| |
| // Depends on library A with a DT_RUNPATH |
| cc_test_library { |
| name: "libtest_dt_runpath_b", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| shared_libs: ["libtest_dt_runpath_a"], |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x", |
| ldflags: ["-Wl,--rpath,${ORIGIN}/../dt_runpath_a"], |
| } |
| |
| // Depends on library A with an incorrect DT_RUNPATH. This does not matter |
| // because B is the first in the D (below) dependency order, and library A |
| // is already loaded using the correct DT_RUNPATH from library B. |
| cc_test_library { |
| name: "libtest_dt_runpath_c", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| shared_libs: ["libtest_dt_runpath_a"], |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x", |
| ldflags: ["-Wl,--rpath,${ORIGIN}/invalid_dt_runpath"], |
| } |
| |
| // D depends on B, C, and Y with DT_RUNPATH. |
| cc_test_library { |
| name: "libtest_dt_runpath_d", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_b.cpp"], |
| shared_libs: [ |
| "libtest_dt_runpath_b", |
| "libtest_dt_runpath_c", |
| "libtest_dt_runpath_y", |
| ], |
| ldflags: [ |
| "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x", |
| "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}", |
| ], |
| } |
| |
| // D version for open-from-zip test with runpath |
| cc_test_library { |
| name: "libtest_dt_runpath_d_zip", |
| srcs: ["dlopen_b.cpp"], |
| shared_libs: [ |
| "libtest_dt_runpath_b", |
| "libtest_dt_runpath_c", |
| "libtest_dt_runpath_y", |
| ], |
| cflags: [ |
| "-Wall", |
| "-Werror", |
| ], |
| gtest: false, |
| relative_install_path: "libtest_dt_runpath_d_zip", |
| ldflags: [ |
| "-Wl,--rpath,${ORIGIN}/dt_runpath_b_c_x", |
| "-Wl,--rpath,${ORIGIN}/dt_runpath_y/${LIB}", |
| ], |
| sanitize: { |
| address: false, |
| }, |
| stl: "libc++_static", |
| target: { |
| darwin: { |
| enabled: false, |
| }, |
| }, |
| } |
| |
| // A leaf library in a directory library D has DT_RUNPATH for. |
| cc_test_library { |
| name: "libtest_dt_runpath_x", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_b_c_x", |
| } |
| |
| // A leaf library in lib or lib64 directory |
| cc_test_library { |
| name: "libtest_dt_runpath_y", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| |
| multilib: { |
| lib32: { |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib", |
| }, |
| lib64: { |
| relative_install_path: "bionic-loader-test-libs/dt_runpath_y/lib64", |
| }, |
| }, |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build library with two parents |
| // |
| // Libraries used by dlfcn tests to verify local group ref_counting |
| // libtest_two_parents*.so |
| // ----------------------------------------------------------------------------- |
| |
| // ..._child.so - correct answer |
| cc_test_library { |
| name: "libtest_two_parents_child", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_2_parents_reloc_answer.cpp"], |
| } |
| |
| // ..._parent1.so - correct answer |
| cc_test_library { |
| name: "libtest_two_parents_parent1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_reloc_answer_impl.cpp"], |
| shared_libs: ["libtest_two_parents_child"], |
| cflags: ["-D__ANSWER=42"], |
| } |
| |
| // ..._parent2.so - incorrect answer |
| cc_test_library { |
| name: "libtest_two_parents_parent2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_reloc_answer_impl.cpp"], |
| shared_libs: ["libtest_two_parents_child"], |
| cflags: ["-D__ANSWER=1"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build libtest_check_order_dlsym.so with its dependencies. |
| // |
| // Libraries used by dlfcn tests to verify correct load order: |
| // ----------------------------------------------------------------------------- |
| |
| // libtest_check_order_2_right.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_2_right", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_dlsym_answer.cpp"], |
| cflags: ["-D__ANSWER=42"], |
| } |
| |
| // libtest_check_order_a.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_a", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_dlsym_answer.cpp"], |
| cflags: ["-D__ANSWER=1"], |
| } |
| |
| // libtest_check_order_b.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_b", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_dlsym_answer.cpp"], |
| cflags: [ |
| "-D__ANSWER=2", |
| "-D__ANSWER2=43", |
| ], |
| } |
| |
| // libtest_check_order_c.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_3_c", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_dlsym_answer.cpp"], |
| cflags: ["-D__ANSWER=3"], |
| } |
| |
| // libtest_check_order_d.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_d", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: ["libtest_check_order_dlsym_b"], |
| srcs: ["dlopen_check_order_dlsym_answer.cpp"], |
| cflags: [ |
| "-D__ANSWER=4", |
| "-D__ANSWER2=4", |
| ], |
| } |
| |
| // libtest_check_order_left.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym_1_left", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_dlsym_a", |
| "libtest_check_order_dlsym_b", |
| ], |
| srcs: ["empty.cpp"], |
| } |
| |
| // libtest_check_order.so |
| cc_test_library { |
| name: "libtest_check_order_dlsym", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_dlsym_1_left", |
| "libtest_check_order_dlsym_2_right", |
| "libtest_check_order_dlsym_3_c", |
| ], |
| srcs: ["empty.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build libtest_check_order_siblings.so with its dependencies. |
| // |
| // Libraries used by dlfcn tests to verify correct relocation order: |
| // libtest_check_order_reloc_siblings*.so |
| // ----------------------------------------------------------------------------- |
| |
| // ..._1.so - empty |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_1", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_reloc_siblings_a", |
| "libtest_check_order_reloc_siblings_b", |
| ], |
| srcs: ["empty.cpp"], |
| } |
| |
| // ..._2.so - empty |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_2", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_reloc_siblings_c", |
| "libtest_check_order_reloc_siblings_d", |
| ], |
| srcs: [ |
| "dlopen_check_order_reloc_grandchild_answer.cpp", |
| ], |
| allow_undefined_symbols: true, |
| } |
| |
| // ..._3.so - get_answer2(); |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_3", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_reloc_siblings_e", |
| "libtest_check_order_reloc_siblings_f", |
| ], |
| srcs: [ |
| "dlopen_check_order_reloc_nephew_answer.cpp", |
| ], |
| } |
| |
| // ..._a.so <- correct impl |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_a", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=42"], |
| } |
| |
| // ..._b.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_b", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=1"], |
| } |
| |
| // ..._c.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_c", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_reloc_siblings_c_1", |
| "libtest_check_order_reloc_siblings_c_2", |
| ], |
| srcs: [ |
| "dlopen_check_order_reloc_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=2"], |
| } |
| |
| // ..._d.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_d", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=3"], |
| } |
| |
| // ..._e.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_e", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_answer_impl.cpp", |
| ], |
| cflags: [ |
| "-D__ANSWER=4", |
| ], |
| } |
| |
| // ..._f.so <- get_answer() |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_f", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_answer.cpp", |
| ], |
| } |
| |
| // ..._c_1.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_c_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_grandchild_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=42"], |
| } |
| |
| // ..._c_2.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings_c_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: [ |
| "dlopen_check_order_reloc_grandchild_answer_impl.cpp", |
| ], |
| cflags: ["-D__ANSWER=0"], |
| } |
| |
| // libtest_check_order_reloc_siblings.so |
| cc_test_library { |
| name: "libtest_check_order_reloc_siblings", |
| defaults: ["bionic_testlib_defaults"], |
| shared_libs: [ |
| "libtest_check_order_reloc_siblings_1", |
| "libtest_check_order_reloc_siblings_2", |
| "libtest_check_order_reloc_siblings_3", |
| ], |
| srcs: [ |
| "empty.cpp", |
| ], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build libtest_check_order_root.so with its dependencies. |
| // |
| // Libraries used by dlfcn tests to verify correct relocation order: |
| // libtest_check_order_reloc_root*.so |
| // ----------------------------------------------------------------------------- |
| |
| // ..._1.so - empty |
| cc_test_library { |
| name: "libtest_check_order_reloc_root_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| } |
| |
| // ..._2.so - this one has the incorrect answer |
| cc_test_library { |
| name: "libtest_check_order_reloc_root_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_reloc_root_answer_impl.cpp"], |
| cflags: ["-D__ANSWER=2"], |
| } |
| |
| // libtest_check_order_reloc_root.so <- implements get_answer3() |
| cc_test_library { |
| name: "libtest_check_order_reloc_root", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_order_reloc_root_answer.cpp"], |
| shared_libs: [ |
| "libtest_check_order_reloc_root_1", |
| "libtest_check_order_reloc_root_2", |
| ], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build libtest_versioned_lib.so with its dependencies. |
| // |
| // Libraries used to test versioned symbols |
| // ----------------------------------------------------------------------------- |
| |
| cc_test_library { |
| name: "libtest_versioned_uselibv1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_uselib.cpp"], |
| shared_libs: ["libtest_versioned_libv1"], |
| } |
| |
| cc_test_library { |
| name: "libtest_versioned_uselibv2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_uselib.cpp"], |
| shared_libs: ["libtest_versioned_libv2"], |
| version_script: "versioned_uselib.map", |
| } |
| |
| cc_test_library { |
| name: "libtest_versioned_uselibv2_other", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_uselib.cpp"], |
| shared_libs: [ |
| "libtest_versioned_otherlib_empty", |
| "libtest_versioned_libv2", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_versioned_uselibv3_other", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_uselib.cpp"], |
| shared_libs: [ |
| "libtest_versioned_otherlib_empty", |
| "libtest_versioned_lib", |
| ], |
| } |
| |
| // lib v1 - this one used during static linking but never used at runtime |
| // which forces libtest_versioned_uselibv1 to use function v1 from |
| // libtest_versioned_lib.so |
| cc_test_library { |
| name: "libtest_versioned_libv1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_lib_v1.cpp"], |
| version_script: "versioned_lib_v1.map", |
| ldflags: ["-Wl,-soname,libtest_versioned_lib.so"], |
| } |
| |
| // lib v2 - to make libtest_versioned_uselibv2.so use version 2 of versioned_function() |
| cc_test_library { |
| name: "libtest_versioned_libv2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_lib_v2.cpp"], |
| version_script: "versioned_lib_v2.map", |
| ldflags: ["-Wl,-soname,libtest_versioned_lib.so"], |
| } |
| |
| // last version - this one is used at the runtime and exports 3 versions |
| // of versioned_symbol(). |
| cc_test_library { |
| name: "libtest_versioned_lib", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_lib_v3.cpp"], |
| version_script: "versioned_lib_v3.map", |
| } |
| |
| // This library is empty, the actual implementation will provide an unversioned |
| // symbol for versioned_function(). |
| cc_test_library { |
| name: "libtest_versioned_otherlib_empty", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| ldflags: ["-Wl,-soname,libtest_versioned_otherlib.so"], |
| } |
| |
| cc_test_library { |
| name: "libtest_versioned_otherlib", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["versioned_lib_other.cpp"], |
| version_script: "versioned_lib_other.map", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Build libraries needed by pthread_atfork tests |
| |
| // This library used to test phtread_atfork handler behaviour |
| // during/after dlclose. |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_pthread_atfork", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["pthread_atfork.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with dependency loop used by dlfcn tests |
| // |
| // libtest_with_dependency_loop -> a -> b -> c -> a |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency_loop", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_loopy_root.cpp"], |
| shared_libs: ["libtest_with_dependency_loop_a"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // libtest_with_dependency_loop_a.so |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency_loop_a", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_loopy_a.cpp"], |
| shared_libs: ["libtest_with_dependency_loop_b_tmp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // libtest_with_dependency_loop_b.so |
| // |
| // this is temporary placeholder - will be removed |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency_loop_b_tmp", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_loopy_invalid.cpp"], |
| ldflags: ["-Wl,-soname=libtest_with_dependency_loop_b.so"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // libtest_with_dependency_loop_b.so |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency_loop_b", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_loopy_b.cpp"], |
| shared_libs: ["libtest_with_dependency_loop_c"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // libtest_with_dependency_loop_c.so |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency_loop_c", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_loopy_c.cpp"], |
| shared_libs: ["libtest_with_dependency_loop_a"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // libtest_relo_check_dt_needed_order.so |
| // | |
| // +-> libtest_relo_check_dt_needed_order_1.so |
| // | |
| // +-> libtest_relo_check_dt_needed_order_2.so |
| // ----------------------------------------------------------------------------- |
| |
| cc_test_library { |
| name: "libtest_relo_check_dt_needed_order", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"], |
| shared_libs: [ |
| "libtest_relo_check_dt_needed_order_1", |
| "libtest_relo_check_dt_needed_order_2", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_relo_check_dt_needed_order_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libtest_relo_check_dt_needed_order_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with dependency used by dlfcn tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_with_dependency", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_simple.cpp"], |
| shared_libs: ["libdlext_test"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by ifunc tests |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_ifunc", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_ifunc.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libtest_ifunc_variable", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_ifunc_variable.cpp"], |
| shared_libs: ["libtest_ifunc_variable_impl"], |
| } |
| |
| cc_test_library { |
| name: "libtest_ifunc_variable_impl", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library used by atexit tests |
| // ----------------------------------------------------------------------------- |
| |
| cc_test_library { |
| name: "libtest_atexit", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["atexit_testlib.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // This library is used by dl_load test to check symbol preempting |
| // by main executable |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdl_preempt_test_1", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dl_preempt_library_1.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // This library is used by dl_load test to check symbol preempting |
| // by libdl_preempt_test_1.so |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdl_preempt_test_2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dl_preempt_library_2.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with DF_1_GLOBAL |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libdl_test_df_1_global", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dl_df_1_global.cpp"], |
| ldflags: ["-Wl,-z,global"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library using symbol from libdl_test_df_1_global |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlsym_df_1_global", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dl_df_1_use_global.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with DF_1_GLOBAL which will be dlopened |
| // (note: libdl_test_df_1_global above will be included in DT_NEEDED) |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlopen_df_1_global", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dl_df_1_global_dummy.cpp"], |
| ldflags: ["-Wl,-z,global"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with weak function |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlsym_weak_func", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlsym_weak_function.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library to check RTLD_LOCAL with dlsym in 'this' |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlsym_from_this", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlsym_from_this_symbol.cpp"], |
| shared_libs: ["libtest_dlsym_from_this_child"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlsym_from_this_child", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlsym_from_this_functions.cpp"], |
| shared_libs: ["libtest_dlsym_from_this_grandchild"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlsym_from_this_grandchild", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlsym_from_this_symbol2.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Empty library |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_empty", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library for inaccessible shared library test |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtestshared", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| relative_install_path: "bionic-loader-test-libs/inaccessible_libs", |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with weak undefined function |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlopen_weak_undefined_func", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_weak_undefined.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Check that RTLD_NEXT of a libc symbol works in dlopened library |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_check_rtld_next_from_library", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["check_rtld_next_from_library.cpp"], |
| native_coverage: false, |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library with constructor that calls dlopen() b/7941716 |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlopen_from_ctor", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries used to check init/fini call order |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_init_fini_order_root", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_init_fini_root.cpp"], |
| shared_libs: [ |
| "libtest_init_fini_order_child", |
| "libtest_init_fini_order_grand_child", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_init_fini_order_root2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_init_fini_root.cpp"], |
| shared_libs: [ |
| "libtest_init_fini_order_grand_child", |
| "libtest_init_fini_order_child", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libtest_init_fini_order_child", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_init_fini_child.cpp"], |
| shared_libs: ["libtest_init_fini_order_grand_child"], |
| } |
| |
| cc_test_library { |
| name: "libtest_init_fini_order_grand_child", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["dlopen_check_init_fini_grand_child.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library that depends on the library with constructor that calls dlopen() b/7941716 |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_dlopen_from_ctor_main", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| shared_libs: ["libtest_dlopen_from_ctor"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Libraries with non-trivial thread_local variable to test dlclose() |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_thread_local_dtor", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["thread_local_dtor.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libtest_thread_local_dtor2", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["thread_local_dtor2.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Library dt_needs libtest_thread_local_dtor/2 (to check no-unload on load_group) |
| // ----------------------------------------------------------------------------- |
| cc_test_library { |
| name: "libtest_indirect_thread_local_dtor", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["empty.cpp"], |
| shared_libs: [ |
| "libtest_thread_local_dtor", |
| "libtest_thread_local_dtor2", |
| ], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Tool to use to align the shared libraries in a zip file. |
| // ----------------------------------------------------------------------------- |
| cc_binary_host { |
| name: "bionic_tests_zipalign", |
| srcs: ["bionic_tests_zipalign.cpp"], |
| cflags: [ |
| "-Wall", |
| "-Werror", |
| ], |
| |
| static_libs: [ |
| "libziparchive", |
| "liblog", |
| "libbase", |
| "libz", |
| "libutils", |
| ], |
| } |
| |
| cc_test_library { |
| name: "libcfi-test", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["cfi_test_lib.cpp"], |
| sanitize: { |
| cfi: false, |
| }, |
| } |
| |
| cc_test_library { |
| name: "libcfi-test-bad", |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["cfi_test_bad_lib.cpp"], |
| sanitize: { |
| cfi: false, |
| }, |
| } |
| |
| cc_test { |
| name: "cfi_test_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["cfi_test_helper.cpp"], |
| ldflags: ["-rdynamic"], |
| } |
| |
| cc_test { |
| name: "cfi_test_helper2", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["cfi_test_helper2.cpp"], |
| shared_libs: ["libcfi-test"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test { |
| name: "preinit_getauxval_test_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["preinit_getauxval_test_helper.cpp"], |
| } |
| |
| cc_test { |
| name: "preinit_syscall_test_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["preinit_syscall_test_helper.cpp"], |
| } |
| |
| cc_test { |
| name: "ld_preload_test_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_preload_test_helper.cpp"], |
| shared_libs: ["ld_preload_test_helper_lib1"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test_library { |
| name: "ld_preload_test_helper_lib1", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_preload_test_helper_lib1.cpp"], |
| } |
| |
| cc_test_library { |
| name: "ld_preload_test_helper_lib2", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_preload_test_helper_lib2.cpp"], |
| } |
| |
| cc_test { |
| name: "ld_config_test_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_config_test_helper.cpp"], |
| shared_libs: ["ld_config_test_helper_lib1"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test_library { |
| name: "ld_config_test_helper_lib1", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_config_test_helper_lib1.cpp"], |
| shared_libs: ["ld_config_test_helper_lib2"], |
| relative_install_path: "bionic-loader-test-libs/ns2", |
| // Mark the library DF_1_GLOBAL so it is added to every linker namespace. |
| ldflags: ["-Wl,-z,global"], |
| } |
| |
| cc_test_library { |
| name: "ld_config_test_helper_lib2", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_config_test_helper_lib2.cpp"], |
| relative_install_path: "bionic-loader-test-libs/ns2", |
| } |
| |
| cc_test_library { |
| name: "ld_config_test_helper_lib3", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["ld_config_test_helper_lib3.cpp"], |
| } |
| |
| cc_test { |
| name: "exec_linker_helper", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["exec_linker_helper.cpp"], |
| shared_libs: ["exec_linker_helper_lib"], |
| ldflags: ["-Wl,--rpath,${ORIGIN}/.."], |
| } |
| |
| cc_test_library { |
| name: "exec_linker_helper_lib", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["exec_linker_helper_lib.cpp"], |
| } |
| |
| cc_test_library { |
| name: "libsegment_gap_outer", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["segment_gap_outer.cpp"], |
| ldflags: ["-Wl,-T,bionic/tests/libs/segment_gap_outer.lds"], |
| } |
| |
| cc_test_library { |
| name: "libsegment_gap_inner", |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["segment_gap_inner.cpp"], |
| } |
| |
| // ----------------------------------------------------------------------------- |
| // Check that we support all kinds of relocations: regular, "relocation packer", |
| // and both the old and new SHT_RELR constants. |
| // ----------------------------------------------------------------------------- |
| |
| // This is what got standardized for SHT_RELR. |
| cc_test_library { |
| name: "librelocations-RELR", |
| ldflags: [ |
| "-Wl,--pack-dyn-relocs=relr", |
| "-Wl,--no-use-android-relr-tags", |
| ], |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["relocations.cpp"], |
| } |
| |
| // This is the same encoding as SHT_RELR, but using OS-specific constants. |
| cc_test_library { |
| name: "librelocations-ANDROID_RELR", |
| ldflags: [ |
| "-Wl,--pack-dyn-relocs=relr", |
| "-Wl,--use-android-relr-tags", |
| ], |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["relocations.cpp"], |
| } |
| |
| // This is the old relocation packer encoding (DT_ANDROID_REL/DT_ANDROID_RELA). |
| cc_test_library { |
| name: "librelocations-ANDROID_REL", |
| ldflags: ["-Wl,--pack-dyn-relocs=android"], |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["relocations.cpp"], |
| } |
| |
| // This is not packed at all. |
| cc_test_library { |
| name: "librelocations-fat", |
| ldflags: ["-Wl,--pack-dyn-relocs=none"], |
| host_supported: false, |
| defaults: ["bionic_testlib_defaults"], |
| srcs: ["relocations.cpp"], |
| } |
| |
| cc_defaults { |
| name: "bionic_targets_only", |
| enabled: false, |
| target: { |
| android: { |
| enabled: true, |
| }, |
| linux_bionic: { |
| enabled: true, |
| }, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_sync_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| sanitize: { |
| memtag_heap: true, |
| diag: { |
| memtag_heap: true, |
| }, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_async_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| sanitize: { |
| memtag_heap: true, |
| diag: { |
| memtag_heap: false, |
| }, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_disabled_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| sanitize: { |
| memtag_heap: false, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_static_sync_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| static_executable: true, |
| sanitize: { |
| memtag_heap: true, |
| diag: { |
| memtag_heap: true, |
| }, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_static_async_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| static_executable: true, |
| sanitize: { |
| memtag_heap: true, |
| diag: { |
| memtag_heap: false, |
| }, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "heap_tagging_static_disabled_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["heap_tagging_helper.cpp"], |
| static_executable: true, |
| sanitize: { |
| memtag_heap: false, |
| hwaddress: false, |
| }, |
| } |
| |
| cc_test { |
| name: "stack_tagging_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["stack_tagging_helper.cpp"], |
| sanitize: { |
| memtag_heap: true, |
| memtag_stack: true, |
| diag: { |
| memtag_heap: true, |
| }, |
| hwaddress: false, |
| }, |
| header_libs: ["bionic_libc_platform_headers"], |
| cflags: ["-fexceptions"], |
| } |
| |
| cc_test { |
| name: "stack_tagging_static_helper", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only", |
| ], |
| srcs: ["stack_tagging_helper.cpp"], |
| static_executable: true, |
| sanitize: { |
| memtag_heap: true, |
| memtag_stack: true, |
| diag: { |
| memtag_heap: true, |
| }, |
| hwaddress: false, |
| }, |
| header_libs: ["bionic_libc_platform_headers"], |
| cflags: ["-fexceptions"], |
| } |
| |
| cc_genrule { |
| name: "libdlext_test_zip_zipaligned", |
| out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"], |
| tools: [ |
| "soong_zip", |
| "bionic_tests_zipalign", |
| ], |
| srcs: [ |
| ":libdlext_test_zip", |
| ":libatest_simple_zip", |
| ":exec_linker_helper", |
| ":exec_linker_helper_lib", |
| ], |
| cmd: "mkdir -p $(genDir)/zipdir/libdir &&" + |
| " cp $(in) $(genDir)/zipdir/libdir/ &&" + |
| " touch $(genDir)/zipdir/empty_file.txt &&" + |
| " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" + |
| " $(location bionic_tests_zipalign) 16384 $(out).unaligned $(out)", |
| |
| } |
| |
| cc_genrule { |
| name: "libdlext_test_runpath_zip_zipaligned", |
| out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"], |
| tools: [ |
| "soong_zip", |
| "bionic_tests_zipalign", |
| ], |
| srcs: [ |
| ":libtest_dt_runpath_d_zip", |
| ":libtest_dt_runpath_a", |
| ":libtest_dt_runpath_b", |
| ":libtest_dt_runpath_c", |
| ":libtest_dt_runpath_x", |
| ":libtest_dt_runpath_y", |
| ], |
| cmd: "mkdir -p $(genDir)/zipdir/libdir &&" + |
| " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" + |
| " PRIVATE_LIB_OR_LIB64=lib;" + |
| " else" + |
| " PRIVATE_LIB_OR_LIB64=lib64;" + |
| " fi &&" + |
| " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" + |
| " PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" + |
| " fi &&" + |
| " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" + |
| " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" + |
| " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" + |
| " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" + |
| " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" + |
| " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" + |
| " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" + |
| " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" + |
| " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" + |
| " touch $(genDir)/zipdir/empty_file.txt &&" + |
| " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" + |
| " $(location bionic_tests_zipalign) 16384 $(out).unaligned $(out)", |
| } |
| |
| cc_defaults { |
| name: "memtag_globals_defaults", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only" |
| ], |
| cflags: [ |
| "-Wno-array-bounds", |
| "-Wno-unused-variable", |
| ], |
| header_libs: ["bionic_libc_platform_headers"], |
| sanitize: { |
| hwaddress: false, |
| memtag_heap: true, |
| memtag_globals: true, |
| diag: { |
| memtag_heap: true, |
| } |
| }, |
| } |
| |
| cc_test_library { |
| name: "memtag_globals_dso", |
| defaults: [ "memtag_globals_defaults" ], |
| srcs: ["memtag_globals_dso.cpp"], |
| } |
| |
| cc_test { |
| name: "memtag_globals_binary", |
| defaults: [ "memtag_globals_defaults" ], |
| srcs: ["memtag_globals_binary.cpp"], |
| shared_libs: [ "memtag_globals_dso" ], |
| // This binary is used in the bionic-unit-tests as a data dependency, and is |
| // in the same folder as memtag_globals_dso. But, the default cc_test rules |
| // make this binary (when just explicitly built and shoved in |
| // /data/nativetest64/) end up in a subfolder called |
| // 'memtag_globals_binary'. When this happens, the explicit build fails to |
| // find the DSO because the default rpath is just ${ORIGIN}, and because we |
| // want this to be usable both from bionic-unit-tests and explicit builds, |
| // let's just not put it in a subdirectory. |
| no_named_install_directory: true, |
| } |
| |
| cc_test { |
| name: "memtag_globals_binary_static", |
| defaults: [ "memtag_globals_defaults" ], |
| srcs: ["memtag_globals_binary.cpp"], |
| static_libs: [ "memtag_globals_dso" ], |
| no_named_install_directory: true, |
| static_executable: true, |
| } |
| |
| // This is a regression test for b/314038442, where binaries built *without* MTE |
| // globals would have out-of-bounds RELR relocations, which where then `ldg`'d, |
| // which resulted in linker crashes. |
| cc_test { |
| name: "mte_globals_relr_regression_test_b_314038442", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only" |
| ], |
| cflags: [ "-Wno-array-bounds" ], |
| ldflags: [ "-Wl,--pack-dyn-relocs=relr" ], |
| srcs: ["mte_globals_relr_regression_test_b_314038442.cpp"], |
| no_named_install_directory: true, |
| sanitize: { |
| memtag_globals: false, |
| }, |
| } |
| |
| // Same test as above, but also for MTE globals, just for the sake of it. |
| cc_test { |
| name: "mte_globals_relr_regression_test_b_314038442_mte", |
| defaults: [ |
| "bionic_testlib_defaults", |
| "bionic_targets_only" |
| ], |
| cflags: [ "-Wno-array-bounds" ], |
| ldflags: [ "-Wl,--pack-dyn-relocs=relr" ], |
| srcs: ["mte_globals_relr_regression_test_b_314038442.cpp"], |
| no_named_install_directory: true, |
| sanitize: { |
| memtag_globals: true, |
| }, |
| } |