Skip to content

Commit b08317a

Browse files
benhillisBen Hillis
and
Ben Hillis
authored
Reapply "Build musl binaries with RELR relocations (#965)" (#1249) (#1250)
This newer relocation format produces considerably smaller relocation sections, saving 1.6MB from openvmm_hcl. This reverts commit 493092c. Co-authored-by: Ben Hillis <[email protected]>
1 parent 493092c commit b08317a

File tree

3 files changed

+93
-38
lines changed

3 files changed

+93
-38
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ rustflags = [
8989
rustflags = [
9090
# Use the musl from the sysroot, not from the Rust distribution.
9191
"-Clink-self-contained=n",
92+
# Use RELR relocation format, which is considerably smaller.
93+
"-Clink-arg=-Wl,-z,pack-relative-relocs",
9294
]
9395

9496
[target.'cfg(all(target_arch = "aarch64", target_env = "musl"))']

.github/workflows/openvmm-pr.yaml

Lines changed: 48 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flowey/flowey_lib_hvlite/src/_jobs/check_openvmm_hcl_size.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,50 @@ impl SimpleFlowNode for Node {
9696
gh_token: gh_token.clone(),
9797
});
9898

99+
// Publish the built binary as an artifact for offline analysis.
100+
//
101+
// FUTURE: Flowey should have a general mechanism for this. We cannot
102+
// use the existing artifact support because all artifacts are only
103+
// published at the end of the job, if everything else succeeds.
104+
let publish_artifact = if ctx.backend() == FlowBackend::Github {
105+
let dir = ctx.emit_rust_stepv("collect openvmm_hcl files for analysis", |ctx| {
106+
let built_openvmm_hcl = built_openvmm_hcl.clone().claim(ctx);
107+
move |rt| {
108+
let built_openvmm_hcl = rt.read(built_openvmm_hcl);
109+
let path = Path::new("artifact");
110+
fs_err::create_dir_all(path)?;
111+
fs_err::copy(built_openvmm_hcl.bin, path.join("openvmm_hcl"))?;
112+
if let Some(dbg) = built_openvmm_hcl.dbg {
113+
fs_err::copy(dbg, path.join("openvmm_hcl.dbg"))?;
114+
}
115+
Ok(path
116+
.absolute()?
117+
.into_os_string()
118+
.into_string()
119+
.ok()
120+
.unwrap())
121+
}
122+
});
123+
let name = format!(
124+
"{}_openvmm_hcl_for_size_analysis",
125+
target.common_arch().unwrap().as_arch()
126+
);
127+
Some(
128+
ctx.emit_gh_step(
129+
"publish openvmm_hcl for analysis",
130+
"actions/upload-artifact@v4",
131+
)
132+
.with("name", name)
133+
.with("path", dir)
134+
.finish(ctx),
135+
)
136+
} else {
137+
None
138+
};
139+
99140
let comparison = ctx.emit_rust_step("binary size comparison", |ctx| {
141+
// Ensure the artifact is published before the analysis since this step may fail.
142+
let _publish_artifact = publish_artifact.claim(ctx);
100143
let xtask = xtask.claim(ctx);
101144
let openvmm_repo_path = openvmm_repo_path.claim(ctx);
102145
let old_openhcl = merge_head_artifact.claim(ctx);

0 commit comments

Comments
 (0)