linker: add bits for boot regions

This adds the necessary bits for linker scripts and source code
to specify which symbols are needed for boot process so they
can be grouped together.

One use of this is to group boot related code and data so these
won't interval with other kernel and application for better
caching.

This is a must for demand paging as some functions and data
must be available during the boot process and before the memory
manager is initialized. During this time, paging cannot be used
so symbols linked in virtual memory space are unavailable.

This is up to the arch/SoC/board to define the sections in
their linker scripts as section may need special alignment
which cannot be done in common script snippets.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-02-24 10:18:34 -08:00 committed by Kumar Gala
commit d812728ec4
6 changed files with 103 additions and 0 deletions

View file

@ -67,6 +67,14 @@
#define _NOCACHE_SECTION_NAME nocache
#endif
#if defined(CONFIG_LINKER_USE_BOOT_SECTION)
#define BOOT_TEXT_SECTION_NAME boot_text
#define BOOT_BSS_SECTION_NAME boot_bss
#define BOOT_RODATA_SECTION_NAME boot_rodata
#define BOOT_DATA_SECTION_NAME boot_data
#define BOOT_NOINIT_SECTION_NAME boot_noinit
#endif
/* Short section references for use in ASM files */
#if defined(_ASMLANGUAGE)
/* Various text section names */
@ -77,6 +85,21 @@
#define RODATA rodata
#define DATA data
#define NOINIT noinit
#if defined(CONFIG_LINKER_USE_BOOT_SECTION)
#define BOOT_TEXT BOOT_TEXT_SECTION_NAME
#define BOOT_BSS BOOT_BSS_SECTION_NAME
#define BOOT_RODATA BOOT_RODATA_SECTION_NAME
#define BOOT_DATA BOOT_DATA_SECTION_NAME
#define BOOT_NOINIT BOOT_NOINIT_SECTION_NAME
#else
#define BOOT_TEXT TEXT
#define BOOT_BSS BSS
#define BOOT_RODATA RODATA
#define BOOT_DATA DATA
#define BOOT_NOINIT NOINIT
#endif /* CONFIG_LINKER_USE_BOOT_SECTION */
#endif /* _ASMLANGUAGE */
#include <linker/section_tags.h>