Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins` by rcvalle · Pull Request #146133 · rust-lang/rust

@tgross35 tgross35 changed the title Revert "Make lto and linker-plugin-lto work the same for `compile… Revert "Make lto and linker-plugin-lto work the same for compiler_builtins

Sep 2, 2025

@rcvalle

…r_builtins`"

This reverts commit cf8753e and fixes the
regressions reported.

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Sep 2, 2025

@rcvalle rcvalle marked this pull request as ready for review

September 3, 2025 06:20

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Sep 3, 2025

@lqd lqd mentioned this pull request

Sep 3, 2025

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Sep 3, 2025

bors added a commit that referenced this pull request

Sep 3, 2025
Rollup of 15 pull requests

Successful merges:

 - #143725 (core: add Peekable::next_if_map)
 - #145209 (Stabilize `path_add_extension`)
 - #145750 (raw_vec.rs: Remove superfluous fn alloc_guard)
 - #145962 (Ensure we emit an allocator shim when only some crate types need one)
 - #145963 (Add LSX accelerated implementation for source file analysis)
 - #146054 (add `#[must_use]` to `array::repeat`)
 - #146090 (Derive `PartialEq` for `InvisibleOrigin`)
 - #146120 (Correct typo in `rustc_errors` comment)
 - #146127 (Rename `ToolRustc` to `ToolRustcPrivate`)
 - #146131 (rustdoc-search: add test case for indexing every item type)
 - #146133 (Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`)
 - #146134 (llvm: nvptx: Layout update to match LLVM)
 - #146136 (docs(std): add missing closing code block fences in doc comments)
 - #146137 (Disallow frontmatter in `--cfg` and `--check-cfg` arguments)
 - #146140 (compiletest: cygwin follows windows in using PATH for dynamic libraries)

r? `@ghost`
`@rustbot` modify labels: rollup

Zalathar added a commit to Zalathar/rust that referenced this pull request

Sep 3, 2025

bors added a commit that referenced this pull request

Sep 3, 2025
Rollup of 16 pull requests

Successful merges:

 - #143725 (core: add Peekable::next_if_map)
 - #145209 (Stabilize `path_add_extension`)
 - #145342 (fix drop scope for `super let` bindings within `if let`)
 - #145750 (raw_vec.rs: Remove superfluous fn alloc_guard)
 - #145962 (Ensure we emit an allocator shim when only some crate types need one)
 - #145963 (Add LSX accelerated implementation for source file analysis)
 - #146054 (add `#[must_use]` to `array::repeat`)
 - #146090 (Derive `PartialEq` for `InvisibleOrigin`)
 - #146120 (Correct typo in `rustc_errors` comment)
 - #146127 (Rename `ToolRustc` to `ToolRustcPrivate`)
 - #146133 (Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins`)
 - #146134 (llvm: nvptx: Layout update to match LLVM)
 - #146136 (docs(std): add missing closing code block fences in doc comments)
 - #146137 (Disallow frontmatter in `--cfg` and `--check-cfg` arguments)
 - #146140 (compiletest: cygwin follows windows in using PATH for dynamic libraries)
 - #146156 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup

@rcvalle rcvalle deleted the rust-cfi-fix-145981 branch

September 4, 2025 21:12

This was referenced

Sep 4, 2025

@ctz ctz mentioned this pull request

Sep 5, 2025

makai410 pushed a commit to makai410/rust that referenced this pull request

Nov 8, 2025

makai410 pushed a commit to makai410/rust that referenced this pull request

Nov 10, 2025

github-merge-queue bot pushed a commit to rust-lang/cargo that referenced this pull request

Nov 20, 2025
Add a test for rust-lang/rust#146133. `cargo
+nightly-2025-08-29 test --test build-std -- lto` can reproduce the
regression.
This is not a bug from Cargo, but it requires `-Zbuild-std` in most use
cases.
The test case is from rust-lang/rust#146109.
The point is that when rustc is invoked with -Clto=fat or -Clto=thin, it
should perform LTO with ALL bitcodes. However,
rust-lang/rust#145368 emits bitcodes for
compiler_builtins but excludes it from LTO participation.
As a result, the compiler_builtins bitcodes library is passed to the
linker, but the linkers, such as the GNU ld or older versions of LLD,
are unable to process bitcodes.

Zalathar added a commit to Zalathar/rust that referenced this pull request

Dec 9, 2025
…to, r=jieyouxu

test: Add a test for 146133

This is a test without using `-Zbuild-std` for rust-lang#146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277.

Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Dec 9, 2025
…to, r=jieyouxu

test: Add a test for 146133

This is a test without using `-Zbuild-std` for rust-lang#146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277.

Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.

rust-timer added a commit that referenced this pull request

Dec 9, 2025
Rollup merge of #149772 - dianqk:no-builtins-linker-plugin-lto, r=jieyouxu

test: Add a test for 146133

This is a test without using `-Zbuild-std` for #146133. There is another test using `-Zbuild-std`: rust-lang/cargo#16277.

Even if a crate is marked as `#![no_builtins]`, we can still generate bitcode for rlib, but we cannot emit bitcode to the linker in rustc's LTO.