#[derive(Debug)]
enum ArchiveEntry {
- FromArchive {
- archive_index: usize,
- entry_index: usize,
- },
+ FromArchive { archive_index: usize, entry_index: usize },
File(PathBuf),
}
// Don't use `HashMap` here, as the order is important. `rust.metadata.bin` must always be at
// the end of an archive for linkers to not get confused.
entries: Vec<(String, ArchiveEntry)>,
- update_symbols: bool,
}
impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
let entry = entry.unwrap();
entries.push((
String::from_utf8(entry.header().identifier().to_vec()).unwrap(),
- ArchiveEntry::FromArchive {
- archive_index: 0,
- entry_index: i,
- },
+ ArchiveEntry::FromArchive { archive_index: 0, entry_index: i },
));
i += 1;
}
src_archives,
entries,
- update_symbols: false,
}
}
fn add_native_library(&mut self, name: rustc_span::symbol::Symbol) {
let location = find_library(name, &self.lib_search_paths, self.sess);
- self.add_archive(location.clone(), |_| false)
- .unwrap_or_else(|e| {
- panic!(
- "failed to add native library {}: {}",
- location.to_string_lossy(),
- e
- );
- });
+ self.add_archive(location.clone(), |_| false).unwrap_or_else(|e| {
+ panic!("failed to add native library {}: {}", location.to_string_lossy(), e);
+ });
}
fn add_rlib(
})
}
- fn update_symbols(&mut self) {
- self.update_symbols = true;
- }
+ fn update_symbols(&mut self) {}
fn build(mut self) {
enum BuilderKind {
// FIXME only read the symbol table of the object files to avoid having to keep all
// object files in memory at once, or read them twice.
let data = match entry {
- ArchiveEntry::FromArchive {
- archive_index,
- entry_index,
- } => {
+ ArchiveEntry::FromArchive { archive_index, entry_index } => {
// FIXME read symbols from symtab
use std::io::Read;
let (ref _src_archive_path, ref mut src_archive) =
err
));
}),
- entries
- .iter()
- .map(|(name, _)| name.as_bytes().to_vec())
- .collect(),
+ entries.iter().map(|(name, _)| name.as_bytes().to_vec()).collect(),
ar::GnuSymbolTableFormat::Size32,
symbol_table,
)
.expect("Couldn't run ranlib");
if !status.success() {
- self.sess
- .fatal(&format!("Ranlib exited with code {:?}", status.code()));
+ self.sess.fatal(&format!("Ranlib exited with code {:?}", status.code()));
}
}
}
let file_name = String::from_utf8(entry.header().identifier().to_vec())
.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err))?;
if !skip(&file_name) {
- self.entries.push((
- file_name,
- ArchiveEntry::FromArchive {
- archive_index,
- entry_index: i,
- },
- ));
+ self.entries
+ .push((file_name, ArchiveEntry::FromArchive { archive_index, entry_index: i }));
}
i += 1;
}