aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
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