Merge "Fix signal trampolines."
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 9801fa1..712e80e 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -232,7 +232,7 @@
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
#endif
-static soinfo __libdl_info("libdl.so", nullptr);
+static soinfo __libdl_info("libdl.so", nullptr, RTLD_GLOBAL);
// This is used by the dynamic linker. Every process gets these symbols for free.
soinfo* get_libdl_info() {
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 6589684..3b18900 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -282,13 +282,13 @@
g_soinfo_links_allocator.protect_all(protection);
}
-static soinfo* soinfo_alloc(const char* name, struct stat* file_stat) {
+static soinfo* soinfo_alloc(const char* name, struct stat* file_stat, int rtld_flags) {
if (strlen(name) >= SOINFO_NAME_LEN) {
DL_ERR("library name \"%s\" too long", name);
return nullptr;
}
- soinfo* si = new (g_soinfo_allocator.alloc()) soinfo(name, file_stat);
+ soinfo* si = new (g_soinfo_allocator.alloc()) soinfo(name, file_stat, rtld_flags);
sonext->next = si;
sonext = si;
@@ -453,7 +453,7 @@
return nullptr;
}
-soinfo::soinfo(const char* name, const struct stat* file_stat) {
+soinfo::soinfo(const char* name, const struct stat* file_stat, int rtld_flags) {
memset(this, 0, sizeof(*this));
strlcpy(this->name, name, sizeof(this->name));
@@ -464,6 +464,8 @@
set_st_dev(file_stat->st_dev);
set_st_ino(file_stat->st_ino);
}
+
+ this->rtld_flags = rtld_flags;
}
static unsigned elfhash(const char* _name) {
@@ -713,6 +715,10 @@
ElfW(Sym)* s = nullptr;
for (soinfo* si = start; (s == nullptr) && (si != nullptr); si = si->next) {
+ if ((si->get_rtld_flags() & RTLD_GLOBAL) == 0) {
+ continue;
+ }
+
s = soinfo_elf_lookup(si, elf_hash, name);
if (s != nullptr) {
*found = si;
@@ -803,7 +809,7 @@
}
}
-static soinfo* load_library(LoadTaskList& load_tasks, const char* name, int dlflags, const android_dlextinfo* extinfo) {
+static soinfo* load_library(LoadTaskList& load_tasks, const char* name, int rtld_flags, const android_dlextinfo* extinfo) {
int fd = -1;
ScopedFd file_guard(-1);
@@ -838,7 +844,7 @@
}
}
- if ((dlflags & RTLD_NOLOAD) != 0) {
+ if ((rtld_flags & RTLD_NOLOAD) != 0) {
DL_ERR("library \"%s\" wasn't loaded and RTLD_NOLOAD prevented it", name);
return nullptr;
}
@@ -849,7 +855,7 @@
return nullptr;
}
- soinfo* si = soinfo_alloc(SEARCH_NAME(name), &file_stat);
+ soinfo* si = soinfo_alloc(SEARCH_NAME(name), &file_stat, rtld_flags);
if (si == nullptr) {
return nullptr;
}
@@ -881,7 +887,7 @@
return nullptr;
}
-static soinfo* find_library_internal(LoadTaskList& load_tasks, const char* name, int dlflags, const android_dlextinfo* extinfo) {
+static soinfo* find_library_internal(LoadTaskList& load_tasks, const char* name, int rtld_flags, const android_dlextinfo* extinfo) {
soinfo* si = find_loaded_library_by_name(name);
@@ -889,7 +895,7 @@
// of this fact is done by load_library.
if (si == nullptr) {
TRACE("[ '%s' has not been found by name. Trying harder...]", name);
- si = load_library(load_tasks, name, dlflags, extinfo);
+ si = load_library(load_tasks, name, rtld_flags, extinfo);
}
return si;
@@ -913,7 +919,7 @@
}
static bool find_libraries(const char* const library_names[], size_t library_names_size, soinfo* soinfos[],
- soinfo* ld_preloads[], size_t ld_preloads_size, int dlflags, const android_dlextinfo* extinfo) {
+ soinfo* ld_preloads[], size_t ld_preloads_size, int rtld_flags, const android_dlextinfo* extinfo) {
// Step 0: prepare.
LoadTaskList load_tasks;
for (size_t i = 0; i < library_names_size; ++i) {
@@ -939,7 +945,7 @@
// 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(), dlflags, extinfo);
+ soinfo* si = find_library_internal(load_tasks, task->get_name(), rtld_flags, extinfo);
if (si == nullptr) {
return false;
}
@@ -984,7 +990,7 @@
return true;
}
-static soinfo* find_library(const char* name, int dlflags, const android_dlextinfo* extinfo) {
+static soinfo* find_library(const char* name, int rtld_flags, const android_dlextinfo* extinfo) {
if (name == nullptr) {
somain->ref_count++;
return somain;
@@ -992,7 +998,7 @@
soinfo* si;
- if (!find_libraries(&name, 1, &si, nullptr, 0, dlflags, extinfo)) {
+ if (!find_libraries(&name, 1, &si, nullptr, 0, rtld_flags, extinfo)) {
return nullptr;
}
@@ -1774,6 +1780,14 @@
return 0;
}
+int soinfo::get_rtld_flags() {
+ if (has_min_version(1)) {
+ return rtld_flags;
+ }
+
+ return 0;
+}
+
// This is a return on get_children()/get_parents() if
// 'this->flags' does not have FLAG_NEW_SOINFO set.
static soinfo::soinfo_list_t g_empty_list;
@@ -2194,7 +2208,7 @@
return;
}
- soinfo* si = soinfo_alloc("[vdso]", nullptr);
+ soinfo* si = soinfo_alloc("[vdso]", nullptr, 0);
si->phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff);
si->phnum = ehdr_vdso->e_phnum;
@@ -2215,7 +2229,7 @@
#else
#define LINKER_PATH "/system/bin/linker"
#endif
-static soinfo linker_soinfo_for_gdb(LINKER_PATH, nullptr);
+static soinfo linker_soinfo_for_gdb(LINKER_PATH, nullptr, 0);
/* gdb expects the linker to be in the debug shared object list.
* Without this, gdb has trouble locating the linker's ".text"
@@ -2279,7 +2293,7 @@
INFO("[ android linker & debugger ]");
- soinfo* si = soinfo_alloc(args.argv[0], nullptr);
+ soinfo* si = soinfo_alloc(args.argv[0], nullptr, RTLD_GLOBAL);
if (si == nullptr) {
exit(EXIT_FAILURE);
}
@@ -2354,7 +2368,7 @@
memset(needed_library_names, 0, sizeof(needed_library_names));
needed_library_name_list.copy_to_array(needed_library_names, needed_libraries_count);
- if (needed_libraries_count > 0 && !find_libraries(needed_library_names, needed_libraries_count, needed_library_si, g_ld_preloads, ld_preloads_count, 0, nullptr)) {
+ if (needed_libraries_count > 0 && !find_libraries(needed_library_names, needed_libraries_count, needed_library_si, g_ld_preloads, ld_preloads_count, RTLD_GLOBAL, nullptr)) {
__libc_format_fd(2, "CANNOT LINK EXECUTABLE DEPENDENCIES: %s\n", linker_get_error_buffer());
exit(EXIT_FAILURE);
}
@@ -2467,7 +2481,7 @@
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_addr + elf_hdr->e_phoff);
- soinfo linker_so("[dynamic linker]", nullptr);
+ soinfo linker_so("[dynamic linker]", nullptr, 0);
// If the linker is not acting as PT_INTERP entry_point is equal to
// _start. Which means that the linker is running as an executable and
diff --git a/linker/linker.h b/linker/linker.h
index 37d513e..ca96e2f 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -201,7 +201,7 @@
// should not use it in any way.
bool has_DT_SYMBOLIC;
- soinfo(const char* name, const struct stat* file_stat);
+ soinfo(const char* name, const struct stat* file_stat, int rtld_flags);
void CallConstructors();
void CallDestructors();
@@ -217,6 +217,8 @@
ino_t get_st_ino();
dev_t get_st_dev();
+ int get_rtld_flags();
+
soinfo_list_t& get_children();
soinfo_list_t& get_parents();
@@ -248,6 +250,7 @@
soinfo_list_t parents;
// version >= 1
+ int rtld_flags;
};
extern soinfo* get_libdl_info();
diff --git a/tests/Android.mk b/tests/Android.mk
index 49efdad..2acb047 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -310,6 +310,7 @@
bionic-unit-tests-glibc_src_files := \
atexit_test.cpp \
+ dlfcn_test.cpp \
bionic-unit-tests-glibc_whole_static_libraries := \
libBionicStandardTests \
@@ -317,8 +318,12 @@
bionic-unit-tests-glibc_ldlibs := \
-lrt -ldl \
+bionic-unit-tests-glibc_c_includes := \
+ bionic/libc \
+
bionic-unit-tests-glibc_cflags := $(test_cflags)
bionic-unit-tests-glibc_cppflags := $(test_cppflags)
+bionic-unit-tests-glibc_ldflags := -Wl,--export-dynamic
module := bionic-unit-tests-glibc
module_tag := optional
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index c561403..1bf186b 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -188,25 +188,62 @@
// get_answer2() is defined in (b, d)
void* sym = dlsym(RTLD_DEFAULT, "dlopen_test_get_answer");
ASSERT_TRUE(sym == nullptr);
- void* handle = dlopen("libtest_check_order.so", RTLD_NOW);
+ void* handle = dlopen("libtest_check_order.so", RTLD_NOW | RTLD_GLOBAL);
ASSERT_TRUE(handle != nullptr);
typedef int (*fn_t) (void);
fn_t fn, fn2;
fn = reinterpret_cast<fn_t>(dlsym(RTLD_DEFAULT, "dlopen_test_get_answer"));
- ASSERT_TRUE(fn != NULL);
+ ASSERT_TRUE(fn != NULL) << dlerror();
fn2 = reinterpret_cast<fn_t>(dlsym(RTLD_DEFAULT, "dlopen_test_get_answer2"));
- ASSERT_TRUE(fn2 != NULL);
+ ASSERT_TRUE(fn2 != NULL) << dlerror();
ASSERT_EQ(42, fn());
ASSERT_EQ(43, fn2());
dlclose(handle);
}
+TEST(dlfcn, dlopen_check_rtld_local) {
+ void* sym = dlsym(RTLD_DEFAULT, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym == nullptr);
+
+ // implicit RTLD_LOCAL
+ void* handle = dlopen("libtest_simple.so", RTLD_NOW);
+ sym = dlsym(RTLD_DEFAULT, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym == nullptr);
+ ASSERT_SUBSTR("undefined symbol: dlopen_testlib_simple_func", dlerror());
+ sym = dlsym(handle, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym != nullptr);
+ ASSERT_TRUE(reinterpret_cast<bool (*)(void)>(sym)());
+ dlclose(handle);
+
+ // explicit RTLD_LOCAL
+ handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_LOCAL);
+ sym = dlsym(RTLD_DEFAULT, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym == nullptr);
+ ASSERT_SUBSTR("undefined symbol: dlopen_testlib_simple_func", dlerror());
+ sym = dlsym(handle, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym != nullptr);
+ ASSERT_TRUE(reinterpret_cast<bool (*)(void)>(sym)());
+ dlclose(handle);
+}
+
+TEST(dlfcn, dlopen_check_rtld_global) {
+ void* sym = dlsym(RTLD_DEFAULT, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym == nullptr);
+
+ void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_GLOBAL);
+ sym = dlsym(RTLD_DEFAULT, "dlopen_testlib_simple_func");
+ ASSERT_TRUE(sym != nullptr) << dlerror();
+ ASSERT_TRUE(reinterpret_cast<bool (*)(void)>(sym)());
+ dlclose(handle);
+}
+
// libtest_with_dependency_loop.so -> libtest_with_dependency_loop_a.so ->
// libtest_with_dependency_loop_b.so -> libtest_with_dependency_loop_c.so ->
// libtest_with_dependency_loop_a.so
TEST(dlfcn, dlopen_check_loop) {
void* handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW);
+#if defined(__BIONIC__)
ASSERT_TRUE(handle == nullptr);
ASSERT_STREQ("dlopen failed: recursive link to \"libtest_with_dependency_loop_a.so\"", dlerror());
// This symbol should never be exposed
@@ -220,6 +257,10 @@
handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW | RTLD_NOLOAD);
ASSERT_TRUE(handle == nullptr);
ASSERT_STREQ("dlopen failed: library \"libtest_with_dependency_loop.so\" wasn't loaded and RTLD_NOLOAD prevented it", dlerror());
+#else // glibc allows recursive links
+ ASSERT_TRUE(handle != nullptr);
+ dlclose(handle);
+#endif
}
TEST(dlfcn, dlopen_failure) {
diff --git a/tests/libs/Android.build.testlib.mk b/tests/libs/Android.build.testlib.mk
new file mode 100644
index 0000000..5b688e4
--- /dev/null
+++ b/tests/libs/Android.build.testlib.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2014 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.
+#
+
+build_target := SHARED_LIBRARY
+build_type := host
+include $(TEST_PATH)/Android.build.mk
+build_type := target
+include $(TEST_PATH)/Android.build.mk
+
diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk
index f7c3f9f..1e8be88 100644
--- a/tests/libs/Android.mk
+++ b/tests/libs/Android.mk
@@ -30,9 +30,7 @@
module := no-elf-hash-table-library
module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
endif
# -----------------------------------------------------------------------------
@@ -46,15 +44,13 @@
module := libdlext_test
module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# create symlink to libdlext_test.so for symlink test
# -----------------------------------------------------------------------------
# Use = instead of := to defer the evaluation of $@
-$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD = \
+$(TARGET_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
$(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
ifneq ($(TARGET_2ND_ARCH),)
@@ -63,6 +59,13 @@
$(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
endif
+# host symlinks
+$(HOST_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
+ $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
+
+$(HOST_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
+ $(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
+
# -----------------------------------------------------------------------------
# Library used by dlext tests - without GNU RELRO program header
# -----------------------------------------------------------------------------
@@ -98,9 +101,7 @@
dlopen_testlib_simple.cpp
module := libtest_simple
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# Libraries used by dlfcn tests to verify correct load order:
@@ -111,9 +112,7 @@
libtest_check_order_2_right_cflags := -D__ANSWER=42
module := libtest_check_order_2_right
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order_a.so
@@ -123,9 +122,7 @@
libtest_check_order_a_cflags := -D__ANSWER=1
module := libtest_check_order_a
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order_b.so
@@ -135,9 +132,7 @@
libtest_check_order_b_cflags := -D__ANSWER=2 -D__ANSWER2=43
module := libtest_check_order_b
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order_c.so
@@ -147,9 +142,7 @@
libtest_check_order_3_c_cflags := -D__ANSWER=3
module := libtest_check_order_3_c
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order_d.so
@@ -160,9 +153,7 @@
libtest_check_order_d_shared_libraries := libtest_check_order_b
libtest_check_order_d_cflags := -D__ANSWER=4 -D__ANSWER2=4
module := libtest_check_order_d
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order_left.so
@@ -173,9 +164,7 @@
libtest_check_order_1_left_shared_libraries := libtest_check_order_a libtest_check_order_b
module := libtest_check_order_1_left
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_check_order.so
@@ -187,9 +176,7 @@
libtest_check_order_2_right libtest_check_order_3_c
module := libtest_check_order
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# Library with dependency loop used by dlfcn tests
@@ -202,9 +189,7 @@
libtest_with_dependency_loop_a
module := libtest_with_dependency_loop
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_with_dependency_loop_a.so
@@ -215,9 +200,7 @@
libtest_with_dependency_loop_b_tmp
module := libtest_with_dependency_loop_a
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_with_dependency_loop_b.so
@@ -228,9 +211,7 @@
libtest_with_dependency_loop_b_tmp_ldflags := -Wl,-soname=libtest_with_dependency_loop_b.so
module := libtest_with_dependency_loop_b_tmp
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_with_dependency_loop_b.so
@@ -239,9 +220,7 @@
libtest_with_dependency_loop_b_shared_libraries := libtest_with_dependency_loop_c
module := libtest_with_dependency_loop_b
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_with_dependency_loop_c.so
@@ -252,9 +231,7 @@
libtest_with_dependency_loop_a
module := libtest_with_dependency_loop_c
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# libtest_relo_check_dt_needed_order.so
@@ -269,15 +246,13 @@
libtest_relo_check_dt_needed_order_src_files := dlopen_testlib_relo_check_dt_needed_order.cpp
libtest_relo_check_dt_needed_order_1_src_files := dlopen_testlib_relo_check_dt_needed_order_1.cpp
libtest_relo_check_dt_needed_order_2_src_files := dlopen_testlib_relo_check_dt_needed_order_2.cpp
-build_type := target
-build_target := SHARED_LIBRARY
module := libtest_relo_check_dt_needed_order
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
module := libtest_relo_check_dt_needed_order_1
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
module := libtest_relo_check_dt_needed_order_2
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# Library with dependency used by dlfcn tests
@@ -288,22 +263,22 @@
libtest_with_dependency_shared_libraries := libdlext_test
module := libtest_with_dependency
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# Library used by ifunc tests
# -----------------------------------------------------------------------------
+libtest_ifunc_src_files := \
+ dlopen_testlib_ifunc.c
+
+libtest_ifunc_clang_host := false
+module := libtest_ifunc
+build_target := SHARED_LIBRARY
+
+build_type := host
+include $(TEST_PATH)/Android.build.mk
+
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64 x86 x86_64))
- libtest_ifunc_src_files := \
- dlopen_testlib_ifunc.c
-
- LOCAL_SDK_VERSION := current
- module := libtest_ifunc
- build_type := target
- build_target := SHARED_LIBRARY
-
ifeq ($(TARGET_ARCH),arm64)
libtest_ifunc_multilib := 64
# TODO: This is a workaround - remove it once gcc
@@ -311,6 +286,7 @@
libtest_ifunc_cflags := -mglibc
endif
+ build_type := target
include $(TEST_PATH)/Android.build.mk
endif
@@ -322,11 +298,7 @@
atexit_testlib.cpp
module := libtest_atexit
-build_target := SHARED_LIBRARY
-build_type := target
-include $(TEST_PATH)/Android.build.mk
-build_type := host
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
# -----------------------------------------------------------------------------
# Library with weak function
@@ -335,8 +307,4 @@
dlsym_weak_function.cpp
module := libtest_dlsym_weak_func
-build_target := SHARED_LIBRARY
-build_type := target
-include $(TEST_PATH)/Android.build.mk
-build_type := host
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.mk
diff --git a/tests/libs/dlopen_testlib_simple.cpp b/tests/libs/dlopen_testlib_simple.cpp
index afe54b4..3226955 100644
--- a/tests/libs/dlopen_testlib_simple.cpp
+++ b/tests/libs/dlopen_testlib_simple.cpp
@@ -14,10 +14,11 @@
* limitations under the License.
*/
+#include <stdint.h>
#include <stdlib.h>
uint32_t dlopen_testlib_taxicab_number = 1729;
-bool dlopen_testlib_simple_func() {
+extern "C" bool dlopen_testlib_simple_func() {
return true;
}