diff -r c9d4daae1dee -r 14f5f3a1e2f7 cmake_modules/compilerchecks.cmake --- a/cmake_modules/compilerchecks.cmake Mon Jul 08 09:54:38 2013 +0200 +++ b/cmake_modules/compilerchecks.cmake Mon Jul 08 12:10:55 2013 +0200 @@ -20,9 +20,6 @@ if(HAVE_STACKPROTECTOR) add_flag_append(CMAKE_C_FLAGS "-fstack-protector-all -fstack-protector") add_flag_append(CMAKE_CXX_FLAGS "-fstack-protector-all -fstack-protector") - add_flag_append(CMAKE_EXE_LINKER_FLAGS "-fstack-protector-all -fstack-protector") - add_flag_append(CMAKE_SHARED_LIBRARY_C_FLAGS "-fstack-protector-all -fstack-protector") - add_flag_append(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fstack-protector-all -fstack-protector") endif() endif() @@ -43,6 +40,13 @@ add_linker_flag("-znoexecstack") endif() + #check for origin on ELF, BSD $ORIGIN support + set(CMAKE_REQUIRED_FLAGS "-Wl,-zorigin") + check_c_compiler_flag("" HAVE_ORIGIN) + if(HAVE_ORIGIN) + add_linker_flag("-zorigin") + endif() + #check for full relro on ELF, Debian security set(CMAKE_REQUIRED_FLAGS "-Wl,-zrelro,-znow") check_c_compiler_flag("" HAVE_RELROFULL)