int0x21 / rpms / dlm

Forked from rpms/dlm 4 years ago
Clone

Blame SOURCES/0003-update-makefile-gcc-flags.patch

11c6eb
From db875a3d07f9f6a633951ed886cec80b91efea43 Mon Sep 17 00:00:00 2001
11c6eb
From: David Teigland <teigland@redhat.com>
11c6eb
Date: Tue, 2 Oct 2018 11:22:39 -0500
11c6eb
Subject: [PATCH] update makefile gcc flags
11c6eb
11c6eb
---
11c6eb
 dlm_controld/Makefile | 41 ++++++++++++++---------------------------
11c6eb
 dlm_tool/Makefile     | 44 ++++++++++++++++----------------------------
11c6eb
 fence/Makefile        | 46 +++++++++++++++++-----------------------------
11c6eb
 libdlm/Makefile       |  6 +++++-
11c6eb
 4 files changed, 52 insertions(+), 85 deletions(-)
11c6eb
11c6eb
diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
11c6eb
index cf556c9d72b8..85c2db12883a 100644
11c6eb
--- a/dlm_controld/Makefile
11c6eb
+++ b/dlm_controld/Makefile
11c6eb
@@ -31,35 +31,22 @@ BIN_SOURCE = action.c \
11c6eb
              rbtree.c
11c6eb
 LIB_SOURCE = lib.c
11c6eb
 
11c6eb
-BIN_CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
-	-Wall \
11c6eb
-	-Wformat \
11c6eb
-	-Wformat-security \
11c6eb
-	-Wmissing-prototypes \
11c6eb
-	-Wnested-externs \
11c6eb
-	-Wpointer-arith \
11c6eb
-	-Wextra -Wshadow \
11c6eb
-	-Wcast-align \
11c6eb
-	-Wwrite-strings \
11c6eb
-	-Waggregate-return \
11c6eb
-	-Wstrict-prototypes \
11c6eb
-	-Winline \
11c6eb
-	-Wredundant-decls \
11c6eb
-	-Wno-sign-compare \
11c6eb
-	-Wno-unused-parameter \
11c6eb
-	-Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
-	-fexceptions \
11c6eb
-	-fasynchronous-unwind-tables \
11c6eb
-	-fdiagnostics-show-option \
11c6eb
-
11c6eb
-BIN_CFLAGS += -fPIE -DPIE
11c6eb
+CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
+	-Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs \
11c6eb
+	-Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings \
11c6eb
+	-Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls \
11c6eb
+	-Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
+	-fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \
11c6eb
+	-Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \
11c6eb
+	-fstack-clash-protection -Wl,-z,now
11c6eb
+
11c6eb
+BIN_CFLAGS += $(CFLAGS) -fPIE -DPIE
11c6eb
 BIN_CFLAGS += -I../include -I../libdlm
11c6eb
+LIB_CFLAGS += $(CFLAGS) -fPIC
11c6eb
 
11c6eb
-BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
11c6eb
+BIN_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -pie
11c6eb
 BIN_LDFLAGS += -lpthread -lrt -lcpg -lcmap -lcfg -lquorum
11c6eb
-
11c6eb
-LIB_CFLAGS += $(BIN_CFLAGS)
11c6eb
-LIB_LDFLAGS += -Wl,-z,relro -pie
11c6eb
+LIB_LDFLAGS += $(LDFLAGS) -Wl,-z,relro -pie
11c6eb
 
11c6eb
 ifeq ($(USE_SD_NOTIFY),yes)
11c6eb
 	BIN_CFLAGS += $(shell pkg-config --cflags libsystemd) \
11c6eb
@@ -73,7 +60,7 @@ $(BIN_TARGET): $(BIN_SOURCE)
11c6eb
 	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L.
11c6eb
 
11c6eb
 $(LIB_TARGET): $(LIB_SOURCE)
