rust-lang / rust-lang/rust

Tracking issue for all the ways in which -C compiler flags can alter the ABI

Open
#131,837 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ABI A-target-feature C-tracking-issue T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

If a -C flag alters the ABI, mixing crates built with different flags causes UB. This issue is gathering all the ways in which this can happen, so that we can figure out what to do with them. The general goal is to make it impossible to alter these flags without realizing that they are "special" and need to be set consistently across all crates. Ideally rustc can even check that they are set consistently, though that will not cover dynamic linking.

Flags that are sus:

  • -Cno-redzone could potentially be a problem
  • Probably -Clink-arg(s) can also do bad shenanigans... but it can't really affect ABI, can it? The ABI is already baked into the object files at this point.

This list might be incomplete!

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 by reading the linked issues on -Ctarget-features, -Cllvm-args, and the other suspected flags, then review the referenced compiler discussion. Done means identifying the ABI-affecting flags and agreeing how rustc should ensure they are configured consistently, including the stated dynamic-linking limitation.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.