rust-lang / rust-lang/rust

Using `-C lto=thin` and `-C no-prepopulate-passes` at the same time for windows target , report link error: undefined symbol

Open
#125,802 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-linkage C-bug O-windows T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

We compile hello.rs for x86_64-pc-windows-gnullvm then there is a link error: undefined symbol
rustc -C lto=thin -C no-prepopulate-passes --target=x86_64-pc-windows-gnullvm hello.rs

fn main() {
    println!("Hello world!");
}

The rustc version is rustc 1.80.0-nightly (867900499 2024-05-23)
The link error reproduces for target x86_64-pc-windows-gnu and x86_64-pc-windows-gnullvm
It seems that -C no-prepopulate-passes isn't compatible with -Clto.
Maybe we should report error that -C no-prepopulate-passes isn't compatible with -Clto?

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

Reproduce the issue with the supplied rustc command and hello.rs example for both Windows targets. Investigate how -C lto=thin and -C no-prepopulate-passes are handled together, then verify that the result is either a clear incompatibility error or no longer produces the reported undefined-symbol link error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.