1/* SPDX-License-Identifier: Apache-2.0 */
2
3#ifdef CONFIG_USERSPACE
4	/* We need to reserve room for the gperf generated hash functions.
5	 * Fortunately, unlike the data tables, the size of the code is
6	 * reasonably predictable.
7	 *
8	 * The linker will error out complaining that the location pointer
9	 * is moving backwards if the reserved room isn't large enough.
10	 */
11	_kobject_text_area_start = .;
12	*(".kobject_data.literal*")
13	*(".kobject_data.text*")
14	_kobject_text_area_end = .;
15	_kobject_text_area_used = _kobject_text_area_end - _kobject_text_area_start;
16#ifndef LINKER_ZEPHYR_FINAL
17#ifdef CONFIG_DYNAMIC_OBJECTS
18	PROVIDE(z_object_gperf_find = .);
19	PROVIDE(z_object_gperf_wordlist_foreach = .);
20#else
21	PROVIDE(k_object_find = .);
22	PROVIDE(k_object_wordlist_foreach = .);
23#endif
24#endif
25
26	/* In a valid build the MAX function will always evaluate to the
27	second argument below, but to give the user a good error message
28	when the area overflows we need to temporarily corrupt the
29	location counter, and then detect the overflow with an assertion
30	later on. */
31
32	. = MAX(., _kobject_text_area_start + CONFIG_KOBJECT_TEXT_AREA);
33
34	ASSERT(
35		CONFIG_KOBJECT_TEXT_AREA >= _kobject_text_area_used,
36"Reserved space for kobject text area is too small. \
37Please change CONFIG_KOBJECT_TEXT_AREA to a larger number."
38		);
39#endif /* CONFIG_USERSPACE */
40