mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 12:36:01 -07:00
Check if we can use inline asm code, not only on x86_64
This commit is contained in:
parent
a18e21b49d
commit
764656443f
12
configure.ac
12
configure.ac
@ -580,6 +580,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|||||||
CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
|
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
|
HAVE_AMD64_ASM_V=0
|
||||||
AS_IF([test "$enable_asm" != "no"],[
|
AS_IF([test "$enable_asm" != "no"],[
|
||||||
AC_MSG_CHECKING(whether we can use x86_64 asm code)
|
AC_MSG_CHECKING(whether we can use x86_64 asm code)
|
||||||
|
@ -113,7 +113,7 @@ sodium_memzero(void *const pnt, const size_t len)
|
|||||||
#elif HAVE_WEAK_SYMBOLS
|
#elif HAVE_WEAK_SYMBOLS
|
||||||
memset(pnt, 0, len);
|
memset(pnt, 0, len);
|
||||||
_sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);
|
_sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);
|
||||||
# ifdef HAVE_AMD64_ASM
|
# ifdef HAVE_INLINE_ASM
|
||||||
__asm__ __volatile__ ("" : : "r"(pnt) : "memory");
|
__asm__ __volatile__ ("" : : "r"(pnt) : "memory");
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user