diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2013-07-22 10:18:33 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2013-07-23 10:44:39 +0200 |
commit | 1829e9981bb5b3269c1bc005f30c4fc41b5724e7 (patch) | |
tree | d08b7dfd163bc6b7e959406511ccf3bbdf667aa4 /ConfigureChecks.cmake | |
parent | 5145daba69e462ddd69d961b0d940db3aebafa11 (diff) | |
download | libssh-1829e9981bb5b3269c1bc005f30c4fc41b5724e7.tar.gz libssh-1829e9981bb5b3269c1bc005f30c4fc41b5724e7.tar.xz libssh-1829e9981bb5b3269c1bc005f30c4fc41b5724e7.zip |
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).
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r-- | ConfigureChecks.cmake | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index fa561d1a..001dfd68 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -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) |