]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - bin/blhc
Don't recognize options which contain compiler names as compiler lines.
[blhc/blhc.git] / bin / blhc
index 49640dd5eb379c70d1fce2d22c47751582a47be7..1d35e0ba489008f5c2eee8bab499256e0445d2b3 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -31,8 +31,10 @@ our $VERSION = '0.01';
 
 # Regex to catch compiler commands.
 my $cc_regex = qr/
-    (?<!\.)(?:cc|gcc|g\+\+|c\+\+)
-    (?:-[\d.]+)?
+    (?<!\s-)               # ignore options, e.g. "-c++" [sic!] (used by swig)
+    (?<!\.)                # ignore file names, e.g. "test.gcc"
+    (?:cc|gcc|g\+\+|c\+\+)
+    (?:-[\d.]+)?           # version suffix, e.g. "gcc-4.6"
     /x;
 # Full regex which matches the complete compiler name. Used in a few places to
 # prevent false negatives.
@@ -711,10 +713,10 @@ foreach my $file (@ARGV) {
         my ($abi, $os, $cpu) = Dpkg::Arch::debarch_to_debtriplet($arch);
 
         # Disable unsupported hardening options.
-        if ($cpu =~ /^(ia64|alpha|mips|mipsel|hppa)$/ or $arch eq 'arm') {
+        if ($cpu =~ /^(?:ia64|alpha|mips|mipsel|hppa)$/ or $arch eq 'arm') {
             $harden_stack = 0;
         }
-        if ($cpu =~ /^(ia64|hppa|avr32)$/) {
+        if ($cpu =~ /^(?:ia64|hppa|avr32)$/) {
             $harden_relro   = 0;
             $harden_bindnow = 0;
         }