1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-01 11:26:52 +03:00

cmake: Check for HAVE_GCC_VOLATILE_MEMORY_PROTECTION.

This ensures that the memset call is not optimized out by the compiler
(works works with gcc and clang).
This commit is contained in:
Andreas Schneider
2013-07-22 10:18:33 +02:00
parent 5145daba69
commit 1829e9981b
3 changed files with 49 additions and 2 deletions

View File

@ -181,6 +181,18 @@ int main(void) {
return 0;
}" HAVE_MSC_THREAD_LOCAL_STORAGE)
check_c_source_compiles("
#include <string.h>
int main(void)
{
char buf[] = \"This is some content\";
memset(buf, '\\\\0', sizeof(buf)); __asm__ volatile(\"\" : : \"r\"(&buf) : \"memory\");
return 0;
}" HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
if (WITH_DEBUG_CRYPTO)
set(DEBUG_CRYPTO 1)
endif (WITH_DEBUG_CRYPTO)