diff --git a/configure/Makefile b/configure/Makefile index ba77d5089..3c2c0b53a 100644 --- a/configure/Makefile +++ b/configure/Makefile @@ -34,5 +34,9 @@ CFG += TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A) include $(TOP)/configure/RULES +ifeq ($(GNU),YES) + # Pass compiler flags to preprocessor to enable _FORTIFY_SOURCE + TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A): CPPFLAGS += $(CFLAGS) +endif TOOLCHAIN.$(EPICS_HOST_ARCH).$(T_A): toolchain.c $(PREPROCESS.cpp) diff --git a/configure/toolchain.c b/configure/toolchain.c index da4e8bb2c..79333198c 100644 --- a/configure/toolchain.c +++ b/configure/toolchain.c @@ -47,3 +47,8 @@ COMMANDLINE_LIBRARY ?= EPICS #else COMMANDLINE_LIBRARY ?= $(strip $(if $(wildcard $(if $(GNU_DIR),$(GNU_DIR)/include/readline/readline.h)), READLINE, EPICS)) #endif + +#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE>2 +OP_SYS_CPPFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 +#endif +