$NetBSD: patch-configure,v 1.1 2014/01/07 17:18:29 richard Exp $ cipher/sha1-ssse3-amd64.S suffers a supposedly "infamous" problem wherein expressions containing a '/' (divide) are problematic because according to the SUN x86 Assembly Language Reference Manual, '/' should be treated as starting comments. To get over this, gas has '--divide' do not treat `/' as a comment character Upstream will check this out during 'configure'. --- configure.orig 2014-01-07 13:33:50.440430723 +0000 +++ configure @@ -16932,13 +16932,63 @@ $as_echo "#define HAVE_GCC_INLINE_ASM_BM fi +# +# Check whether GCC assembler needs "-Wa,--divide" to correctly handle +# constant division +# +if test $amd64_as_feature_detection = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler handles division correctly" >&5 +$as_echo_n "checking whether GCC assembler handles division correctly... " >&6; } +if ${gcry_cv_gcc_as_const_division_ok+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcry_cv_gcc_as_const_division_ok=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__asm__("xorl \$(123456789/12345678), %ebp;\n\t"); +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gcry_cv_gcc_as_const_division_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcry_cv_gcc_as_const_division_ok" >&5 +$as_echo "$gcry_cv_gcc_as_const_division_ok" >&6; } + if test "$gcry_cv_gcc_as_const_division_ok" = "no" ; then + # + # Add '-Wa,--divide' to CPPFLAGS and try check again. + # + _gcc_cppflags_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Wa,--divide" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler handles division correctly with \"-Wa,--divide\"" >&5 +$as_echo_n "checking whether GCC assembler handles division correctly with \"-Wa,--divide\"... " >&6; } +if ${gcry_cv_gcc_as_const_division_with_wadivide_ok+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcry_cv_gcc_as_const_division_with_wadivide_ok=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__asm__("xorl \$(123456789/12345678), %ebp;\n\t"); +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gcry_cv_gcc_as_const_division_with_wadivide_ok=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcry_cv_gcc_as_const_division_with_wadivide_ok" >&5 +$as_echo "$gcry_cv_gcc_as_const_division_with_wadivide_ok" >&6; } + if test "$gcry_cv_gcc_as_const_division_with_wadivide_ok" = "no" ; then + CPPFLAGS="$_gcc_cppflags_save" + fi + fi +fi # # Check whether GCC assembler supports features needed for our amd64 # implementations # if test $amd64_as_feature_detection = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler is compatible for amd64 assembly implementations" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GCC assembler is compatible for amd64 assembly implementations" >&5 $as_echo_n "checking whether GCC assembler is compatible for amd64 assembly implementations... " >&6; } if ${gcry_cv_gcc_amd64_platform_as_ok+:} false; then : $as_echo_n "(cached) " >&6 @@ -16955,6 +17005,11 @@ __asm__( "asmfunc:\n\t" ".size asmfunc,.-asmfunc;\n\t" ".type asmfunc,@function;\n\t" + /* Test if assembler allows use of '/' for constant division + * (Solaris/x86 issue). If previous constant division check + * and "-Wa,--divide" workaround failed, this causes assembly + * to be disable on this machine. */ + "xorl \$(123456789/12345678), %ebp;\n\t" ); _ACEOF if ac_fn_c_try_compile "$LINENO"; then :