Skip to content

Commit 7fbdd8d

Browse files
committed
build: removed -fcf-protection build option for old GCC
This allows oneDNN to build successfully with GCC 7.x
1 parent 599c839 commit 7fbdd8d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cmake/SDL.cmake

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ macro(sdl_unix_common_ccxx_flags var)
3030
append(${var} "-fPIC -Wformat -Wformat-security")
3131
endmacro()
3232

33-
macro(sdl_gnu_common_ccxx_flags var)
33+
macro(sdl_gnu_common_ccxx_flags var gnu_version)
3434
append(${var} "-fstack-protector-strong")
35-
if(DNNL_TARGET_ARCH STREQUAL "X64")
35+
if(NOT (${gnu_version} VERSION_LESS 8.0)
36+
AND (DNNL_TARGET_ARCH STREQUAL "X64"))
3637
append(${var} "-fcf-protection=full")
3738
endif()
3839
endmacro()
@@ -61,7 +62,8 @@ if(UNIX)
6162
append(ONEDNN_SDL_COMPILER_FLAGS "-D_FORTIFY_SOURCE=2")
6263
endif()
6364
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
64-
sdl_gnu_common_ccxx_flags(ONEDNN_SDL_COMPILER_FLAGS)
65+
sdl_gnu_common_ccxx_flags(ONEDNN_SDL_COMPILER_FLAGS
66+
CMAKE_CXX_COMPILER_VERSION)
6567
sdl_gnu_src_ccxx_flags(CMAKE_SRC_CCXX_FLAGS)
6668
sdl_gnu_example_ccxx_flags(CMAKE_EXAMPLE_CCXX_FLAGS)
6769
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang")

cmake/host_compiler.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if(DPCPP_HOST_COMPILER_KIND MATCHES "^(GNU|CLANG)$")
7878

7979
if(DPCPP_HOST_COMPILER_KIND STREQUAL "GNU")
8080
platform_gnu_nowarn_ccxx_flags(DPCPP_CXX_NOWARN_FLAGS ${DPCPP_HOST_COMPILER_MAJOR_VER}.${DPCPP_HOST_COMPILER_MINOR_VER})
81-
sdl_gnu_common_ccxx_flags(DPCPP_HOST_COMPILER_OPTS)
81+
sdl_gnu_common_ccxx_flags(DPCPP_HOST_COMPILER_OPTS DPCPP_HOST_COMPILER_VER)
8282
sdl_gnu_src_ccxx_flags(DPCPP_SRC_CXX_FLAGS)
8383
sdl_gnu_example_ccxx_flags(DPCPP_EXAMPLE_CXX_FLAGS)
8484

0 commit comments

Comments
 (0)