Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit a1d2a6b4 authored by Alan Kao's avatar Alan Kao Committed by Palmer Dabbelt
Browse files

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: default avatarAlan Kao <alankao@andestech.com>
Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
parent 0adb3285
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -114,6 +114,7 @@ config ARCH_RV64I
	select 64BIT
	select 64BIT
	select HAVE_FUNCTION_TRACER
	select HAVE_FUNCTION_TRACER
	select HAVE_FUNCTION_GRAPH_TRACER
	select HAVE_FUNCTION_GRAPH_TRACER
	select HAVE_FTRACE_MCOUNT_RECORD


endchoice
endchoice


+3 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,9 @@
LDFLAGS         :=
LDFLAGS         :=
OBJCOPYFLAGS    := -O binary
OBJCOPYFLAGS    := -O binary
LDFLAGS_vmlinux :=
LDFLAGS_vmlinux :=
ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
	LDFLAGS_vmlinux := --no-relax
endif
KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_AFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC
KBUILD_CFLAGS_MODULE += -fPIC


+5 −0
Original line number Original line Diff line number Diff line
@@ -376,6 +376,11 @@ if ($arch eq "x86_64") {
    $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";
    $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$";
    $type = ".quad";
    $type = ".quad";
    $alignment = 8;
    $alignment = 8;
} elsif ($arch eq "riscv") {
    $function_regex = "^([0-9a-fA-F]+)\\s+<([^.0-9][0-9a-zA-Z_\\.]+)>:";
    $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$";
    $type = ".quad";
    $alignment = 2;
} else {
} else {
    die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
    die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
}
}