ref: 67e41d9fd50f18771f17da2bb03bf2270ac76752
parent: 76dd08773fafe93012c7d15833482a1d2ee1357b
parent: a93572ede73c19373a5a1376bb05d1c42ea52d7a
author: guangwei <GuangweiWang@users.noreply.github.com>
date: Thu May 28 05:05:00 EDT 2020
Merge pull request #3175 from ffontaine/master Add USE_STACK_PROTECTOR option
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@
CCASFLAGS=$(CFLAGS)
STATIC_LDFLAGS=-lstdc++
STRIP ?= strip
+USE_STACK_PROTECTOR = Yes
SHAREDLIB_MAJORVERSION=6
FULL_VERSION := 2.1.0
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -44,7 +44,10 @@
CXX = $(TOOLCHAINPREFIX)g++
CC = $(TOOLCHAINPREFIX)gcc
AR = $(TOOLCHAINPREFIX)ar
-CFLAGS += -DANDROID_NDK -fpic --sysroot=$(SYSROOT) -MMD -MP -fstack-protector-all
+CFLAGS += -DANDROID_NDK -fpic --sysroot=$(SYSROOT) -MMD -MP
+ifeq ($(USE_STACK_PROTECTOR), Yes)
+CFLAGS += -fstack-protector-all
+endif
CFLAGS += -isystem $(NDKROOT)/sysroot/usr/include -isystem $(NDKROOT)/sysroot/usr/include/$(TOOLCHAIN_NAME) -D__ANDROID_API__=$(NDKLEVEL)
CXXFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += --sysroot=$(SYSROOT)
--- a/build/platform-bsd.mk
+++ b/build/platform-bsd.mk
@@ -3,7 +3,10 @@
SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX).$(FULL_VERSION)
SHAREDLIBSUFFIXMAJORVER=$(SHAREDLIBSUFFIX).$(SHAREDLIB_MAJORVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER)
-CFLAGS += -fPIC -fstack-protector-all
+CFLAGS += -fPIC
+ifeq ($(USE_STACK_PROTECTOR), Yes)
+CFLAGS += -fstack-protector-all
+endif
LDFLAGS += -lpthread
STATIC_LDFLAGS += -lpthread -lm
ifeq ($(ASM_ARCH), x86)
--- a/build/platform-darwin.mk
+++ b/build/platform-darwin.mk
@@ -10,7 +10,10 @@
$(SHAREDLIB_DIR)/$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER)
SHARED = -dynamiclib
SHARED += -current_version $(CURRENT_VERSION) -compatibility_version $(COMPATIBILITY_VERSION)
-CFLAGS += -Wall -fPIC -MMD -MP -fstack-protector-all
+CFLAGS += -Wall -fPIC -MMD -MP
+ifeq ($(USE_STACK_PROTECTOR), Yes)
+CFLAGS += -fstack-protector-all
+endif
ifeq ($(ASM_ARCH), x86)
ASMFLAGS += -DPREFIX
ifeq ($(ARCH), x86_64)
--- a/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -3,7 +3,10 @@
SHAREDLIBSUFFIXFULLVER=$(SHAREDLIBSUFFIX).$(FULL_VERSION)
SHAREDLIBSUFFIXMAJORVER=$(SHAREDLIBSUFFIX).$(SHAREDLIB_MAJORVERSION)
SHLDFLAGS = -Wl,-soname,$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER)
-CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP -fstack-protector-all
+CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP
+ifeq ($(USE_STACK_PROTECTOR), Yes)
+CFLAGS += -fstack-protector-all
+endif
LDFLAGS += -lpthread
STATIC_LDFLAGS += -lpthread -lm
AR_OPTS = crD $@