1/* SPDX-License-Identifier: Apache-2.0 */
2
3	SECTION_PROLOGUE(initlevel,,)
4	{
5		/*
6		 * link in initialization objects for all objects that are
7		 * automatically initialized by the kernel; the objects are
8		 * sorted in the order they will be initialized (i.e. ordered
9		 * by level, sorted by priority within a level)
10		 */
11		__init_start = .;
12		CREATE_OBJ_LEVEL(init, PRE_KERNEL_1)
13		CREATE_OBJ_LEVEL(init, PRE_KERNEL_2)
14		CREATE_OBJ_LEVEL(init, POST_KERNEL)
15		CREATE_OBJ_LEVEL(init, APPLICATION)
16		CREATE_OBJ_LEVEL(init, SMP)
17		__init_end = .;
18	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
19
20	SECTION_PROLOGUE(devices,,)
21	{
22		/* Link in devices objects, which are tied to the init ones;
23		 * the objects are thus sorted the same way as their init
24		 * object parent. See above and include/device.h.
25		 */
26		__device_start = .;
27		CREATE_OBJ_LEVEL(device, PRE_KERNEL_1)
28		CREATE_OBJ_LEVEL(device, PRE_KERNEL_2)
29		CREATE_OBJ_LEVEL(device, POST_KERNEL)
30		CREATE_OBJ_LEVEL(device, APPLICATION)
31		CREATE_OBJ_LEVEL(device, SMP)
32		__device_end = .;
33	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
34
35#if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
36	SECTION_PROLOGUE(sw_isr_table,,)
37	{
38		/*
39		 * Some arch requires an entry to be aligned to arch
40		 * specific boundary for using double word load
41		 * instruction.  See include/sw_isr_table.h.
42		 */
43		. = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN);
44		*(_SW_ISR_TABLE_SECTION_SYMS)
45	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
46#endif
47
48	/* verify we don't have rogue .z_init_<something> initlevel sections */
49	SECTION_PROLOGUE(initlevel_error,,)
50	{
51		KEEP(*(SORT(.z_init_[_A-Z0-9]*)))
52	}
53	ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
54
55#ifdef CONFIG_CPP_STATIC_INIT_GNU
56	SECTION_PROLOGUE(_CTOR_SECTION_NAME,,)
57	{
58		/*
59		 * The compiler fills the constructor pointers table below,
60		 * hence symbol __CTOR_LIST__ must be aligned on word
61		 * boundary.  To align with the C++ standard, the first elment
62		 * of the array contains the number of actual constructors. The
63		 * last element is NULL.
64		 */
65#ifdef CONFIG_64BIT
66		. = ALIGN(8);
67		__CTOR_LIST__ = .;
68		QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
69		KEEP(*(SORT_BY_NAME(".ctors*")))
70		QUAD(0)
71		__CTOR_END__ = .;
72#else
73		. = ALIGN(4);
74		__CTOR_LIST__ = .;
75		LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
76		KEEP(*(SORT_BY_NAME(".ctors*")))
77		LONG(0)
78		__CTOR_END__ = .;
79#endif
80	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
81
82	SECTION_PROLOGUE(init_array,,)
83	{
84		. = ALIGN(4);
85		__init_array_start = .;
86		KEEP(*(SORT_BY_NAME(".init_array*")))
87		__init_array_end = .;
88	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
89#endif
90#ifdef CONFIG_USERSPACE
91	/* Build-time assignment of permissions to kernel objects to
92	 * threads declared with K_THREAD_DEFINE()
93	 */
94	ITERABLE_SECTION_ROM(z_object_assignment, 4)
95#endif
96
97	SECTION_DATA_PROLOGUE(app_shmem_regions,,)
98	{
99		__app_shmem_regions_start = .;
100		KEEP(*(SORT(.app_regions.*)));
101		__app_shmem_regions_end = .;
102	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
103
104#if defined(CONFIG_NET_SOCKETS)
105	ITERABLE_SECTION_ROM(net_socket_register, 4)
106#endif
107
108#if defined(CONFIG_NET_L2_PPP)
109	ITERABLE_SECTION_ROM(ppp_protocol_handler, 4)
110#endif
111
112	ITERABLE_SECTION_ROM(bt_l2cap_fixed_chan, 4)
113
114#if defined(CONFIG_BT_BREDR)
115	ITERABLE_SECTION_ROM(bt_l2cap_br_fixed_chan, 4)
116#endif
117
118#if defined(CONFIG_BT_CONN)
119	ITERABLE_SECTION_ROM(bt_conn_cb, 4)
120#endif
121
122	ITERABLE_SECTION_ROM(bt_gatt_service_static, 4)
123
124#if defined(CONFIG_BT_MESH)
125	ITERABLE_SECTION_ROM(bt_mesh_subnet_cb, 4)
126	ITERABLE_SECTION_ROM(bt_mesh_app_key_cb, 4)
127
128	ITERABLE_SECTION_ROM(bt_mesh_hb_cb, 4)
129#endif
130
131#if defined(CONFIG_BT_MESH_FRIEND)
132	ITERABLE_SECTION_ROM(bt_mesh_friend_cb, 4)
133#endif
134
135#if defined(CONFIG_BT_MESH_LOW_POWER)
136	ITERABLE_SECTION_ROM(bt_mesh_lpn_cb, 4)
137#endif
138
139#if defined(CONFIG_BT_MESH_GATT_PROXY)
140	ITERABLE_SECTION_ROM(bt_mesh_proxy_cb, 4)
141#endif
142
143#if defined(CONFIG_EC_HOST_CMD)
144	ITERABLE_SECTION_ROM(ec_host_cmd_handler, 4)
145#endif
146
147#if defined(CONFIG_SETTINGS)
148	ITERABLE_SECTION_ROM(settings_handler_static, 4)
149#endif
150
151	ITERABLE_SECTION_ROM(k_p4wq_initparam, 4)
152
153#if defined(CONFIG_EMUL)
154	SECTION_DATA_PROLOGUE(emulators_section,,)
155	{
156		__emul_list_start = .;
157		KEEP(*(SORT_BY_NAME(".emulators")));
158		__emul_list_end = .;
159	} GROUP_LINK_IN(ROMABLE_REGION)
160#endif /* CONFIG_EMUL */
161
162#if defined(CONFIG_DNS_SD)
163	ITERABLE_SECTION_ROM(dns_sd_rec, 4)
164#endif
165
166#if defined(CONFIG_PCIE)
167	SECTION_DATA_PROLOGUE(irq_alloc,,)
168	{
169		__irq_alloc_start = .;
170		KEEP(*(SORT_BY_NAME("._irq_alloc*")));
171		__irq_alloc_end = .;
172	} GROUP_LINK_IN(ROMABLE_REGION)
173#endif /* CONFIG_PCIE */
174
175	SECTION_DATA_PROLOGUE(log_strings_sections,,)
176	{
177		__log_strings_start = .;
178		KEEP(*(SORT(.log_strings*)));
179		__log_strings_end = .;
180	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
181
182	SECTION_DATA_PROLOGUE(log_const_sections,,)
183	{
184		__log_const_start = .;
185		KEEP(*(SORT(.log_const_*)));
186		__log_const_end = .;
187	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
188
189	SECTION_DATA_PROLOGUE(log_backends_sections,,)
190	{
191		__log_backends_start = .;
192		KEEP(*("._log_backend.*"));
193		__log_backends_end = .;
194	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
195
196	ITERABLE_SECTION_ROM(shell, 4)
197
198	SECTION_DATA_PROLOGUE(shell_root_cmds_sections,,)
199	{
200		__shell_root_cmds_start = .;
201		KEEP(*(SORT(.shell_root_cmd_*)));
202		__shell_root_cmds_end = .;
203	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
204
205	SECTION_DATA_PROLOGUE(font_entry_sections,,)
206	{
207		__font_entry_start = .;
208		KEEP(*(SORT_BY_NAME("._cfb_font.*")))
209		__font_entry_end = .;
210	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
211
212	ITERABLE_SECTION_ROM(tracing_backend, 4)
213
214	SECTION_DATA_PROLOGUE(zephyr_dbg_info,,)
215	{
216		KEEP(*(".dbg_thread_info"));
217	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
218
219	SECTION_DATA_PROLOGUE(device_handles,,)
220	{
221		__device_handles_start = .;
222#ifdef LINKER_ZEPHYR_FINAL
223		KEEP(*(SORT(.__device_handles_pass2*)));
224#else /* LINKER_ZEPHYR_FINAL */
225		KEEP(*(SORT(.__device_handles_pass1*)));
226#endif /* LINKER_ZEPHYR_FINAL */
227		__device_handles_end = .;
228	} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
229