diff options
| author | Alan Kao <alankao@andestech.com> | 2018-02-13 00:13:16 -0500 |
|---|---|---|
| committer | Palmer Dabbelt <palmer@sifive.com> | 2018-04-02 22:59:10 -0400 |
| commit | a1d2a6b4cee858a2f27eebce731fbf1dfd72cb4e (patch) | |
| tree | 02678da661691d5576560c22f7aa62621d3773c2 | |
| parent | 0adb32858b0bddf4ada5f364a84ed60b196dbcda (diff) | |
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.
Cc: Greentime Hu <greentime@andestech.com>
Signed-off-by: Alan Kao <alankao@andestech.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
| -rw-r--r-- | arch/riscv/Kconfig | 1 | ||||
| -rw-r--r-- | arch/riscv/Makefile | 3 | ||||
| -rwxr-xr-x | scripts/recordmcount.pl | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 04807c7f64cc..c9ccc6ea4371 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig | |||
| @@ -114,6 +114,7 @@ config ARCH_RV64I | |||
| 114 | select 64BIT | 114 | select 64BIT |
| 115 | select HAVE_FUNCTION_TRACER | 115 | select HAVE_FUNCTION_TRACER |
| 116 | select HAVE_FUNCTION_GRAPH_TRACER | 116 | select HAVE_FUNCTION_GRAPH_TRACER |
| 117 | select HAVE_FTRACE_MCOUNT_RECORD | ||
| 117 | 118 | ||
| 118 | endchoice | 119 | endchoice |
| 119 | 120 | ||
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 6719dd30ec5b..899226e0da7d 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile | |||
| @@ -11,6 +11,9 @@ | |||
| 11 | LDFLAGS := | 11 | LDFLAGS := |
| 12 | OBJCOPYFLAGS := -O binary | 12 | OBJCOPYFLAGS := -O binary |
| 13 | LDFLAGS_vmlinux := | 13 | LDFLAGS_vmlinux := |
| 14 | ifeq ($(CONFIG_DYNAMIC_FTRACE),y) | ||
| 15 | LDFLAGS_vmlinux := --no-relax | ||
| 16 | endif | ||
| 14 | KBUILD_AFLAGS_MODULE += -fPIC | 17 | KBUILD_AFLAGS_MODULE += -fPIC |
| 15 | KBUILD_CFLAGS_MODULE += -fPIC | 18 | KBUILD_CFLAGS_MODULE += -fPIC |
| 16 | 19 | ||
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 2033af758173..d44d55db7c06 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
| @@ -376,6 +376,11 @@ if ($arch eq "x86_64") { | |||
| 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 | } |
