diff options
author | juj <jujjyl@gmail.com> | 2019-01-10 19:00:22 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2019-01-10 09:00:22 -0800 |
commit | 6f435bc063840f16b782fd3faa733990cdf3a24e (patch) | |
tree | b49161a069129360aba4f232f281f7c32b1e1205 | |
parent | 51a481f6ed9e39b284421778b63b265eca6c1b58 (diff) | |
download | binaryen-6f435bc063840f16b782fd3faa733990cdf3a24e.tar.gz binaryen-6f435bc063840f16b782fd3faa733990cdf3a24e.tar.bz2 binaryen-6f435bc063840f16b782fd3faa733990cdf3a24e.zip |
Fix build on macOS High Sierra 10.13.1 and Xcode 9.2 (9C40b), which does not have aligned_alloc() (not sure if newer macOS/Xcodes do, or if this an issue with old macOS/Xcode version) (#1862)
-rw-r--r-- | src/support/alloc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/support/alloc.h b/src/support/alloc.h index 86c49d2f5..075896694 100644 --- a/src/support/alloc.h +++ b/src/support/alloc.h @@ -37,6 +37,10 @@ inline void* aligned_malloc(size_t align, size_t size) { void* ret = _aligned_malloc(size, align); if (errno == ENOMEM) ret = nullptr; return ret; +#elif defined(__APPLE__) + void *ptr; + int result = posix_memalign(&ptr, align, size); + return result == 0 ? ptr : nullptr; #else return aligned_alloc(align, size); #endif |