diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp @@ -20,6 +20,21 @@ #define __GLIBC_PREREQ(x, y) 0 #endif +#if SCUDO_FUCHSIA +// Fuchsia only has valloc +#define HAVE_VALLOC 1 +#elif SCUDO_ANDROID +// Android only has pvalloc/valloc on 32 bit +#if !defined(__LP64__) +#define HAVE_PVALLOC 1 +#define HAVE_VALLOC 1 +#endif // !defined(__LP64__) +#else +// All others assumed to support both functions. +#define HAVE_PVALLOC 1 +#define HAVE_VALLOC 1 +#endif + extern "C" { void malloc_enable(void); void malloc_disable(void); @@ -240,7 +255,7 @@ #endif TEST(ScudoWrappersCTest, OtherAlloc) { -#if !SCUDO_FUCHSIA +#if HAVE_PVALLOC const size_t PageSize = sysconf(_SC_PAGESIZE); void *P = pvalloc(Size); @@ -257,7 +272,9 @@ free(P); #endif +#if HAVE_VALLOC EXPECT_EQ(valloc(SIZE_MAX), nullptr); +#endif } #if !SCUDO_FUCHSIA