11c6eb
-	$(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_SMAJOR)
11c6eb
+	$(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ -Wl,-soname=$(LIB_SMAJOR)
11c6eb
 	ln -sf $(LIB_TARGET) $(LIB_SO)
11c6eb
 	ln -sf $(LIB_TARGET) $(LIB_SMAJOR)
11c6eb
 
11c6eb
diff --git a/dlm_tool/Makefile b/dlm_tool/Makefile
11c6eb
index c16d8f537225..80d7725791f3 100644
11c6eb
--- a/dlm_tool/Makefile
11c6eb
+++ b/dlm_tool/Makefile
11c6eb
@@ -8,38 +8,26 @@ MAN_TARGET = dlm_tool.8
11c6eb
 
11c6eb
 BIN_SOURCE = main.c
11c6eb
 
11c6eb
-BIN_CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
-	-Wall \
11c6eb
-	-Wformat \
11c6eb
-	-Wformat-security \
11c6eb
-	-Wmissing-prototypes \
11c6eb
-	-Wnested-externs \
11c6eb
-	-Wpointer-arith \
11c6eb
-	-Wextra -Wshadow \
11c6eb
-	-Wcast-align \
11c6eb
-	-Wwrite-strings \
11c6eb
-	-Waggregate-return \
11c6eb
-	-Wstrict-prototypes \
11c6eb
-	-Winline \
11c6eb
-	-Wredundant-decls \
11c6eb
-	-Wno-sign-compare \
11c6eb
-	-Wno-unused-parameter \
11c6eb
-	-Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
-	-fexceptions \
11c6eb
-	-fasynchronous-unwind-tables \
11c6eb
-	-fdiagnostics-show-option \
11c6eb
-
11c6eb
-BIN_CFLAGS += -fPIE -DPIE
11c6eb
-BIN_CFLAGS += -I../include -I../libdlm -I../dlm_controld
11c6eb
-
11c6eb
-BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
11c6eb
-BIN_LDFLAGS += -L../libdlm -L../dlm_controld
11c6eb
-BIN_LDFLAGS += -lpthread -ldlm -ldlmcontrol
11c6eb
+CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
+	-Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs \
11c6eb
+	-Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings \
11c6eb
+	-Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls \
11c6eb
+	-Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
+	-fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \
11c6eb
+	-Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \
11c6eb
+	-fstack-clash-protection -Wl,-z,now
11c6eb
+
11c6eb
+CFLAGS += -fPIE -DPIE
11c6eb
+CFLAGS += -I../include -I../libdlm -I../dlm_controld
11c6eb
+
11c6eb
+LDFLAGS += -Wl,-z,relro -pie
11c6eb
+LDFLAGS += -L../libdlm -L../dlm_controld
11c6eb
+LDFLAGS += -lpthread -ldlm -ldlmcontrol
11c6eb
 
11c6eb
 all: $(BIN_TARGET)
11c6eb
 
11c6eb
 $(BIN_TARGET): $(BIN_SOURCE)
11c6eb
-	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@
11c6eb
+	$(CC) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@
11c6eb
 
11c6eb
 clean:
11c6eb
 	rm -f *.o *.so *.so.* $(BIN_TARGET)
11c6eb
diff --git a/fence/Makefile b/fence/Makefile
11c6eb
index 77bf0fd15be8..b927879eb141 100644
11c6eb
--- a/fence/Makefile
11c6eb
+++ b/fence/Makefile
11c6eb
@@ -8,39 +8,27 @@ MAN_TARGET = dlm_stonith.8
11c6eb
 
11c6eb
 BIN_SOURCE = stonith_helper.c
11c6eb
 
11c6eb
-BIN_CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
-	-Wall \
11c6eb
-	-Wformat \
11c6eb
-	-Wformat-security \
11c6eb
-	-Wmissing-prototypes \
11c6eb
-	-Wnested-externs \
11c6eb
-	-Wpointer-arith \
11c6eb
-	-Wextra -Wshadow \
11c6eb
-	-Wcast-align \
11c6eb
-	-Wwrite-strings \
11c6eb
-	-Waggregate-return \
11c6eb
-	-Wstrict-prototypes \
11c6eb
-	-Winline \
11c6eb
-	-Wredundant-decls \
11c6eb
-	-Wno-sign-compare \
11c6eb
-	-Wno-unused-parameter \
11c6eb
-	-Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
-	-fexceptions \
11c6eb
-	-fasynchronous-unwind-tables \
11c6eb
-	-fdiagnostics-show-option \
11c6eb
-
11c6eb
-BIN_CFLAGS += -fPIE -DPIE
11c6eb
-BIN_CFLAGS += `xml2-config --cflags`
11c6eb
-BIN_CFLAGS += -I../include
11c6eb
-
11c6eb
-BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
11c6eb
-BIN_LDFLAGS += `xml2-config --libs`
11c6eb
-BIN_LDFLAGS += -ldl
11c6eb
+CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
+	-Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs \
11c6eb
+	-Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings \
11c6eb
+	-Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls \
11c6eb
+	-Wno-sign-compare -Wno-unused-parameter -Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
+	-fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option \
11c6eb
+	-Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong \
11c6eb
+	-fstack-clash-protection -Wl,-z,now
11c6eb
+
11c6eb
+CFLAGS += -fPIE -DPIE
11c6eb
+CFLAGS += `xml2-config --cflags`
11c6eb
+CFLAGS += -I../include
11c6eb
+
11c6eb
+LDFLAGS += -Wl,-z,relro -pie
11c6eb
+LDFLAGS += `xml2-config --libs`
11c6eb
+LDFLAGS += -ldl
11c6eb
 
11c6eb
 all: $(BIN_TARGET)
11c6eb
 
11c6eb
 $(BIN_TARGET): $(BIN_SOURCE)
11c6eb
-	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L.
11c6eb
+	$(CC) $(BIN_SOURCE) $(CFLAGS) $(LDFLAGS) -o $@ -L.
11c6eb
 
11c6eb
 clean:
11c6eb
 	rm -f *.o *.so *.so.* $(BIN_TARGET)
11c6eb
diff --git a/libdlm/Makefile b/libdlm/Makefile
11c6eb
index 336c22e7edb4..ab32761912b3 100644
11c6eb
--- a/libdlm/Makefile
11c6eb
+++ b/libdlm/Makefile
11c6eb
@@ -72,10 +72,14 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
11c6eb
 	-Wno-sign-compare \
11c6eb
 	-Wno-unused-parameter \
11c6eb
 	-Wp,-D_FORTIFY_SOURCE=2 \
11c6eb
+	-Wp,-D_GLIBCXX_ASSERTIONS \
11c6eb
+	-fstack-protector-strong \
11c6eb
+	-fstack-clash-protection \
11c6eb
 	-fexceptions \
11c6eb
 	-fasynchronous-unwind-tables \
11c6eb
 	-fdiagnostics-show-option \
11c6eb
-	-fPIC
11c6eb
+	-fPIC \
11c6eb
+	-Wl,-z,now
11c6eb
 
11c6eb
 LIB_CFLAGS += $(CFLAGS) -D_REENTRANT
11c6eb
 LLT_CFLAGS += $(CFLAGS)
11c6eb
-- 
11c6eb
2.7.5
11c6eb