rust-lang / rust-lang/rust

Tracking Issue for fine-grained `-C link-self-contained`

Open
#149,175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-tracking-issue
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This is a tracking issue for the unstable parts of the command line option -C link-self-contained=+component1,-component2.
There's no RFC, but some of the feature was stabilized by an FCP for LLD-by-default.

The stable subset is documented in https://doc.rust-lang.org/rustc/codegen-options/index.html#link-self-contained.
The unstable and mostly unimplemented subset is documented in https://doc.rust-lang.org/beta/unstable-book/compiler-flags/codegen-options.html#link-self-contained.

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
  • Support other components besides linker in rustc_codegen_ssa and maybe other places
  • Move all the libraries and binaries to subdirectories of the self-contained directories corresponding to the individual components
  • Move self-contained components not currently living in the self-contained directories to those directories
    • Move libunwind
    • Move mingw linker and C compiler
    • Move sanitizers
  • Migrate targets using some shipped components without considering the self-contained mechanism to that mechanism
    • libunwind on some targets
    • linker and C compiler on mingw
    • sanitizers everywhere
  • Migrate bare-metal targets using rust-lld as linker to using ld.lld through the self-contained mechanism
  • On targets where -C link-self-contained=+something/yes does nothing it should be prohibited or unstable
  • On targets where -C link-self-contained=-something/no does nothing and the target behaves correctly with regards to self-contained (rust-lld/libunwind/etc are migrated), it can be allowed and stabilized.
  • On targets where -C link-self-contained doesn't behave correctly (rust-lld/libunwind/etc are not migrated), it should be prohibited or unstable
  • On targets where -C link-self-contained=something does something it can be allowed and stabilized through an FCP or MCP mechanism
  • Perhaps rename self-contained directories to sc to shorten all the paths
Unresolved Questions
  • TBD
Implementation history
  • TODO
Some relevant PRs

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 stable and unstable documentation for -C link-self-contained, then inspect the rustc_codegen_ssa support mentioned in the checklist and the relevant self-contained target directories. A complete contribution would address one clearly scoped checklist item, with the affected targets behaving consistently and the corresponding documentation updated where needed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.