rust-embedded / rust-embedded/cortex-m

Warning from linker about alignment of `.text` section

Open
#678 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1k
Forks
202
Avg merge
6d 2h
Merged PRs (30d)
2

Description

I'm writing a simple Rust program for STM32U5A5, using the stm32-rs PAC.

It seems I have 0x218 bytes worth of interrupt vectors (134 vectors).

This puts .text at 0xc000258, which the linker warns me is not a multiple of 16

warning: linker stderr: rust-lld: address (0xc000258) of section .text is not a multiple of alignment (16)
  |
  = note: `#[warn(linker_messages)]` on by default

Should link.x apply some alignment to the start of the .text section?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting link.x and how rust-lld places the .text section after the interrupt vectors for the STM32U5A5 case. Reproduce the warning with the reported 0x218-byte vector table, then verify that the resulting .text address satisfies the required 16-byte alignment and that the linker warning is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.