commit 88413472b09e2ecd4ad2b4a00992184c14d5723c Author: Kristoffer Gronlund Date: Mon Jun 17 13:00:08 2019 +0000 SUSE: Makefile sec options Index: haproxy-3.2/Makefile =================================================================== --- haproxy-3.2.orig/Makefile +++ haproxy-3.2/Makefile @@ -346,7 +346,8 @@ use_opts = USE_EPOLL USE_KQUEUE USE_NETF USE_THREAD_DUMP USE_EVPORTS USE_OT USE_QUIC USE_PROMEX \ USE_MEMORY_PROFILING \ USE_STATIC_PCRE USE_STATIC_PCRE2 \ - USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_QUIC_OPENSSL_COMPAT + USE_PCRE USE_PCRE_JIT USE_PCRE2 USE_PCRE2_JIT USE_QUIC_OPENSSL_COMPAT \ + USE_PIE USE_STACKPROTECTOR USE_RELRO_NOW # preset all variables for all supported build options among use_opts $(reset_opts_vars) @@ -897,6 +898,35 @@ ifneq ($(TRACE),) COPTS += -finstrument-functions endif +# PIE +ifneq ($(USE_PIE),) +OPTIONS_CFLAGS += -DUSE_PIE +BUILD_OPTIONS += $(call ignore_implicit,USE_PIE) +OPTIONS_LDFLAGS += -pie +# still need to figure out how to express this conditional in the makefile +# %ifarch s390 s390x %sparc +# PIEFLAGS="-fPIE" +# %else +# PIEFLAGS="-fpie" +# %endif +# PIE_FLAGS.s390 = -fPIE +# PIE_FLAGS.i386 = -fpie +# SEC_FLAGS += $(PIE_FLAGS.$(ARCH)) +OPTIONS_CFLAGS += -fpie +endif + +ifneq ($(USE_STACKPROTECTOR),) +OPTIONS_CFLAGS += -DUSE_STACKPROTECTOR +BUILD_OPTIONS += $(call ignore_implicit,USE_STACKPROTECTOR) +OPTIONS_CFLAGS += -fstack-protector +endif + +ifneq ($(USE_RELRO_NOW),) +OPTIONS_CFLAGS += -DUSE_RELRO_NOW +BUILD_OPTIONS += $(call ignore_implicit,USE_RELRO_NOW) +OPTIONS_LDFLAGS += -Wl,-z,relro,-z,now +endif + #### Global link options # These options are added at the end of the "ld" command line. Use LDFLAGS to # add options at the beginning of the "ld" command line if needed.