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:
parent
c760ca02eb
commit
fb0faaa123
5 changed files with 50 additions and 39 deletions
|
@ -324,34 +324,6 @@ SECTIONS
|
||||||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
|
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
|
||||||
#endif
|
#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
|
/* Located in generated directory. This file is populated by the
|
||||||
* zephyr_linker_sources() Cmake function.
|
* zephyr_linker_sources() Cmake function.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -120,14 +120,3 @@
|
||||||
KEEP(*(SORT_BY_NAME(".font_entry.*")))
|
KEEP(*(SORT_BY_NAME(".font_entry.*")))
|
||||||
__font_entry_end = .;
|
__font_entry_end = .;
|
||||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
} 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 */
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
zephyr_sources_ifdef(CONFIG_COVERAGE_GCOV coverage.c)
|
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)
|
||||||
|
|
||||||
|
|
30
subsys/testsuite/coverage/coverage_ram.ld
Normal file
30
subsys/testsuite/coverage/coverage_ram.ld
Normal 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;
|
16
subsys/testsuite/coverage/coverage_rom.ld
Normal file
16
subsys/testsuite/coverage/coverage_rom.ld
Normal 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)
|
Loading…
Add table
Add a link
Reference in a new issue