summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2013-06-20 14:20:36 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2013-06-20 14:20:36 +0300
commit3544fa8aa63bef9a35abf236e9376191b5ec206b (patch)
tree3e48b8009b02dfd544efc5199abc780dcca5a9d1 /configure.ac
parentec2f8de409a93c80efa658134df22074a9bca5a4 (diff)
downloadlibgcrypt-3544fa8aa63bef9a35abf236e9376191b5ec206b.tar.gz
Check if assembler is compatible with AMD64 assembly implementations
* cipher/blowfish-amd64.S: Enable only if HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS is defined. * cipher/camellia-aesni-avx-amd64.S: Ditto. * cipher/camellia-aesni-avx2-amd64.S: Ditto. * cipher/cast5-amd64.S: Ditto. * cipher/rinjdael-amd64.S: Ditto. * cipher/serpent-avx2-amd64.S: Ditto. * cipher/serpent-sse2-amd64.S: Ditto. * cipher/twofish-amd64.S: Ditto. * cipher/blowfish.c: Use AMD64 assembly implementation only if HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS is defined * cipher/camellia-glue.c: Ditto. * cipher/cast5.c: Ditto. * cipher/rijndael.c: Ditto. * cipher/serpent.c: Ditto. * cipher/twofish.c: Ditto. * configure.ac: Check gcc/as compatibility with AMD64 assembly implementations. -- Later these checks can be split and assembly implementations adapted to handle different platforms, but for now disable AMD64 assembly implementations if assembler does not look to be able to handle them. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac30
1 files changed, 30 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 5b9d837e..d9b16392 100644
--- a/configure.ac
+++ b/configure.ac
@@ -941,6 +941,36 @@ if test "$gcry_cv_gcc_inline_asm_avx2" = "yes" ; then
fi
+#
+# Check whether GCC assembler supports features needed for our amd64
+# implementations
+#
+AC_CACHE_CHECK([whether GCC assembler is compatible for amd64 assembly implementations],
+ [gcry_cv_gcc_amd64_platform_as_ok],
+ [gcry_cv_gcc_amd64_platform_as_ok=no
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[__asm__(
+ /* Test if '.set' is supported by underlying assembler. */
+ ".set a0, %rax\n\t"
+ ".set b0, %rdx\n\t"
+ "asmfunc:\n\t"
+ "movq a0, b0;\n\t" /* Fails here if .set ignored by as. */
+
+ /* Test if '.type' and '.size' are supported. */
+ /* These work only on ELF targets. */
+ /* TODO: add COFF (mingw64, cygwin64) support to assembly
+ * implementations. Mingw64/cygwin64 also require additional
+ * work because they use different calling convention. */
+ ".size asmfunc,.-asmfunc;\n\t"
+ ".type asmfunc,@function;\n\t"
+ );]])],
+ [gcry_cv_gcc_amd64_platform_as_ok=yes])])
+if test "$gcry_cv_gcc_amd64_platform_as_ok" = "yes" ; then
+ AC_DEFINE(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS,1,
+ [Defined if underlying assembler is compatible with amd64 assembly implementations])
+fi
+
+
#######################################
#### Checks for library functions. ####
#######################################