linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Enable GCOV
@ 2020-12-03  7:22 Xingxing Su
  2020-12-04 12:08 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Xingxing Su @ 2020-12-03  7:22 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Youling Tang, linux-mips, linux-kernel

Enable gcov profiling of the entire kernel on mips. Required changes
include disabling profiling for:

* arch/kernel/boot/compressed: not linked to main kernel.

Lightly tested on Loongson 3A3000 an 3A4000, seems to work as expected.

without "GCOV_PROFILE := n" in compressed Makefile,
build errors as follows:
...
ld: arch/mips/boot/compressed/string.o:(.data+0x88):
 undefined reference to `__gcov_merge_add'
ld: arch/mips/boot/compressed/string.o:
 in function `_GLOBAL__sub_I_00100_0_memcpy':
string.c:(.text.startup+0x4): undefined reference to `__gcov_init'
ld: arch/mips/boot/compressed/string.o:
 in function `_GLOBAL__sub_D_00100_1_memcpy':
string.c:(.text.exit+0x0): undefined reference to `__gcov_exit'
...

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Xingxing Su <suxingxing@loongson.cn>
---
 arch/mips/Kconfig                  | 1 +
 arch/mips/boot/compressed/Makefile | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 2000bb2..52664a30 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -9,6 +9,7 @@ config MIPS
 	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
+	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_SUPPORTS_UPROBES
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index d665118..405b47a 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -36,6 +36,7 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
 
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT		:= n
+GCOV_PROFILE := n
 
 # decompressor objects (linked with vmlinuz)
 vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: Enable GCOV
  2020-12-03  7:22 [PATCH] MIPS: Enable GCOV Xingxing Su
@ 2020-12-04 12:08 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2020-12-04 12:08 UTC (permalink / raw)
  To: Xingxing Su; +Cc: Youling Tang, linux-mips, linux-kernel

On Thu, Dec 03, 2020 at 03:22:51PM +0800, Xingxing Su wrote:
> Enable gcov profiling of the entire kernel on mips. Required changes
> include disabling profiling for:
> 
> * arch/kernel/boot/compressed: not linked to main kernel.
> 
> Lightly tested on Loongson 3A3000 an 3A4000, seems to work as expected.
> 
> without "GCOV_PROFILE := n" in compressed Makefile,
> build errors as follows:
> ...
> ld: arch/mips/boot/compressed/string.o:(.data+0x88):
>  undefined reference to `__gcov_merge_add'
> ld: arch/mips/boot/compressed/string.o:
>  in function `_GLOBAL__sub_I_00100_0_memcpy':
> string.c:(.text.startup+0x4): undefined reference to `__gcov_init'
> ld: arch/mips/boot/compressed/string.o:
>  in function `_GLOBAL__sub_D_00100_1_memcpy':
> string.c:(.text.exit+0x0): undefined reference to `__gcov_exit'
> ...
> 
> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> Signed-off-by: Xingxing Su <suxingxing@loongson.cn>
> ---
>  arch/mips/Kconfig                  | 1 +
>  arch/mips/boot/compressed/Makefile | 1 +
>  2 files changed, 2 insertions(+)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-04 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  7:22 [PATCH] MIPS: Enable GCOV Xingxing Su
2020-12-04 12:08 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).