rewrite pgo-gen-no-imp-symbols to rmake · rust-lang/rust@6d9d605 (original) (raw)

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -56,7 +56,6 @@ run-make/no-builtins-attribute/Makefile
56 56 run-make/panic-abort-eh_frame/Makefile
57 57 run-make/pdb-buildinfo-cl-cmd/Makefile
58 58 run-make/pgo-gen-lto/Makefile
59 -run-make/pgo-gen-no-imp-symbols/Makefile
60 59 run-make/pgo-indirect-call-promotion/Makefile
61 60 run-make/pointer-auth-link-with-c/Makefile
62 61 run-make/print-calling-conventions/Makefile
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
4 4 // This test checks that the impl_* symbols are preserved as they should.
5 5 // See https://github.com/rust-lang/rust/issues/108030
6 6
7 -//FIXME(Oneirical): try it on more than only-x86_64-unknown-linux-gnu
7 +//@ only-x86_64-unknown-linux-gnu
8 +// Reason: some of the inline assembly directives are architecture-specific.
8 9
9 10 use run_make_support::rustc;
10 11
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
9 9 //@ ignore-cross-compile
10 10 // Reason: the compiled binary is executed
11 11
12 -// FIXME(Oneirical): try on msvc because of #27979
12 +//@ ignore-msvc
13 +// Reason: native compilation results in an unresolved external symbol
13 14
14 15 use run_make_support::{build_native_static_lib, run, rustc};
15 16
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
1 +// LLVM's profiling instrumentation adds a few symbols that are used by the profiler runtime.
2 +// Since these show up as globals in the LLVM IR, the compiler generates dllimport-related
3 +// __imp_ stubs for them. This can lead to linker errors because the instrumentation
4 +// symbols have weak linkage or are in a comdat section, but the __imp_ stubs aren't.
5 +// Since profiler-related symbols were excluded from stub-generation in #59812, this has
6 +// been fixed, and this test checks that the llvm profile symbol appear, but without the
7 +// anomalous __imp_ stubs.
8 +// See https://github.com/rust-lang/rust/pull/59812
9 +
10 +use run_make_support::{cwd, rfs, rustc};
11 +
12 +fn main() {
13 +rustc()
14 +.input("test.rs")
15 +.emit("llvm-ir")
16 +.opt()
17 +.codegen_units(1)
18 +.profile_generate(cwd())
19 +.arg("-Zno-profiler-runtime")
20 +.run();
21 +let out = rfs::read_to_string("test.ll");
22 +// We expect symbols starting with "__llvm_profile_".
23 +assert!(out.contains("__llvm_profile_"));
24 +// We do NOT expect the "__imp_" version of these symbols.
25 +assert!(!out.contains("__imp___llvm_profile_")); // 64 bit
26 +assert!(!out.contains("__imp____llvm_profile_")); // 32 bit
27 +}