rust-lang / rust-lang/rust

Tracking Issue for `-Zregparm`

Open
#131,749 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

-Zregparm A-ABI A-CLI A-rust-for-linux C-tracking-issue I-lang-nominated O-windows O-x86_32 P-lang-drag-1 T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This is a tracking issue for the -Zregparm flag for x86. It is the equivalent of Clang's/GCC's -mregparm=3. The kernel needs it to support the x86 32-bit architecture, together with -Zreg-struct-return.

It could potentially be a "global target feature", i.e. a target feature that is required to be set the same way for all compilation units.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Steps
Unresolved Questions & Answers
  • Q: Should it affect the Rust ABI? It cannot be documented as doing such, because the Rust ABI is unstable, but should it do so anyways as a quality-of-implementation matter?
    • Currently: No.
    • Alternatives:
      • Maybe yes?
      • Maybe we want to have a modification equivalent to "fastcall" or -Zregparm=3 apply to the Rust ABI implicitly, without -Zregparm affecting it?
  • Q: Should it affect any other ABIs than "C", "cdecl", and "stdcall"?
    • Currently: No.
    • Alternatives: It's not yet clear what ABIs this affects for gcc and clang.
  • Q: Should it be accepted on any other architecture than x86_32?
    • Currently: No.
  • Q: Does MSVC code use this? extern "fastcall" does something equivalent to -Zregparm=2, so do MSVC targets even use it, or do they just use fastcall?

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 linked implementation PR and the stabilization guide instructions in the issue. Review the unresolved ABI and architecture questions before working on the remaining documentation and stabilization PR tasks. Done means the documentation is adjusted and a stabilization PR is prepared, with the open design questions resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.