From 1829e9981bb5b3269c1bc005f30c4fc41b5724e7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 22 Jul 2013 10:18:33 +0200 Subject: 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). --- ConfigureChecks.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ConfigureChecks.cmake') 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 + +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) -- cgit v1.2.3