]> ruderich.org/simon Gitweb - blhc/blhc.git/blob - t/tests.t
Fix false positive in C++ compiler detection
[blhc/blhc.git] / t / tests.t
1 # Tests for blhc.
2 #
3 # Copyright (C) 2012-2024  Simon Ruderich
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 use strict;
20 use warnings;
21
22 use Test::More tests => 248;
23
24
25 sub is_blhc {
26     my ($file, $options, $exit, $expected) = @_;
27
28     # Multiple files as array references.
29     if (ref $file eq 'ARRAY') {
30         local $" = ' ./t/logs/';
31         $file = "@{$file}";
32     }
33
34     $file = "./t/logs/$file" if $file;
35     my $output = `./bin/blhc $options $file 2>&1`;
36
37     if ($options) {
38         $options = ' '. $options;
39     }
40     is $? >> 8, $exit,     "$file$options (exit code)";
41     # Perform regex or string match.
42     my $cmd = (ref $expected eq 'Regexp')
43               ? \&like
44               : \&is;
45     &$cmd($output, $expected, "$file$options (output)");
46 }
47
48
49 # Usage, invalid arguments.
50
51 use Pod::Usage;
52 my $usage = ( $Pod::Usage::VERSION < 1.65 ?
53         'Usage:
54     blhc [*options*] *<dpkg-buildpackage build log file>..*
55
56 '
57     :
58         'Usage:
59     blhc [options] <dpkg-buildpackage build log file>..
60
61 ');
62 is_blhc '', '--invalid', 2,
63         "Unknown option: invalid\n"
64         . $usage;
65
66 is_blhc '', '', 2,
67         $usage;
68
69 is_blhc '', '--version', 0,
70         'blhc 0.14  Copyright (C) 2012-2024  Simon Ruderich
71
72 This program is free software: you can redistribute it and/or modify
73 it under the terms of the GNU General Public License as published by
74 the Free Software Foundation, either version 3 of the License, or
75 (at your option) any later version.
76
77 This program is distributed in the hope that it will be useful,
78 but WITHOUT ANY WARRANTY; without even the implied warranty of
79 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80 GNU General Public License for more details.
81
82 You should have received a copy of the GNU General Public License
83 along with this program.  If not, see <http://www.gnu.org/licenses/>.
84 ';
85
86 is_blhc '', '--help', 1,
87         qr/^Usage:
88     blhc \[\*?options\*?\] \*?<dpkg-buildpackage build log file>\.\.\*?
89
90 Options:
91 /s;
92
93 is_blhc 'doesnt-exist', '', 2,
94         qr{^No such file: \./t/logs/doesnt-exist at \./bin/blhc line \d+\.$};
95
96
97 # No compiler commands found.
98
99 my $empty = "No compiler commands!\n";
100 is_blhc 'empty', '', 1,
101         $empty;
102
103
104 # ANSI colored output.
105
106 is_blhc 'arch-amd64', '--color', 8,
107         "\033[31mCFLAGS missing\033[0m (-fstack-protector-strong -fcf-protection)\033[33m:\033[0m gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
108 \033[31mLDFLAGS missing\033[0m (-pie)\033[33m:\033[0m gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
109 ";
110
111
112 # Ignore missing compiler flags.
113
114 is_blhc 'ignore-flag', '--ignore-flag -g', 8,
115         'CFLAGS missing (-O2): gcc -g     -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
116 ';
117
118 is_blhc 'ignore-flag', '--ignore-flag -g --ignore-flag -O2', 0,
119         '';
120
121 is_blhc 'ignore-flag-ldflags', '--ignore-flag -fPIE', 0,
122         '';
123
124 # Ignore missing compiler flags for specific architectures.
125
126 # Invalid option.
127 is_blhc 'ignore-flag', '--ignore-arch-flag -g', 2,
128         'Value "-g" invalid for option ignore-arch-flag ("arch:flag" expected)'
129         . "\n$usage";
130 is_blhc 'ignore-flag', '--ignore-arch-flag -g:', 2,
131         'Value "-g:" invalid for option ignore-arch-flag ("arch:flag" expected)'
132         . "\n$usage";
133 is_blhc 'ignore-flag', '--ignore-arch-flag :amd64', 2,
134         'Value ":amd64" invalid for option ignore-arch-flag ("arch:flag" expected)'
135         . "\n$usage";
136
137 # Wrong architecture.
138 is_blhc 'ignore-flag', '--ignore-arch-flag amd64:-g', 8,
139         'CFLAGS missing (-g): gcc    -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
140 CFLAGS missing (-O2): gcc -g     -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
141 ';
142
143 is_blhc 'arch-i386', '--ignore-arch-flag i386:-fstack-protector-strong', 8,
144         'LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
145 ';
146 is_blhc 'arch-i386', '--ignore-arch-flag i386:-pie', 8,
147         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
148 ';
149 is_blhc 'arch-i386', '--ignore-arch-flag i386:-fstack-protector-strong --ignore-arch-flag i386:-pie', 0,
150         '';
151
152 # Wrong architecture.
153 is_blhc 'arch-i386', '--ignore-arch-flag amd64:-fstack-protector-strong', 8,
154         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
155 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
156 ';
157 is_blhc 'arch-i386', '--ignore-arch-flag amd64:-pie', 8,
158         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
159 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
160 ';
161 is_blhc 'arch-i386', '--ignore-arch-flag amd64:-fstack-protector-strong --ignore-arch-flag amd64:-pie', 8,
162         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
163 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
164 ';
165
166 # Ignore certain lines (through inline command).
167
168 is_blhc 'ignore-line-inline', '', 8,
169         'CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):     ./prepare-script gcc test-a.c test-b.c test-c.c
170 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):     ./prepare-script gcc test-a.c test-b.c test-c.c
171 LDFLAGS missing (-Wl,-z,relro):     ./prepare-script gcc test-a.c test-b.c test-c.c
172 ';
173
174 is_blhc 'ignore-line-inline2', '', 0,
175         '';
176
177
178 # Ignore certain lines.
179
180 is_blhc 'ignore-line', '--ignore-line "\./prepare-script gcc test-[a-z]\.c"', 8,
181         'CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):     ./prepare-script gcc test-a.c test-b.c test-c.c
182 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):     ./prepare-script gcc test-a.c test-b.c test-c.c
183 LDFLAGS missing (-Wl,-z,relro):     ./prepare-script gcc test-a.c test-b.c test-c.c
184 ';
185
186 is_blhc 'ignore-line', '--ignore-line "\./prepare-script gcc test-[a-z]\.c" --ignore-line "\s*\./prepare-script gcc test-[a-z]\.c .+"', 0,
187         '';
188
189 # Ignore certain lines for specific architectures.
190
191 # Invalid option.
192 is_blhc 'ignore-line', '--ignore-arch-line .+', 2,
193         'Value ".+" invalid for option ignore-arch-line ("arch:line" expected)'
194         . "\n$usage";
195 is_blhc 'ignore-line', '--ignore-arch-line .+:', 2,
196         'Value ".+:" invalid for option ignore-arch-line ("arch:line" expected)'
197         . "\n$usage";
198 is_blhc 'ignore-line', '--ignore-arch-line :amd64', 2,
199         'Value ":amd64" invalid for option ignore-arch-line ("arch:line" expected)'
200         . "\n$usage";
201
202 # Wrong architecture.
203 is_blhc 'ignore-line', '--ignore-arch-line "amd64:.+"', 8,
204         'CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):     ./prepare-script gcc test-a.c test-b.c test-c.c
205 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):     ./prepare-script gcc test-a.c test-b.c test-c.c
206 LDFLAGS missing (-Wl,-z,relro):     ./prepare-script gcc test-a.c test-b.c test-c.c
207 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-a.c
208 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-a.c
209 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-a.c
210 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-b.c
211 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-b.c
212 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-b.c
213 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-c.c
214 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-c.c
215 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-c.c
216 ';
217
218 # Line regex anchored at beginning/end of the line.
219 is_blhc 'arch-i386', '--ignore-arch-line "i386:-fPIE"', 8,
220         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
221 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
222 ';
223
224 is_blhc 'arch-i386', '--ignore-arch-line "i386:gcc .+ -fPIE .+ test\.c"', 8,
225         'LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
226 ';
227 is_blhc 'arch-i386', '--ignore-arch-line "i386:gcc .+ -Wl,-z,relro -Wl,-z,now .+"', 8,
228         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
229 ';
230 is_blhc 'arch-i386', '--ignore-arch-line "i386:gcc .+ -fPIE .+ test\.c" --ignore-arch-line "i386:gcc .+ -Wl,-z,relro -Wl,-z,now .+"', 0,
231         '';
232
233 # Wrong architecture.
234 is_blhc 'arch-i386', '--ignore-arch-line "amd64:gcc .+ -fPIE .+ test\.c"', 8,
235         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
236 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
237 ';
238 is_blhc 'arch-i386', '--ignore-arch-line "amd64:gcc .+ -Wl,-z,relro -Wl,-z,now .+"', 8,
239         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
240 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
241 ';
242 is_blhc 'arch-i386', '--ignore-arch-line "amd64:gcc .+ -fPIE .+ test\.c" --ignore-arch-line "amd64:gcc .+ -Wl,-z,relro -Wl,-z,now .+"', 8,
243         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
244 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
245 ';
246
247
248 # Correct build logs.
249
250 is_blhc 'good', '', 0,
251         '';
252 is_blhc 'good-pie', '', 0,
253         '';
254 is_blhc 'good-pie', '--pie', 0,
255         '';
256 is_blhc 'good-bindnow', '', 0,
257         '';
258 is_blhc 'good-bindnow', '--bindnow', 0,
259         '';
260 is_blhc 'good-all', '', 0,
261         '';
262 is_blhc 'good-all', '--all', 0,
263         '';
264 is_blhc 'good-all', '--pie --bindnow', 0,
265         '';
266
267 is_blhc 'good-multiline', '', 0,
268         '';
269 is_blhc 'good-library', '--all', 0,
270         '';
271
272
273 # Build logs with missing flags.
274
275 is_blhc 'bad', '', 8,
276         'CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-a.c
277 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c
278 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-b.c
279 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c
280 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-c.c
281 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-c.c
282 LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
283 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
284 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
285 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
286 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
287 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
288 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
289 LDFLAGS missing (-Wl,-z,relro): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest
290 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
291 LDFLAGS missing (-Wl,-z,relro): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
292 LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.a
293 LDFLAGS missing (-Wl,-z,relro): g++  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test
294 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S
295 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c
296 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -S test.c
297 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c
298 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c
299 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c
300 LDFLAGS missing (-Wl,-z,relro): gcc test.c
301 CXXFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
302 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
303 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MD -c test.c
304 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c
305 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MD -MF test.d -c test.c
306 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c
307 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MMD -c test.c
308 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c
309 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c
310 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c
311 ';
312 is_blhc 'bad', '--pie', 8,
313         'CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-a.c
314 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c
315 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-b.c
316 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c
317 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-c.c
318 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-c.c
319 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
320 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
321 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
322 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
323 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
324 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
325 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
326 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest
327 CXXFLAGS missing (-fPIE): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
328 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
329 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
330 LDFLAGS missing (-fPIE -pie): g++  -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o
331 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.a
332 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): g++  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test
333 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S
334 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c
335 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -S test.c
336 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c
337 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c
338 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c
339 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc test.c
340 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
341 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
342 LDFLAGS missing (-fPIE -pie): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
343 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MD -c test.c
344 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c
345 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MD -MF test.d -c test.c
346 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c
347 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MMD -c test.c
348 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c
349 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c
350 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c
351 ';
352 is_blhc 'bad', '--bindnow', 8,
353         'CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-a.c
354 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c
355 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-b.c
356 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c
357 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-c.c
358 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-c.c
359 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
360 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
361 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
362 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
363 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
364 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
365 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
366 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest
367 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
368 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
369 LDFLAGS missing (-Wl,-z,now): g++  -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o
370 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.a
371 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): g++  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test
372 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S
373 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c
374 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -S test.c
375 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c
376 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c
377 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c
378 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc test.c
379 CXXFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
380 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
381 LDFLAGS missing (-Wl,-z,now): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
382 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MD -c test.c
383 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c
384 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MD -MF test.d -c test.c
385 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c
386 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MMD -c test.c
387 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c
388 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c
389 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c
390 ';
391 my $bad_pie_bindnow =
392         'CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-a.c
393 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-a.c
394 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-b.c
395 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-b.c
396 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 -c test-c.c
397 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -c test-c.c
398 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
399 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
400 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-a.c
401 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
402 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-b.c
403 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
404 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): x86_64-linux-gnu-gcc -g -O2 -c test-c.c
405 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-gcc -o test test-a.o test-b.o test-c.o -ltest
406 CXXFLAGS missing (-fPIE): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
407 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
408 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -pthread -o ./testProgram ../src/test/testProgram.cpp
409 LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++  -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -pthread -Wl,-z,relro -o ../src/test/bin/test ../src/test/objs/test.o
410 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.a
411 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security ../src/test/objs/test.o -o ../src/test/bin/test
412 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -o test test.S
413 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -E test.c
414 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -S test.c
415 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -S test.c
416 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c
417 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c
418 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc test.c
419 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
420 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
421 LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -Wl,-z,relro -o test test-.cpp test-b.cpp.o
422 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MD -c test.c
423 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MD -c test.c
424 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MD -MF test.d -c test.c
425 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MD -MF test.d -c test.c
426 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MMD -c test.c
427 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MMD -c test.c
428 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -MT -MMD -MF test.d -c test.c
429 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -MT -MMD -MF test.d -c test.c
430 ';
431 is_blhc 'bad', '--pie --bindnow', 8,
432         $bad_pie_bindnow;
433 is_blhc 'bad', '--all', 8,
434         $bad_pie_bindnow;
435
436 is_blhc 'bad-cflags', '', 8,
437         'CFLAGS missing (-Wformat): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
438 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
439 CFLAGS missing (-Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
440 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test.c -ltest
441 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test.c -ltest
442 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
443 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
444 CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c -D_FORTIFY_SOURCE=2 ../../../../src/test/test.c -o test.so.o
445 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c -o test.output
446 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output
447 LDFLAGS missing (-Wl,-z,relro): gcc test.c -o test.output
448 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c)
449 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c)
450 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-comma.c
451 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-comma.c
452 LDFLAGS missing (-Wl,-z,relro):  gcc test-comma.c
453 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-and.c
454 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-and.c
455 LDFLAGS missing (-Wl,-z,relro):  gcc test-and.c
456 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-or.c
457 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-or.c
458 LDFLAGS missing (-Wl,-z,relro):  gcc test-or.c
459 ';
460 is_blhc 'bad-cflags', '--pie', 8,
461         'CFLAGS missing (-fPIE -Wformat): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
462 CFLAGS missing (-fPIE -fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
463 CFLAGS missing (-fPIE -Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
464 LDFLAGS missing (-fPIE -pie): gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
465 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test.c -ltest
466 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test.c -ltest
467 LDFLAGS missing (-fPIE -pie): gcc -Wl,-z,relro -o test test.c -ltest
468 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
469 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
470 CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c -D_FORTIFY_SOURCE=2 ../../../../src/test/test.c -o test.so.o
471 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c -o test.output
472 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output
473 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc test.c -o test.output
474 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c)
475 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c)
476 LDFLAGS missing (-fPIE -pie): (gcc -Wl,-z,relro -o test.output test.c)
477 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-comma.c
478 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-comma.c
479 LDFLAGS missing (-fPIE -pie -Wl,-z,relro):  gcc test-comma.c
480 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-and.c
481 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-and.c
482 LDFLAGS missing (-fPIE -pie -Wl,-z,relro):  gcc test-and.c
483 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-or.c
484 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-or.c
485 LDFLAGS missing (-fPIE -pie -Wl,-z,relro):  gcc test-or.c
486 ';
487 is_blhc 'bad-cflags', '--bindnow', 8,
488         'CFLAGS missing (-Wformat): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
489 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
490 CFLAGS missing (-Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
491 LDFLAGS missing (-Wl,-z,now): gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
492 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test.c -ltest
493 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test.c -ltest
494 LDFLAGS missing (-Wl,-z,now): gcc -Wl,-z,relro -o test test.c -ltest
495 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
496 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
497 LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
498 CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c -D_FORTIFY_SOURCE=2 ../../../../src/test/test.c -o test.so.o
499 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c -o test.output
500 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output
501 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc test.c -o test.output
502 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c)
503 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c)
504 LDFLAGS missing (-Wl,-z,now): (gcc -Wl,-z,relro -o test.output test.c)
505 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-comma.c
506 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-comma.c
507 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now):  gcc test-comma.c
508 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-and.c
509 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-and.c
510 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now):  gcc test-and.c
511 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-or.c
512 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-or.c
513 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now):  gcc test-or.c
514 ';
515 is_blhc 'bad-cflags', '--pie --bindnow', 8,
516         'CFLAGS missing (-fPIE -Wformat): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
517 CFLAGS missing (-fPIE -fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
518 CFLAGS missing (-fPIE -Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
519 LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest
520 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -Wl,-z,relro -o test test.c -ltest
521 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -Wl,-z,relro -o test test.c -ltest
522 LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -Wl,-z,relro -o test test.c -ltest
523 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
524 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
525 LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC -Wl,-z,relro -o test.so test.c -ltest
526 CFLAGS missing (-Wformat): gcc -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c -D_FORTIFY_SOURCE=2 ../../../../src/test/test.c -o test.so.o
527 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc test.c -o test.output
528 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc test.c -o test.output
529 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc test.c -o test.output
530 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): (gcc -Wl,-z,relro -o test.output test.c)
531 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): (gcc -Wl,-z,relro -o test.output test.c)
532 LDFLAGS missing (-fPIE -pie -Wl,-z,now): (gcc -Wl,-z,relro -o test.output test.c)
533 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-comma.c
534 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-comma.c
535 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now):  gcc test-comma.c
536 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-and.c
537 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-and.c
538 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now):  gcc test-and.c
539 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc test-or.c
540 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc test-or.c
541 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now):  gcc test-or.c
542 ';
543 is_blhc 'bad-cflags-stackprotector', '', 8,
544         'CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c -fno-stack-protector test-a.c
545 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c -fno-stack-protector-all test-a.c
546 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c -fno-stack-protector-strong test-a.c
547 ';
548
549 is_blhc 'bad-cppflags', '', 8,
550         'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
551 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-b.c
552 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-c.c
553 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c ../../../../src/test/test.c -o test.so.o
554 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -o test -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security test-a.cxx test-b.o test-c.o -Wl,-z,relro
555 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=0 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -c test-a.c
556 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=1 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -c test-b.c
557 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -c test-c.c
558 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=0 -c test-d.c
559 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -U_FORTIFY_SOURCE   -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -c test-g.c
560 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -U_FORTIFY_SOURCE -c test-i.c
561 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -U_FORTIFY_SOURCE -c test-i.c
562 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=1 -c test-i.c
563 ';
564
565 is_blhc 'bad-cppflags', '--ignore-flag -D_FORTIFY_SOURCE=2', 0,
566         '';
567
568 my $bad_ldflags =
569         'LDFLAGS missing (-Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
570 LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
571 LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
572 ';
573 is_blhc 'bad-ldflags', '', 8,
574         $bad_ldflags;
575 is_blhc 'bad-ldflags', '--pie', 8,
576         'CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
577 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
578 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
579 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -o test test-a.o test-b.o test-c.o -ltest
580 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
581 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
582 ';
583 is_blhc 'bad-ldflags', '--bindnow', 8,
584         'LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
585 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
586 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
587 ';
588 is_blhc 'bad-ldflags', '--pie --bindnow', 8,
589         'CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
590 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
591 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
592 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -o test test-a.o test-b.o test-c.o -ltest
593 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o
594 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -o test test-a.o test-b.o test-c.o test.h
595 ';
596
597 is_blhc 'bad-multiline', '', 8,
598         'CFLAGS missing (-Wformat): gcc \               -g -O2 -fstack-protector-strong\     -fstack-clash-protection -Wformat-security\ -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
599 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security\ -D_FORTIFY_SOURCE=2\ -c test-b.c
600 CFLAGS missing (-Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
601 LDFLAGS missing (-Wl,-z,relro): gcc -o\ test test-c.o test-a.o test-b.o\        -ltest
602 LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-c.o test-b.o test-a.o\       
603 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -o \ test test-b.o test-a.o test-c.c\   
604 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -o \ test test-b.o test-a.o test-c.c\       
605 LDFLAGS missing (-Wl,-z,relro): gcc -o \ test test-b.o test-a.o test-c.c\       
606 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
607 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  gcc -D_FORTIFY_SOURCE=2 -c test-b.c
608 CFLAGS missing (-Werror=format-security): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -D_FORTIFY_SOURCE=2 -c test-a.c
609 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat):  gcc -Wformat-security -Werror=format-security -c test-b.c
610 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  gcc -Wformat-security -Werror=format-security -c test-b.c
611 CFLAGS missing (-O2): gcc -g -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
612 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
613 CFLAGS missing (-g -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): \ gcc -O2 -D_FORTIFY_SOURCE=2 -c test-b.c
614 CFLAGS missing (-fstack-protector-strong): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
615 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -c test-a.c
616 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):  \ gcc -D_FORTIFY_SOURCE=2 -c test-b.c
617 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security \; -Werror=format-security -D_FORTIFY_SOURCE=1 -c test-a.c
618 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):  \ gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=1 -c test-b.c
619 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c test.c `echo -g -O2 -fstack-protector-strong -fstack-clash-protection echo -Wformat -Wformat-security -Werror=format-security | sed \'s/.../; s/.../\'` -o test.o
620 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c test.c `echo -g -O2 -fstack-protector-strong -fstack-clash-protection echo -Wformat -Wformat-security -Werror=format-security | sed "s/.../; s/.../"` -o test.o
621 ';
622
623 is_blhc 'bad-library', '--all', 8,
624         'CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.so
625 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Werror=format-security test.c -fPIC -DPIC -o libtest.so
626 LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,relro -Wl,--as-needed -o libtest.so
627 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -shared -fPIC -DPIC libtest.o -lpthread -O2 -Wl,--as-needed -o libtest.so
628 LDFLAGS missing (-Wl,-z,now): gcc -shared -fPIC test.o -Wl,-z -Wl,relro -o .libs/libtest.so.1.0.0
629 LDFLAGS missing (-Wl,-z,relro): gcc -shared -o libtest.so.0d ./test-a.o test/./test-b.o -Wl,-z,now -lpthread -ldl
630 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): /usr/bin/g++ -shared -fpic -o libtest-6.1.so.0 test.o -ltiff -lz
631 LDFLAGS missing (-Wl,-z,relro -Wl,-z,now): gcc -Wl,--as-needed  -fPIE -pie -o test.cgi test.o -lgcrypt
632 CFLAGS missing (-fPIE): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security test.c -o lib`basename test/test`.so
633 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security test.c -o lib`basename test/test`.so
634 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security test.c -o lib`basename test/test`.so
635 ';
636
637 is_blhc 'env', '--all', 8,
638         'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): VERSION="`echo hi`" CPP="gcc -x assembler-with-cpp -E -P -Wdate-time -D_FORTIFY_SOURCE=2" CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2" ../../config/gen-posix-names.sh _SC_ ml_sysconf.h
639 ';
640
641
642 # check the build log is verbose
643
644 is_blhc 'verbose-build', '', 12,
645         'NONVERBOSE BUILD: checking if you want to see long compiling messages... no
646 NONVERBOSE BUILD:   CC     libtest-a.lo
647 NONVERBOSE BUILD:   CC     libtest-b.lo
648 NONVERBOSE BUILD:   CC     libtest_c.lo
649 NONVERBOSE BUILD:   CC     libtest-d.lo
650 NONVERBOSE BUILD:   CCLD   libtest.la
651 NONVERBOSE BUILD:   LINK   libtest.la
652 NONVERBOSE BUILD:   CXX    libtest-a.lo
653 NONVERBOSE BUILD:   CXX    libtest-b.lo
654 NONVERBOSE BUILD:   CXX    libtest_c.lo
655 NONVERBOSE BUILD:   CXX    libtest-d.lo
656 NONVERBOSE BUILD:   CXXLD  libtest.la
657 NONVERBOSE BUILD:       [CC]   src/test-a.o
658 NONVERBOSE BUILD:       [CC]   src/test-b.o
659 NONVERBOSE BUILD:       [CC]   src/test_c.o
660 NONVERBOSE BUILD:       [CXX]  src/test-d.o
661 NONVERBOSE BUILD:       [LD]   src/test.o
662 NONVERBOSE BUILD:       [CC]   src/test-a.o
663 NONVERBOSE BUILD:       [CC]   src/test-b.o
664 NONVERBOSE BUILD:       [CC]   src/test_c.o
665 NONVERBOSE BUILD:       [LD]   src/test.o
666 NONVERBOSE BUILD:       [CC]   src/test-a.o
667 NONVERBOSE BUILD:       [CC]   src/test-b.o
668 NONVERBOSE BUILD:       [CC]   src/test_c.o
669 NONVERBOSE BUILD:       [LD]   src/test.o
670 NONVERBOSE BUILD: CC modules/server/test.c
671 NONVERBOSE BUILD:     C++      test/test.o
672 NONVERBOSE BUILD: C++ test.cpp
673 NONVERBOSE BUILD: Building program ../build/bin/test
674 NONVERBOSE BUILD: Compiling test/test.cc to ../build/test/test.o
675 NONVERBOSE BUILD: Compiling test/test.cc to ../build/test/test.o
676 NONVERBOSE BUILD: Building shared library ../build/test/libtest.so.1.2.3
677 NONVERBOSE BUILD: Compiling test.cc to ../build/test/test.o
678 NONVERBOSE BUILD: Building program ../build/bin/test
679 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -o ../build/test/test.o test/test.cc
680 LDFLAGS missing (-Wl,-z,relro): g++ -fPIC -DPIC \            -o ../build/test/libtest.so.1.2.3 -shared \                       ../build/obj/test/test-a.o ../build/obj/test/test-b.o ../build/obj/test/test-c.o
681 CXXFLAGS missing (-Wformat): g++ -c -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -o ../build/test/test.o test.cc
682 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -o ../build/test/test.o test.cc
683 LDFLAGS missing (-Wl,-z,relro): g++ ../build/obj/test/test.o -o /../build/bin/test
684 NONVERBOSE BUILD: Compiling test_file.cxx...
685 CXXFLAGS missing (-fstack-protector-strong -fstack-clash-protection): g++ -g -O2 -fPIC -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test_file.cxx
686 NONVERBOSE BUILD: [ 22%] Building CXX object src/CMakeFiles/test/test.cpp.o
687 NONVERBOSE BUILD: [ 82%] Building C object src/CMakeFiles/test/test.c.o
688 CXXFLAGS missing (-Wformat):  /usr/bin/c++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -o CMakeFiles/test-verbose.dir/verbose.cpp.o -c -D_FORTIFY_SOURCE=2 /tmp/test/src/test-verbose/verbose.cpp
689 CFLAGS missing (-Werror=format-security):  /usr/bin/gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -o CMakeFiles/test-verbose-c.dir/verbose-c.c.o -c -D_FORTIFY_SOURCE=2 /tmp/test/src/test-verbose-c/verbose-c.c
690 NONVERBOSE BUILD: Compiling test.c \     gcc test.c
691 NONVERBOSE BUILD: [  3%] Building CXX object scribus/text/CMakeFiles/scribus_text_lib.dir/frect.cpp.o
692 NONVERBOSE BUILD: [ 1/13] Compiling src/instance.c
693 NONVERBOSE BUILD: [11/13] Compiling suil.pc.in
694 ';
695
696 is_blhc 'parallel', '', 0, '';
697
698
699 # handle debug builds
700
701 is_blhc 'debug-build', '', 0, '';
702
703
704 # configure/make
705
706 is_blhc 'configure', '', 1,
707         $empty;
708
709 is_blhc 'configure-check', '', 4,
710         'NONVERBOSE BUILD:   CC              = gcc -std=gnu99 -std=gnu99 test.c
711 ';
712
713 is_blhc 'configure-check', '--line-numbers', 4,
714         '5:NONVERBOSE BUILD:   CC              = gcc -std=gnu99 -std=gnu99 test.c
715 ';
716
717 is_blhc 'make', '', 1,
718         $empty;
719
720
721 # qt4
722
723 is_blhc 'qt4', '', 1,
724         $empty;
725
726
727 # cc
728
729 is_blhc 'cc', '--pie --bindnow', 8,
730         'CXXFLAGS missing (-fPIE -Wformat): cc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc
731 CFLAGS missing (-fPIE -Wformat): cc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
732 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): cc -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
733 CFLAGS missing (-fPIE -Werror=format-security): cc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
734 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest
735 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): cc\     test.cc
736 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): cc\     test.cc
737 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc\     test.cc
738 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): cc\ test.cc
739 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): cc\ test.cc
740 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): cc\ test.cc
741 LDFLAGS missing (-fPIE -pie -Wl,-z,now): cc -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o
742 ';
743
744
745 # gcc
746
747 is_blhc 'gcc', '--pie --bindnow', 8,
748         'CXXFLAGS missing (-fPIE -Wformat): gcc-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cc
749 CFLAGS missing (-fPIE -Wformat): gcc-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.c
750 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): gcc-4.6 -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
751 CFLAGS missing (-fPIE -Werror=format-security): gcc-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.c
752 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o -ltest
753 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc\     test.c
754 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc\     test.c
755 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc\     test.c
756 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc\ test.c
757 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc\ test.c
758 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): gcc\ test.c
759 LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc-4.6 -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o
760 ';
761
762
763 # c++
764
765 is_blhc 'c++', '--pie --bindnow', 8,
766         'CXXFLAGS missing (-fPIE -Wformat): c++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp
767 CXXFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): c++ -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp
768 CXXFLAGS missing (-fPIE -Werror=format-security): c++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp
769 CXXFLAGS missing (-fPIE): c++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc
770 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest
771 LDFLAGS missing (-fPIE -pie -Wl,-z,now): c++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o
772 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): c++\     test.c
773 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\     test.c
774 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\     test.c
775 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): c++\     test.c++
776 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\     test.c++
777 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\     test.c++
778 CXXFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): c++\ test.c++
779 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\ test.c++
780 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++\ test.c++
781 CXXFLAGS missing (-fPIE -Wformat): c++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp
782 CXXFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): c++-4.6 -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp
783 CXXFLAGS missing (-fPIE -Werror=format-security): c++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp
784 CXXFLAGS missing (-fPIE): c++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc
785 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): c++-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest
786 ';
787
788
789 # g++
790
791 is_blhc 'g++', '--pie --bindnow', 8,
792         'CXXFLAGS missing (-fPIE -Wformat): g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp
793 CXXFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): g++ -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp
794 CXXFLAGS missing (-fPIE -Werror=format-security): g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp
795 CXXFLAGS missing (-fPIE): g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc
796 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest
797 CXXFLAGS missing (-fPIE -Wformat): x86_64-linux-gnu-g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp
798 CXXFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): x86_64-linux-gnu-g++ -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp
799 CXXFLAGS missing (-fPIE -Werror=format-security): x86_64-linux-gnu-g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp
800 CXXFLAGS missing (-fPIE): x86_64-linux-gnu-g++ -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc
801 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): x86_64-linux-gnu-g++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest
802 LDFLAGS missing (-fPIE -pie -Wl,-z,now): g++ -Wl,-z,defs test-a.o test-b.o test-c.o -ltest -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o
803 CFLAGS missing (-g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): g++\     test.c
804 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++\     test.c
805 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++\     test.c
806 CXXFLAGS missing (-fPIE -Wformat): g++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-a.cpp
807 CXXFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection): g++-4.6 -g -O2 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.cpp
808 CXXFLAGS missing (-fPIE -Werror=format-security): g++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp
809 CXXFLAGS missing (-fPIE): g++-4.6 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc
810 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest
811 ';
812
813
814 # ada
815
816 my $ada = 'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc-4.6 -c -fPIC -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security test.c
817 LDFLAGS missing (-Wl,-z,relro): /usr/bin/gcc-4.6 -shared -lgnat-4.6 -o libtest.so.2 test-a.o test-b.o test-c.o -Wl,--as-needed
818 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -c -g -O2 test.c
819 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -g -O2 test.c
820 CFLAGS missing (-fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -g -O2 test.c
821 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 test.c
822 LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 test.c
823 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb
824 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada
825 ';
826 is_blhc 'ada', '', 8,
827         $ada;
828 is_blhc 'ada-pbuilder', '', 8,
829         $ada;
830
831
832 # fortran
833
834 is_blhc 'fortran', '', 8,
835         'CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -o balls balls.f
836 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o quadric.o quadric.f
837 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o suv.o suv.f
838 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 \ rastep.f quadric.o suv.o -Wl,-z,relro \ -o rastep
839 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o render.o render.f
840 LDFLAGS missing (-Wl,-z,relro): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -fstack-protector-strong -fstack-clash-protection -o balls-without-ldflags balls.f
841 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90
842 ';
843
844 is_blhc 'fortran-no-build-deps', '', 8,
845         'CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -o balls balls.f
846 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o quadric.o quadric.f
847 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o suv.o suv.f
848 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 \ rastep.f quadric.o suv.o -Wl,-z,relro \ -o rastep
849 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132  -c -o render.o render.f
850 LDFLAGS missing (-Wl,-z,relro): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -fstack-protector-strong -fstack-clash-protection -o balls-without-ldflags balls.f
851 CFLAGS missing (-fstack-protector-strong -fstack-clash-protection): mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90
852 ';
853
854
855 # libtool
856
857 is_blhc 'libtool', '--bindnow', 12,
858         'CFLAGS missing (-fPIE -Wformat): libtool: compile: x86_64-linux-gnu-gcc -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c test.c
859 CXXFLAGS missing (-fPIE -Wformat): libtool: compile: x86_64-linux-gnu-g++ -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c test.cpp
860 CFLAGS missing (-fPIE -Wformat): libtool: compile: gcc-4.6 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c test.c
861 CXXFLAGS missing (-fPIE -Wformat): libtool: compile: g++-4.6 -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat-security -Werror=format-security -c test.cc
862 LDFLAGS missing (-Wl,-z,now): libtool: link: g++ -shared test-a.o test-b.o test-b.o test-c.o -O2 -Wl,relro -o test.so
863 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z -Wl,relro -o test test.o
864 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: cc -Wl,-z,relro -o test.so test.o
865 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc-4.6 -Wl,-z,relro -o test.so test.o
866 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: x86_64-linux-gnu-g++ -Wl,-z,relro -o test.so test.o
867 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o test.so test.o
868 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o test/test-4.2~_4711/test.so test.o
869 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o test.so test.o
870 LDFLAGS missing (-fPIE -pie -Wl,-z,now):   libtool: link: gcc -Wl,-z,relro -o test.so test.o
871 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o test.so test.o
872 NONVERBOSE BUILD:  /bin/bash /tmp/test/build/libtool  --silent --tag CC --mode=relink gcc -Wl,-z,relro -o test.so test.o
873 LDFLAGS missing (-fPIE -pie -Wl,-z,now):  libtool: relink: gcc -Wl,-z,relro -o test.so test.o
874 LDFLAGS missing (-fPIE -pie -Wl,-z,now):  libtool: relink: g++ -Wl,-z,relro -o test.la test.o
875 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc  -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security   -Wl,-z,relro -o test test.o
876 LDFLAGS missing (-fPIE -pie -Wl,-z,now): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wl,-z -Wl,relro -o .libs/test test.o
877 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: g++ -include ./include/CppUTest/MemoryLeakDetectorNewMacros.h -Wall -Wextra -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic -Wsign-conversion -Woverloaded-virtual -Wno-disabled-macro-expansion -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-old-style-cast -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -Wl,-z -Wl,relro -o CppUTestTests CppUTestTests-AllocationInCFile.o CppUTestTests-AllocationInCppFile.o CppUTestTests-AllocLetTestFree.o CppUTestTests-AllocLetTestFreeTest.o CppUTestTests-AllTests.o CppUTestTests-CheatSheetTest.o CppUTestTests-CommandLineArgumentsTest.o CppUTestTests-CommandLineTestRunnerTest.o CppUTestTests-JUnitOutputTest.o CppUTestTests-MemoryLeakDetectorTest.o CppUTestTests-MemoryLeakOperatorOverloadsTest.o CppUTestTests-MemoryLeakWarningTest.o CppUTestTests-PluginTest.o CppUTestTests-PreprocessorTest.o CppUTestTests-SetPluginTest.o CppUTest Tests-SimpleStringTest.o CppUTestTests-SimpleMutexTest.o CppUTestTests-TestFailureNaNTest.o CppUTestTests-TestFailureTest.o CppUTestTests-TestFilterTest.o CppUTestTests-TestHarness_cTest.o CppUTestTests-TestHarness_cTestCFile.o CppUTestTests-TestInstallerTest.o CppUTestTests-TestMemoryAllocatorTest.o CppUTestTests-TestOutputTest.o CppUTestTests-TestRegistryTest.o CppUTestTests-TestResultTest.o CppUTestTests-TestUTestMacro.o CppUTestTests-UtestTest.o CppUTestTests-UtestPlatformTest.o  lib/libCppUTest.a -lpthread
878 LDFLAGS missing (-fPIE -pie -Wl,-z,now): libtool: link: gcc -Wl,-z,relro -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
879 LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): libtool: link: gcc -o libtest.la test.h test-a.lo test-b.lo test-c.lo test-d.la
880 NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=compile x86_64-linux-gnu-gcc -std=gnu99 -I/usr/include/libxml2 -pthread  -pipe -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security ... -prefer-pic -c mod_buffer.c
881 NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -std=gnu99 -I/usr/include/libxml2 -pthread  -pipe -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -Wl,--as-needed -Wl,-z,relro -o mod_buffer.la -rpath /usr/lib/apache2/modules -module -avoid-version  mod_buffer.lo
882 NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -std=gnu99  -pthread  -pipe -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -lssl -lcrypto -pie -Wl,--as-needed -Wl,-z,relro -o ab  ab.lo   -lcap        /usr/lib/libaprutil-1.la /usr/lib/libapr-1.la -lm
883 NONVERBOSE BUILD: /usr/share/apr-1.0/build/libtool --silent --mode=link x86_64-linux-gnu-gcc -std=gnu99  -pthread  -pipe -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -lssl -lcrypto -pie \                -Wl,--as-needed -Wl,-z,relro -o ab  ab.lo   -lcap        /usr/lib/libaprutil-1.la /usr/lib/libapr-1.la -lm
884 NONVERBOSE BUILD: /bin/bash ../libtool --silent --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I..   -D_FORTIFY_SOURCE=2  -Wall -Wextra -Wconversion -g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -MT coloredstderr.lo -MD -MP -MF .deps/coloredstderr.Tpo -c -o coloredstderr.lo coloredstderr.c
885 NONVERBOSE BUILD: /bin/bash ../libtool --silent --tag=CC   --mode=link gcc  -Wall -Wextra -Wconversion -g -O2 -fPIE -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security  -fPIE -pie -Wl,-z,relro -Wl,-z,now -o libcoloredstderr.la -rpath /usr/local/lib coloredstderr.lo  -ldl
886 ';
887
888 # cargo/rust
889
890 is_blhc 'cargo', '', 0,
891         '';
892
893
894
895 # different architectures
896
897 my $arch_hppa = '';
898 is_blhc 'arch-hppa', '', 0,
899         $arch_hppa;
900
901 my $arch_i386 =
902         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
903 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
904 ';
905 is_blhc 'arch-i386', '', 8,
906         $arch_i386;
907
908 my $arch_ia64 = '';
909 is_blhc 'arch-ia64', '', 0,
910         $arch_ia64;
911
912 is_blhc 'arch-ia64', '--arch i386', 8,
913         'CFLAGS missing (-fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
914 LDFLAGS missing (-Wl,-z,relro): gcc -fPIE -pie -o test test.o
915 CFLAGS missing (-fPIE -fstack-protector-strong): gcc -D_FORTIFY_SOURCE=2 -g -O2 -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
916 LDFLAGS missing (-pie -Wl,-z,relro): gcc -fPIE -o test test.o
917 ';
918
919
920 # architecture in older buildd logs
921
922 is_blhc 'dpkg-buildpackage-architecture-old', '', 0,
923         '';
924
925 # architecture in newer buildd logs
926
927 is_blhc 'dpkg-buildpackage-architecture-new', '', 0,
928         '';
929
930
931 # correct architecture detection
932
933 is_blhc 'buildd-architecture',     '', 0, '';
934 is_blhc 'buildd-architecture-old', '', 0, '';
935
936
937 # ignore architecture
938
939 is_blhc ['arch-hppa', 'arch-i386', 'empty', 'arch-mipsel'],
940         '--ignore-arch hppa --ignore-arch mipsel',
941         9,
942         "checking './t/logs/arch-hppa'...\n"
943         . "ignoring architecture 'hppa'\n"
944         . "checking './t/logs/arch-i386'...\n"
945         . $arch_i386
946         . "checking './t/logs/empty'...\n"
947         . $empty
948         . "checking './t/logs/arch-mipsel'...\n"
949         . "ignoring architecture 'mipsel'\n"
950         ;
951
952 is_blhc 'buildd-dpkg-dev', '--ignore-arch i386', 0,
953         "ignoring architecture 'i386'\n";
954
955
956 # debian
957
958 is_blhc 'debian', '', 8,
959         'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
960 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get CFLAGS` test.c
961 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c `dpkg-buildflags --get CXXFLAGS` test.cc
962 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -c `dpkg-buildflags --get LDFLAGS` test.c
963 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get LDFLAGS` test.c
964 LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS`
965 ';
966
967 is_blhc 'debian', '--line-numbers', 8,
968         '9:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
969 13:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get CFLAGS` test.c
970 14:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): g++ -c `dpkg-buildflags --get CXXFLAGS` test.cc
971 15:CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): gcc -c `dpkg-buildflags --get LDFLAGS` test.c
972 15:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get LDFLAGS` test.c
973 19:LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS`
974 ';
975
976 is_blhc 'debian-cmake', '', 32,
977         'INVALID CMAKE: 2.8.7-1
978 ';
979 is_blhc 'debian-cmake-2', '', 32,
980         'INVALID CMAKE: 2.8.7-2
981 ';
982 is_blhc 'debian-cmake-ok', '', 0,
983         '';
984
985 my $debian_hardening_wrapper =
986         'HARDENING WRAPPER: no checks possible, aborting
987 ';
988 is_blhc 'debian-hardening-wrapper', '', 16,
989         $debian_hardening_wrapper;
990 is_blhc 'debian-hardening-wrapper-old-build-depends', '', 16,
991         $debian_hardening_wrapper;
992 is_blhc 'debian-hardening-wrapper-pbuilder', '', 16,
993         $debian_hardening_wrapper;
994
995
996 # false positives
997
998 is_blhc 'false-positives', '', 0,
999         '';
1000
1001
1002 # buildd support
1003
1004 is_blhc 'empty', '--buildd', 0,
1005         'I-no-compiler-commands||
1006 ';
1007
1008 is_blhc 'buildd-package-details', '--buildd', 0,
1009         '';
1010
1011 is_blhc 'buildd-dpkg-dev', '--buildd', 0,
1012         'W-dpkg-buildflags-missing|CPPFLAGS 7 (of 7), CFLAGS 6 (of 6), CXXFLAGS 1 (of 1), LDFLAGS 2 (of 2) missing|
1013 ';
1014
1015 # NOTE: 3 of 6 is important here, search for $disable_clash in blhc
1016 is_blhc 'buildd-dpkg-dev-old', '--buildd', 0,
1017         'W-dpkg-buildflags-missing|CFLAGS 3 (of 6), CXXFLAGS 1 (of 1) missing|
1018 ';
1019
1020 is_blhc 'buildd-dpkg-dev-missing', '--buildd', 0,
1021         'W-dpkg-buildflags-missing|CFLAGS 3 (of 6), CXXFLAGS 1 (of 1) missing|
1022 ';
1023
1024 is_blhc 'buildd-gcc-pie', '--buildd --all', 0,
1025         'W-dpkg-buildflags-missing|CFLAGS 1 (of 1), LDFLAGS 1 (of 1) missing|
1026 ';
1027 is_blhc 'buildd-gcc-pie-builtin-wrong-arch', '--buildd --all', 0,
1028         'W-dpkg-buildflags-missing|CFLAGS 1 (of 1), LDFLAGS 1 (of 1) missing|
1029 ';
1030 is_blhc 'buildd-gcc-pie-builtin', '--buildd', 0, '';
1031 is_blhc 'buildd-gcc-pie-builtin', '--buildd --all', 0, '';
1032
1033 # Older dpkg versions use -fstack-protector instead of -strong.
1034 is_blhc 'buildd-dpkg-fstack-protector', '--buildd', 0,
1035         '';
1036 is_blhc 'buildd-dpkg-fstack-protector-missing', '--buildd', 0,
1037         'W-dpkg-buildflags-missing|CFLAGS 5 (of 5) missing|
1038 ';
1039
1040 is_blhc 'debian-hardening-wrapper', '--buildd', 0,
1041         'I-hardening-wrapper-used||
1042 ';
1043 is_blhc 'debian-hardening-wrapper-pbuilder', '--buildd', 0,
1044         'I-hardening-wrapper-used||
1045 ';
1046
1047 is_blhc 'buildd-verbose-build', '--buildd', 0,
1048         'W-compiler-flags-hidden|3 (of 5) hidden|
1049 ';
1050
1051 is_blhc 'make', '--buildd', 0,
1052         'I-no-compiler-commands||
1053 ';
1054
1055 is_blhc 'debian-cmake', '--buildd', 0,
1056         'I-invalid-cmake-used|2.8.7-1|
1057 ';
1058
1059
1060 # debian specific settings
1061
1062 is_blhc 'debian-gcc-pie', '--debian', 0, '';
1063
1064
1065 # multiple files
1066
1067 is_blhc ['good', 'good-pie', 'good-bindnow', 'good-all', 'good-multiline', 'good-library'], '', 0,
1068         "checking './t/logs/good'...
1069 checking './t/logs/good-pie'...
1070 checking './t/logs/good-bindnow'...
1071 checking './t/logs/good-all'...
1072 checking './t/logs/good-multiline'...
1073 checking './t/logs/good-library'...
1074 ";
1075 is_blhc ['good-all', 'good-library'], '--all', 0,
1076         "checking './t/logs/good-all'...
1077 checking './t/logs/good-library'...
1078 ";
1079
1080 is_blhc ['arch-i386', 'arch-ia64'], '', 8,
1081         "checking './t/logs/arch-i386'...\n"
1082         . $arch_i386
1083         . "checking './t/logs/arch-ia64'...\n"
1084         . $arch_ia64;
1085
1086 # No exit when multiple files are specified.
1087 is_blhc ['bad-ldflags', 'empty', 'arch-hppa', 'debian-hardening-wrapper'], '', 25,
1088         "checking './t/logs/bad-ldflags'...\n"
1089         . $bad_ldflags
1090         . "checking './t/logs/empty'...\n"
1091         . $empty
1092         . "checking './t/logs/arch-hppa'...\n"
1093         . $arch_hppa
1094         . "checking './t/logs/debian-hardening-wrapper'...\n"
1095         . $debian_hardening_wrapper
1096         ;
1097
1098 # Ignore works correctly with multiple architectures.
1099 is_blhc ['arch-i386', 'arch-amd64', 'arch-hppa', 'ignore-flag'],
1100         '--ignore-arch-flag i386:-fstack-protector-strong --ignore-arch-flag mipsel:-Werror=format-security', 8,
1101         "checking './t/logs/arch-i386'...
1102 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
1103 checking './t/logs/arch-amd64'...
1104 CFLAGS missing (-fstack-protector-strong -fcf-protection): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
1105 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
1106 checking './t/logs/arch-hppa'...
1107 checking './t/logs/ignore-flag'...
1108 CFLAGS missing (-g): gcc    -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c
1109 CFLAGS missing (-O2): gcc -g     -fstack-protector-strong -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c
1110 "
1111         ;
1112
1113 is_blhc ['arch-i386', 'arch-amd64', 'arch-hppa', 'ignore-line'],
1114         '--ignore-arch-line "i386:gcc .+ -fPIE .+" --ignore-arch-line "mipsel:gcc .+ -Wl,-z,relro -Wl,-z,now .+"', 8,
1115         "checking './t/logs/arch-i386'...
1116 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
1117 checking './t/logs/arch-amd64'...
1118 CFLAGS missing (-fstack-protector-strong -fcf-protection): gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -fstack-clash-protection -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
1119 LDFLAGS missing (-pie): gcc -fPIE -Wl,-z,relro -Wl,-z,now -o test test.o
1120 checking './t/logs/arch-hppa'...
1121 checking './t/logs/ignore-line'...
1122 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security):     ./prepare-script gcc test-a.c test-b.c test-c.c
1123 CPPFLAGS missing (-D_FORTIFY_SOURCE=2):     ./prepare-script gcc test-a.c test-b.c test-c.c
1124 LDFLAGS missing (-Wl,-z,relro):     ./prepare-script gcc test-a.c test-b.c test-c.c
1125 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-a.c
1126 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-a.c
1127 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-a.c
1128 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-b.c
1129 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-b.c
1130 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-b.c
1131 CFLAGS missing (-g -O2 -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security): ./prepare-script gcc test-c.c
1132 CPPFLAGS missing (-D_FORTIFY_SOURCE=2): ./prepare-script gcc test-c.c
1133 LDFLAGS missing (-Wl,-z,relro): ./prepare-script gcc test-c.c
1134 "
1135         ;