Skip to content
Permalink
Browse files

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>
  • Loading branch information...
oyvindronningstad authored and nashif committed Mar 20, 2019
1 parent c760ca0 commit fb0faaa1239ad5f6577d3268c67ba168aab57656
@@ -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)

@@ -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;
@@ -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)

0 comments on commit fb0faaa

Please sign in to comment.
You can’t perform that action at this time.