Skip to content

Commit 97146ac

Browse files
committed
rewrite pgo-gen-no-imp-symbols to rmake
1 parent 96ffb66 commit 97146ac

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ run-make/panic-abort-eh_frame/Makefile
6767
run-make/pass-non-c-like-enum-to-c/Makefile
6868
run-make/pdb-buildinfo-cl-cmd/Makefile
6969
run-make/pgo-gen-lto/Makefile
70-
run-make/pgo-gen-no-imp-symbols/Makefile
7170
run-make/pgo-indirect-call-promotion/Makefile
7271
run-make/pointer-auth-link-with-c/Makefile
7372
run-make/print-calling-conventions/Makefile

tests/run-make/pgo-gen-no-imp-symbols/Makefile

-11
This file was deleted.
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)