From 29cd3e5a71787250d5641b40c24efd85360fe7e8 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Thu, 7 Mar 2024 16:17:47 -0600 Subject: [PATCH] Use gcc option _FORTIFY_SOURCE=3 The RPM spec has been updated to use gcc option _FORTIFY_SOURCE=3 since it's now required by rpminspect. The code that configures this option in CMake script has been removed to reduce dependency on CMake. --- cmake/Modules/DefineCompilerFlags.cmake | 5 ----- pki.spec | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake index 413648d13fe..72517cf341f 100644 --- a/cmake/Modules/DefineCompilerFlags.cmake +++ b/cmake/Modules/DefineCompilerFlags.cmake @@ -26,11 +26,6 @@ if (UNIX AND NOT WIN32) if (WITH_STACK_PROTECTOR) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong") endif (WITH_STACK_PROTECTOR) - - check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE) - if (WITH_FORTIFY_SOURCE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2") - endif (WITH_FORTIFY_SOURCE) endif (${CMAKE_C_COMPILER_ID} MATCHES GNU) # diff --git a/pki.spec b/pki.spec index 375de6b3209..b65dc9cad29 100644 --- a/pki.spec +++ b/pki.spec @@ -1041,6 +1041,9 @@ C_FLAGS="$C_FLAGS -D_GLIBCXX_ASSERTIONS" # https://sourceware.org/annobin/annobin.html/Test-lto.html C_FLAGS="$C_FLAGS -fno-lto" + +# https://sourceware.org/annobin/annobin.html/Test-fortify.html +C_FLAGS="$C_FLAGS -D_FORTIFY_SOURCE=3" %endif pkgs=base\