OSDN Git Service

linker: don't pass dlextinfo to dependent loads.
authorTorne (Richard Coles) <torne@google.com>
Wed, 2 Sep 2015 13:14:08 +0000 (14:14 +0100)
committerDmitriy Ivanov <dimitry@google.com>
Thu, 8 Oct 2015 19:28:39 +0000 (12:28 -0700)
Don't pass the parent load's dlextinfo to dependent loads, since this
causes the linker to try to load the dependencies using the same
addresses/relro/fds/etc as the main library, which is never going to
work. This was how it worked before ae69a95 which broke this.

Bug: 23742664
Change-Id: I53d8cdf0982d8758e6d2ced4864c704cdf74118f

linker/linker.cpp
tests/libs/Android.mk

index b860f70..faacd49 100644 (file)
@@ -1468,13 +1468,14 @@ static bool find_libraries(soinfo* start_with, const char* const library_names[]
   // Step 1: load and pre-link all DT_NEEDED libraries in breadth first order.
   for (LoadTask::unique_ptr task(load_tasks.pop_front());
       task.get() != nullptr; task.reset(load_tasks.pop_front())) {
-    soinfo* si = find_library_internal(load_tasks, task->get_name(), rtld_flags, extinfo);
+    soinfo* needed_by = task->get_needed_by();
+
+    soinfo* si = find_library_internal(load_tasks, task->get_name(),
+                                       rtld_flags, needed_by == nullptr ? extinfo : nullptr);
     if (si == nullptr) {
       return false;
     }
 
-    soinfo* needed_by = task->get_needed_by();
-
     if (needed_by != nullptr) {
       needed_by->add_child(si);
     }
index a5ef622..5b96306 100644 (file)
@@ -67,6 +67,8 @@ libdlext_test_src_files := \
 libdlext_test_ldflags := \
     -Wl,-z,relro \
 
+libdlext_test_shared_libraries := libtest_simple
+
 module := libdlext_test
 module_tag := optional
 include $(LOCAL_PATH)/Android.build.testlib.mk