[nolibc] Move GetPageSize to the individual platforms.
GetPageSize wraps sysconf(_SC_PAGESIZE) on POSIX platforms, but
sysconf resides in libc. To make this libc-independent on Linux,
move the wrapper to sanitizer_mac.cc and return the Linux-specific
constant EXEC_PAGESIZE in the sanitizer_linux.cc implementation.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182303 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
index 778a31e..c326750 100644
--- a/lib/sanitizer_common/sanitizer_linux.cc
+++ b/lib/sanitizer_common/sanitizer_linux.cc
@@ -613,6 +613,10 @@
return true;
}
+uptr GetPageSize() {
+ return EXEC_PAGESIZE;
+}
+
// Match full names of the form /path/to/base_name{-,.}*
bool LibraryNameIs(const char *full_name, const char *base_name) {
const char *name = full_name;
diff --git a/lib/sanitizer_common/sanitizer_mac.cc b/lib/sanitizer_common/sanitizer_mac.cc
index 9d74a48..f97d1e3 100644
--- a/lib/sanitizer_common/sanitizer_mac.cc
+++ b/lib/sanitizer_common/sanitizer_mac.cc
@@ -170,6 +170,10 @@
// Nothing here for now.
}
+uptr GetPageSize() {
+ return sysconf(_SC_PAGESIZE);
+}
+
// ----------------- sanitizer_procmaps.h
MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) {
diff --git a/lib/sanitizer_common/sanitizer_posix.cc b/lib/sanitizer_common/sanitizer_posix.cc
index 72dde4c..86e22db 100644
--- a/lib/sanitizer_common/sanitizer_posix.cc
+++ b/lib/sanitizer_common/sanitizer_posix.cc
@@ -35,10 +35,6 @@
namespace __sanitizer {
// ------------- sanitizer_common.h
-uptr GetPageSize() {
- return sysconf(_SC_PAGESIZE);
-}
-
uptr GetMmapGranularity() {
return GetPageSize();
}