fix: align .text section start to 8 bytes - #614
Conversation
|
The linker-script change itself looks correct: /* Move .text after the boot info and satisfy its current 8-byte
* output-section alignment requirement. */
_stext = ALIGN(ADDR(.start_block) + SIZEOF(.start_block), 8);With that wording adjustment, I have no issue with the alignment implementation. |
|
Thank you for the fix @kosmar! If you allow edits by maintainers for this PR, we can also take care of rebasing and testing this properly. |
|
@chmanie Thanks — updated the |
Co-authored-by: Cursor <cursoragent@cursor.com>
Authored by an AI coding agent on behalf of kosmar. Co-authored-by: Cursor <cursoragent@cursor.com>
39d6682 to
0d93dd1
Compare
ArthurGibert
left a comment
There was a problem hiding this comment.
Reviewed and empirically verified. Built main pre-fix and reproduced the exact rust-lld alignment warning this PR fixes; built this branch and confirmed the warning is gone, .text lands 8-aligned (confirmed via readelf), and the resulting release ELF still converts to a valid UF2. No correctness issues.
One minor, non-blocking note: the ALIGN(..., 8) value is hardcoded with nothing asserting it matches .text's actual required alignment. If a future toolchain/dependency bump raises that requirement, the same warning would silently reappear — it's a linker warning, not a rustc one, so it isn't caught by -D warnings or any CI gate. Not worth blocking on.
|
Approved on my side. @chmanie let me know |
|
@ArthurGibert yeah fine by me |
Summary
_stext = ADDR(.start_block) + SIZEOF(.start_block)places.textat 0x1000013c, which is not a multiple of the section’s current 8-byte alignment requirement. rust-lld has been warning about this on every build (“address of section .text is not a multiple of alignment”).ALIGN(..., 8)pads 4 bytes after.start_blockso.textstarts at 0x10000140 and satisfies the ELF output-section alignment invariant.Found while debugging dense preset pushes with the preset editor (#602). Host-side pacing there reduces USB pressure; this change clears the linker alignment warning and keeps
.textproperly aligned.Test plan