properly expose all symbls in manganis without linker intercept (#3230)

* force a volatile read of manganis symbols to preserve them in the final binary
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2024-11-17 00:36:56 -05:00
1 parent 017478d212
commit 493c5c7532
4 files changed
+12 -25

No files matched your search

-25
View File
@@ -7,7 +7,6 @@ use crate::{AppBundle, Platform};
use anyhow::Context;
use serde::Deserialize;
use std::{
ffi::OsStr,
path::{Path, PathBuf},
process::Stdio,
time::Instant,
@@ -225,30 +224,6 @@ impl BuildRequest {
// walk every file in the incremental cache dir, reading and inserting items into the manifest.
let mut manifest = AssetManifest::default();
// Add from the deps folder where the rlibs are stored for dependencies
let deps_folder = exe.parent().unwrap().join("deps");
tracing::trace!("Adding assets from deps folder: {deps_folder:?}");
for entry in deps_folder.read_dir()?.flatten() {
if entry.path().extension() == Some(OsStr::new("rlib")) {
_ = manifest.add_from_object_path(&entry.path());
}
}
// Add from the incremental cache folder by recursively walking the folder
// it seems that this sticks around no matter what - and cargo doesn't clean it up since the .os are cached anyway
fn recursive_add(manifest: &mut AssetManifest, path: &Path) -> Result<()> {
if path.extension() == Some(OsStr::new("o")) {
_ = manifest.add_from_object_path(path);
} else if let Ok(dir) = path.read_dir() {
for entry in dir.flatten() {
recursive_add(manifest, &entry.path())?;
}
}
Ok(())
}
recursive_add(&mut manifest, &exe.parent().unwrap().join("incremental"))?;
// And then add from the exe directly, just in case it's LTO compiled and has no incremental cache
_ = manifest.add_from_object_path(exe);