History

riscv/ftrace: Add RECORD_MCOUNT support

Now recordmcount.pl recognizes RISC-V object files. For the mechanism to work, we have to disable the linker relaxation.

Alan Kao committed 8 years ago

Commit a1d2a6b1 parent 0adb3283 files · +9 −0Browse files

Unified · Split

3 files
  1. arch/riscv/Kconfig +1 −0
  2. arch/riscv/Makefile +3 −0
  3. scripts/recordmcount.pl +5 −0
arch/riscv/Kconfig+1−0
@@ -114,6 +114,7 @@ config ARCH_RV64I · 113 unmodified lines
114 select 64BIT114 select 64BIT
115 select HAVE_FUNCTION_TRACER115 select HAVE_FUNCTION_TRACER
116 select HAVE_FUNCTION_GRAPH_TRACER116 select HAVE_FUNCTION_GRAPH_TRACER
117 select HAVE_FTRACE_MCOUNT_RECORD
117 118
118endchoice119endchoice
119 120
arch/riscv/Makefile+3−0
@@ -11,6 +11,9 @@ · 10 unmodified lines
11LDFLAGS :=11LDFLAGS :=
12OBJCOPYFLAGS := -O binary12OBJCOPYFLAGS := -O binary
13LDFLAGS_vmlinux :=13LDFLAGS_vmlinux :=
14ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
15 LDFLAGS_vmlinux := --no-relax
16endif
14KBUILD_AFLAGS_MODULE += -fPIC17KBUILD_AFLAGS_MODULE += -fPIC
15KBUILD_CFLAGS_MODULE += -fPIC18KBUILD_CFLAGS_MODULE += -fPIC
16 19
scripts/recordmcount.pl+5−0
@@ -376,6 +376,11 @@ if ($arch eq "x86_64") { · 375 unmodified lines
376 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";376 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";
377 $type = ".quad";377 $type = ".quad";
378 $alignment = 8;378 $alignment = 8;
379} elsif ($arch eq "riscv") {
380 $function_regex = "^([0-9a-fA-F]+)\\s+<([^.0-9][0-9a-zA-Z_\\.]+)>:";
381 $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$";
382 $type = ".quad";
383 $alignment = 2;
379} else {384} else {
380 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";385 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
381}386}