shithub: openh264

Download patch

ref: a93572ede73c19373a5a1376bb05d1c42ea52d7a
parent: 9ed97c73627482b975992b20a53d9fca426f8cbb
author: Fabrice Fontaine <[email protected]>
date: Tue Oct 8 16:18:18 EDT 2019

Add USE_STACK_PROTECTOR option

-fstack-protector-all is not supported on all linux toolchains so add an
option to disable it (and enable it by default to keep current behavior)

Fixes:
 - http://autobuild.buildroot.org/results/377818cf8c1f2632cabdccb32bf4e7f06c0fdbbd

Signed-off-by: Fabrice Fontaine <[email protected]>

--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@
 CCASFLAGS=$(CFLAGS)
 STATIC_LDFLAGS=-lstdc++
 STRIP ?= strip
+USE_STACK_PROTECTOR = Yes
 
 SHAREDLIB_MAJORVERSION=5
 FULL_VERSION := 2.0.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 $@