Skip to content

Commit

Permalink
rewrite no-builtins-lto to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jun 14, 2024
1 parent cabc982 commit 4c50d7a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ run-make/native-link-modifier-verbatim-rustc/Makefile
run-make/native-link-modifier-whole-archive/Makefile
run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/no-builtins-lto/Makefile
run-make/no-duplicate-libs/Makefile
run-make/obey-crate-type-flag/Makefile
run-make/optimization-remarks-dir-pgo/Makefile
Expand Down
1 change: 1 addition & 0 deletions tests/run-make/lto-avoid-object-duplication/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore-tidy-tab
// Staticlibs don't include Rust object files from upstream crates if the same
// code was already pulled into the lib via LTO. However, the bug described in
// https://github.com/rust-lang/rust/issues/64153 lead to this exclusion not
Expand Down
9 changes: 0 additions & 9 deletions tests/run-make/no-builtins-lto/Makefile

This file was deleted.

20 changes: 20 additions & 0 deletions tests/run-make/no-builtins-lto/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// The rlib produced by a no_builtins crate should be explicitely linked
// during compilation, and as a result be present in the linker arguments.
// See the comments inside the test for more details.
// See https://github.com/rust-lang/rust/pull/35637

use run_make_support::{rust_lib_name, rustc};

fn main() {
// Compile a `#![no_builtins]` rlib crate
rustc().input("no_builtins.rs").run();
// Build an executable that depends on that crate using LTO. The no_builtins crate doesn't
// participate in LTO, so its rlib must be explicitly
// linked into the final binary. Verify this by grepping the linker arguments.
rustc()
.input("main.rs")
.arg("-Clto")
.print("link-args")
.run()
.assert_stdout_contains(rust_lib_name("no_builtins"));
}

0 comments on commit 4c50d7a

Please sign in to comment.