Skip to content

Commit 823d860

Browse files
ioannisgcarlescufi
authored andcommitted
arch: arm: MPU-align GCOV section, only if CONFIG_USERSPACE=y
The GCOV section is programmed as a static MPU region, only in builds with support for User Mode, otherwise it is not programmed into an MPU region at all. To reflect this in the linker, the MPU-alignment for GCOV section is enforced only under CONFIG_USERSPACE=y. Otherwise, single-word alignment is enforced. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent b7a20d1 commit 823d860

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

include/arch/arm/cortex_m/scripts/linker.ld

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,20 @@ SECTIONS
332332
SECTION_DATA_PROLOGUE(_GCOV_BSS_SECTION_NAME,(NOLOAD),)
333333
{
334334

335-
#ifdef CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
336-
. = ALIGN( 1 << LOG2CEIL(__gcov_bss_end - __gcov_bss_start ));
337-
#endif /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT */
335+
#ifdef CONFIG_USERSPACE
336+
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
337+
#else /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT && CONFIG_USERSPACE */
338+
. = ALIGN(_region_min_align);
339+
#endif /* CONFIG_USERSPACE */
338340

339341
__gcov_bss_start = .;
340342
KEEP(*(".bss.__gcov0.*"));
341343

342-
#ifdef CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT
343-
. = ALIGN( 1 << LOG2CEIL(__gcov_bss_end - __gcov_bss_start ));
344-
#else /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT */
345-
. = ALIGN(4);
346-
#endif /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT */
344+
#ifdef CONFIG_USERSPACE
345+
MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
346+
#else /* CONFIG_USERSPACE */
347+
. = ALIGN(_region_min_align);
348+
#endif /* CONFIG_USERSPACE */
347349

348350
__gcov_bss_end = .;
349351

0 commit comments

Comments
 (0)