diff options
author | dormando <dormando@rydia.net> | 2018-03-15 12:57:51 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2018-03-15 12:57:51 -0700 |
commit | 8333182bc8da1c4b4d4b482f67658c60690320cc (patch) | |
tree | 71014f3675c68df7055a0cbcfdd5260cd02966b1 /configure.ac | |
parent | 8bdf0a3bb92046814aebf920eda823d1718ce2c7 (diff) | |
download | memcached-8333182bc8da1c4b4d4b482f67658c60690320cc.tar.gz |
Fix SIGBUS from alignment issues on 64bit ARM
ARMv8 (and in general aarch64) has flipped some strictness requirements.
However, at some point in history the NEED_ALIGN configure check code was
optimized away by GCC.
This fixes detection of alignment, as well as fixes an unaligned access that
snuck in via the logging code.
Also fixes a 64bit GCC atomics test that possibly never worked before.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 9f05cfa..7d1ab31 100644 --- a/configure.ac +++ b/configure.ac @@ -490,6 +490,8 @@ AC_CHECK_FUNCS(clock_gettime) AC_CHECK_FUNCS([accept4], [AC_DEFINE(HAVE_ACCEPT4, 1, [Define to 1 if support accept4])]) AC_CHECK_FUNCS([getopt_long], [AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if support getopt_long])]) +dnl Need to disable opt for alignment check. GCC is too clever and turns this +dnl into wide stores and no cmp under O2. AC_DEFUN([AC_C_ALIGNMENT], [AC_CACHE_CHECK(for alignment, ac_cv_c_alignment, [ @@ -497,6 +499,7 @@ AC_DEFUN([AC_C_ALIGNMENT], [AC_LANG_PROGRAM([ #include <stdlib.h> #include <inttypes.h> +#pragma GCC optimize ("O0") ], [ char *buf = malloc(32); @@ -551,7 +554,8 @@ dnl Check for usage of 64bit atomics dnl 32bit systems shouldn't have these. have_gcc_64atomics=no AC_MSG_CHECKING(for GCC 64bit atomics) -AC_TRY_LINK([],[ +AC_TRY_LINK([#include <inttypes.h> + ],[ uint64_t a; uint64_t b; b = __sync_add_and_fetch(&a, 1); |