3 # Build log hardening check, checks build logs for missing hardening flags.
5 # Copyright (C) 2012 Simon Ruderich
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 use Term::ANSIColor ();
26 use Text::ParseWords ();
28 our $VERSION = '0.01';
33 # Regex to catch compiler commands.
35 (?<!\.)(?:cc|gcc|g\+\+|c\+\+)
38 # Full regex which matches the complete compiler name. Used in a few places to
39 # prevent false negatives.
40 my $cc_regex_full = qr/
41 (?:[a-z0-9_]+-(?:linux-|kfreebsd-)?gnu(?:eabi|eabihf)?-)?
44 # Regex to catch (GCC) compiler warnings.
45 my $warning_regex = qr/^(.+?):([0-9]+):[0-9]+: warning: (.+?) \[(.+?)\]$/;
47 # List of source file extensions which require preprocessing.
48 my @source_preprocess_compile_cpp = (
50 qw( cc cp cxx cpp CPP c++ C ),
54 my @source_preprocess_compile = (
60 @source_preprocess_compile_cpp,
62 qw( F FOR fpp FPP FTN F90 F95 F03 F08 ),
64 my @source_preprocess_no_compile = (
68 my @source_preprocess = (
69 @source_preprocess_compile,
70 @source_preprocess_no_compile,
72 # List of source file extensions which don't require preprocessing.
73 my @source_no_preprocess_compile_cpp = (
79 my @source_no_preprocess_compile = (
83 @source_no_preprocess_compile_cpp,
87 qw( f for ftn f90 f95 f03 f08 ),
89 my @source_no_preprocess_no_compile = (
93 my @source_no_preprocess = (
94 @source_no_preprocess_compile,
95 @source_no_preprocess_no_compile,
97 # List of header file extensions which require preprocessing.
98 my @header_preprocess = (
99 # C, C++, Objective-C, Objective-C++
102 qw( hh H hp hxx hpp HPP h++ tcc ),
105 # Hashes for fast extensions lookup to check if a file falls in one of these
107 my %extensions_no_preprocess = map { $_ => 1 } (
108 @source_no_preprocess,
110 my %extensions_preprocess = map { $_ => 1 } (
114 my %extensions_compile_link = map { $_ => 1 } (
116 @source_no_preprocess,
118 my %extensions_compile = map { $_ => 1 } (
119 @source_preprocess_compile,
120 @source_no_preprocess_compile,
122 my %extensions_no_compile = map { $_ => 1 } (
123 @source_preprocess_no_compile,
124 @source_no_preprocess_no_compile,
126 my %extensions_compile_cpp = map { $_ => 1 } (
127 @source_preprocess_compile_cpp,
128 @source_no_preprocess_compile_cpp,
130 my %extension = map { $_ => 1 } (
131 @source_no_preprocess,
132 @source_no_preprocess_compile,
133 @source_no_preprocess_compile_cpp,
134 @source_no_preprocess_no_compile,
137 @source_preprocess_compile,
138 @source_preprocess_compile_cpp,
139 @source_preprocess_no_compile,
142 # Regexp to match file extensions.
143 my $file_extension_regex = qr/
145 \S+ # Filename without extension.
147 ([^\\.,;:\s]+) # File extension.
148 (?=\s|\\) # At end of word. Can't use \b because some files have non
149 # word characters at the end and because \b matches double
150 # extensions (like .cpp.o). Works always as all lines are
151 # terminated with "\n".
154 # Expected (hardening) flags. All flags are used as regexps.
159 my @def_cflags_format = (
162 '-Werror=format-security',
164 my @def_cflags_fortify = (
165 # fortify needs at least -O1, but -O2 is recommended anyway
167 my @def_cflags_stack = (
169 '--param=ssp-buffer-size=4',
171 my @def_cflags_pie = (
177 # @def_cxxflags_* is the same as @def_cflags_*.
178 my @def_cppflags = ();
179 my @def_cppflags_fortify = (
180 '-D_FORTIFY_SOURCE=2',
182 my @def_ldflags = ();
183 my @def_ldflags_relro = (
186 my @def_ldflags_bindnow = (
189 my @def_ldflags_pie = (
193 my @def_ldflags_pic = (
198 # Renaming rules for the output so the regex parts are not visible. Also
199 # stores string values of flag regexps above, see compile_flag_regexp().
201 '-O(?:2|3)' => '-O2',
202 '-Wl,(-z,)?relro' => '-Wl,-z,relro',
203 '-Wl,(-z,)?now' => '-Wl,-z,now',
206 # Statistics of missing flags and non-verbose build commands. Used for
210 preprocess_missing => 0,
212 compile_missing => 0,
214 compile_cpp_missing => 0,
218 commands_nonverbose => 0,
221 # Use colored (ANSI) output?
228 my ($message, $missing_flags_ref, $flag_renames_ref, $line) = @_;
230 # Get string value of qr//-escaped regexps and if requested rename them.
231 my @missing_flags = map {
232 $flag_renames_ref->{$_}
233 } @{$missing_flags_ref};
235 my $flags = join ' ', @missing_flags;
236 printf "%s (%s)%s %s",
237 error_color($message, 'red'), $flags, error_color(':', 'yellow'),
240 sub error_non_verbose_build {
244 error_color('NONVERBOSE BUILD', 'red'),
245 error_color(':', 'yellow'),
248 sub error_hardening_wrapper {
250 error_color('HARDENING WRAPPER', 'red'),
251 error_color(':', 'yellow'),
252 'no checks possible, aborting';
255 my ($message, $color) = @_;
258 return Term::ANSIColor::colored($message, $color);
265 my ($line, @flags) = @_;
267 foreach my $flag (@flags) {
268 return 1 if $line =~ /$flag/;
274 my ($line, $missing_flags_ref, @flags) = @_;
276 my @missing_flags = ();
277 foreach my $flag (@flags) {
278 if (not $line =~ /$flag/) {
279 push @missing_flags, $flag;
283 return 1 if scalar @missing_flags == 0;
285 @{$missing_flags_ref} = @missing_flags;
289 # Modifies $missing_flags_ref array.
290 sub pic_pie_conflict {
291 my ($line, $pie, $missing_flags_ref, @flags_pie) = @_;
293 return 0 if not $pie;
294 return 0 if not any_flags_used($line, @def_ldflags_pic);
296 my %flags = map { $_ => 1 } @flags_pie;
298 # Remove all PIE flags from @missing_flags as they are not required with
301 not exists $flags{$_}
302 } @{$missing_flags_ref};
303 @{$missing_flags_ref} = @result;
305 # We got a conflict when no flags are left, thus only PIE flags were
306 # missing. If other flags were missing abort because the conflict is not
308 return scalar @result == 0;
311 sub is_non_verbose_build {
312 my ($line, $next_line, $skip_ref) = @_;
314 if (not ($line =~ /^checking if you want to see long compiling messages\.\.\. no/
315 or $line =~ /^\s*\[?(?:CC|CCLD|C\+\+|CXX|CXXLD|LD|LINK)\]?\s+(.+?)$/
316 or $line =~ /^\s*(?:C|c)ompiling\s+(.+?)(?:\.\.\.)?$/
317 or $line =~ /^\s*(?:B|b)uilding (?:program|shared library)\s+(.+?)$/
318 or $line =~ /^\s*\[[\d ]+%\] Building (?:C|CXX) object (.+?)$/)) {
323 return 0 if $line =~ /^\s*C\+\+.+?:\s+(?:yes|no)\s*$/;
327 # On the first pass we only check if this line is verbose or not.
328 return 1 if not defined $next_line;
330 # Second pass, we have access to the next line.
333 # CMake and other build systems print the non-verbose messages also when
334 # building verbose. If a compiler and the file name occurs in the next
335 # line, treat it as verbose build.
337 # Get filename, we can't use the complete path as only parts of it are
338 # used in the real compiler command.
339 $file =~ m{/([^/\s]+)$};
342 if ($next_line =~ /\Q$file\E/ and $next_line =~ /$cc_regex/o) {
343 # We still have to skip the current line as it doesn't contain any
353 sub compile_flag_regexp {
354 my ($flag_renames_ref, @flags) = @_;
357 foreach my $flag (@flags) {
358 # Store flag name in replacement string for correct flags in messages
359 # with qr//ed flag regexps.
360 $flag_renames_ref->{qr/\s$flag(?:\s|\\)/}
361 = (exists $flag_renames_ref->{$flag})
362 ? $flag_renames_ref->{$flag}
365 # Compile flag regexp for faster execution.
366 push @result, qr/\s$flag(?:\s|\\)/;
371 sub extension_found {
372 my ($extensions_ref, @extensions) = @_;
375 foreach my $extension (@extensions) {
376 if (exists $extensions_ref->{$extension}) {
387 # Parse command line arguments.
389 my $option_version = 0;
391 my $option_bindnow = 0;
393 my $option_arch = undef;
394 my $option_buildd = 0;
396 if (not Getopt::Long::GetOptions(
397 'help|h|?' => \$option_help,
398 'version' => \$option_version,
400 'pie' => \$option_pie,
401 'bindnow' => \$option_bindnow,
402 'all' => \$option_all,
404 'color' => \$option_color,
405 'arch=s' => \$option_arch,
406 'buildd' => \$option_buildd,
409 Pod::Usage::pod2usage(2);
413 Pod::Usage::pod2usage(1);
415 if ($option_version) {
416 print "blhc $VERSION Copyright (C) 2012 Simon Ruderich
418 This program is free software: you can redistribute it and/or modify
419 it under the terms of the GNU General Public License as published by
420 the Free Software Foundation, either version 3 of the License, or
421 (at your option) any later version.
423 This program is distributed in the hope that it will be useful,
424 but WITHOUT ANY WARRANTY; without even the implied warranty of
425 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
426 GNU General Public License for more details.
428 You should have received a copy of the GNU General Public License
429 along with this program. If not, see <http://www.gnu.org/licenses/>.
439 # Precompile all flag regexps. any_flags_used(), all_flags_used() get a lot
441 @def_cflags = compile_flag_regexp(\%flag_renames, @def_cflags);
442 @def_cflags_format = compile_flag_regexp(\%flag_renames, @def_cflags_format);
443 @def_cflags_fortify = compile_flag_regexp(\%flag_renames, @def_cflags_fortify);
444 @def_cflags_stack = compile_flag_regexp(\%flag_renames, @def_cflags_stack);
445 @def_cflags_pie = compile_flag_regexp(\%flag_renames, @def_cflags_pie);
446 @def_cxxflags = compile_flag_regexp(\%flag_renames, @def_cxxflags);
447 @def_cppflags = compile_flag_regexp(\%flag_renames, @def_cppflags);
448 @def_cppflags_fortify = compile_flag_regexp(\%flag_renames, @def_cppflags_fortify);
449 @def_ldflags = compile_flag_regexp(\%flag_renames, @def_ldflags);
450 @def_ldflags_relro = compile_flag_regexp(\%flag_renames, @def_ldflags_relro);
451 @def_ldflags_bindnow = compile_flag_regexp(\%flag_renames, @def_ldflags_bindnow);
452 @def_ldflags_pie = compile_flag_regexp(\%flag_renames, @def_ldflags_pie);
453 @def_ldflags_pic = compile_flag_regexp(\%flag_renames, @def_ldflags_pic);
458 FILE: foreach my $file (@ARGV) {
459 open my $fh, '<', $file or die "$!: $file";
461 # Hardening options. Not all architectures support all hardening options.
462 my $harden_format = 1;
463 my $harden_fortify = 1;
464 my $harden_stack = 1;
465 my $harden_relro = 1;
466 my $harden_bindnow = $option_bindnow; # defaults to 0
467 my $harden_pie = $option_pie; # defaults to 0
469 while (my $line = <$fh>) {
470 # dpkg-buildflags only provides hardening flags since 1.16.1, don't
471 # check for hardening flags in buildd mode if an older dpkg-dev is
472 # used. Default flags (-g -O2) are still checked.
474 # Packages which were built before 1.16.1 but used their own hardening
475 # flags are not checked.
476 if ($option_buildd and $line =~ /^Toolchain package versions: /) {
477 require Dpkg::Version;
478 if ($line !~ /dpkg-dev_(\S+)/
479 or Dpkg::Version::version_compare($1, '1.16.1') < 0) {
489 # If hardening wrapper is used (wraps calls to gcc and adds hardening
490 # flags automatically) we can't perform any checks, abort.
491 if ($line =~ /^Build-Depends: .*\bhardening-wrapper\b/) {
492 if (not $option_buildd) {
493 error_hardening_wrapper();
495 print "I-hardening-wrapper-used\n";
501 # We skip over unimportant lines at the beginning of the log to
502 # prevent false positives.
503 last if $line =~ /^dpkg-buildpackage:/;
506 # Input lines, contain only the lines with compiler commands.
509 my $continuation = 0;
510 my $complete_line = undef;
511 while (my $line = <$fh>) {
512 # And stop at the end of the build log. Package details (reported by
513 # the buildd logs) are not important for us. This also prevents false
515 last if $line =~ /^Build finished at \d{8}-\d{4}$/;
517 # Detect architecture automatically unless overridden.
519 and $line =~ /^dpkg-buildpackage: host architecture (.+)$/) {
523 # Ignore compiler warnings for now.
524 next if $line =~ /$warning_regex/o;
526 if ($line =~ /\033/) { # esc
527 # Remove all ANSI color sequences which are sometimes used in
528 # non-verbose builds.
529 $line = Term::ANSIColor::colorstrip($line);
530 # Also strip '\0xf' (delete previous character), used by Elinks'
533 # And "ESC(B" which seems to be used on armhf and hurd (not sure
535 $line =~ s/\033\(B//g;
538 # Check if this line indicates a non verbose build.
539 my $non_verbose = is_non_verbose_build($line);
541 # One line may contain multiple commands (";"). Treat each one as
542 # single line. parse_line() is slow, only use it when necessary.
543 my @line = (not $line =~ /;/)
546 # Ensure newline at the line end - necessary for
547 # correct parsing later.
550 } Text::ParseWords::parse_line(';', 1, $line);
551 foreach $line (@line) {
555 # Join lines, but leave the "\" in place so it's clear where
556 # the original line break was.
557 chomp $complete_line;
558 $complete_line .= ' ' . $line;
560 # Line continuation, line ends with "\".
561 if ($line =~ /\\\s*$/) {
563 # Start line continuation.
564 if (not defined $complete_line) {
565 $complete_line = $line;
570 if (not $continuation) {
571 # Use the complete line if a line continuation occurred.
572 if (defined $complete_line) {
573 $line = $complete_line;
574 $complete_line = undef;
577 # Ignore lines with no compiler commands.
578 next if not $non_verbose
579 and not $line =~ /\b$cc_regex(?:\s|\\)/o;
580 # Ignore lines with no filenames with extensions. May miss
581 # some non-verbose builds (e.g. "gcc -o test" [sic!]), but
582 # shouldn't be a problem as the log will most likely contain
583 # other non-verbose commands which are detected.
584 next if not $non_verbose
585 and not $line =~ /$file_extension_regex/o;
587 # Ignore false positives.
589 # `./configure` output.
590 next if not $non_verbose
591 and $line =~ /^(?:checking|(?:C|c)onfigure:) /;
592 next if $line =~ /^\s*(?:Host\s+)?(?:C(?:\+\+)?\s+)?
593 (?:C|c)ompiler[\s.]*:?\s+
595 next if $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o;
597 # Check if additional hardening options were used. Used to
598 # ensure they are used for the complete build.
599 $harden_pie = 1 if any_flags_used($line, @def_cflags_pie, @def_ldflags_pie);
600 $harden_bindnow = 1 if any_flags_used($line, @def_ldflags_bindnow);
609 if (scalar @input == 0) {
610 if (not $option_buildd) {
611 print "No compiler commands!\n";
613 print "W-no-compiler-commands\n";
619 if ($option_buildd) {
620 $statistics{commands} += scalar @input;
623 # Option or auto detected.
625 # The following was partially copied from dpkg-dev 1.16.1.2
626 # (/usr/share/perl5/Dpkg/Vendor/Debian.pm, add_hardening_flags()),
627 # copyright Raphaël Hertzog <hertzog@debian.org>, Kees Cook
628 # <kees@debian.org>, Canonical, Ltd. licensed under GPL version 2 or
629 # later. Keep it in sync.
632 my ($abi, $os, $cpu) = Dpkg::Arch::debarch_to_debtriplet($option_arch);
634 # Disable unsupported hardening options.
635 if ($cpu =~ /^(ia64|alpha|mips|mipsel|hppa)$/ or $option_arch eq 'arm') {
638 if ($cpu =~ /^(ia64|hppa|avr32)$/) {
645 my @cflags = @def_cflags;
646 my @cxxflags = @def_cxxflags;
647 my @cppflags = @def_cppflags;
648 my @ldflags = @def_ldflags;
649 # Check the specified hardening options, same order as dpkg-buildflags.
651 @cflags = (@cflags, @def_cflags_pie);
652 @cxxflags = (@cxxflags, @def_cflags_pie);
653 @ldflags = (@ldflags, @def_ldflags_pie);
656 @cflags = (@cflags, @def_cflags_stack);
657 @cxxflags = (@cxxflags, @def_cflags_stack);
659 if ($harden_fortify) {
660 @cflags = (@cflags, @def_cflags_fortify);
661 @cxxflags = (@cxxflags, @def_cflags_fortify);
662 @cppflags = (@cppflags, @def_cppflags_fortify);
664 if ($harden_format) {
665 @cflags = (@cflags, @def_cflags_format);
666 @cxxflags = (@cxxflags, @def_cflags_format);
669 @ldflags = (@ldflags, @def_ldflags_relro);
671 if ($harden_bindnow) {
672 @ldflags = (@ldflags, @def_ldflags_bindnow);
675 for (my $i = 0; $i < scalar @input; $i++) {
676 my $line = $input[$i];
679 if (is_non_verbose_build($line, $input[$i + 1], \$skip)) {
680 if (not $option_buildd) {
681 error_non_verbose_build($line);
683 $statistics{commands_nonverbose}++;
688 # Even if it's a verbose build, we might have to skip this line.
691 # Remove everything until and including the compiler command. Makes
692 # checks easier and faster.
693 $line =~ s/^.*?$cc_regex//o;
694 # "([...] test.c)" is not detected as 'test.c' - fix this by removing
695 # the brace and similar characters.
696 $line =~ s/['")]+$//;
698 # Skip unnecessary tests when only preprocessing.
699 my $flag_preprocess = 0;
705 # Preprocess, compile, assemble.
706 if ($line =~ /\s(-E|-S|-c)\b/) {
708 $flag_preprocess = 1 if $1 eq '-E';
709 $compile = 1 if $1 eq '-S' or $1 eq '-c';
710 # Otherwise assume we are linking.
715 # Get all file extensions on this line.
716 my @extensions = $line =~ /$file_extension_regex/go;
717 # Ignore all unknown extensions to speedup the search below.
718 @extensions = grep { exists $extension{$_} } @extensions;
720 # These file types don't require preprocessing.
721 if (extension_found(\%extensions_no_preprocess, @extensions)) {
724 # These file types require preprocessing.
725 if (extension_found(\%extensions_preprocess, @extensions)) {
729 # If there are source files then it's compiling/linking in one step
730 # and we must check both. We only check for source files here, because
731 # header files cause too many false positives.
732 if (not $flag_preprocess
733 and extension_found(\%extensions_compile_link, @extensions)) {
734 # Assembly files don't need CFLAGS.
735 if (not extension_found(\%extensions_compile, @extensions)
736 and extension_found(\%extensions_no_compile, @extensions)) {
744 # Assume CXXFLAGS are required when a C++ file is specified in the
748 and extension_found(\%extensions_compile_cpp, @extensions)) {
753 if ($option_buildd) {
754 $statistics{preprocess}++ if $preprocess;
755 $statistics{compile}++ if $compile;
756 $statistics{compile_cpp}++ if $compile_cpp;
757 $statistics{link}++ if $link;
760 # Check hardening flags.
762 if ($compile and not all_flags_used($line, \@missing, @cflags)
763 # Libraries linked with -fPIC don't have to (and can't) be
764 # linked with -fPIE as well. It's no error if only PIE flags
766 and not pic_pie_conflict($line, $harden_pie, \@missing, @def_cflags_pie)
767 # Assume dpkg-buildflags returns the correct flags.
768 and not $line =~ /`dpkg-buildflags --get CFLAGS`/) {
769 if (not $option_buildd) {
770 error_flags('CFLAGS missing', \@missing, \%flag_renames, $input[$i]);
772 $statistics{compile_missing}++;
775 } elsif ($compile_cpp and not all_flags_used($line, \@missing, @cflags)
776 # Libraries linked with -fPIC don't have to (and can't) be
777 # linked with -fPIE as well. It's no error if only PIE flags
779 and not pic_pie_conflict($line, $harden_pie, \@missing, @def_cflags_pie)
780 # Assume dpkg-buildflags returns the correct flags.
781 and not $line =~ /`dpkg-buildflags --get CXXFLAGS`/) {
782 if (not $option_buildd) {
783 error_flags('CXXFLAGS missing', \@missing, \%flag_renames, $input[$i]);
785 $statistics{compile_cpp_missing}++;
789 if ($preprocess and not all_flags_used($line, \@missing, @cppflags)
790 # Assume dpkg-buildflags returns the correct flags.
791 and not $line =~ /`dpkg-buildflags --get CPPFLAGS`/) {
792 if (not $option_buildd) {
793 error_flags('CPPFLAGS missing', \@missing, \%flag_renames, $input[$i]);
795 $statistics{preprocess_missing}++;
799 if ($link and not all_flags_used($line, \@missing, @ldflags)
800 # Same here, -fPIC conflicts with -fPIE.
801 and not pic_pie_conflict($line, $harden_pie, \@missing, @def_ldflags_pie)
802 # Assume dpkg-buildflags returns the correct flags.
803 and not $line =~ /`dpkg-buildflags --get LDFLAGS`/) {
804 if (not $option_buildd) {
805 error_flags('LDFLAGS missing', \@missing, \%flag_renames, $input[$i]);
807 $statistics{link_missing}++;
814 # Print statistics for buildd mode, only output in this mode.
815 if ($option_buildd) {
818 if ($statistics{preprocess_missing}) {
819 push @warning, sprintf "CPPFLAGS %d (of %d)",
820 $statistics{preprocess_missing},
821 $statistics{preprocess};
823 if ($statistics{compile_missing}) {
824 push @warning, sprintf "CFLAGS %d (of %d)",
825 $statistics{compile_missing},
826 $statistics{compile};
828 if ($statistics{compile_cpp_missing}) {
829 push @warning, sprintf "CXXFLAGS %d (of %d)",
830 $statistics{compile_cpp_missing},
831 $statistics{compile_cpp};
833 if ($statistics{link_missing}) {
834 push @warning, sprintf "LDFLAGS %d (of %d)",
835 $statistics{link_missing},
838 if (scalar @warning) {
839 local $" = ', '; # array join string
840 print "W-dpkg-buildflags-missing @warning missing\n";
843 if ($statistics{commands_nonverbose}) {
844 printf "W-compiler-flags-hidden %d (of %d) hidden\n",
845 $statistics{commands_nonverbose},
846 $statistics{commands},
858 blhc - build log hardening check, checks build logs for missing hardening flags
862 B<blhc> [I<options>] I<E<lt>dpkg-buildpackage build log fileE<gt>..>
866 blhc is a small tool which checks build logs for missing hardening flags and
867 other important warnings. It's licensed under the GPL 3 or later.
875 Force check for all +all (+pie, +bindnow) hardening flags. By default it's
878 =item B<--arch> I<architecture>
880 Set the specific architecture (e.g. amd64, armel, etc.), automatically
881 disables hardening flags not available on this architecture. Is detected
882 automatically if dpkg-buildpackage is used.
886 Force check for all +bindnow hardening flags. By default it's auto detected.
890 Special mode for buildds when automatically parsing log files. The following
891 changes are in effect:
897 Don't check hardening flags in old log files (if dpkg-dev << 1.16.1 is
904 Use colored (ANSI) output for warning messages.
908 Force check for all +pie hardening flags. By default it's auto detected.
910 =item B<-h -? --help>
912 Print available options.
916 Print version number and license.
920 Auto detection for B<--pie> and B<--bindnow> only works if at least one
921 command uses the required hardening flag (e.g. -fPIE). Then it's required for
922 all other commands as well.
926 The exit status is a "bit mask", each listed status is ORed when the error
927 condition occurs to get the result.
937 No compiler commands were found.
941 Invalid arguments/options given to blhc.
949 Missing hardening flags.
953 Hardening wrapper detected, no tests performed.
959 Simon Ruderich, E<lt>simon@ruderich.orgE<gt>
961 =head1 COPYRIGHT AND LICENSE
963 Copyright (C) 2012 by Simon Ruderich
965 This program is free software: you can redistribute it and/or modify
966 it under the terms of the GNU General Public License as published by
967 the Free Software Foundation, either version 3 of the License, or
968 (at your option) any later version.
970 This program is distributed in the hope that it will be useful,
971 but WITHOUT ANY WARRANTY; without even the implied warranty of
972 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
973 GNU General Public License for more details.
975 You should have received a copy of the GNU General Public License
976 along with this program. If not, see <http://www.gnu.org/licenses/>.