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>
This commit is contained in:
parent
ac8825ec6d
commit
f2f8458e75
|
@ -186,6 +186,36 @@ if ($filename =~ m,^(.*)(\.\S),) {
|
|||
my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s";
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue