Skip to content

Commit e5e2316

Browse files
committed
Auto merge of #112049 - Kobzol:pgo-omit-benchmarks, r=<try>
[do not merge] CI experiments Various CI experiments for try/dist builds. r? `@ghost`
2 parents 608e228 + b01f641 commit e5e2316

File tree

1 file changed

+15
-0
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+15
-0
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::io::{BufWriter, Write};
55
use std::ops::{ControlFlow, Deref};
66
use std::path::{Path, PathBuf};
77
use std::process::{ExitStatus, Output, Stdio};
8+
use std::time::Instant;
89
use std::{env, fmt, fs, io, mem, str};
910

1011
use cc::windows_registry;
@@ -990,6 +991,20 @@ fn link_natively(
990991
}
991992
}
992993

994+
// Scan the built artifact, lld might keep .ctors/.dtors in it
995+
use object::read::Object;
996+
use rustc_data_structures::memmap::Mmap;
997+
998+
let start = Instant::now();
999+
let file = std::fs::File::open(&temp_filename).unwrap();
1000+
let mmap = unsafe { Mmap::map(file).unwrap() };
1001+
if let Ok(file) = object::read::File::parse(mmap.as_ref()) {
1002+
if let Some(_section) = file.section_by_name(".ctors") {
1003+
eprintln!(".ctors found!");
1004+
}
1005+
}
1006+
eprintln!("{}s", start.elapsed().as_secs_f64());
1007+
9931008
match prog {
9941009
Ok(prog) => {
9951010
let is_msvc_link_exe = sess.target.is_like_msvc

0 commit comments

Comments
 (0)