From b57a1498280b9b86f06e73696ea2531ba53e93ec Mon Sep 17 00:00:00 2001 From: Adithya Baglody Date: Fri, 31 Aug 2018 15:09:26 +0530 Subject: [PATCH] Gcov: Added linker changes needed by Gcov. This patch adds all the required hooks needed in the linker script. Signed-off-by: Adithya Baglody --- arch/Kconfig | 1 + include/linker/common-rom.ld | 22 +++++++++++----------- include/linker/linker-defs.h | 6 ++++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 3bc1a288bf..6d0f97ef68 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -156,6 +156,7 @@ config PRIVILEGED_STACK_SIZE config PRIVILEGED_STACK_TEXT_AREA int "Privileged stacks text area" default 256 if (DEBUG || STACK_CANARIES || CODE_DATA_RELOCATION) + default 512 if COVERAGE_GCOV default 128 depends on ARCH_HAS_USERSPACE help diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index 4164324754..aba1d0e568 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -42,17 +42,6 @@ } #endif -#ifdef CONFIG_COVERAGE_GCOV - /* Section needed by gcov when coverage is turned on.*/ - SECTION_PROLOGUE (gcov, (OPTIONAL),) - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array*)) - PROVIDE_HIDDEN (__init_array_end = .); - } GROUP_LINK_IN(ROMABLE_REGION) -#endif /* CONFIG_COVERAGE_GCOV */ - SECTION_PROLOGUE (devconfig, (OPTIONAL),) { __devconfig_start = .; @@ -105,3 +94,14 @@ KEEP(*(SORT_BY_NAME(".font_entry.*"))) __font_entry_end = .; } GROUP_LINK_IN(ROMABLE_REGION) + +#ifdef CONFIG_COVERAGE_GCOV + /* Section needed by gcov when coverage is turned on.*/ + SECTION_PROLOGUE (gcov, (OPTIONAL),) + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } GROUP_LINK_IN(ROMABLE_REGION) +#endif /* CONFIG_COVERAGE_GCOV */ diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index 511ea7a620..31f37812b4 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -236,6 +236,12 @@ extern char _image_rodata_end[]; extern char _vector_start[]; extern char _vector_end[]; +#ifdef CONFIG_COVERAGE_GCOV +extern char __gcov_bss_start[]; +extern char __gcov_bss_end[]; +extern char __gcov_bss_size[]; +#endif /* CONFIG_COVERAGE_GCOV */ + /* end address of image, used by newlib for the heap */ extern char _end[];