965d06da1e
This change addresses multiple problems introduced by
02586a2a34
1. In the case of unsuccessful dlopen the failure guard is triggered
for two namespaces which leads to double unload.
2. In the case where load_tasks includes libraries from 3 and more
namespaces it results in incorrect linking of libraries shared between
second and third/forth and so on namespaces.
The root cause of these problems was recursive call to find_libraries.
It does not do what it is expected to do. It does not form new load_tasks
list and immediately jumps to linking local_group. Not only this skips
reference counting it also will include unlinked but accessible library
from third (and fourth and fifth) namespaces in invalid local group. The
best case scenario here is that for 3 or more namesapces this will
fail to link. The worse case scenario it will link the library
incorrectly with will lead to very hard to catch bugs.
This change removes recursive call and replaces it with explicit list of
local_groups which should be linked. It also revisits the way we do
reference counting - with this change the reference counts are updated after
after libraries are successfully loaded.
Also update soinfo_free to abort in case when linker tries to free same
soinfo for the second time - this makes linker behavior less undefined.
Test: bionic-unit-tests
Bug: http://b/69787209
Change-Id: Iea25ced181a98c6503cce6e2b832c91d697342d5
761 lines
26 KiB
Text
761 lines
26 KiB
Text
//
|
|
// 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.
|
|
//
|
|
|
|
cc_defaults {
|
|
name: "bionic_testlib_defaults",
|
|
host_supported: true,
|
|
cflags: [
|
|
"-Wall",
|
|
"-Werror",
|
|
],
|
|
ldflags: [
|
|
"-Wl,--rpath,${ORIGIN}",
|
|
"-Wl,--enable-new-dtags",
|
|
],
|
|
relative_install_path: "bionic-loader-test-libs",
|
|
gtest: false,
|
|
sanitize: {
|
|
address: false,
|
|
coverage: false,
|
|
},
|
|
stl: "libc++_static",
|
|
target: {
|
|
darwin: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
arch: {
|
|
mips: {
|
|
enabled: false,
|
|
},
|
|
mips64: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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
|
|
// -----------------------------------------------------------------------------
|
|
// In Android.mk to support creating symlinks
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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 - different name non-default location
|
|
// -----------------------------------------------------------------------------
|
|
// In Android.mk to support installing to /data
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Libraries used by dlext tests for open from a zip-file
|
|
// -----------------------------------------------------------------------------
|
|
// In Android.mk to support installing to /data
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// Library with soname which does not match filename
|
|
// ----------------------------------------------------------------------------
|
|
// In Android.mk to support zipped and aligned tests
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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 DT_RUNPATH test helper libraries
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.dt_runpath.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build library with two parents
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.dlopen_2_parents_reloc.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build libtest_check_order_dlsym.so with its dependencies.
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.dlopen_check_order_dlsym.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build libtest_check_order_siblings.so with its dependencies.
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_siblings.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build libtest_check_order_root.so with its dependencies.
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.dlopen_check_order_reloc_main_executable.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build libtest_versioned_lib.so with its dependencies.
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.versioned_lib.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Build libraries needed by pthread_atfork tests
|
|
// -----------------------------------------------------------------------------
|
|
// include $(LOCAL_PATH)/Android.build.pthread_atfork.mk
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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
|
|
// -----------------------------------------------------------------------------
|
|
// In Android.mk to support dependency on libdlext_test
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Library used by ifunc tests
|
|
// -----------------------------------------------------------------------------
|
|
cc_test_library {
|
|
name: "libtest_ifunc",
|
|
defaults: ["bionic_testlib_defaults"],
|
|
srcs: ["dlopen_testlib_ifunc.cpp"],
|
|
|
|
arch: {
|
|
mips: {
|
|
enabled: false,
|
|
},
|
|
mips64: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
}
|
|
|
|
cc_test_library {
|
|
name: "libtest_ifunc_variable",
|
|
defaults: ["bionic_testlib_defaults"],
|
|
srcs: ["dlopen_testlib_ifunc_variable.cpp"],
|
|
shared_libs: [ "libtest_ifunc_variable_impl" ],
|
|
|
|
arch: {
|
|
mips: {
|
|
enabled: false,
|
|
},
|
|
mips64: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
}
|
|
|
|
cc_test_library {
|
|
name: "libtest_ifunc_variable_impl",
|
|
defaults: ["bionic_testlib_defaults"],
|
|
srcs: ["dlopen_testlib_ifunc_variable_impl.cpp"],
|
|
|
|
arch: {
|
|
mips: {
|
|
enabled: false,
|
|
},
|
|
mips64: {
|
|
enabled: false,
|
|
},
|
|
},
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
|
|
target: {
|
|
host: {
|
|
// TODO (dimitry): host ld.gold does not yet support -z global
|
|
// remove this line once it is updated.
|
|
ldflags: ["-fuse-ld=bfd"],
|
|
},
|
|
},
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
|
|
target: {
|
|
host: {
|
|
// TODO (dimitry): host ld.gold does not yet support -z global
|
|
// remove this line once it is updated.
|
|
ldflags: ["-fuse-ld=bfd"],
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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"],
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// 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",
|
|
}
|
|
|
|
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"],
|
|
}
|