[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.13-26-g486dddb



The following commit has been merged in the master branch:
commit 486dddb91aa1ad90fb36a1a6f8505baa21e1497d
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 15 14:56:59 2013 +0200

    c/binaries: Look for mcount (etc.) on all architectures
    
    When testing an ELF binary for being compiled with profiling options,
    look also for "mcount" (or "_mcount" or "__mcount").  According to the
    binutils documentation, one of the "mcount" symbols will be present[1].
    
    [1] http://sourceware.org/binutils/docs/gprof/Implementation.html
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/binaries.pm b/checks/binaries.pm
index bbc9ec7..08b1cca 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -113,6 +113,7 @@ my $srcpkg = $proc->pkg_src;
 foreach my $file (sort keys %{$info->objdump_info}) {
     my $objdump = $info->objdump_info->{$file};
     my $has_lfs = undef;
+    my $is_profiled = 0;
     # Only 32bit ELF binaries can lack LFS.
     $ARCH_32_REGEX = $ARCH_REGEX->value ('32') unless defined $ARCH_32_REGEX;
     $has_lfs = 1 unless $info->file_info ($file) =~ m/$ARCH_32_REGEX/o;
@@ -135,16 +136,20 @@ foreach my $file (sort keys %{$info->objdump_info}) {
                 $has_lfs = 0;
             }
         }
-        if ($arch ne 'hppa') {
+        next if $is_profiled;
+        # According to the binutils documentation[1], the profiling symbol
+        # can be named "mcount", "_mcount" or even "__mcount".
+        # [1] http://sourceware.org/binutils/docs/gprof/Implementation.html
+        if ( $sec =~ /^GLIBC_.*/ and $sym =~ m{\A _?+ _?+ mcount \Z}xsm ) {
+            $is_profiled = 1;
+        } elsif ($arch ne 'hppa') {
+            # This code was used to detect profiled code in Wheezy (and earlier)
             if ($foo eq '.text' and $sec eq 'Base' and
-                $sym eq '__gmon_start__') {
-                tag 'binary-compiled-with-profiling-enabled', $file;
-            }
-        } else {
-            if ( ($sec =~ /^GLIBC_.*/) and ($sym eq '_mcount') ) {
-                tag 'binary-compiled-with-profiling-enabled', $file;
+                    $sym eq '__gmon_start__') {
+                $is_profiled = 1;
             }
         }
+        tag 'binary-compiled-with-profiling-enabled', $file if $is_profiled;
     }
     tag 'binary-file-compressed-with-upx', $file if $objdump->{'UPX'};
     tag 'apparently-corrupted-elf-binary', $file if $objdump->{'ERRORS'};
diff --git a/debian/changelog b/debian/changelog
index 85e3dc1..e90d09e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,10 @@ lintian (2.5.14) UNRELEASED; urgency=low
   * checks/*:
     + [NT] Rename all checks to include the extension ".pm".
       (Closes: #710405)
+  * checks/binaries.pm:
+    + [NT] Also check for the presence of "mcount" to detect
+      whether a binary was compiled with profiling.
+      (Closes: #712124)
   * checks/cruft.pm:
     + [NT] Revise a few tests that relied on file(1) on text files.
     + [NT] Apply patches from Bastien Roucariès to fix some false

-- 
Debian package checker


Reply to: