diff options
author | Joe Slater <jslater@windriver.com> | 2015-07-02 17:10:51 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-08 00:01:23 +0100 |
commit | abe6459c28a8e30ab6a9da76f27370c24c4746ee (patch) | |
tree | f0842eacfa99a7142c83e7e71c8520ba6b422730 | |
parent | c4437f17806c10f619cd7bfe699bf122b7f2bde9 (diff) | |
download | poky-abe6459c28a8e30ab6a9da76f27370c24c4746ee.tar.gz |
security_flags: eliminate FORTIFY_SOURCE for debug builds
If -D_FORTIFY_SOURCE=2 is included in CFLAGS for debug builds,
many warnings will be generated and some packages will fail to
build. So, only conditionally include it.
(From OE-Core rev: 1b576012a6a2b2ebc2c507cdaebd62174810b191)
Signed-off-by: Joe Slater <jslater@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/conf/distro/include/security_flags.inc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index 104a6cbfea..85a3bfe589 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc | |||
@@ -5,13 +5,18 @@ | |||
5 | # From a Yocto Project perspective, this file is included and tested | 5 | # From a Yocto Project perspective, this file is included and tested |
6 | # in the DISTRO="poky-lsb" configuration. | 6 | # in the DISTRO="poky-lsb" configuration. |
7 | 7 | ||
8 | SECURITY_CFLAGS ?= "-fstack-protector-all -pie -fpie -D_FORTIFY_SOURCE=2" | 8 | # _FORTIFY_SOURCE requires -O1 or higher, so disable in debug builds as they use |
9 | SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-all -D_FORTIFY_SOURCE=2" | 9 | # -O0 which then results in a compiler warning. |
10 | lcl_maybe_fortify = "${@base_conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE=2',d)}" | ||
11 | |||
12 | SECURITY_CFLAGS ?= "-fstack-protector-all -pie -fpie ${lcl_maybe_fortify}" | ||
13 | SECURITY_NO_PIE_CFLAGS ?= "-fstack-protector-all ${lcl_maybe_fortify}" | ||
14 | |||
10 | SECURITY_LDFLAGS ?= "-Wl,-z,relro,-z,now" | 15 | SECURITY_LDFLAGS ?= "-Wl,-z,relro,-z,now" |
11 | SECURITY_X_LDFLAGS ?= "-Wl,-z,relro" | 16 | SECURITY_X_LDFLAGS ?= "-Wl,-z,relro" |
12 | 17 | ||
13 | # powerpc does not get on with pie for reasons not looked into as yet | 18 | # powerpc does not get on with pie for reasons not looked into as yet |
14 | SECURITY_CFLAGS_powerpc = "-fstack-protector-all -D_FORTIFY_SOURCE=2" | 19 | SECURITY_CFLAGS_powerpc = "-fstack-protector-all ${lcl_maybe_fortify}" |
15 | # Deal with ppc specific linker failures when using the cflags | 20 | # Deal with ppc specific linker failures when using the cflags |
16 | SECURITY_CFLAGS_pn-dbus_powerpc = "" | 21 | SECURITY_CFLAGS_pn-dbus_powerpc = "" |
17 | SECURITY_CFLAGS_pn-dbus-ptest_powerpc = "" | 22 | SECURITY_CFLAGS_pn-dbus-ptest_powerpc = "" |