rust-lang / rust-lang/rust

Undefined symbol errors on `__aeabi_uread*` and `__aeabi_uwrite*` functions with opt-level = "z" and `build-std`

Open
#162,259 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-compiler-builtins C-bug regression-untriaged T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

On more recent Rust versions (after update to LLVM 23, I assume), I no longer can build some bare-metal projects.
There are errors such as

 = note: rust-lld: error: undefined symbol: __aeabi_uread4
          >>> referenced by mod.rs:1758 (src\ptr\mod.rs:1758)

Also mentioning __aeabi_uread8, __aeabi_uwrite4, __aeabi_uread8.
This only happens with option opt-level = "z" AND build-std enabled.

.cargo/cargo.toml:

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# replace STM32G0B1RETx with your chip as listed in `probe-rs chip list`
runner = "probe-rs run --chip STM32G0B1RETx"

[build]
target = "thumbv6m-none-eabi"

[env]
DEFMT_LOG = "trace"

[unstable]
build-std = ["core"]

Problem can be easily reproduced on embassy project examples
e.g. (https://github.com/embassy-rs/embassy/blob/main/examples/stm32g0/src/bin/blinky.rs)
This example's target is thumbv6m-none-eabi.

Version it worked on

It most recently worked on: Rust 1.95

Version with regression

rustc --version --verbose:

rustc 1.100.0-nightly (2e2b193f8 2026-09-02)

Contributor guide

Open the contributing guide

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

Reproduce the failure using the provided .cargo/cargo.toml settings, the thumbv6m-none-eabi target, and the Embassy STM32G0 blinky example. Inspect the undefined-symbol reference at src/ptr/mod.rs:1758 and compare Rust 1.95 with the reported 1.100.0-nightly build. Done means the example links successfully with opt-level = "z" and build-std enabled without the __aeabi_uread* or __aeabi_uwrite* errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.