diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-01 15:54:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-01 18:49:02 -0400 |
commit | 8302294f43250dc337108c51882a6007f2b1e2e0 (patch) | |
tree | 85acd4440799c46a372df9cad170fa0c21e59096 /scripts | |
parent | 4fe70410d9a219dabb47328effccae7e7f2a6e26 (diff) | |
parent | 2e572895bf3203e881356a4039ab0fa428ed2639 (diff) |
Merge branch 'tracing/core-v2' into tracing-for-linus
Conflicts:
include/linux/slub_def.h
lib/Kconfig.debug
mm/slob.c
mm/slub.c
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.build | 13 | ||||
-rw-r--r-- | scripts/kallsyms.c | 57 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 37 |
3 files changed, 96 insertions, 11 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index c7de8b39fcf1..39a9642927d3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -112,13 +112,13 @@ endif | |||
112 | # --------------------------------------------------------------------------- | 112 | # --------------------------------------------------------------------------- |
113 | 113 | ||
114 | # Default is built-in, unless we know otherwise | 114 | # Default is built-in, unless we know otherwise |
115 | modkern_cflags := $(CFLAGS_KERNEL) | 115 | modkern_cflags = $(if $(part-of-module), $(CFLAGS_MODULE), $(CFLAGS_KERNEL)) |
116 | quiet_modtag := $(empty) $(empty) | 116 | quiet_modtag := $(empty) $(empty) |
117 | 117 | ||
118 | $(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) | 118 | $(real-objs-m) : part-of-module := y |
119 | $(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE) | 119 | $(real-objs-m:.o=.i) : part-of-module := y |
120 | $(real-objs-m:.o=.s) : modkern_cflags := $(CFLAGS_MODULE) | 120 | $(real-objs-m:.o=.s) : part-of-module := y |
121 | $(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE) | 121 | $(real-objs-m:.o=.lst): part-of-module := y |
122 | 122 | ||
123 | $(real-objs-m) : quiet_modtag := [M] | 123 | $(real-objs-m) : quiet_modtag := [M] |
124 | $(real-objs-m:.o=.i) : quiet_modtag := [M] | 124 | $(real-objs-m:.o=.i) : quiet_modtag := [M] |
@@ -205,7 +205,8 @@ endif | |||
205 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 205 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
206 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 206 | cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
207 | "$(if $(CONFIG_64BIT),64,32)" \ | 207 | "$(if $(CONFIG_64BIT),64,32)" \ |
208 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" "$(@)"; | 208 | "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ |
209 | "$(if $(part-of-module),1,0)" "$(@)"; | ||
209 | endif | 210 | endif |
210 | 211 | ||
211 | define rule_cc_o_c | 212 | define rule_cc_o_c |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index ad2434b26970..6654cbed965b 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -500,6 +500,51 @@ static void optimize_token_table(void) | |||
500 | optimize_result(); | 500 | optimize_result(); |
501 | } | 501 | } |
502 | 502 | ||
503 | /* guess for "linker script provide" symbol */ | ||
504 | static int may_be_linker_script_provide_symbol(const struct sym_entry *se) | ||
505 | { | ||
506 | const char *symbol = (char *)se->sym + 1; | ||
507 | int len = se->len - 1; | ||
508 | |||
509 | if (len < 8) | ||
510 | return 0; | ||
511 | |||
512 | if (symbol[0] != '_' || symbol[1] != '_') | ||
513 | return 0; | ||
514 | |||
515 | /* __start_XXXXX */ | ||
516 | if (!memcmp(symbol + 2, "start_", 6)) | ||
517 | return 1; | ||
518 | |||
519 | /* __stop_XXXXX */ | ||
520 | if (!memcmp(symbol + 2, "stop_", 5)) | ||
521 | return 1; | ||
522 | |||
523 | /* __end_XXXXX */ | ||
524 | if (!memcmp(symbol + 2, "end_", 4)) | ||
525 | return 1; | ||
526 | |||
527 | /* __XXXXX_start */ | ||
528 | if (!memcmp(symbol + len - 6, "_start", 6)) | ||
529 | return 1; | ||
530 | |||
531 | /* __XXXXX_end */ | ||
532 | if (!memcmp(symbol + len - 4, "_end", 4)) | ||
533 | return 1; | ||
534 | |||
535 | return 0; | ||
536 | } | ||
537 | |||
538 | static int prefix_underscores_count(const char *str) | ||
539 | { | ||
540 | const char *tail = str; | ||
541 | |||
542 | while (*tail != '_') | ||
543 | tail++; | ||
544 | |||
545 | return tail - str; | ||
546 | } | ||
547 | |||
503 | static int compare_symbols(const void *a, const void *b) | 548 | static int compare_symbols(const void *a, const void *b) |
504 | { | 549 | { |
505 | const struct sym_entry *sa; | 550 | const struct sym_entry *sa; |
@@ -521,6 +566,18 @@ static int compare_symbols(const void *a, const void *b) | |||
521 | if (wa != wb) | 566 | if (wa != wb) |
522 | return wa - wb; | 567 | return wa - wb; |
523 | 568 | ||
569 | /* sort by "linker script provide" type */ | ||
570 | wa = may_be_linker_script_provide_symbol(sa); | ||
571 | wb = may_be_linker_script_provide_symbol(sb); | ||
572 | if (wa != wb) | ||
573 | return wa - wb; | ||
574 | |||
575 | /* sort by the number of prefix underscores */ | ||
576 | wa = prefix_underscores_count((const char *)sa->sym + 1); | ||
577 | wb = prefix_underscores_count((const char *)sb->sym + 1); | ||
578 | if (wa != wb) | ||
579 | return wa - wb; | ||
580 | |||
524 | /* sort by initial order, so that other symbols are left undisturbed */ | 581 | /* sort by initial order, so that other symbols are left undisturbed */ |
525 | return sa->start_pos - sb->start_pos; | 582 | return sa->start_pos - sb->start_pos; |
526 | } | 583 | } |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index fe831412bea9..409596eca124 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -100,14 +100,19 @@ $P =~ s@.*/@@g; | |||
100 | 100 | ||
101 | my $V = '0.1'; | 101 | my $V = '0.1'; |
102 | 102 | ||
103 | if ($#ARGV < 6) { | 103 | if ($#ARGV < 7) { |
104 | print "usage: $P arch objdump objcopy cc ld nm rm mv inputfile\n"; | 104 | print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n"; |
105 | print "version: $V\n"; | 105 | print "version: $V\n"; |
106 | exit(1); | 106 | exit(1); |
107 | } | 107 | } |
108 | 108 | ||
109 | my ($arch, $bits, $objdump, $objcopy, $cc, | 109 | my ($arch, $bits, $objdump, $objcopy, $cc, |
110 | $ld, $nm, $rm, $mv, $inputfile) = @ARGV; | 110 | $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV; |
111 | |||
112 | # This file refers to mcount and shouldn't be ftraced, so lets' ignore it | ||
113 | if ($inputfile eq "kernel/trace/ftrace.o") { | ||
114 | exit(0); | ||
115 | } | ||
111 | 116 | ||
112 | # Acceptable sections to record. | 117 | # Acceptable sections to record. |
113 | my %text_sections = ( | 118 | my %text_sections = ( |
@@ -201,6 +206,13 @@ if ($arch eq "x86_64") { | |||
201 | $alignment = 2; | 206 | $alignment = 2; |
202 | $section_type = '%progbits'; | 207 | $section_type = '%progbits'; |
203 | 208 | ||
209 | } elsif ($arch eq "ia64") { | ||
210 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; | ||
211 | $type = "data8"; | ||
212 | |||
213 | if ($is_module eq "0") { | ||
214 | $cc .= " -mconstant-gp"; | ||
215 | } | ||
204 | } else { | 216 | } else { |
205 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | 217 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; |
206 | } | 218 | } |
@@ -263,7 +275,6 @@ if (!$found_version) { | |||
263 | "\tDisabling local function references.\n"; | 275 | "\tDisabling local function references.\n"; |
264 | } | 276 | } |
265 | 277 | ||
266 | |||
267 | # | 278 | # |
268 | # Step 1: find all the local (static functions) and weak symbols. | 279 | # Step 1: find all the local (static functions) and weak symbols. |
269 | # 't' is local, 'w/W' is weak (we never use a weak function) | 280 | # 't' is local, 'w/W' is weak (we never use a weak function) |
@@ -331,13 +342,16 @@ sub update_funcs | |||
331 | # | 342 | # |
332 | # Step 2: find the sections and mcount call sites | 343 | # Step 2: find the sections and mcount call sites |
333 | # | 344 | # |
334 | open(IN, "$objdump -dr $inputfile|") || die "error running $objdump"; | 345 | open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump"; |
335 | 346 | ||
336 | my $text; | 347 | my $text; |
337 | 348 | ||
349 | my $read_headers = 1; | ||
350 | |||
338 | while (<IN>) { | 351 | while (<IN>) { |
339 | # is it a section? | 352 | # is it a section? |
340 | if (/$section_regex/) { | 353 | if (/$section_regex/) { |
354 | $read_headers = 0; | ||
341 | 355 | ||
342 | # Only record text sections that we know are safe | 356 | # Only record text sections that we know are safe |
343 | if (defined($text_sections{$1})) { | 357 | if (defined($text_sections{$1})) { |
@@ -371,6 +385,19 @@ while (<IN>) { | |||
371 | $ref_func = $text; | 385 | $ref_func = $text; |
372 | } | 386 | } |
373 | } | 387 | } |
388 | } elsif ($read_headers && /$mcount_section/) { | ||
389 | # | ||
390 | # Somehow the make process can execute this script on an | ||
391 | # object twice. If it does, we would duplicate the mcount | ||
392 | # section and it will cause the function tracer self test | ||
393 | # to fail. Check if the mcount section exists, and if it does, | ||
394 | # warn and exit. | ||
395 | # | ||
396 | print STDERR "ERROR: $mcount_section already in $inputfile\n" . | ||
397 | "\tThis may be an indication that your build is corrupted.\n" . | ||
398 | "\tDelete $inputfile and try again. If the same object file\n" . | ||
399 | "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n"; | ||
400 | exit(-1); | ||
374 | } | 401 | } |
375 | 402 | ||
376 | # is this a call site to mcount? If so, record it to print later | 403 | # is this a call site to mcount? If so, record it to print later |