rewrite pgo-gen-no-imp-symbols to rmake
This commit is contained in:
parent
f307287659
commit
6d9d605fca
@ -56,7 +56,6 @@ run-make/no-builtins-attribute/Makefile
|
||||
run-make/panic-abort-eh_frame/Makefile
|
||||
run-make/pdb-buildinfo-cl-cmd/Makefile
|
||||
run-make/pgo-gen-lto/Makefile
|
||||
run-make/pgo-gen-no-imp-symbols/Makefile
|
||||
run-make/pgo-indirect-call-promotion/Makefile
|
||||
run-make/pointer-auth-link-with-c/Makefile
|
||||
run-make/print-calling-conventions/Makefile
|
||||
|
@ -4,7 +4,8 @@
|
||||
// This test checks that the impl_* symbols are preserved as they should.
|
||||
// See https://github.com/rust-lang/rust/issues/108030
|
||||
|
||||
//FIXME(Oneirical): try it on more than only-x86_64-unknown-linux-gnu
|
||||
//@ only-x86_64-unknown-linux-gnu
|
||||
// Reason: some of the inline assembly directives are architecture-specific.
|
||||
|
||||
use run_make_support::rustc;
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
//@ ignore-cross-compile
|
||||
// Reason: the compiled binary is executed
|
||||
|
||||
// FIXME(Oneirical): try on msvc because of #27979
|
||||
//@ ignore-msvc
|
||||
// Reason: native compilation results in an unresolved external symbol
|
||||
|
||||
use run_make_support::{build_native_static_lib, run, rustc};
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
COMPILE_FLAGS=-O -Ccodegen-units=1 -Cprofile-generate="$(TMPDIR)" -Zno-profiler-runtime
|
||||
|
||||
all:
|
||||
$(RUSTC) $(COMPILE_FLAGS) --emit=llvm-ir test.rs
|
||||
# We expect symbols starting with "__llvm_profile_".
|
||||
$(CGREP) "__llvm_profile_" < $(TMPDIR)/test.ll
|
||||
# We do NOT expect the "__imp_" version of these symbols.
|
||||
$(CGREP) -v "__imp___llvm_profile_" < $(TMPDIR)/test.ll # 64 bit
|
||||
$(CGREP) -v "__imp____llvm_profile_" < $(TMPDIR)/test.ll # 32 bit
|
27
tests/run-make/pgo-gen-no-imp-symbols/rmake.rs
Normal file
27
tests/run-make/pgo-gen-no-imp-symbols/rmake.rs
Normal file
@ -0,0 +1,27 @@
|
||||
// LLVM's profiling instrumentation adds a few symbols that are used by the profiler runtime.
|
||||
// Since these show up as globals in the LLVM IR, the compiler generates dllimport-related
|
||||
// __imp_ stubs for them. This can lead to linker errors because the instrumentation
|
||||
// symbols have weak linkage or are in a comdat section, but the __imp_ stubs aren't.
|
||||
// Since profiler-related symbols were excluded from stub-generation in #59812, this has
|
||||
// been fixed, and this test checks that the llvm profile symbol appear, but without the
|
||||
// anomalous __imp_ stubs.
|
||||
// See https://github.com/rust-lang/rust/pull/59812
|
||||
|
||||
use run_make_support::{cwd, rfs, rustc};
|
||||
|
||||
fn main() {
|
||||
rustc()
|
||||
.input("test.rs")
|
||||
.emit("llvm-ir")
|
||||
.opt()
|
||||
.codegen_units(1)
|
||||
.profile_generate(cwd())
|
||||
.arg("-Zno-profiler-runtime")
|
||||
.run();
|
||||
let out = rfs::read_to_string("test.ll");
|
||||
// We expect symbols starting with "__llvm_profile_".
|
||||
assert!(out.contains("__llvm_profile_"));
|
||||
// We do NOT expect the "__imp_" version of these symbols.
|
||||
assert!(!out.contains("__imp___llvm_profile_")); // 64 bit
|
||||
assert!(!out.contains("__imp____llvm_profile_")); // 32 bit
|
||||
}
|
Loading…
Reference in New Issue
Block a user