* [PATCH] ftrace: objcopy version test for local symbols [not found] ` <20080825060934.GB14993@elte.hu> @ 2008-08-25 18:52 ` Steven Rostedt 2008-08-25 19:01 ` Ingo Molnar 0 siblings, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2008-08-25 18:52 UTC (permalink / raw) To: Ingo Molnar Cc: Stephen Rothwell, Thomas Gleixner, H. Peter Anvin, linux-next, LKML From: Steven Rostedt <srostedt@redhat.com> Subject: ftrace: objcopy version test for local symbols The --globalize-symbols option came out in objcopy version 2.17. If the kernel is being compiled on a system with a lower version of objcopy, then we can not use the globalize / localize trick to link to symbols pointing to local functions. This patch tests the version of objcopy and will only use the trick if the version is greater than or equal to 2.17. Otherwise, if an object has only local functions within a section, it will give a nice warning and recommend the user to upgrade their objcopy. Leaving the symbols unrecorded is not that big of a deal, since the mcount record method changes the actual mcount code to be a simple "ret" without recording registers or anything. Signed-off-by: Steven Rostedt <srostedt@redhat.com> --- scripts/recordmcount.pl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) Index: linux-tip.git/scripts/recordmcount.pl =================================================================== --- linux-tip.git.orig/scripts/recordmcount.pl 2008-08-25 14:02:03.000000000 -0400 +++ linux-tip.git/scripts/recordmcount.pl 2008-08-25 14:38:36.000000000 -0400 @@ -187,6 +187,36 @@ my $mcount_s = $dirname . "/.tmp_mc_" . my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o"; # +# --globalize-symbols came out in 2.17, we must test the version +# of objcopy, and if it is less than 2.17, then we can not +# record local functions. +my $use_locals = 01; +my $local_warn_once = 0; +my $found_version = 0; + +open (IN, "$objcopy --version |") || die "error running $objcopy"; +while (<IN>) { + if (/objcopy.*\s(\d+)\.(\d+)/) { + my $major = $1; + my $minor = $2; + + $found_version = 1; + if ($major < 2 || + ($major == 2 && $minor < 17)) { + $use_locals = 0; + } + last; + } +} +close (IN); + +if (!$found_version) { + print STDERR "WARNING: could not find objcopy version.\n" . + "\tDisabling local function references.\n"; +} + + +# # Step 1: find all the local (static functions) and weak symbols. # 't' is local, 'w/W' is weak (we never use a weak function) # @@ -229,6 +259,17 @@ sub update_funcs # is this function static? If so, note this fact. if (defined $locals{$ref_func}) { + + # only use locals if objcopy supports globalize-symbols + if (!$use_locals) { + print STDERR + "$inputfile: WARNING: referencing local function " . + "$ref_func for mcount\n" . + "\tConsider upgrading objcopy to support the globalize-" . + "symbols option.\n" + if (!$local_warn_once++); + return; + } $convert{$ref_func} = 1; } ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: objcopy version test for local symbols 2008-08-25 18:52 ` [PATCH] ftrace: objcopy version test for local symbols Steven Rostedt @ 2008-08-25 19:01 ` Ingo Molnar 2008-08-25 23:46 ` Stephen Rothwell 0 siblings, 1 reply; 10+ messages in thread From: Ingo Molnar @ 2008-08-25 19:01 UTC (permalink / raw) To: Steven Rostedt Cc: Stephen Rothwell, Thomas Gleixner, H. Peter Anvin, linux-next, LKML * Steven Rostedt <rostedt@goodmis.org> wrote: > From: Steven Rostedt <srostedt@redhat.com> > Subject: ftrace: objcopy version test for local symbols > > The --globalize-symbols option came out in objcopy version 2.17. > If the kernel is being compiled on a system with a lower version of > objcopy, then we can not use the globalize / localize trick to > link to symbols pointing to local functions. > > This patch tests the version of objcopy and will only use the trick > if the version is greater than or equal to 2.17. Otherwise, if an > object has only local functions within a section, it will give a > nice warning and recommend the user to upgrade their objcopy. > > Leaving the symbols unrecorded is not that big of a deal, since the > mcount record method changes the actual mcount code to be a simple > "ret" without recording registers or anything. > > Signed-off-by: Steven Rostedt <srostedt@redhat.com> applied to tip/tracing/ftrace, also have integrated it into auto-ftrace-next. (without much testing - i hope it goes well) Ingo ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: objcopy version test for local symbols 2008-08-25 19:01 ` Ingo Molnar @ 2008-08-25 23:46 ` Stephen Rothwell 2008-08-26 1:51 ` Stephen Rothwell 0 siblings, 1 reply; 10+ messages in thread From: Stephen Rothwell @ 2008-08-25 23:46 UTC (permalink / raw) To: Ingo Molnar Cc: Steven Rostedt, Thomas Gleixner, H. Peter Anvin, linux-next, LKML [-- Attachment #1: Type: text/plain, Size: 425 bytes --] Hi Ingo, Steve, On Mon, 25 Aug 2008 21:01:03 +0200 Ingo Molnar <mingo@elte.hu> wrote: > > applied to tip/tracing/ftrace, also have integrated it into > auto-ftrace-next. (without much testing - i hope it goes well) Looks ok at a first glance, but it may spam my build logs a bit ... Anyway, we will see. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: objcopy version test for local symbols 2008-08-25 23:46 ` Stephen Rothwell @ 2008-08-26 1:51 ` Stephen Rothwell 2008-08-26 2:34 ` Steven Rostedt 2008-08-26 3:25 ` [PATCH] ftrace: only warn once on old objcopy and local functions Steven Rostedt 0 siblings, 2 replies; 10+ messages in thread From: Stephen Rothwell @ 2008-08-26 1:51 UTC (permalink / raw) To: Ingo Molnar Cc: Steven Rostedt, Thomas Gleixner, H. Peter Anvin, linux-next, LKML Hi Ingo, Steve, On Tue, 26 Aug 2008 09:46:27 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > On Mon, 25 Aug 2008 21:01:03 +0200 Ingo Molnar <mingo@elte.hu> wrote: > > > > applied to tip/tracing/ftrace, also have integrated it into > > auto-ftrace-next. (without much testing - i hope it goes well) > > Looks ok at a first glance, but it may spam my build logs a bit ... > Anyway, we will see. I was right, it produces way to many messages :-( I applied the following patch for now. It would be nice if this check could be done once per build and warned about once as well. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ >From 54bc3035c76a242d14df554966110e5964b3eac3 Mon Sep 17 00:00:00 2001 From: Stephen Rothwell <sfr@canb.auug.org.au> Date: Tue, 26 Aug 2008 11:45:01 +1000 Subject: [PATCH] ftrace: silence overly verbose warning Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> --- scripts/recordmcount.pl | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index ee9e126..ef0c6db 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -262,12 +262,12 @@ sub update_funcs # only use locals if objcopy supports globalize-symbols if (!$use_locals) { - print STDERR - "$inputfile: WARNING: referencing local function " . - "$ref_func for mcount\n" . - "\tConsider upgrading objcopy to support the globalize-" . - "symbols option.\n" - if (!$local_warn_once++); +# print STDERR +# "$inputfile: WARNING: referencing local function " . +# "$ref_func for mcount\n" . +# "\tConsider upgrading objcopy to support the globalize-" . +# "symbols option.\n" +# if (!$local_warn_once++); return; } $convert{$ref_func} = 1; -- 1.5.6.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: objcopy version test for local symbols 2008-08-26 1:51 ` Stephen Rothwell @ 2008-08-26 2:34 ` Steven Rostedt 2008-08-26 3:25 ` [PATCH] ftrace: only warn once on old objcopy and local functions Steven Rostedt 1 sibling, 0 replies; 10+ messages in thread From: Steven Rostedt @ 2008-08-26 2:34 UTC (permalink / raw) To: Stephen Rothwell Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-next, LKML On Tue, 26 Aug 2008, Stephen Rothwell wrote: > Hi Ingo, Steve, > > On Tue, 26 Aug 2008 09:46:27 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > > > On Mon, 25 Aug 2008 21:01:03 +0200 Ingo Molnar <mingo@elte.hu> wrote: > > > > > > applied to tip/tracing/ftrace, also have integrated it into > > > auto-ftrace-next. (without much testing - i hope it goes well) > > > > Looks ok at a first glance, but it may spam my build logs a bit ... > > Anyway, we will see. > > I was right, it produces way to many messages :-( I was afraid of that :-( > > I applied the following patch for now. It would be nice if this check > could be done once per build and warned about once as well. Actually, there is a way. I'll write one up and send it out. -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] ftrace: only warn once on old objcopy and local functions 2008-08-26 1:51 ` Stephen Rothwell 2008-08-26 2:34 ` Steven Rostedt @ 2008-08-26 3:25 ` Steven Rostedt 2008-08-26 5:47 ` Stephen Rothwell 1 sibling, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2008-08-26 3:25 UTC (permalink / raw) To: Stephen Rothwell Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-next, LKML [ Stephen, can you try to see if this works for you, with the issue of spamming warnings? Thanks, -- Steve ] Older versions of objcopy do not support the --globalize-symbols option, which prevent mcount calls in local functions within their own sections from being reference by the mcount_loc table. We want to warn the user about this out of date objcopy without spamming them with warning messages. To do this, we create a .tmp_mcversion and compare it with the .version to see if we have already warned the user for that build. Signed-off-by: Steven Rostedt <srostedt@redhat.com> --- Makefile | 3 +- scripts/recordmcount.pl | 69 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 7 deletions(-) Index: linux-tip.git/Makefile =================================================================== --- linux-tip.git.orig/Makefile 2008-08-25 14:01:57.000000000 -0400 +++ linux-tip.git/Makefile 2008-08-25 23:17:57.000000000 -0400 @@ -1155,7 +1155,8 @@ endif # CONFIG_MODULES # Directories & files removed with 'make clean' CLEAN_DIRS += $(MODVERDIR) CLEAN_FILES += vmlinux System.map \ - .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map + .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map \ + .tmp_mcversion # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include2 usr/include Index: linux-tip.git/scripts/recordmcount.pl =================================================================== --- linux-tip.git.orig/scripts/recordmcount.pl 2008-08-25 16:23:29.000000000 -0400 +++ linux-tip.git/scripts/recordmcount.pl 2008-08-25 23:19:52.000000000 -0400 @@ -96,6 +96,8 @@ use strict; my $P = $0; +my $D = $P; +$D =~ s@(.*)/.*@$1@; $P =~ s@.*/@@g; my $V = '0.1'; @@ -235,6 +237,66 @@ my $ref_func; # reference function to u my $offset = 0; # offset of ref_func to section beginning ## +# warn_on_local - check to see if this make already had a warning +# +# We want to warn to the user if the objcopy is out of date +# for referencing local functions, but we do not want to +# spam the build with errors. We create a file ".tmp_mcversion" +# and compare it to the .version file to see if we have already +# warned the user in this compile or not. +sub warn_on_local +{ + if ($local_warn_once) { + return; + } + + $local_warn_once++; + + # Check to see if we already warned on this build. + my $topdir = $D . "/.."; + open(VER, "$topdir/.version") || return; + my $ver_num = -1; + while (<VER>) { + if (/(\d+)/) { + $ver_num = $1; + last; + } + } + close (VER); + + my $last_ver = $topdir . "/.tmp_mcversion"; + if (open(VER, $last_ver)) { + my $this_num = -2; + # see if the versions match + while (<VER>) { + if (/(\d+)/) { + $this_num = $1; + } + } + close (VER); + + if ($ver_num == $this_num) { + return; + } + } + + # Either the file does not exist, or the versions do + # not match. Write the version we read, and warn about + # the message. + + open (VER, ">$last_ver") || return; + print VER $ver_num . "\n"; + close (VER); + + print STDERR + "$inputfile: WARNING: referencing local function " . + "$ref_func for mcount\n" . + "\tConsider upgrading objcopy to support the globalize-" . + "symbols option.\n" . + "\tDisabling local function references.\n"; +} + +## # update_funcs - print out the current mcount callers # # Go through the list of offsets to callers and write them to @@ -262,12 +324,7 @@ sub update_funcs # only use locals if objcopy supports globalize-symbols if (!$use_locals) { - print STDERR - "$inputfile: WARNING: referencing local function " . - "$ref_func for mcount\n" . - "\tConsider upgrading objcopy to support the globalize-" . - "symbols option.\n" - if (!$local_warn_once++); + warn_on_local(); return; } $convert{$ref_func} = 1; ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: only warn once on old objcopy and local functions 2008-08-26 3:25 ` [PATCH] ftrace: only warn once on old objcopy and local functions Steven Rostedt @ 2008-08-26 5:47 ` Stephen Rothwell 2008-08-26 20:53 ` Steven Rostedt 2008-08-27 17:02 ` [PATCH] ftrace: remove warning of " Steven Rostedt 0 siblings, 2 replies; 10+ messages in thread From: Stephen Rothwell @ 2008-08-26 5:47 UTC (permalink / raw) To: Steven Rostedt Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-next, LKML [-- Attachment #1: Type: text/plain, Size: 473 bytes --] Hi Steve, On Mon, 25 Aug 2008 23:25:25 -0400 (EDT) Steven Rostedt <rostedt@goodmis.org> wrote: > > Stephen, can you try to see if this works for you, with the > issue of spamming warnings? I get no warnings at all. I think this is because I always build with O=... so that the way you find $topdir (and therefore the .version file) does not work. -- Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: only warn once on old objcopy and local functions 2008-08-26 5:47 ` Stephen Rothwell @ 2008-08-26 20:53 ` Steven Rostedt 2008-08-27 17:02 ` [PATCH] ftrace: remove warning of " Steven Rostedt 1 sibling, 0 replies; 10+ messages in thread From: Steven Rostedt @ 2008-08-26 20:53 UTC (permalink / raw) To: Stephen Rothwell Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-next, LKML On Tue, 26 Aug 2008, Stephen Rothwell wrote: > Hi Steve, > > On Mon, 25 Aug 2008 23:25:25 -0400 (EDT) Steven Rostedt <rostedt@goodmis.org> wrote: > > > > Stephen, can you try to see if this works for you, with the > > issue of spamming warnings? > > I get no warnings at all. I think this is because I always build with > O=... so that the way you find $topdir (and therefore the .version file) > does not work. Hmm, Well we don't need the warning, although it would be nice to give. There seems to be a lot of hacking to get a warning for this. Perhaps we just ignore the local functions and not warn at all? -- Steve ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] ftrace: remove warning of old objcopy and local functions 2008-08-26 5:47 ` Stephen Rothwell 2008-08-26 20:53 ` Steven Rostedt @ 2008-08-27 17:02 ` Steven Rostedt 2008-08-28 7:52 ` Ingo Molnar 1 sibling, 1 reply; 10+ messages in thread From: Steven Rostedt @ 2008-08-27 17:02 UTC (permalink / raw) To: Stephen Rothwell Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-next, LKML The warning messages about old objcopy and local functions spam the user quite drastically. Remove the warning until we can find a nicer way of tell the user to upgrade their objcopy. Signed-off-by: Steven Rostedt <srostedt@redhat.com> --- scripts/recordmcount.pl | 6 ------ 1 file changed, 6 deletions(-) Index: linux-tip.git/scripts/recordmcount.pl =================================================================== --- linux-tip.git.orig/scripts/recordmcount.pl 2008-08-27 12:57:40.000000000 -0400 +++ linux-tip.git/scripts/recordmcount.pl 2008-08-27 12:58:03.000000000 -0400 @@ -262,12 +262,6 @@ sub update_funcs # only use locals if objcopy supports globalize-symbols if (!$use_locals) { - print STDERR - "$inputfile: WARNING: referencing local function " . - "$ref_func for mcount\n" . - "\tConsider upgrading objcopy to support the globalize-" . - "symbols option.\n" - if (!$local_warn_once++); return; } $convert{$ref_func} = 1; ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ftrace: remove warning of old objcopy and local functions 2008-08-27 17:02 ` [PATCH] ftrace: remove warning of " Steven Rostedt @ 2008-08-28 7:52 ` Ingo Molnar 0 siblings, 0 replies; 10+ messages in thread From: Ingo Molnar @ 2008-08-28 7:52 UTC (permalink / raw) To: Steven Rostedt Cc: Stephen Rothwell, Thomas Gleixner, H. Peter Anvin, linux-next, LKML * Steven Rostedt <rostedt@goodmis.org> wrote: > The warning messages about old objcopy and local functions spam the > user quite drastically. Remove the warning until we can find a nicer > way of tell the user to upgrade their objcopy. applied to tip/tracing/ftrace, thanks! Ingo ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-08-28 7:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20080825130117.33fe34bc.sfr@canb.auug.org.au>
[not found] ` <20080825060934.GB14993@elte.hu>
2008-08-25 18:52 ` [PATCH] ftrace: objcopy version test for local symbols Steven Rostedt
2008-08-25 19:01 ` Ingo Molnar
2008-08-25 23:46 ` Stephen Rothwell
2008-08-26 1:51 ` Stephen Rothwell
2008-08-26 2:34 ` Steven Rostedt
2008-08-26 3:25 ` [PATCH] ftrace: only warn once on old objcopy and local functions Steven Rostedt
2008-08-26 5:47 ` Stephen Rothwell
2008-08-26 20:53 ` Steven Rostedt
2008-08-27 17:02 ` [PATCH] ftrace: remove warning of " Steven Rostedt
2008-08-28 7:52 ` Ingo Molnar
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox