linker: llext: move #ifdef CONFIG_LLEXT guard inside common file

LLEXT-related sections should only be added to the linker script when the
associated CONFIG_LLEXT is enabled. This has been done by checking for this
Kconfig symbol in every linker file, but this creates a lot of boilerplate
for no good reason.

Use the much simpler solution: move the check inside the common linker file
and remove existing "#ifdef CONFIG_LLEXT" checks in all linker files.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
This commit is contained in:
Mathieu Choplain
2025-11-06 17:23:10 +01:00
committed by Johan Hedberg
parent bfc69ad935
commit 947749abfc
40 changed files with 12 additions and 117 deletions

View File

@@ -253,10 +253,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/DISCARD/ :
{

View File

@@ -80,10 +80,7 @@ MEMORY {
SECTIONS {
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
GROUP_START(ROMABLE_REGION)

View File

@@ -97,10 +97,7 @@ ENTRY(CONFIG_KERNEL_ENTRY)
SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose',

View File

@@ -101,10 +101,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose',

View File

@@ -81,10 +81,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose',

View File

@@ -45,10 +45,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
SECTION_PROLOGUE(_VECTOR_SECTION_NAME,,)
{

View File

@@ -20,10 +20,7 @@
SECTIONS
{
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
SECTION_PROLOGUE(rom_start,,)
{

View File

@@ -126,10 +126,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* The .plt and .iplt are here according to

View File

@@ -66,10 +66,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
GROUP_START(ROMABLE_REGION)
. = ROM_START; /* for kernel logging */

View File

@@ -22,10 +22,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
__rom_region_start = .;

View File

@@ -76,10 +76,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/DISCARD/ :
{

View File

@@ -262,7 +262,5 @@ SECTION_PROLOGUE(.x86shadowstack.arr,,)
.shstrtab 0 : { *(.shstrtab) }
#endif
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
#include <zephyr/linker/llext-sections.ld>
}

View File

@@ -1,5 +1,10 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Only define LLEXT sections if the subsystem is enabled.
* Check here to avoid duplication in every linker script.
*/
#ifdef CONFIG_LLEXT
/*
* Save the current address to avoid changing it in this file.
*/
@@ -35,3 +40,4 @@
#endif
. = __llext_current_addr;
#endif /* CONFIG_LLEXT */

View File

@@ -112,10 +112,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
#ifdef CONFIG_GEN_ISR_TABLES
#include <zephyr/linker/intlist.ld>

View File

@@ -176,10 +176,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
#ifdef CONFIG_GEN_ISR_TABLES
#include <zephyr/linker/intlist.ld>

View File

@@ -199,10 +199,7 @@ SECTIONS
#endif /* CONFIG_BOOTLOADER_MCUBOOT */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- RTC BEGIN --- */

View File

@@ -115,10 +115,7 @@ SECTIONS
} > metadata
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF IRAM --- */

View File

@@ -173,10 +173,7 @@ SECTIONS
dram_size_field = LOADADDR(.dram0.end) - LOADADDR(.dram0.data);
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF IRAM --- */

View File

@@ -178,10 +178,7 @@ SECTIONS
#endif /* CONFIG_BOOTLOADER_MCUBOOT */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF RTC --- */

View File

@@ -185,10 +185,7 @@ SECTIONS
#endif /* CONFIG_BOOTLOADER_MCUBOOT */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF RTC --- */
.rtc.text :

View File

@@ -181,10 +181,7 @@ SECTIONS
#endif /* CONFIG_BOOTLOADER_MCUBOOT */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF RTC --- */
.rtc.text :

View File

@@ -196,10 +196,7 @@ SECTIONS
/* Virtual non-loadable sections */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF RTC --- */

View File

@@ -209,10 +209,7 @@ SECTIONS
/* Virtual non-loadable sections */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF RTC --- */

View File

@@ -156,10 +156,7 @@ SECTIONS
} > metadata
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/* --- START OF IRAM --- */

View File

@@ -120,10 +120,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose',

View File

@@ -102,10 +102,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* .plt and .iplt are here according to 'arm-zephyr-elf-ld --verbose',

View File

@@ -610,8 +610,5 @@ SECTIONS {
#ifdef CONFIG_GEN_ISR_TABLES
#include <zephyr/linker/intlist.ld>
#endif
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
}

View File

@@ -507,8 +507,5 @@ SECTIONS {
#ifdef CONFIG_GEN_ISR_TABLES
#include <zephyr/linker/intlist.ld>
#endif
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
}

View File

@@ -130,10 +130,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* The .plt and .iplt are here according to

View File

@@ -90,10 +90,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
/*
* The .plt and .iplt are here according to

View File

@@ -155,9 +155,6 @@ SECTIONS {
* just dump it in an unreadable area at the top of memory.
*/
#include <zephyr/linker/intlist.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
} /* SECTIONS */

View File

@@ -179,10 +179,8 @@ SECTIONS
#endif
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
.ResetVector.text : ALIGN(4)
{
_ResetVector_text_start = ABSOLUTE(.);

View File

@@ -179,10 +179,8 @@ SECTIONS
#endif
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
.ResetVector.text : ALIGN(4)
{
_ResetVector_text_start = ABSOLUTE(.);

View File

@@ -180,10 +180,8 @@ SECTIONS
#endif
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
.ResetVector.text : ALIGN(4)
{
_ResetVector_text_start = ABSOLUTE(.);

View File

@@ -180,10 +180,8 @@ SECTIONS
#endif
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
.ResetVector.text : ALIGN(4)
{
_ResetVector_text_start = ABSOLUTE(.);

View File

@@ -134,10 +134,8 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
.ResetVector.text : ALIGN(4)
{
_ResetVector_text_start = ABSOLUTE(.);

View File

@@ -86,10 +86,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
SECTION_PROLOGUE(.plt,,)
{

View File

@@ -77,10 +77,7 @@ SECTIONS
} > L2_PRIV_CH0
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
SECTION_PROLOGUE(.plt,,)
{

View File

@@ -13,10 +13,7 @@ SECTIONS
{
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
#ifdef CONFIG_OPENAMP_RSC_TABLE

View File

@@ -14,8 +14,5 @@ SECTIONS
{
/* Standard Zephyr relocation section */
#include <zephyr/linker/rel-sections.ld>
#ifdef CONFIG_LLEXT
#include <zephyr/linker/llext-sections.ld>
#endif
}