OSDN Git Service

linker: unload RTLD_NODELETE libraries when loading fails
authorDimitry Ivanov <dimitry@google.com>
Wed, 13 Apr 2016 18:46:59 +0000 (11:46 -0700)
committerDimitry Ivanov <dimitry@google.com>
Wed, 13 Apr 2016 18:46:59 +0000 (11:46 -0700)
Linker was not unloading libraries marked with RTLD_NODELETE
even when there was a error on load. For example when one of
dt_needed libraries was not found.

Bug: http://b/27911891
Change-Id: Ibc0bf110aa41fbfdc9f327ad8c364f2e3600af71

linker/linker.cpp

index dfa3d21..a4dae3e 100644 (file)
@@ -3322,7 +3322,7 @@ bool soinfo::is_gnu_hash() const {
 }
 
 bool soinfo::can_unload() const {
-  return (get_rtld_flags() & (RTLD_NODELETE | RTLD_GLOBAL)) == 0;
+  return !is_linked() || ((get_rtld_flags() & (RTLD_NODELETE | RTLD_GLOBAL)) == 0);
 }
 
 bool soinfo::is_linked() const {