Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@
# include <sys/personality.h>
# endif

# if SANITIZER_ANDROID && __ANDROID_API__ < 35
// The weak `strerrorname_np` (introduced in API level 35) definition,
// allows for checking the API level at runtime.
extern "C" SANITIZER_WEAK_ATTRIBUTE const char *strerrorname_np(int);
# endif

# if SANITIZER_LINUX && defined(__loongarch__)
# include <sys/sysmacros.h>
# endif
Expand Down Expand Up @@ -1219,17 +1213,11 @@ uptr GetPageSize() {
int rv = internal_sysctl(mib, 2, &pz, &pzl, nullptr, 0);
CHECK_EQ(rv, 0);
return (uptr)pz;
# elif SANITIZER_ANDROID
// Using `getpagesize` because calling `getauxval` or `sysconf` from the
// `.preinit_array` can cause crashes on some older API levels.
return getpagesize();
# elif SANITIZER_USE_GETAUXVAL
# if SANITIZER_ANDROID && __ANDROID_API__ < 35
// The 16 KB page size was introduced in Android 15 (API level 35), while
// earlier versions of Android always used a 4 KB page size.
// We are checking the weak definition of `strerrorname_np` (introduced in API
// level 35) because some earlier API levels crashed when
// `getauxval(AT_PAGESZ)` was called from the `.preinit_array`.
if (!strerrorname_np)
return 4096;
# endif

return getauxval(AT_PAGESZ);
# else
return sysconf(_SC_PAGESIZE); // EXEC_PAGESIZE may not be trustworthy.
Expand Down
Loading