aboutsummaryrefslogtreecommitdiff
path: root/package/libopenh264/0001-Add-USE_STACK_PROTECTOR-option.patch
blob: 3758cd668ba2e7f092053d50e4a05a779a65a6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
From 1e7435751c055723b7103dd1d5bb68530e1a2678 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Tue, 8 Oct 2019 20:18:18 +0200
Subject: [PATCH] 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 <fontaine.fabrice@gmail.com>
[Upstream status: https://github.com/cisco/openh264/pull/3175]
---
 Makefile                  | 1 +
 build/platform-android.mk | 5 ++++-
 build/platform-bsd.mk     | 5 ++++-
 build/platform-darwin.mk  | 5 ++++-
 build/platform-linux.mk   | 5 ++++-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 74ff029d..c2061f6a 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,7 @@ GTEST_VER=release-1.8.1
 CCASFLAGS=$(CFLAGS)
 STATIC_LDFLAGS=-lstdc++
 STRIP ?= strip
+USE_STACK_PROTECTOR = Yes
 
 SHAREDLIB_MAJORVERSION=5
 FULL_VERSION := 2.0.0
diff --git a/build/platform-android.mk b/build/platform-android.mk
index 6f6ce347..06534301 100644
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -44,7 +44,10 @@ SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH)
 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)
diff --git a/build/platform-bsd.mk b/build/platform-bsd.mk
index e60d2cc0..2e0bf2cc 100644
--- a/build/platform-bsd.mk
+++ b/build/platform-bsd.mk
@@ -3,7 +3,10 @@ SHAREDLIBSUFFIX = so
 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)
diff --git a/build/platform-darwin.mk b/build/platform-darwin.mk
index 6c7b2443..718c8e2f 100644
--- a/build/platform-darwin.mk
+++ b/build/platform-darwin.mk
@@ -10,7 +10,10 @@ SHLDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \
 	$(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)
diff --git a/build/platform-linux.mk b/build/platform-linux.mk
index 44fe2424..b5c006b2 100644
--- a/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -3,7 +3,10 @@ SHAREDLIBSUFFIX = so
 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 $@
-- 
2.23.0