Merge "Use __RENAME for long double functions."
diff --git a/libdl/libdl_cfi.cpp b/libdl/libdl_cfi.cpp
index 483364f..1dd5b21 100644
--- a/libdl/libdl_cfi.cpp
+++ b/libdl/libdl_cfi.cpp
@@ -52,7 +52,10 @@
static uintptr_t cfi_check_addr(uint16_t v, void* Ptr) {
uintptr_t addr = reinterpret_cast<uintptr_t>(Ptr);
- uintptr_t aligned_addr = align_up(addr, CFIShadow::kShadowAlign);
+ // The aligned range of [0, kShadowAlign) uses a single shadow element, therefore all pointers in
+ // this range must get the same aligned_addr below. This matches CFIShadowWriter::Add; not the
+ // same as align_up().
+ uintptr_t aligned_addr = align_down(addr, CFIShadow::kShadowAlign) + CFIShadow::kShadowAlign;
uintptr_t p = aligned_addr - (static_cast<uintptr_t>(v - CFIShadow::kRegularShadowMin)
<< CFIShadow::kCfiCheckGranularity);
#ifdef __arm__
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index cd51e1b..8af2263 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -784,6 +784,12 @@
EXPECT_GT(_XOPEN_IOV_MAX, 0);
EXPECT_GT(_XOPEN_UNIX, 0);
+ // In O, the headers still have -1 (even though all the functionality has
+ // been there for a long time). This was fixed in O-DR, but there isn't a
+ // separate CTS for O-DR, so we'll accept both.
+ EXPECT_TRUE(_POSIX_THREAD_PROCESS_SHARED == -1 ||
+ _POSIX_THREAD_PROCESS_SHARED == _POSIX_VERSION);
+
#if defined(__BIONIC__)
// These tests only pass on bionic, as bionic and glibc has different support on these macros.
// Macros like _POSIX_ASYNCHRONOUS_IO are not supported on bionic yet.