Skip to content

Commit 7ab8dda

Browse files
committed
Fix gnu archives
1 parent e8db15f commit 7ab8dda

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ indexmap = "1.0.2"
3939
#gimli = { path = "../" }
4040

4141
[patch.crates-io]
42-
ar = { git = "https://github.com/mdsteele/rust-ar.git" }
42+
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "non_multiple_of_two_identifiers_gnu_format" }
4343

4444
[profile.dev.overrides."*"]
4545
opt-level = 3

src/archive.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
3636
dst: output.to_path_buf(),
3737
src: input.map(|p| p.to_path_buf()),
3838
lib_search_paths: archive_search_paths(sess),
39-
is_like_osx: true, //sess.target.target.options.is_like_osx,
39+
is_like_osx: sess.target.target.options.is_like_osx,
4040
};
4141

4242
let (src_archives, entries) = if let Some(src) = &config.src {
@@ -147,23 +147,8 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
147147
let entry = self.src_archives[archive_index].jump_to_entry(entry_index).unwrap();
148148
let orig_header = entry.header();
149149

150-
let orig_filename = orig_header.identifier().to_vec();
151-
152-
use std::collections::hash_map::DefaultHasher;
153-
use std::hash::{Hash, Hasher};
154-
let mut hasher = DefaultHasher::new();
155-
orig_filename.hash(&mut hasher);
156-
let mut filename = hasher.finish().to_le_bytes()[0..6].to_vec();
157-
filename.extend(&orig_filename[orig_filename.len() - 9..]);
158-
159-
assert!(
160-
filename.len() <= 16,
161-
"Filenames bigger than 16 bytes are not yet supported. Filename was: \"{}\"",
162-
String::from_utf8(filename).unwrap_or_else(|e| e.to_string()),
163-
);
164-
165150
let mut header =
166-
ar::Header::new(filename, orig_header.size());
151+
ar::Header::new(orig_header.identifier().to_vec(), orig_header.size());
167152
header.set_mtime(orig_header.mtime());
168153
header.set_uid(orig_header.uid());
169154
header.set_gid(orig_header.gid());

0 commit comments

Comments
 (0)