diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.build | 2 | ||||
-rw-r--r-- | scripts/recordmcount.c | 22 |
2 files changed, 21 insertions, 3 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 4d03a7efc689..4db60b2e2a76 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -210,7 +210,7 @@ endif | |||
210 | 210 | ||
211 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 211 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
212 | ifdef BUILD_C_RECORDMCOUNT | 212 | ifdef BUILD_C_RECORDMCOUNT |
213 | cmd_record_mcount = $(srctree)/scripts/recordmcount "$(@)"; | 213 | cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)"; |
214 | else | 214 | else |
215 | cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 215 | cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
216 | "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ | 216 | "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ |
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 7f7f7180fe24..26e1271259ba 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c | |||
@@ -313,12 +313,30 @@ do_file(char const *const fname) | |||
313 | int | 313 | int |
314 | main(int argc, char const *argv[]) | 314 | main(int argc, char const *argv[]) |
315 | { | 315 | { |
316 | const char ftrace[] = "kernel/trace/ftrace.o"; | ||
317 | int ftrace_size = sizeof(ftrace) - 1; | ||
316 | int n_error = 0; /* gcc-4.3.0 false positive complaint */ | 318 | int n_error = 0; /* gcc-4.3.0 false positive complaint */ |
317 | if (argc <= 1) | 319 | |
320 | if (argc <= 1) { | ||
318 | fprintf(stderr, "usage: recordmcount file.o...\n"); | 321 | fprintf(stderr, "usage: recordmcount file.o...\n"); |
319 | else /* Process each file in turn, allowing deep failure. */ | 322 | return 0; |
323 | } | ||
324 | |||
325 | /* Process each file in turn, allowing deep failure. */ | ||
320 | for (--argc, ++argv; 0 < argc; --argc, ++argv) { | 326 | for (--argc, ++argv; 0 < argc; --argc, ++argv) { |
321 | int const sjval = setjmp(jmpenv); | 327 | int const sjval = setjmp(jmpenv); |
328 | int len; | ||
329 | |||
330 | /* | ||
331 | * The file kernel/trace/ftrace.o references the mcount | ||
332 | * function but does not call it. Since ftrace.o should | ||
333 | * not be traced anyway, we just skip it. | ||
334 | */ | ||
335 | len = strlen(argv[0]); | ||
336 | if (len >= ftrace_size && | ||
337 | strcmp(argv[0] + (len - ftrace_size), ftrace) == 0) | ||
338 | continue; | ||
339 | |||
322 | switch (sjval) { | 340 | switch (sjval) { |
323 | default: { | 341 | default: { |
324 | fprintf(stderr, "internal error: %s\n", argv[0]); | 342 | fprintf(stderr, "internal error: %s\n", argv[0]); |