1/*
2 * Copyright (c) 2019 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/* Copied from linker.ld */
8
9#ifdef CONFIG_ARM
10SECTION_DATA_PROLOGUE(_GCOV_BSS_SECTION_NAME,(NOLOAD),)
11{
12#ifdef CONFIG_USERSPACE
13	MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
14#else  /* CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT && CONFIG_USERSPACE */
15	. = ALIGN(_region_min_align);
16#endif /* CONFIG_USERSPACE */
17
18	__gcov_bss_start = .;
19	KEEP(*(".bss.__gcov0.*"));
20
21#ifdef CONFIG_USERSPACE
22	MPU_ALIGN(__gcov_bss_end - __gcov_bss_start );
23#else  /* CONFIG_USERSPACE */
24	. = ALIGN(_region_min_align);
25#endif /* CONFIG_USERSPACE */
26
27	__gcov_bss_end = .;
28} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
29#endif
30
31#ifdef CONFIG_X86_64
32SECTION_PROLOGUE(_GCOV_BSS_SECTION_NAME, (NOLOAD), ALIGN(16))
33{
34	MMU_PAGE_ALIGN
35	__gcov_bss_start = .;
36	*(".bss.__gcov0.*");
37	. = ALIGN(8);
38	MMU_PAGE_ALIGN
39	__gcov_bss_end = .;
40}GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
41
42#elif CONFIG_X86
43SECTION_PROLOGUE(_GCOV_BSS_SECTION_NAME, (NOLOAD),)
44{
45	MMU_PAGE_ALIGN
46	__gcov_bss_start = .;
47	*(".bss.__gcov0.*");
48	. = ALIGN(4);
49	MMU_PAGE_ALIGN
50	__gcov_bss_end = .;
51} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
52#endif
53
54#ifdef CONFIG_ARC
55SECTION_PROLOGUE(_GCOV_BSS_SECTION_NAME, (NOLOAD),)
56{
57	MPU_MIN_SIZE_ALIGN
58	__gcov_bss_start = .;
59	*(".bss.__gcov0.*");
60#ifdef CONFIG_USERSPACE
61	. = ALIGN(1 << LOG2CEIL(. - __gcov_bss_start));
62#else
63	MPU_MIN_SIZE_ALIGN
64#endif
65	__gcov_bss_end = .;
66} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
67#endif
68
69#ifdef CONFIG_RISCV
70SECTION_PROLOGUE(_GCOV_BSS_SECTION_NAME, (NOLOAD),)
71{
72	MPU_MIN_SIZE_ALIGN
73	__gcov_bss_start = .;
74	*(".bss.__gcov0.*");
75	. = ALIGN(4);
76	MPU_MIN_SIZE_ALIGN
77	__gcov_bss_end = .;
78} GROUP_NOLOAD_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
79#endif
80
81__gcov_bss_num_words = ((__gcov_bss_end - __gcov_bss_start) >> 2);
82__gcov_bss_size = __gcov_bss_end - __gcov_bss_start;
83