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 82
82
# include < sys/personality.h>
83
83
# endif
84
84
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
+
85
91
# if SANITIZER_LINUX && defined(__loongarch__)
86
92
# include < sys/sysmacros.h>
87
93
# endif
@@ -1240,6 +1246,16 @@ uptr GetPageSize() {
1240
1246
CHECK_EQ (rv, 0 );
1241
1247
return (uptr)pz;
1242
1248
# 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
+
1243
1259
return getauxval (AT_PAGESZ);
1244
1260
# else
1245
1261
return sysconf (_SC_PAGESIZE); // EXEC_PAGESIZE may not be trustworthy.
You can’t perform that action at this time.
0 commit comments