2 # Copyright (C) 2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 PKG_CHECK_FORMAT_SECURITY ?
= 1
10 PKG_FORTIFY_SOURCE ?
= 1
13 ifdef CONFIG_PKG_CHECK_FORMAT_SECURITY
14 ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY
)),1)
15 TARGET_CFLAGS
+= -Wformat
-Werror
=format-security
18 ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
19 ifeq ($(strip $(PKG_SSP
)),1)
20 TARGET_CFLAGS
+= -fstack-protector
23 ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
24 ifeq ($(strip $(PKG_SSP
)),1)
25 TARGET_CFLAGS
+= -fstack-protector-strong
28 ifdef CONFIG_PKG_FORTIFY_SOURCE_1
29 ifeq ($(strip $(PKG_FORTIFY_SOURCE
)),1)
30 TARGET_CFLAGS
+= -D_FORTIFY_SOURCE
=1
33 ifdef CONFIG_PKG_FORTIFY_SOURCE_2
34 ifeq ($(strip $(PKG_FORTIFY_SOURCE
)),1)
35 TARGET_CFLAGS
+= -D_FORTIFY_SOURCE
=2
38 ifdef CONFIG_PKG_RELRO_PARTIAL
39 ifeq ($(strip $(PKG_RELRO
)),1)
40 TARGET_CFLAGS
+= -Wl
,-z
,relro
41 TARGET_LDFLAGS
+= -zrelro
44 ifdef CONFIG_PKG_RELRO_FULL
45 ifeq ($(strip $(PKG_RELRO
)),1)
46 TARGET_CFLAGS
+= -Wl
,-z
,now
-Wl
,-z
,relro
47 TARGET_LDFLAGS
+= -znow
-zrelro