aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2008-08-25 14:52:11 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 04:36:12 -0400
commitf2f8458e751f9ae41dfec3c00a46d3e62dc38f60 (patch)
treec16c97b3891790c9ffedc59579876510a8352ae4 /scripts
parentac8825ec6d941b6899331b84c7d6bf027c3bb4f1 (diff)
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. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/recordmcount.pl41
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 1891cf9743fc..ee9e12676776 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -187,6 +187,36 @@ my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
187my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o"; 187my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o";
188 188
189# 189#
190# --globalize-symbols came out in 2.17, we must test the version
191# of objcopy, and if it is less than 2.17, then we can not
192# record local functions.
193my $use_locals = 01;
194my $local_warn_once = 0;
195my $found_version = 0;
196
197open (IN, "$objcopy --version |") || die "error running $objcopy";
198while (<IN>) {
199 if (/objcopy.*\s(\d+)\.(\d+)/) {
200 my $major = $1;
201 my $minor = $2;
202
203 $found_version = 1;
204 if ($major < 2 ||
205 ($major == 2 && $minor < 17)) {
206 $use_locals = 0;
207 }
208 last;
209 }
210}
211close (IN);
212
213if (!$found_version) {
214 print STDERR "WARNING: could not find objcopy version.\n" .
215 "\tDisabling local function references.\n";
216}
217
218
219#
190# Step 1: find all the local (static functions) and weak symbols. 220# Step 1: find all the local (static functions) and weak symbols.
191# 't' is local, 'w/W' is weak (we never use a weak function) 221# 't' is local, 'w/W' is weak (we never use a weak function)
192# 222#
@@ -229,6 +259,17 @@ sub update_funcs
229 259
230 # is this function static? If so, note this fact. 260 # is this function static? If so, note this fact.
231 if (defined $locals{$ref_func}) { 261 if (defined $locals{$ref_func}) {
262
263 # only use locals if objcopy supports globalize-symbols
264 if (!$use_locals) {
265 print STDERR
266 "$inputfile: WARNING: referencing local function " .
267 "$ref_func for mcount\n" .
268 "\tConsider upgrading objcopy to support the globalize-" .
269 "symbols option.\n"
270 if (!$local_warn_once++);
271 return;
272 }
232 $convert{$ref_func} = 1; 273 $convert{$ref_func} = 1;
233 } 274 }
234 275