subsys/testsuite/coverage: move initialization vector to RODATA

The .init_array vector is, in fact, read-only data, so put it there.

Previously it was placed at the end of the ROM, but was unknown to
the x86 memory protection code with XIP enabled (because it was not
part of the text, rodata, or kernel RAM). Until recently, the XIP
implementation artificially bloated _image_rodata_size to cover the
entire ROM, so the (mis)placement of .init_array went unnoticed.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-11 11:16:29 -04:00 committed by Andrew Boie
parent 8a2624c106
commit 155853b39c
3 changed files with 10 additions and 18 deletions

View file

@ -3,5 +3,4 @@
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)
zephyr_linker_sources_ifdef(CONFIG_COVERAGE_GCOV RODATA coverage_rodata.ld)

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2019 Intel Corporation
* SPDX-License-Identifier: Apache-2.0
*/
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);

View file

@ -1,16 +0,0 @@
/*
* 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)