Merge changes Ibcd45e9b,I1ff5c0fa
* changes:
Do not munmap in MmapFile::~MmapFile
Build bionic/tests with cpp_std experimental.
diff --git a/libc/bionic/grp_pwd_file.cpp b/libc/bionic/grp_pwd_file.cpp
index c17dbb7..37493a7 100644
--- a/libc/bionic/grp_pwd_file.cpp
+++ b/libc/bionic/grp_pwd_file.cpp
@@ -236,7 +236,7 @@
auto mmap_size = fd_stat.st_size;
- const void* map_result = mmap(nullptr, mmap_size, PROT_READ, MAP_SHARED, fd, 0);
+ void* map_result = mmap(nullptr, mmap_size, PROT_READ, MAP_SHARED, fd, 0);
close(fd);
if (map_result == MAP_FAILED) {
@@ -246,7 +246,12 @@
start_ = static_cast<const char*>(map_result);
end_ = start_ + mmap_size - 1;
- return *end_ == '\n';
+ if (*end_ != '\n') {
+ munmap(map_result, mmap_size);
+ return false;
+ }
+
+ return true;
}
template <typename Line, typename Predicate>
diff --git a/linker/Android.bp b/linker/Android.bp
index b6fcf49..2fcf369 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -209,12 +209,6 @@
android: {
static_libs: ["libdebuggerd_handler_fallback"],
},
- android64: {
- cflags: ["-DTARGET_IS_64_BIT"],
- },
- linux_bionic: {
- cflags: ["-DTARGET_IS_64_BIT"],
- },
},
compile_multilib: "both",
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 3f898ba..ff2a7e6 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -863,11 +863,8 @@
}
}
- // If not found - use dlsym_handle_lookup for caller's
- // local_group unless it is part of the global group in which
- // case we already did it.
- if (s == nullptr && caller != nullptr &&
- (caller->get_rtld_flags() & RTLD_GLOBAL) == 0) {
+ // If not found - use dlsym_handle_lookup for caller's local_group
+ if (s == nullptr && caller != nullptr) {
soinfo* local_group_root = caller->get_local_group_root();
return dlsym_handle_lookup(local_group_root->get_primary_namespace(),
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 000d1f7..c40a35b 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -256,7 +256,12 @@
return;
}
#endif
- void* handle = dlopen("linux-vdso.so.1", RTLD_NOW);
+
+ const char* vdso_name = "linux-vdso.so.1";
+#if defined(__i386__)
+ vdso_name = "linux-gate.so.1";
+#endif
+ void* handle = dlopen(vdso_name, RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
dlclose(handle);
}
@@ -1118,7 +1123,7 @@
// Check that RTLD_NEXT of a libc symbol works in dlopened library
TEST(dlfcn, rtld_next_from_library) {
- void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW);
+ void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW | RTLD_GLOBAL);
ASSERT_TRUE(library_with_fclose != nullptr) << dlerror();
void* expected_addr = dlsym(RTLD_DEFAULT, "fclose");
ASSERT_TRUE(expected_addr != nullptr) << dlerror();