소스 검색

tracing: Only print objcopy version warning once from recordmcount

If the user has an older version of objcopy, that can not handle
converting local symbols to global and vice versa, then some
functions will not be part of the dynamic function tracer. The current
code in recordmcount.pl will print a warning in this case. Unfortunately,
there exists lots of files that may have this issue with older objcopys
and this will cause a warning for every file compiled with this
issue.

This patch solves this overwhelming output by creating a
.tmp_quiet_recordmcount file on the first instance the warning is
encountered. The warning will not print if this file exists.

The temp file is deleted at the beginning of the compile to ensure that
the warning will happen once again on new compiles (because the issue
is still present).

Reported-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt 15 년 전
부모
커밋
638adb0561
2개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      Makefile
  2. 10 2
      scripts/recordmcount.pl

+ 1 - 0
Makefile

@@ -379,6 +379,7 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
 PHONY += scripts_basic
 PHONY += scripts_basic
 scripts_basic:
 scripts_basic:
 	$(Q)$(MAKE) $(build)=scripts/basic
 	$(Q)$(MAKE) $(build)=scripts/basic
+	$(Q)rm -f .tmp_quiet_recordmcount
 
 
 # To avoid any implicit rule to kick in, define an empty command.
 # To avoid any implicit rule to kick in, define an empty command.
 scripts/basic/%: scripts_basic ;
 scripts/basic/%: scripts_basic ;

+ 10 - 2
scripts/recordmcount.pl

@@ -162,6 +162,11 @@ my $alignment;		# The .align value to use for $mcount_section
 my $section_type;	# Section header plus possible alignment command
 my $section_type;	# Section header plus possible alignment command
 my $can_use_local = 0; 	# If we can use local function references
 my $can_use_local = 0; 	# If we can use local function references
 
 
+# Shut up recordmcount if user has older objcopy
+my $quiet_recordmcount = ".tmp_quiet_recordmcount";
+my $print_warning = 1;
+$print_warning = 0 if ( -f $quiet_recordmcount);
+
 ##
 ##
 # check_objcopy - whether objcopy supports --globalize-symbols
 # check_objcopy - whether objcopy supports --globalize-symbols
 #
 #
@@ -179,10 +184,13 @@ sub check_objcopy
     }
     }
     close (IN);
     close (IN);
 
 
-    if (!$can_use_local) {
+    if (!$can_use_local && $print_warning) {
 	print STDERR "WARNING: could not find objcopy version or version " .
 	print STDERR "WARNING: could not find objcopy version or version " .
 	    "is less than 2.17.\n" .
 	    "is less than 2.17.\n" .
-	    "\tLocal function references is disabled.\n";
+	    "\tLocal function references are disabled.\n";
+	open (QUIET, ">$quiet_recordmcount");
+	printf QUIET "Disables the warning from recordmcount.pl\n";
+	close QUIET;
     }
     }
 }
 }