-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Expand file tree
/
Copy pathrmake.rs
More file actions
42 lines (36 loc) · 1.32 KB
/
rmake.rs
File metadata and controls
42 lines (36 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Check if hotpatch makes the functions hotpachable that were not
// More details in lib.rs
use run_make_support::{llvm, rustc};
fn main() {
// hotpatch is only implemented for x86 and aarch64, but for aarch64 functions
// are always hotpatchable so we don't need to check it
#[cfg(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64"))]
{
fn base_rustc() -> rustc::Rustc {
let mut rustc = rustc();
rustc.input("lib.rs").crate_type("lib").opt_level("3");
rustc
}
fn dump_lib(libname: &str) -> String {
llvm::llvm_objdump()
.arg("--disassemble-symbols=empty_fn")
.input(libname)
.run()
.stdout_utf8()
}
{
base_rustc().crate_name("regular").run();
let regular_dump = dump_lib("libregular.rlib");
llvm::llvm_filecheck().patterns("lib.rs").stdin_buf(regular_dump).run();
}
{
base_rustc().crate_name("hotpatch").arg("-Zhotpatch").run();
let hotpatch_dump = dump_lib("libhotpatch.rlib");
llvm::llvm_filecheck()
.patterns("lib.rs")
.check_prefix("HOTPATCH")
.stdin_buf(hotpatch_dump)
.run();
}
}
}