From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932444AbZHDGHe (ORCPT ); Tue, 4 Aug 2009 02:07:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932426AbZHDGHU (ORCPT ); Tue, 4 Aug 2009 02:07:20 -0400 Received: from cs20.apochromatic.org ([204.152.189.161]:61543 "EHLO cs20.apochromatic.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932412AbZHDGHM (ORCPT ); Tue, 4 Aug 2009 02:07:12 -0400 From: Matt Fleming To: linux-kernel@vger.kernel.org Cc: Steven Rostedt , Paul Mundt , Ingo Molnar , Thomas Gelixner Subject: [PATCH 2/2] ftrace: Only update $offset when we update $ref_func Date: Tue, 4 Aug 2009 07:06:41 +0100 Message-Id: <375cc28178c79bfb22c89a01f8da30d270bbfcbe.1249365713.git.matt@console-pimps.org> X-Mailer: git-send-email 1.6.4.rc0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The value of $offset should be the offset of $ref_func from the beginning of the object file. Therefore, we should set both variables together. This fixes a bug I was hitting on sh where $offset (which is used to calcualte the addends for the __mcount_loc entries) was being set multiple times and didn't correspond to $ref_func's offset in the object file. The addends in __mcount_loc were calculated incorrectly, resulting in ftrace dynamically modifying addresses that weren't mcount call sites. Signed-off-by: Matt Fleming --- scripts/recordmcount.pl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 16c5563..d29baa2 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -403,7 +403,6 @@ while () { # section found, now is this a start of a function? } elsif ($read_function && /$function_regex/) { $text_found = 1; - $offset = hex $1; $text = $2; # if this is either a local function or a weak function @@ -412,10 +411,12 @@ while () { if (!defined($locals{$text}) && !defined($weak{$text})) { $ref_func = $text; $read_function = 0; + $offset = hex $1; } else { # if we already have a function, and this is weak, skip it if (!defined($ref_func) && !defined($weak{$text})) { $ref_func = $text; + $offset = hex $1; } } } elsif ($read_headers && /$mcount_section/) { -- 1.6.4.rc0