You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Err("dylib metadata loading is not yet supported".to_string())
42
+
println!("abc");
43
+
use object::Object;
44
+
let file = std::fs::read(path).map_err(|e| format!("read:{:?}", e))?;
45
+
let file = object::File::parse(&file).map_err(|e| format!("parse: {:?}", e))?;
46
+
let buf = file.section_data_by_name(".rustc").ok_or("no .rustc section")?.into_owned();
47
+
let buf:OwningRef<Vec<u8>,[u8]> = OwningRef::new(buf).into();
48
+
Ok(rustc_erase_owner!(buf.map_owner_box()))
39
49
}
40
50
}
51
+
52
+
// Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112
53
+
pubfnwrite_metadata<'a,'gcx>(
54
+
tcx:TyCtxt<'a,'gcx,'gcx>,
55
+
artifact:&mut faerie::Artifact
56
+
) -> EncodedMetadata{
57
+
use std::io::Write;
58
+
use flate2::Compression;
59
+
use flate2::write::DeflateEncoder;
60
+
61
+
#[derive(PartialEq,Eq,PartialOrd,Ord)]
62
+
enumMetadataKind{
63
+
None,
64
+
Uncompressed,
65
+
Compressed
66
+
}
67
+
68
+
let kind = tcx.sess.crate_types.borrow().iter().map(|ty| {
0 commit comments