device-mapper-multipath/0062-RH-use-rpm-optflags-if-present.patch
Benjamin Marzinski 9abdc502cf device-mapper-multipath-0.8.4-4
Rebased on top of additional commits staged for upstream
  * Previous patches 0048-0060 are now patches 0053-0054 & 0059-0069
Add 0048-libmultipath-add-device-to-hwtable.c.patch
Add 0049-master-libmultipath-fix-use-after-free-when-iscsi-lo.patch
Add 0050-libmultipath-warn-if-freeing-path-that-holds-mpp-hwe.patch
Add 0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
Add 0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
Add 0055-libmultipath-remove-code-duplication-in-path-countin.patch
Add 0056-libmultipath-count-pending-paths-as-active-on-loads.patch
Add 0057-libmultipath-deal-with-flushing-no-maps.patch
Add 0058-multipath-deal-with-delegation-failures-correctly.patch
Add 0070-multipath-add-libmpathvalid-library.patch
  * adds the libmpathvalid.so library to determine if devices are
    valid multipath paths.
Add 0071-libmultipath-add-uid-failback-for-dasd-devices.patch
Add 0072-libmultipath-add-ignore_udev_uid-option.patch
2020-07-21 17:39:38 -05:00

61 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 19 Apr 2017 06:10:01 -0500
Subject: [PATCH] RH: use rpm optflags if present
Use the passed in optflags when compiling as an RPM, and keep the
default flags as close as possible to the current fedora flags, while
still being generic.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 873fb62f..479523bc 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -89,15 +89,27 @@ TEST_CC_OPTION = $(shell \
echo "$(2)"; \
fi)
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
-OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
-WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 -Werror=implicit-int \
+ifndef RPM_OPT_FLAGS
+ STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
+ OPTFLAGS := -O2 -g -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
+ $(STACKPROT) -grecord-gcc-switches \
+ -fasynchronous-unwind-tables --param=ssp-buffer-size=4
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1)
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
+ endif
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-annobin-cc1 && echo 1),1)
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
+ endif
+else
+ OPTFLAGS := $(RPM_OPT_FLAGS) --param=ssp-buffer-size=4
+endif
+WARNFLAGS := -Werror -Wextra -Wformat=2 -Werror=implicit-int \
-Werror=implicit-function-declaration -Werror=format-security \
- $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
-CPPFLAGS := -Wp,-D_FORTIFY_SOURCE=2
+ $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
+ -Wstrict-prototypes
CFLAGS := $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
-DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
-MMD -MP
@@ -135,4 +147,4 @@ check_file = $(shell \
%.o: %.c
@echo building $@ because of $?
- $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) -c -o $@ $<
--
2.17.2