Browse Source

[build] use -fstack-protector-strong w/ extra warn

use -fstack-protector-strong if configured with --enable-extra-warnings
master
Glenn Strauss 4 months ago
parent
commit
f95ca5ef3b
  1. 1
      configure.ac
  2. 2
      meson_options.txt
  3. 2
      src/CMakeLists.txt

1
configure.ac

@ -1623,6 +1623,7 @@ AC_ARG_ENABLE([extra-warnings],
if test "$extrawarnings" = true || test "$extrawarnings" = error; then
TRY_CFLAGS([-g -O2 -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security])
TRY_CFLAGS([-fstack-protector-strong])
case "$host_os" in
*darwin* ) ;;
* ) TRY_LDFLAGS([-Wl,--as-needed]) ;;

2
meson_options.txt

@ -151,7 +151,7 @@ option('build_extra_warnings',
)
option('warn_cflags',
type: 'string',
value: '-g -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security',
value: '-g -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Werror=format-security',
description: 'CFLAGS to use when build_extra_warnings is active',
)

2
src/CMakeLists.txt

@ -52,7 +52,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(BUILD_SANITIZE_UNDEFINED "Enable undefined sanitizer" OFF)
if(BUILD_EXTRA_WARNINGS)
set(WARN_CFLAGS "-g -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security")
set(WARN_CFLAGS "-g -g2 -Wall -Wmissing-declarations -Wcast-align -Wsign-compare -Wnested-externs -Wpointer-arith -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Werror=format-security")
set(WARN_LDFLAGS "")
# -Werror -Wbad-function-cast -Wmissing-prototypes
if(NOT BUILD_SANITIZE_ADDRESS)

Loading…
Cancel
Save