File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
compiler-rt/lib/sanitizer_common Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 8282# include < sys/personality.h>
8383# endif
8484
85+ # if SANITIZER_ANDROID && __ANDROID_API__ < 35
86+ // The weak `strerrorname_np` (introduced in API level 35) definition,
87+ // allows for checking the API level at runtime.
88+ extern " C" SANITIZER_WEAK_ATTRIBUTE const char *strerrorname_np (int );
89+ # endif
90+
8591# if SANITIZER_LINUX && defined(__loongarch__)
8692# include < sys/sysmacros.h>
8793# endif
@@ -1240,6 +1246,16 @@ uptr GetPageSize() {
12401246 CHECK_EQ (rv, 0 );
12411247 return (uptr)pz;
12421248# elif SANITIZER_USE_GETAUXVAL
1249+ # if SANITIZER_ANDROID && __ANDROID_API__ < 35
1250+ // The 16 KB page size was introduced in Android 15 (API level 35), while
1251+ // earlier versions of Android always used a 4 KB page size.
1252+ // We are checking the weak definition of `strerrorname_np` (introduced in API
1253+ // level 35) because some earlier API levels crashed when
1254+ // `getauxval(AT_PAGESZ)` was called from the `.preinit_array`.
1255+ if (!strerrorname_np)
1256+ return 4096 ;
1257+ # endif
1258+
12431259 return getauxval (AT_PAGESZ);
12441260# else
12451261 return sysconf (_SC_PAGESIZE); // EXEC_PAGESIZE may not be trustworthy.
You can’t perform that action at this time.
0 commit comments