Move creation of last section id from ld linker script LONG() usage to C code with last section attribute. The use of `LONG()` works correctly with ld but lld emits a warning because .last_section section is not allocated as there are no matching input sections and discards the `LONG()` call, meaning the last section identifier will not be present in the flash. > ld.lld: warning: ignoring memory region assignment for > non-allocatable section '.last_section' Placing the last section id in `.last_section` in C code makes lld allocate the memory for the id and thereby create the output section with the correct output. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
11 lines
261 B
C
11 lines
261 B
C
/*
|
|
* Copyright (C) 2025, Nordic Semiconductor ASA
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
*/
|
|
#include <zephyr/types.h>
|
|
|
|
static uint32_t last_id __attribute__((section(".last_section"))) __attribute__((__used__)) =
|
|
CONFIG_LINKER_LAST_SECTION_ID_PATTERN;
|