diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2017-01-23 19:48:28 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2017-01-23 19:55:37 +0200 |
commit | bf9e0b79e620ca2324224893b07522462b125412 (patch) | |
tree | 5314b9313fbc4611d4a5d92967d77180180760a3 /configure.ac | |
parent | 623aab8a940ea61afe3fef650ad485a755ed9fe7 (diff) | |
download | libgcrypt-bf9e0b79e620ca2324224893b07522462b125412.tar.gz |
bufhelp: use 'may_alias' attribute unaligned pointer types
* configure.ac (gcry_cv_gcc_attribute_may_alias)
(HAVE_GCC_ATTRIBUTE_MAY_ALIAS): New check for 'may_alias' attribute.
* cipher/bufhelp.h (BUFHELP_FAST_UNALIGNED_ACCESS): Enable only if
HAVE_GCC_ATTRIBUTE_MAY_ALIAS is defined.
[BUFHELP_FAST_UNALIGNED_ACCESS] (bufhelp_int_t, bufhelp_u32_t)
(bufhelp_u64_t): Add 'may_alias' attribute.
* src/g10lib.h (fast_wipememory_t): Add HAVE_GCC_ATTRIBUTE_MAY_ALIAS
defined check; Add 'may_alias' attribute.
--
Attribute 'may_alias' was missing from bufhelp unaligned memory access
pointer types, and was causing problems with newer GCC versions (with
more aggressive optimization). This patch fixes broken Camellia-CFB
with '-O3 -flto' flags with GCC-6 on x86-64 and generic GCM with
default '-O2' on x32.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 31c0d553..5dd27ca2 100644 --- a/configure.ac +++ b/configure.ac @@ -994,6 +994,21 @@ fi # +# Check whether the compiler supports the GCC style may_alias attribute +# +AC_CACHE_CHECK([whether the GCC style may_alias attribute is supported], + [gcry_cv_gcc_attribute_may_alias], + [gcry_cv_gcc_attribute_may_alias=no + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [[struct { int a; } foo __attribute__ ((may_alias));]])], + [gcry_cv_gcc_attribute_may_alias=yes])]) +if test "$gcry_cv_gcc_attribute_may_alias" = "yes" ; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE_MAY_ALIAS,1, + [Defined if a GCC style "__attribute__ ((may_alias))" is supported]) +fi + + +# # Check whether the compiler supports 'asm' or '__asm__' keyword for # assembler blocks. # |