From: Paul Floyd Date: Sun, 5 Mar 2023 14:42:39 +0000 (+0100) Subject: Solaris: adapt to aligned_alloc only enforcing a multiple of 4 X-Git-Tag: VALGRIND_3_21_0~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b723d03bb3debd88e5d7cad081e23fda843597f5;p=thirdparty%2Fvalgrind.git Solaris: adapt to aligned_alloc only enforcing a multiple of 4 --- diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 1bdcac7d3e..719d011410 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -1926,6 +1926,19 @@ extern int *___errno (void) __attribute__((weak)); #define VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN 0 #endif +#if defined(VGO_solaris) +#define VG_ALIGNED_ALLOC_ALIGN_POWER_TWO 0 +#else +#define VG_ALIGNED_ALLOC_ALIGN_POWER_TWO 1 +#endif + +#if defined(VGO_solaris) +#define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 1 +#else +#define VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR 0 +#endif + + #if defined (VGO_linux) && !defined(MUSL_LIBC) #define ALIGNED_ALLOC(soname, fnname) \ @@ -1968,7 +1981,8 @@ extern int *___errno (void) __attribute__((weak)); (ULong)alignment, (ULong)size ); \ if (alignment == 0 \ || (VG_ALIGNED_ALLOC_SIZE_MULTIPLE_ALIGN && (size % alignment != 0)) \ - || (alignment & (alignment - 1)) != 0) { \ + || (VG_ALIGNED_ALLOC_ALIGN_POWER_TWO && (alignment & (alignment - 1)) != 0) \ + || (VG_ALIGNED_ALLOC_ALIGN_FACTOR_FOUR && (size % 4 != 0))) { \ SET_ERRNO_EINVAL; \ return 0; \ } \