rust-lang / rust-lang/rust

Arm32 EABI exception handling

Open
#128,156 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-runtime O-Arm O-netbsd T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I am opening this issue to track work regarding improving Arm 32-bit EABI exception-handling. There are a few fixmes that were never addressed and some things that I found a bit unclear. These are currently mostly questions, and it is possible this issue may be resolved fully by merely answering the questions (and hopefully committing an answer somewhere).

  • How bad is reusing r12, anyways?
  • What's up with NetBSD?

Arm, GCC, exceptions, and r12

We find this comment in our source:

https://github.com/rust-lang/rust/blob/6106b05b27988f4b946d7af219a6db95fb4477a1/library/std/src/sys/personality/gcc.rs#L126-L136

It's unclear what benefits this has, to me, and if our codegen backend could even exploit them, theoretically, if we did this. Mere correctness? Perhaps mere correctness is worth it, it might just be a fairly simple def.

NetBSD

According to this lovingly detailed commit message, NetBSD on 32-bit Arm using the EABI does not use the Arm EABI exception handling routines.

However, perhaps because it was not seen as relevant, it was not documented what it does use as its approach for unwinding. This is unfortunate, as we have recently seen Arm bugs on NetBSD that appear to be caused by assuming NetBSD on Arm must operate exactly like it does on x86, and discovering we are wrong, because of bugs or other reasons.

@he32 Do all NetBSD architectures use the same unwinding? Do we even unwind correctly on the not-so-x86 NetBSD architectures? Apparently not if this is to be believed? https://github.com/rust-lang/rust/issues/96914

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

Start with the Arm exception-handling comment in library/std/src/sys/personality/gcc.rs and read the linked commit about NetBSD's 32-bit Arm EABI behavior. Investigate whether r12 reuse is correct and identify the unwinding approach used by NetBSD architectures, including the concerns in issue #96914. Done means the questions are answered and the conclusions are documented or the necessary fixes are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.