diff --git a/Cargo.toml b/Cargo.toml index 58c0eac7..d67d10fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core [build-dependencies] cc = { optional = true, version = "1.0" } -ar = { optional = true } +ar = { optional = true, path = "../rust-ar" } [dev-dependencies] panic-handler = { path = 'crates/panic-handler' } diff --git a/build.rs b/build.rs index befa05e5..3e8f1d2f 100644 --- a/build.rs +++ b/build.rs @@ -504,16 +504,6 @@ mod c_system { r.to_string() } - // TODO: this really should be part of ar - fn clone_header(h0: &ar::Header) -> ar::Header { - let mut h = ar::Header::new(h0.identifier().to_vec(), h0.size()); - h.set_mtime(h0.mtime()); - h.set_uid(h0.uid()); - h.set_gid(h0.gid()); - h.set_mode(h0.mode()); - h - } - fn find_library(dirs: I, libname: &str) -> Result> where I: Iterator @@ -600,11 +590,9 @@ mod c_system { }, } }; - orig.jump_to_entry(i).unwrap(); // Work around a stupid rust-ar bug let mut entry = orig.jump_to_entry(i).unwrap(); - let header = clone_header(entry.header()); // TODO: ar really should have an append_entry to avoid the clone - new.append(&header, &mut entry).unwrap(); + new.append(&entry.header().clone(), &mut entry).unwrap(); println!("cargo:rustc-cfg={}=\"optimized-c\"", sym); }