Skip to content

Commit 66af86e

Browse files
author
Ingo Molnar
committed
Merge branch 'tip/perf/recordmcount' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
2 parents 0fdf136 + 85caa99 commit 66af86e

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

scripts/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ endif
210210

211211
ifdef CONFIG_FTRACE_MCOUNT_RECORD
212212
ifdef BUILD_C_RECORDMCOUNT
213-
cmd_record_mcount = $(srctree)/scripts/recordmcount "$(@)";
213+
cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
214214
else
215215
cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
216216
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \

scripts/recordmcount.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,30 @@ do_file(char const *const fname)
313313
int
314314
main(int argc, char const *argv[])
315315
{
316+
const char ftrace[] = "kernel/trace/ftrace.o";
317+
int ftrace_size = sizeof(ftrace) - 1;
316318
int n_error = 0; /* gcc-4.3.0 false positive complaint */
317-
if (argc <= 1)
319+
320+
if (argc <= 1) {
318321
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. */
320326
for (--argc, ++argv; 0 < argc; --argc, ++argv) {
321327
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+
322340
switch (sjval) {
323341
default: {
324342
fprintf(stderr, "internal error: %s\n", argv[0]);

0 commit comments

Comments
 (0)