# Expected (hardening) flags. All flags are used as regexps.
my @cflags = (
'-g',
- '-O2',
+ '-O(?:2|3)',
);
my @cflags_format = (
'-Wformat',
);
# Renaming rules for the output so the regex parts are not visible.
my %flag_renames = (
+ '-O(?:2|3)' => '-O2',
'-Wl,(-z,)?relro' => '-Wl,-z,relro',
'-Wl,(-z,)?now' => '-Wl,-z,now',
);
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
+gcc -g -O3 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.c
gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
# Compiling and linking in one step must also check CFLAGS/CPPFLAGS.