Skip to content

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

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.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions