From 99290f7fef06b21e6b6ea0671b4c03df485dd1a1 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 19 Jul 2021 14:06:36 -0700 Subject: [PATCH] linker: allow symbols to be in a named __noinit section This adds a new __noinit_named() macro which can be used to attach named section attributes for symbols. The original __noinit creates a section attribute with source file name and a sequential counter. This simply replaces the counter with the supplied name. This is useful for demand paging as developers can choose which symbols is pinned memory. Signed-off-by: Daniel Leung --- include/linker/section_tags.h | 1 + include/toolchain/gcc.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/linker/section_tags.h b/include/linker/section_tags.h index 39549c82428..f2d7593a65b 100644 --- a/include/linker/section_tags.h +++ b/include/linker/section_tags.h @@ -14,6 +14,7 @@ #if !defined(_ASMLANGUAGE) #define __noinit __in_section_unique(_NOINIT_SECTION_NAME) +#define __noinit_named(name) __in_section_unique_named(_NOINIT_SECTION_NAME, name) #define __irq_vector_table Z_GENERIC_SECTION(_IRQ_VECTOR_TABLE_SECTION_NAME) #define __sw_isr_table Z_GENERIC_SECTION(_SW_ISR_TABLE_SECTION_NAME) diff --git a/include/toolchain/gcc.h b/include/toolchain/gcc.h index c34e815151c..cc2fdc7dc9b 100644 --- a/include/toolchain/gcc.h +++ b/include/toolchain/gcc.h @@ -156,6 +156,9 @@ do { \ #define __in_section_unique(seg) ___in_section(seg, __FILE__, __COUNTER__) +#define __in_section_unique_named(seg, name) \ + ___in_section(seg, __FILE__, name) + /* When using XIP, using '__ramfunc' places a function into RAM instead * of FLASH. Make sure '__ramfunc' is defined only when * CONFIG_ARCH_HAS_RAMFUNC_SUPPORT is defined, so that the compiler can