Check if we can use inline asm code, not only on x86_64

This commit is contained in:
Frank Denis 2017-12-31 01:23:58 +01:00
parent a18e21b49d
commit 764656443f
2 changed files with 13 additions and 1 deletions

View File

@ -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)

View File

@ -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