Skip to content

Commit

Permalink
[WIP] Use a fixed rust-ar
Browse files Browse the repository at this point in the history
  • Loading branch information
infinity0 committed Aug 31, 2019
1 parent cbb4f13 commit 0e64d5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down
14 changes: 1 addition & 13 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I>(dirs: I, libname: &str) -> Result<PathBuf, Vec<String>>
where
I: Iterator<Item = PathBuf>
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 0e64d5e

Please sign in to comment.