ecpg、gms_*、pg_archivecleanup添加安全编译选项

This commit is contained in:
lukeman
2024-09-20 14:40:16 +08:00
parent b6fd8742c3
commit ce82ee05fa
7 changed files with 10 additions and 5 deletions

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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