diff options
-rw-r--r-- | cipher/cipher-internal.h | 2 | ||||
-rw-r--r-- | cipher/rijndael.c | 4 | ||||
-rw-r--r-- | configure.ac | 24 | ||||
-rw-r--r-- | random/rndhw.c | 2 |
4 files changed, 28 insertions, 4 deletions
diff --git a/cipher/cipher-internal.h b/cipher/cipher-internal.h index 437e9c04..025bf2ec 100644 --- a/cipher/cipher-internal.h +++ b/cipher/cipher-internal.h @@ -31,7 +31,7 @@ We use the aligned attribute, thus it is only possible to implement this with gcc. */ #undef NEED_16BYTE_ALIGNED_CONTEXT -#if defined (__GNUC__) +#ifdef HAVE_GCC_ATTRIBUTE_ALIGNED # define NEED_16BYTE_ALIGNED_CONTEXT 1 #endif diff --git a/cipher/rijndael.c b/cipher/rijndael.c index a2aedf01..b9ee8add 100644 --- a/cipher/rijndael.c +++ b/cipher/rijndael.c @@ -52,7 +52,7 @@ /* Helper macro to force alignment to 16 bytes. */ -#ifdef __GNUC__ +#ifdef HAVE_GCC_ATTRIBUTE_ALIGNED # define ATTR_ALIGNED_16 __attribute__ ((aligned (16))) #else # define ATTR_ALIGNED_16 @@ -63,7 +63,7 @@ code. */ #undef USE_PADLOCK #ifdef ENABLE_PADLOCK_SUPPORT -# ifdef __GNUC__ +# ifdef HAVE_GCC_ATTRIBUTE_ALIGNED # if (defined (__i386__) && SIZEOF_UNSIGNED_LONG == 4) || defined(__x86_64__) # define USE_PADLOCK 1 # endif diff --git a/configure.ac b/configure.ac index 0e99ca5b..a2235a8a 100644 --- a/configure.ac +++ b/configure.ac @@ -789,6 +789,21 @@ if test "$gcry_cv_visibility_attribute" = "yes" \ fi +# +# Check whether the compiler supports the GCC style aligned attribute +# +AC_CACHE_CHECK([whether the GCC style aligned attribute is supported], + [gcry_cv_gcc_attribute_aligned], + [gcry_cv_gcc_attribute_aligned=no + AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [[struct { int a; } foo __attribute__ ((aligned (16)));]])], + [gcry_cv_gcc_attribute_aligned=yes])]) +if test "$gcry_cv_gcc_attribute_aligned" = "yes" ; then + AC_DEFINE(HAVE_GCC_ATTRIBUTE_ALIGNED,1, + [Defined if a GCC style "__attribute__ ((aligned (n))" is supported]) +fi + + ####################################### #### Checks for library functions. #### ####################################### @@ -1286,6 +1301,15 @@ cat <<G10EOF G10EOF fi +if test "$gcry_cv_gcc_attribute_aligned" != "yes" ; then +cat <<G10EOF + + Please not that your compiler does not support the GCC style + aligned attribute. Using this software may evoke bus errors. + +G10EOF +fi + if test -n "$gpl"; then echo "Please note that you are building a version of Libgcrypt with" echo " $gpl" diff --git a/random/rndhw.c b/random/rndhw.c index 0a5c9fa3..775d90f0 100644 --- a/random/rndhw.c +++ b/random/rndhw.c @@ -27,7 +27,7 @@ #undef USE_PADLOCK #ifdef ENABLE_PADLOCK_SUPPORT -# ifdef __GNUC__ +# ifdef HAVE_GCC_ATTRIBUTE_ALIGNED # if (defined (__i386__) && SIZEOF_UNSIGNED_LONG == 4) || defined(__x86_64__) # define USE_PADLOCK 1 # endif |