Use _fortify_level to disable fortification in debug builds

Fedora commit: cb41bf05f1f267ad79b8f72ee95addcc29e8f2e5

Related: RHEL-8419
This commit is contained in:
Siddhesh Poyarekar 2023-09-22 09:58:30 +00:00 committed by Lukas Javorsky
parent f6b2adba64
commit fbadaf5b92
1 changed files with 5 additions and 2 deletions

View File

@ -872,10 +872,10 @@ CFLAGS="$CFLAGS -fPIC"
%if %{with debug}
# Override all optimization flags when making a debug build
# -D_FORTIFY_SOURCE requires optimizations enabled. Disable the fortify.
CFLAGS=`echo "$CFLAGS" | sed -r 's/-D_FORTIFY_SOURCE=[012]/-D_FORTIFY_SOURCE=0/'`
%undefine _fortify_level
CFLAGS=`echo "$CFLAGS" | sed -r 's/-O[0123]//'`
CFLAGS="$CFLAGS -O0 -g -D_FORTIFY_SOURCE=0"
CFLAGS="$CFLAGS -O0 -g"
# Fixes for Fedora 32 & Rawhide (GCC 10.0):
%if 0%{?fedora} >= 32
@ -1628,6 +1628,9 @@ fi
%endif
%changelog
* Wed May 31 2023 Siddhesh Poyarekar <siddhesh@redhat.com> - 3:10.5.20-2
- Use _fortify_level to disable fortification in debug builds
* Tue May 30 2023 Lukas Javorsky <ljavorsk@redhat.com> - 3:10.5.20-1
- Rebase to version 10.5.20