-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite pgo-gen-no-imp-symbols to rmake
- Loading branch information
Showing
4 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |