diff --git a/cmake/src/build_options.cmake b/cmake/src/build_options.cmake index 82c543b96..b161361d8 100755 --- a/cmake/src/build_options.cmake +++ b/cmake/src/build_options.cmake @@ -176,7 +176,7 @@ else() endif() # libraries need secure options during compling -set(LIB_SECURE_OPTIONS -fPIC -fno-common -fstack-protector) +set(LIB_SECURE_OPTIONS -fPIC -fno-common -fstack-protector-strong) # libraries need link options during linking set(LIB_LINK_OPTIONS -pthread -std=c++14 -Wl,-z,noexecstack -Wl,-z,relro,-z,now) if(NOT "${ENABLE_UT}" STREQUAL "ON") diff --git a/contrib/gms_output/Makefile b/contrib/gms_output/Makefile index f3144f97f..741132b94 100644 --- a/contrib/gms_output/Makefile +++ b/contrib/gms_output/Makefile @@ -6,7 +6,7 @@ EXTENSION = gms_output DATA = gms_output--1.0.sql exclude_option = -fPIE -override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS)) +override CPPFLAGS := -fstack-protector-strong $(filter-out $(exclude_option),$(CPPFLAGS)) REGRESS = gms_output diff --git a/contrib/gms_profiler/Makefile b/contrib/gms_profiler/Makefile index dffec66d9..f22033728 100644 --- a/contrib/gms_profiler/Makefile +++ b/contrib/gms_profiler/Makefile @@ -7,7 +7,7 @@ EXTENSION = gms_profiler DATA = gms_profiler--1.0.sql exclude_option = -fPIE -override CPPFLAGS := $(filter-out $(exclude_option),$(CPPFLAGS)) +override CPPFLAGS := -fstack-protector-strong $(filter-out $(exclude_option),$(CPPFLAGS)) REGRESS = gms_profiler diff --git a/contrib/gms_stats/Makefile b/contrib/gms_stats/Makefile index ff09558da..b912191ce 100644 --- a/contrib/gms_stats/Makefile +++ b/contrib/gms_stats/Makefile @@ -5,6 +5,9 @@ OBJS = gms_stats.o EXTENSION = gms_stats DATA = gms_stats--1.0.sql +exclude_option = -fPIE +override CPPFLAGS := -fstack-protector-strong $(filter-out $(exclude_option),$(CPPFLAGS)) + REGRESS = gms_stats ifdef USE_PGXS diff --git a/contrib/pg_archivecleanup/Makefile b/contrib/pg_archivecleanup/Makefile index 39c55d871..2985fb874 100644 --- a/contrib/pg_archivecleanup/Makefile +++ b/contrib/pg_archivecleanup/Makefile @@ -14,5 +14,6 @@ else subdir = contrib/pg_archivecleanup top_builddir = ../.. include $(top_builddir)/src/Makefile.global +override LDFLAGS += -Wl,-z,relro,-z,now include $(top_srcdir)/contrib/contrib-global.mk endif diff --git a/src/common/interfaces/ecpg/compatlib/Makefile b/src/common/interfaces/ecpg/compatlib/Makefile index 2a97ed750..15e94fa75 100644 --- a/src/common/interfaces/ecpg/compatlib/Makefile +++ b/src/common/interfaces/ecpg/compatlib/Makefile @@ -22,8 +22,8 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \ -I$(libpq_srcdir) -I$(top_srcdir)/src/include/utils $(CPPFLAGS) override CFLAGS += $(PTHREAD_CFLAGS) -override CPPFLAGS := $(filter-out -fPIE, $(CPPFLAGS)) -fPIC -override CFLAGS := $(filter-out -fPIE, $(CFLAGS)) -fPIC +override CPPFLAGS := $(filter-out -fPIE, $(CPPFLAGS)) -fPIC -fstack-protector-strong +override CFLAGS := $(filter-out -fPIE, $(CFLAGS)) -fPIC -fstack-protector-strong SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \ $(filter -lintl -lm, $(LIBS)) $(PTHREAD_LIBS) diff --git a/src/common/interfaces/ecpg/preproc/Makefile b/src/common/interfaces/ecpg/preproc/Makefile index bcf5fc996..3221e9fee 100644 --- a/src/common/interfaces/ecpg/preproc/Makefile +++ b/src/common/interfaces/ecpg/preproc/Makefile @@ -43,6 +43,7 @@ TOOLSDIR = $(top_srcdir)/src/tools GEN_KEYWORDLIST = $(PERL) -I $(TOOLSDIR) $(TOOLSDIR)/gen_keywordlist.pl GEN_KEYWORDLIST_DEPS = $(TOOLSDIR)/gen_keywordlist.pl $(TOOLSDIR)/PerfectHash.pm +override LDFLAGS += -Wl,-z,relro,-z,now ifeq ($(GCC),yes) preproc.o: CXXFLAGS += -Wno-error