diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2014-11-29 13:57:41 -0800 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2014-12-02 10:54:26 -0800 |
commit | ab972b9adf8789a9e1b03129cd7f0c22e6bba117 (patch) | |
tree | 33b816d65afbcd622e38730b7516ba59ddb48fac /linker/dlfcn.cpp | |
parent | f64c43ba6c9244c50e904961dc432f04b1dfcfd9 (diff) | |
download | bionic-ab972b9adf8789a9e1b03129cd7f0c22e6bba117.zip bionic-ab972b9adf8789a9e1b03129cd7f0c22e6bba117.tar.gz bionic-ab972b9adf8789a9e1b03129cd7f0c22e6bba117.tar.bz2 |
Count references for groups instead of instances
Count references on the group level to avoid
partially unloading function that might be
referenced by other libraries in the local_group
Bonus: with this change we can correctly unload recursively
linked libraries. is_recursive check is removed.
Also dynamic executables (not .so) with 0 DT_NEEDED libraries
are now correctly linked.
Change-Id: Idfa83baef402840599b93a875f2881d9f020dbcd
Diffstat (limited to 'linker/dlfcn.cpp')
-rw-r--r-- | linker/dlfcn.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp index 2486e02..6aa9cd7 100644 --- a/linker/dlfcn.cpp +++ b/linker/dlfcn.cpp @@ -236,16 +236,17 @@ static soinfo __libdl_info("libdl.so", nullptr, 0, RTLD_GLOBAL); // This is used by the dynamic linker. Every process gets these symbols for free. soinfo* get_libdl_info() { - if ((__libdl_info.flags & FLAG_LINKED) == 0) { - __libdl_info.flags |= FLAG_LINKED; + if ((__libdl_info.flags_ & FLAG_LINKED) == 0) { + __libdl_info.flags_ |= FLAG_LINKED; __libdl_info.strtab_ = ANDROID_LIBDL_STRTAB; __libdl_info.symtab_ = g_libdl_symtab; __libdl_info.nbucket_ = sizeof(g_libdl_buckets)/sizeof(unsigned); __libdl_info.nchain_ = sizeof(g_libdl_chains)/sizeof(unsigned); __libdl_info.bucket_ = g_libdl_buckets; __libdl_info.chain_ = g_libdl_chains; - __libdl_info.ref_count = 1; + __libdl_info.ref_count_ = 1; __libdl_info.strtab_size_ = sizeof(ANDROID_LIBDL_STRTAB); + __libdl_info.local_group_root_ = &__libdl_info; } return &__libdl_info; |