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.text*")
13	_kobject_text_area_end = .;
14	_kobject_text_area_used = _kobject_text_area_end - _kobject_text_area_start;
15#ifndef LINKER_ZEPHYR_FINAL
16#ifdef CONFIG_DYNAMIC_OBJECTS
17	PROVIDE(z_object_gperf_find = .);
18	PROVIDE(z_object_gperf_wordlist_foreach = .);
19#else
20	PROVIDE(z_object_find = .);
21	PROVIDE(z_object_wordlist_foreach = .);
22#endif
23#endif
24
25	/* In a valid build the MAX function will always evaluate to the
26	second argument below, but to give the user a good error message
27	when the area overflows we need to temporarily corrupt the
28	location counter, and then detect the overflow with an assertion
29	later on. */
30
31	. = MAX(., _kobject_text_area_start + CONFIG_KOBJECT_TEXT_AREA);
32
33	ASSERT(
34		CONFIG_KOBJECT_TEXT_AREA >= _kobject_text_area_used,
35"Reserved space for kobject text area is too small. \
36Please change CONFIG_KOBJECT_TEXT_AREA to a larger number."
37		);
38#endif /* CONFIG_USERSPACE */
39