Merge "Update mmap benchmarks and add madvise bechmarks." into main
diff --git a/README.md b/README.md
index 9a44934..32dda04 100644
--- a/README.md
+++ b/README.md
@@ -101,10 +101,18 @@
upstream-freebsd/
upstream-netbsd/
upstream-openbsd/
- # These directories contain unmolested upstream source. Any time we can
- # just use a BSD implementation of something unmodified, we should.
- # The structure under these directories mimics the upstream tree,
- # but there's also...
+ # These directories contain upstream source with no local changes.
+ # Any time we can just use a BSD implementation of something unmodified,
+ # we should. Ideally these should probably have been three separate git
+ # projects in external/, but they're here instead mostly by historical
+ # accident (because it wouldn't have been easy to import just the tiny
+ # subset of these operating systems that -- unlike Android -- just have
+ # one huge repository rather than lots of little ones and a mechanism
+ # like our `repo` tool).
+ # The structure under these directories mimics the relevant upstream tree,
+ # but in order to actually be able to compile this code in our tree
+ # _without_ making modifications to the source files directly, we also
+ # have the following subdirectories in each one that aren't upstream:
android/
include/
# This is where we keep the hacks necessary to build BSD source
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 7ef79b6..51f7ce9 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -56,7 +56,7 @@
extern "C" void scudo_malloc_set_zero_contents(int);
extern "C" void scudo_malloc_set_pattern_fill_contents(int);
-__LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
+__LIBC_HIDDEN__ constinit WriteProtected<libc_globals> __libc_globals;
// Not public, but well-known in the BSDs.
__BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE
diff --git a/libc/private/WriteProtected.h b/libc/private/WriteProtected.h
index 2faaf77..fac07cb 100644
--- a/libc/private/WriteProtected.h
+++ b/libc/private/WriteProtected.h
@@ -44,7 +44,6 @@
public:
static_assert(sizeof(T) < max_page_size(),
"WriteProtected only supports contents up to max_page_size()");
- static_assert(__is_pod(T), "WriteProtected only supports POD contents");
WriteProtected() = default;
BIONIC_DISALLOW_COPY_AND_ASSIGN(WriteProtected);
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 14a426f..2b48d85 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -935,7 +935,8 @@
size_t expected_alignment = alignof(Type);
if (expected_alignment != 0) {
ASSERT_EQ(0U, (expected_alignment - 1) & reinterpret_cast<uintptr_t>(floating))
- << "Expected alignment " << expected_alignment << " ptr value " << floating;
+ << "Expected alignment " << expected_alignment << " ptr value "
+ << static_cast<void*>(floating);
}
}
diff --git a/tests/wctype_test.cpp b/tests/wctype_test.cpp
index 85a46aa..0f07956 100644
--- a/tests/wctype_test.cpp
+++ b/tests/wctype_test.cpp
@@ -35,20 +35,24 @@
const wchar_t* falses) {
UtfLocale l;
for (const wchar_t* p = trues; *p; ++p) {
- if (!have_dl() && *p > 0x7f) {
- GTEST_LOG_(INFO) << "skipping unicode test " << *p;
+ const wchar_t val_ch = *p;
+ const int val_int = static_cast<int>(val_ch);
+ if (!have_dl() && val_ch > 0x7f) {
+ GTEST_LOG_(INFO) << "skipping unicode test " << val_int;
continue;
}
- EXPECT_TRUE(fn(*p)) << *p;
- EXPECT_TRUE(fn_l(*p, l.l)) << *p;
+ EXPECT_TRUE(fn(val_ch)) << val_int;
+ EXPECT_TRUE(fn_l(val_ch, l.l)) << val_int;
}
for (const wchar_t* p = falses; *p; ++p) {
- if (!have_dl() && *p > 0x7f) {
- GTEST_LOG_(INFO) << "skipping unicode test " << *p;
+ const wchar_t val_ch = *p;
+ const int val_int = static_cast<int>(val_ch);
+ if (!have_dl() && val_ch > 0x7f) {
+ GTEST_LOG_(INFO) << "skipping unicode test " << val_int;
continue;
}
- EXPECT_FALSE(fn(*p)) << *p;
- EXPECT_FALSE(fn_l(*p, l.l)) << *p;
+ EXPECT_FALSE(fn(val_ch)) << val_int;
+ EXPECT_FALSE(fn_l(val_ch, l.l)) << val_int;
}
}