am edc73f62: am ba9c1705: Merge "linker: don\'t pass dlextinfo to dependent loads"

* commit 'edc73f6286bcd1f7d0278d25d4484bf23a0e53b2':
  linker: don't pass dlextinfo to dependent loads
This commit is contained in:
Elliott Hughes 2015-09-04 18:21:34 +00:00 committed by Android Git Automerger
commit a775a41130
3 changed files with 19 additions and 2 deletions

View File

@ -1525,13 +1525,16 @@ static bool find_libraries(soinfo* start_with,
for (LoadTask::unique_ptr task(load_tasks.pop_front());
task.get() != nullptr; task.reset(load_tasks.pop_front())) {
soinfo* needed_by = task->get_needed_by();
bool is_dt_needed = needed_by != nullptr && (needed_by != start_with || add_as_children);
soinfo* si = find_library_internal(load_tasks, task->get_name(), needed_by,
rtld_flags, extinfo);
rtld_flags,
is_dt_needed ? nullptr : extinfo);
if (si == nullptr) {
return false;
}
if (needed_by != nullptr && (needed_by != start_with || add_as_children)) {
if (is_dt_needed) {
needed_by->add_child(si);
}

View File

@ -114,6 +114,10 @@ TEST_F(DlExtTest, ExtInfoUseFd) {
fn f = reinterpret_cast<fn>(dlsym(handle_, "getRandomNumber"));
ASSERT_DL_NOTNULL(f);
EXPECT_EQ(4, f());
uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle_, "dlopen_testlib_taxicab_number"));
ASSERT_DL_NOTNULL(taxicab_number);
EXPECT_EQ(1729U, *taxicab_number);
}
TEST_F(DlExtTest, ExtInfoUseFdWithOffset) {
@ -372,6 +376,10 @@ protected:
fn f = reinterpret_cast<fn>(dlsym(handle_, "getRandomNumber"));
ASSERT_DL_NOTNULL(f);
EXPECT_EQ(4, f());
uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle_, "dlopen_testlib_taxicab_number"));
ASSERT_DL_NOTNULL(taxicab_number);
EXPECT_EQ(1729U, *taxicab_number);
}
void SpawnChildrenAndMeasurePss(const char* lib, bool share_relro, size_t* pss_out);

View File

@ -68,6 +68,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
@ -101,6 +103,8 @@ libdlext_test_norelro_src_files := \
libdlext_test_norelro_ldflags := \
-Wl,-z,norelro \
libdlext_test_norelro_shared_libraries := libtest_simple
module := libdlext_test_norelro
module_tag := optional
build_type := target
@ -113,6 +117,8 @@ include $(TEST_PATH)/Android.build.mk
libdlext_test_fd_src_files := \
dlext_test_library.cpp \
libdlext_test_fd_shared_libraries := libtest_simple
libdlext_test_fd_install_to_out_data := true
module := libdlext_test_fd
module_tag := optional