From ee70de55bf56bca220d37cf5dab89c48bf37b4de Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Aug 2026 12:12:28 +0200 Subject: [PATCH] avoid explicit .filler section - The .filler section would count to the .bss segment for tools like llvm-size which lead to bloated/wrong .bss segment information. --- aarch32-rt/CHANGELOG.md | 4 ++++ aarch32-rt/link.x | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/aarch32-rt/CHANGELOG.md b/aarch32-rt/CHANGELOG.md index 3ae31b2..cedb2d2 100644 --- a/aarch32-rt/CHANGELOG.md +++ b/aarch32-rt/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Changed + +- Replaced .filler padding section with fixed offset for stack placement in link.x + ## [aarch32-rt v0.4.0] ### Added diff --git a/aarch32-rt/link.x b/aarch32-rt/link.x index fd03821..f8e2530 100644 --- a/aarch32-rt/link.x +++ b/aarch32-rt/link.x @@ -156,24 +156,18 @@ SECTIONS { /* # Stack Padding * - * A padding region to push the stacks to the top of the STACKS region. - * If `_pack_stacks == 0`, this is forced to be zero size, putting the - * stacks at the bottom of the STACK region. + * Compute where `.stacks` should start: at the top of the STACKS region, + * unless `_pack_stacks == 1`, in which case right where we already are. */ - .filler (NOLOAD) : { - /* Move the .stacks section to the end of the STACKS memory region */ - _next_region = ORIGIN(STACKS) + LENGTH(STACKS); - _start_moved_stacks = _next_region - SIZEOF(.stacks); - _start_stacks = _pack_stacks ? . : _start_moved_stacks; - FILL(0x00) - . = _start_stacks; - } > STACKS + _next_region = ORIGIN(STACKS) + LENGTH(STACKS); + _start_moved_stacks = _next_region - SIZEOF(.stacks); + _start_stacks = _pack_stacks ? . : _start_moved_stacks; /* # Stacks * * Space for all seven stacks. */ - .stacks (NOLOAD) : ALIGN(_stack_alignment) + .stacks _start_stacks (NOLOAD) : ALIGN(_stack_alignment) { . = ALIGN(_stack_alignment);