[compiler-rt] 9608176 - [scudo] Modify hard-coded page size for Android.
Christopher Ferris via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 18:18:17 PDT 2023
Author: Christopher Ferris
Date: 2023-08-17T18:18:03-07:00
New Revision: 96081768daac1988f0735955fa787e01f5454745
URL: https://github.com/llvm/llvm-project/commit/96081768daac1988f0735955fa787e01f5454745
DIFF: https://github.com/llvm/llvm-project/commit/96081768daac1988f0735955fa787e01f5454745.diff
LOG: [scudo] Modify hard-coded page size for Android.
On Android, if PAGE_SIZE is defined, use that as the hard-coded value.
Otherwise, fallback to using getting the page size.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D158123
Added:
Modified:
compiler-rt/lib/scudo/standalone/common.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/common.h b/compiler-rt/lib/scudo/standalone/common.h
index 82e6cf4aee6186..dec7c56b1b2371 100644
--- a/compiler-rt/lib/scudo/standalone/common.h
+++ b/compiler-rt/lib/scudo/standalone/common.h
@@ -17,6 +17,7 @@
#include <stddef.h>
#include <string.h>
+#include <unistd.h>
namespace scudo {
@@ -131,9 +132,10 @@ inline void yieldProcessor(UNUSED u8 Count) {
extern uptr PageSizeCached;
uptr getPageSizeSlow();
inline uptr getPageSizeCached() {
- // Bionic uses a hardcoded value.
- if (SCUDO_ANDROID)
- return 4096U;
+#if SCUDO_ANDROID && defined(PAGE_SIZE)
+ // Most Android builds have a build-time constant page size.
+ return PAGESIZE;
+#endif
if (LIKELY(PageSizeCached))
return PageSizeCached;
return getPageSizeSlow();
More information about the llvm-commits
mailing list