]> code.ossystems Code Review - openembedded-core.git/commit
security_flags.inc: Use -O with -D_FORTIFY_SOURCE
authorKhem Raj <raj.khem@gmail.com>
Sat, 6 Feb 2021 06:31:38 +0000 (22:31 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 8 Feb 2021 14:47:00 +0000 (14:47 +0000)
commitb6113dd68caa46d56cf3c8293119f2b9d8b137fd
treedd0b2405008a2514ce3df4349c037d0c5aeb9f59
parent5c7f963d395aa4a94d78c37883488baac471ea43
security_flags.inc: Use -O with -D_FORTIFY_SOURCE

compiler can only use fortify options when some level of optimization is
on, otherwise it ends up sending some warnings.

warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]

this is usually OK, since -O<level> would be added via CFLAGS to
compiler cmdline in normal compile stages, however during configure
there are problems when CC,CPP,CXX are probed alone in configure tests
which results in above warning, which confuses the configure results and
autotools 2.70+ detects it as error e.g.

configure:17292: error: C preprocessor "riscv32-yoe-linux-clang -target riscv32-yoe-linux      -mlittle-endian -mno-relax -Qunused-arguments -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/b/yoe/master/build/tmp/work/riscv32-yoe-linux/ndpi/3.4-r0/recipe-sysroot -E" fails sanity check
See `config.log' for more details

therefore adding a -O ( which actually is -O1 ) to lcl_maybe_fortify
means we can properly test these configure tests and real -O<level> will
still override -O added here, so overrall behavior improves

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/conf/distro/include/security_flags.inc