Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,15 @@ impl<'a> Linker for GccLinker<'a> {
fn enable_profiling(&mut self) {
// This flag is also used when linking to choose target specific
// libraries needed to enable profiling.
self.cc_arg("-pg");
// On windows-gnu targets, libgmon also needs to be linked, and this
// requires readding libraries to satisfy its dependencies.
if self.sess.target.is_like_windows {
self.cc_arg("-lgmon");
self.cc_arg("-lkernel32");
self.cc_arg("-lmsvcrt");
if !self.is_ld {
self.cc_arg("-pg");
// On windows-gnu targets, libgmon also needs to be linked, and this
// requires readding libraries to satisfy its dependencies.
if self.sess.target.is_like_windows {
self.cc_arg("-lgmon");
self.cc_arg("-lkernel32");
self.cc_arg("-lmsvcrt");
}
Comment on lines +743 to +747
Copy link
Copy Markdown
Member

@mati865 mati865 May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is fine to be passed to the linkers directly, although it won't really work without gcrt object. So, it doesn't really make a difference right now.

View changes since the review

}
}

Expand Down
Loading