testsuite: coverage: Port GCOV linker code to Cmake.

From linker.ld and common-rom.ld

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
This commit is contained in:
Øyvind Rønningstad 2019-03-20 13:20:11 +01:00 committed by Anas Nashif
commit fb0faaa123
5 changed files with 50 additions and 39 deletions

View file

@ -324,34 +324,6 @@ SECTIONS
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
#endif
#ifdef CONFIG_COVERAGE_GCOV
SECTION_DATA_PROLOGUE(_GCOV_BSS_SECTION_NAME,(NOLOAD),)
{
#ifdef CONFIG_USERSPACE
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
#else /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT && CONFIG_USERSPACE */
. = ALIGN(_region_min_align);
#endif /* CONFIG_USERSPACE */
__gcov_bss_start = .;
KEEP(*(".bss.__gcov0.*"));
#ifdef CONFIG_USERSPACE
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
#else /* CONFIG_USERSPACE */
. = ALIGN(_region_min_align);
#endif /* CONFIG_USERSPACE */
__gcov_bss_end = .;
} GROUP_LINK_IN(RAMABLE_REGION)
__gcov_bss_num_words = ((__gcov_bss_end - __gcov_bss_start) >> 2);
__gcov_bss_size = __gcov_bss_end - __gcov_bss_start;
#endif /* CONFIG_COVERAGE_GCOV */
/* Located in generated directory. This file is populated by the
* zephyr_linker_sources() Cmake function.
*/

View file

@ -120,14 +120,3 @@
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,,)
{
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 */

View file

@ -1,3 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_sources_ifdef(CONFIG_COVERAGE_GCOV coverage.c)
zephyr_linker_sources_ifdef(CONFIG_COVERAGE_GCOV RAM_SECTIONS coverage_ram.ld)
zephyr_linker_sources_ifdef(CONFIG_COVERAGE_GCOV SECTIONS coverage_rom.ld)

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2019 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copied from linker.ld */
SECTION_DATA_PROLOGUE(_GCOV_BSS_SECTION_NAME,(NOLOAD),)
{
#ifdef CONFIG_USERSPACE
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
#else /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT && CONFIG_USERSPACE */
. = ALIGN(_region_min_align);
#endif /* CONFIG_USERSPACE */
__gcov_bss_start = .;
KEEP(*(".bss.__gcov0.*"));
#ifdef CONFIG_USERSPACE
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
#else /* CONFIG_USERSPACE */
. = ALIGN(_region_min_align);
#endif /* CONFIG_USERSPACE */
__gcov_bss_end = .;
} GROUP_LINK_IN(RAMABLE_REGION)
__gcov_bss_num_words = ((__gcov_bss_end - __gcov_bss_start) >> 2);
__gcov_bss_size = __gcov_bss_end - __gcov_bss_start;

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2019 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copied from linker.ld */
/* Section needed by gcov when coverage is turned on.*/
SECTION_PROLOGUE (gcov,,)
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} GROUP_LINK_IN(ROMABLE_REGION)