1# SPDX-License-Identifier: Apache-2.0 2# The contents of this file is based on include/zephyr/linker/kobject-priv-stacks.ld 3# Please keep in sync 4 5if(CONFIG_USERSPACE) 6 if(CONFIG_GEN_PRIV_STACKS) 7 # Padding is needed to preserve kobject addresses 8 # if we have reserved more space than needed. 9 zephyr_linker_section(NAME .priv_stacks_noinit GROUP NOINIT_REGION NOINPUT NOINIT 10 MIN_SIZE @KOBJECT_PRIV_STACKS_SZ,undef:0@ MAX_SIZE @KOBJECT_PRIV_STACKS_SZ,undef:0@) 11 12 zephyr_linker_section_configure( 13 SECTION .priv_stacks_noinit 14 SYMBOLS z_priv_stacks_ram_start 15 ) 16 17 # During LINKER_KOBJECT_PREBUILT and LINKER_ZEPHYR_PREBUILT, 18 # space needs to be reserved for the rodata that will be 19 # produced by gperf during the final stages of linking. 20 # The alignment and size are produced by 21 # scripts/build/gen_kobject_placeholders.py. These are here 22 # so the addresses to kobjects would remain the same 23 # during the final stages of linking (LINKER_ZEPHYR_FINAL). 24 zephyr_linker_section_configure( 25 SECTION .priv_stacks_noinit 26 ALIGN @KOBJECT_PRIV_STACKS_ALIGN,undef:0@ 27 INPUT ".priv_stacks.noinit" 28 KEEP 29 PASS LINKER_ZEPHYR_PREBUILT LINKER_ZEPHYR_FINAL 30 SYMBOLS z_priv_stacks_ram_aligned_start z_priv_stacks_ram_end 31 ) 32 33 if(KOBJECT_PRIV_STACKS_ALIGN) 34 zephyr_linker_symbol( 35 SYMBOL z_priv_stacks_ram_used 36 EXPR "(@z_priv_stacks_ram_end@ - @z_priv_stacks_ram_start@)" 37 PASS LINKER_ZEPHYR_FINAL 38 ) 39 endif() 40 endif() 41endif() 42