diff --git a/configure.ac b/configure.ac index 479dc64f..6e5a113f 100644 --- a/configure.ac +++ b/configure.ac @@ -580,6 +580,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS" ]) +AC_MSG_CHECKING(whether we can use inline asm code) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +]], [[ +int a = 42; +int *pnt = &a; +__asm__ __volatile__ ("" : : "r"(pnt) : "memory"); +]])], + [AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_INLINE_ASM], [1], [inline asm code can be used])] + [AC_MSG_RESULT(no)] +) + HAVE_AMD64_ASM_V=0 AS_IF([test "$enable_asm" != "no"],[ AC_MSG_CHECKING(whether we can use x86_64 asm code) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 2e3fcea8..3a5f835b 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -113,7 +113,7 @@ sodium_memzero(void *const pnt, const size_t len) #elif HAVE_WEAK_SYMBOLS memset(pnt, 0, len); _sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len); -# ifdef HAVE_AMD64_ASM +# ifdef HAVE_INLINE_ASM __asm__ __volatile__ ("" : : "r"(pnt) : "memory"); # endif #else