mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
cmake: Build with -fstack-protector-strong if available #2597
If not available, fall back to -fstack-protector + --param=ssp-buffer-size=4 If that isn't available, do nothing. See the following articles for more information: https://lwn.net/Articles/584225/ https://outflux.net/blog/archives/2014/01/27/fstack-protector-strong/
This commit is contained in:
parent
b2ece148e6
commit
2b4cbbebf4
@ -117,6 +117,16 @@ if (MINGW)
|
||||
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
||||
endif()
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
|
||||
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
|
||||
|
||||
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
|
||||
add_definitions(-fstack-protector-strong)
|
||||
elseif(HAS_FSTACK_PROTECTOR_FLAG)
|
||||
add_definitions(-fstack-protector --param ssp-buffer-size=4)
|
||||
endif()
|
||||
|
||||
option(
|
||||
TRAVIS_CI_BUILD "Travis CI build. Extra compilation flags will be set." OFF)
|
||||
|
||||
@ -126,7 +136,6 @@ if(TRAVIS_CI_BUILD)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-Og HAS_OG_FLAG)
|
||||
else()
|
||||
set(HAS_OG_FLAG 0)
|
||||
|
Loading…
Reference in New Issue
Block a user