rust-lang / rust-lang/rust

Add a `-C embed-binary=no` compiler option

Open
#137,998 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

It would be useful to ask rustc to not embed object code in a rlib when doing LTO. I suggest adding a -C embed-binary=no compiler option similar to -C embed-bitcode=no.

This would allow https://github.com/rust-lang/cargo/issues/14575 to be fixed without incurring a compile time cost, as Cargo misuses -C linker-plugin-lto as a -C embed-binary=no option, which currently leads to miscompilations.

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 tracing rustc's existing handling of the analogous -C embed-bitcode=no option and the LTO path that produces rlibs. Determine where the new -C embed-binary=no setting must be accepted and applied, then verify that Cargo's use case no longer causes miscompilations without adding a compile-time cost.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.