Use DDEBUG in Makefile.inc instead of DEBUG_CFLAGS

Instead of building debug packages with "-O0" and unsetting
"_FORTIFY_SOURCE" (which could lead to annocheck errors), pass
-DDEBUG, which will enable guarded code, while retaining the
"_FORTIFY_SOURCE" protection.

Related: rhbz#2044882

Signed-off-by: Bryan Gurney <bgurney@redhat.com>
This commit is contained in:
Bryan Gurney 2022-02-01 10:31:11 -05:00
parent c7220d1066
commit 432841f235
2 changed files with 34 additions and 1 deletions

View File

@ -21,7 +21,7 @@
Name: nvml
Version: 1.10.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Persistent Memory Development Kit (formerly NVML)
License: BSD
URL: http://pmem.io/pmdk
@ -36,6 +36,7 @@ Source1: pmdk-%{version}-man.tar.gz
# but do_open never initializes "attr"
# may read that object
Patch0: Makefile-bypass-check-doc-in-check.patch
Patch1: pmdk-1.10.1-use_ddebug_instead_of_debug_cflags.patch
BuildRequires: gcc
@ -510,6 +511,7 @@ provided in the command line options to check whether files are in a consistent
%prep
%setup -q -n pmdk-%{upstreamversion}
%patch0 -p1
%patch1 -p1
%build
@ -592,6 +594,10 @@ mkdir -p %{buildroot}%{_mandir}
%changelog
* Mon Feb 07 2022 Bryan Gurney <bgurney@redhat.com> - 1.10.1-2
- Use DDEBUG in Makefile.inc instead of DEBUG_CFLAGS
- Related: rhbz#2044882
* Thu Oct 14 2021 Bryan Gurney <bgurney@redhat.com> - 1.10.1-1
- Update to PMDK version 1.10.1
- Related: rhbz#1874208

View File

@ -0,0 +1,27 @@
--- pmdk-1.10.1/src/Makefile.inc.orig 2022-02-01 10:57:54.530694627 -0500
+++ pmdk-1.10.1/src/Makefile.inc 2022-02-01 10:59:19.461777353 -0500
@@ -67,14 +67,10 @@ DEFAULT_CFLAGS += -DSTRINGOP_TRUNCATION_
endif
ifeq ($(DEBUG),1)
-# Undefine _FORTIFY_SOURCE in case it's set in system-default or
-# user-defined CFLAGS as it conflicts with -O0.
-DEBUG_CFLAGS += -Wp,-U_FORTIFY_SOURCE
-DEBUG_CFLAGS += -O0 -ggdb -DDEBUG
LIB_SUBDIR = /pmdk_debug
OBJDIR = debug
else
-DEFAULT_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+DEFAULT_CFLAGS += -O2 -g -D_FORTIFY_SOURCE=2
LIB_SUBDIR =
OBJDIR = nondebug
endif
@@ -119,7 +115,7 @@ endif
CFLAGS += $(EXTRA_CFLAGS)
ifeq ($(DEBUG),1)
-CFLAGS += $(EXTRA_CFLAGS_DEBUG) $(DEBUG_CFLAGS)
+CFLAGS += $(EXTRA_CFLAGS_DEBUG) -DDEBUG
else
CFLAGS += $(EXTRA_CFLAGS_RELEASE)
endif