rewrite no-builtins-attribute to rmake

This commit is contained in:
Oneirical 2024-07-22 15:35:18 -04:00
parent c8f049cd80
commit d5c073eb09
4 changed files with 15 additions and 11 deletions

View File

@ -35,7 +35,6 @@ run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile run-make/min-global-align/Makefile
run-make/native-link-modifier-bundle/Makefile run-make/native-link-modifier-bundle/Makefile
run-make/no-alloc-shim/Makefile run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/pdb-buildinfo-cl-cmd/Makefile run-make/pdb-buildinfo-cl-cmd/Makefile
run-make/pgo-gen-lto/Makefile run-make/pgo-gen-lto/Makefile
run-make/pgo-indirect-call-promotion/Makefile run-make/pgo-indirect-call-promotion/Makefile

View File

@ -66,7 +66,8 @@ fn main() {
.crate_type("rlib") .crate_type("rlib")
.arg("-lstatic:-bundle,+whole-archive=c_static_lib_with_constructor") .arg("-lstatic:-bundle,+whole-archive=c_static_lib_with_constructor")
.run(); .run();
// Native lib linked into RLIB via `-l static:-bundle,+whole-archive`, RLIB linked into executable // Native lib linked into RLIB via `-l static:-bundle,+whole-archive`
// RLIB linked into executable
rustc().input("indirectly_linked.rs").run(); rustc().input("indirectly_linked.rs").run();
// Native lib linked into rlib via `#[link()]` attribute on extern block. // Native lib linked into rlib via `#[link()]` attribute on extern block.

View File

@ -1,9 +0,0 @@
include ../tools.mk
# We want to check if `no-builtins` is also added to the function declarations in the used crate.
all:
$(RUSTC) no_builtins.rs --emit=link
$(RUSTC) main.rs --emit=llvm-ir
cat "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck.main.txt

View File

@ -0,0 +1,13 @@
// `no_builtins` is an attribute related to LLVM's optimizations. In order to ensure that it has an
// effect on link-time optimizations (LTO), it should be added to function declarations in a crate.
// This test uses the `llvm-filecheck` tool to determine that this attribute is successfully
// being added to these function declarations.
// See https://github.com/rust-lang/rust/pull/113716
use run_make_support::{llvm_filecheck, rfs, rustc};
fn main() {
rustc().input("no_builtins.rs").emit("link").run();
rustc().input("main.rs").emit("llvm-ir").run();
llvm_filecheck().patterns("filecheck.main.txt").stdin(rfs::read("main.ll")).run();
}