protect all types with -fstack-protector-all
authorkoda
Mon, 10 Jun 2013 10:59:49 +0200
changeset 9167 ecf19179b37e
parent 9165 7b0d5388abc4
child 9169 ef53201e95ec
protect all types with -fstack-protector-all
cmake_modules/compilerchecks.cmake
--- a/cmake_modules/compilerchecks.cmake	Mon Jun 10 10:47:59 2013 +0200
+++ b/cmake_modules/compilerchecks.cmake	Mon Jun 10 10:59:49 2013 +0200
@@ -10,13 +10,13 @@
 #TODO: should there be two different checks for C and CXX?
 
 #stack protection, when found it needs to go in the linker flags too (-lssp is added)
-check_c_compiler_flag("-fstack-protector" HAVE_STACKPROTECTOR)
+check_c_compiler_flag("-fstack-protector-all -fstack-protector" HAVE_STACKPROTECTOR)
 if(HAVE_STACKPROTECTOR)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector")
-    set(CMAKE_SHARED_LIBRARY_C_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
-    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all -fstack-protector")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all -fstack-protector")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-all -fstack-protector")
+    set(CMAKE_SHARED_LIBRARY_C_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector-all -fstack-protector")
+    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS  "${CMAKE_SHARED_LIBRARY_C_FLAGS} -fstack-protector-all -fstack-protector")
 endif()
 
 #symbol visibility