Skip to content

unsafe(naked) functions might not be called via a thunk #151946

@thejpster

Description

@thejpster
  • Using nightly 2026-01-30
  • And the minimal reproducer at https://github.com/thejpster/aarch32-hell
  • And a target that supports two modes of operation but needs either a thunk to switch modes or a special mode switching branch instruction
  • And with a naked function given an instruction_set attribute to compile it in the non-default mode
  • calling the naked function does not insert the thunk or the special instruction

Discussion at https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/naked.20functions.20broken.20-.20missing.20thunk/with/571236055

Cc: @folkertdev

Metadata

Metadata

Assignees

Labels

A-nakedArea: `#[naked]`, prologue and epilogue-free, functions, https://git.io/vAzzSC-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

To Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions