mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 19:23:50 +00:00
Unconditionally update symbols
All paths to an ArchiveBuilder::build call update_symbols first.
This commit is contained in:
parent
203b622a65
commit
609784711a
@ -105,8 +105,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_symbols(&mut self) {}
|
|
||||||
|
|
||||||
fn build(mut self) {
|
fn build(mut self) {
|
||||||
enum BuilderKind {
|
enum BuilderKind {
|
||||||
Bsd(ar::Builder<File>),
|
Bsd(ar::Builder<File>),
|
||||||
|
@ -113,9 +113,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_symbols(&mut self) {
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build(mut self) {
|
fn build(mut self) {
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ pub struct LlvmArchiveBuilder<'a> {
|
|||||||
config: ArchiveConfig<'a>,
|
config: ArchiveConfig<'a>,
|
||||||
removals: Vec<String>,
|
removals: Vec<String>,
|
||||||
additions: Vec<Addition>,
|
additions: Vec<Addition>,
|
||||||
should_update_symbols: bool,
|
|
||||||
src_archive: Option<Option<ArchiveRO>>,
|
src_archive: Option<Option<ArchiveRO>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +74,6 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
|
|||||||
config,
|
config,
|
||||||
removals: Vec::new(),
|
removals: Vec::new(),
|
||||||
additions: Vec::new(),
|
additions: Vec::new(),
|
||||||
should_update_symbols: false,
|
|
||||||
src_archive: None,
|
src_archive: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,12 +127,6 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
|
|||||||
.push(Addition::File { path: file.to_path_buf(), name_in_archive: name.to_owned() });
|
.push(Addition::File { path: file.to_path_buf(), name_in_archive: name.to_owned() });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicate that the next call to `build` should update all symbols in
|
|
||||||
/// the archive (equivalent to running 'ar s' over it).
|
|
||||||
fn update_symbols(&mut self) {
|
|
||||||
self.should_update_symbols = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Combine the provided files, rlibs, and native libraries into a single
|
/// Combine the provided files, rlibs, and native libraries into a single
|
||||||
/// `Archive`.
|
/// `Archive`.
|
||||||
fn build(mut self) {
|
fn build(mut self) {
|
||||||
@ -313,7 +305,6 @@ impl<'a> LlvmArchiveBuilder<'a> {
|
|||||||
let mut members = Vec::new();
|
let mut members = Vec::new();
|
||||||
|
|
||||||
let dst = CString::new(self.config.dst.to_str().unwrap())?;
|
let dst = CString::new(self.config.dst.to_str().unwrap())?;
|
||||||
let should_update_symbols = self.should_update_symbols;
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
if let Some(archive) = self.src_archive() {
|
if let Some(archive) = self.src_archive() {
|
||||||
@ -385,7 +376,7 @@ impl<'a> LlvmArchiveBuilder<'a> {
|
|||||||
dst.as_ptr(),
|
dst.as_ptr(),
|
||||||
members.len() as libc::size_t,
|
members.len() as libc::size_t,
|
||||||
members.as_ptr() as *const &_,
|
members.as_ptr() as *const &_,
|
||||||
should_update_symbols,
|
true,
|
||||||
kind,
|
kind,
|
||||||
);
|
);
|
||||||
let ret = if r.into_result().is_err() {
|
let ret = if r.into_result().is_err() {
|
||||||
|
@ -51,7 +51,6 @@ pub trait ArchiveBuilder<'a> {
|
|||||||
fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()>
|
fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()>
|
||||||
where
|
where
|
||||||
F: FnMut(&str) -> bool + 'static;
|
F: FnMut(&str) -> bool + 'static;
|
||||||
fn update_symbols(&mut self);
|
|
||||||
|
|
||||||
fn build(self);
|
fn build(self);
|
||||||
|
|
||||||
|
@ -371,10 +371,6 @@ fn link_rlib<'a, B: ArchiveBuilder<'a>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// After adding all files to the archive, we need to update the
|
|
||||||
// symbol table of the archive.
|
|
||||||
ab.update_symbols();
|
|
||||||
|
|
||||||
return Ok(ab);
|
return Ok(ab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +499,6 @@ fn link_staticlib<'a, B: ArchiveBuilder<'a>>(
|
|||||||
sess.fatal(&e);
|
sess.fatal(&e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ab.update_symbols();
|
|
||||||
ab.build();
|
ab.build();
|
||||||
|
|
||||||
if !all_native_libs.is_empty() {
|
if !all_native_libs.is_empty() {
|
||||||
@ -2304,7 +2299,6 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
|
|||||||
|
|
||||||
sess.prof.generic_activity_with_arg("link_altering_rlib", name).run(|| {
|
sess.prof.generic_activity_with_arg("link_altering_rlib", name).run(|| {
|
||||||
let mut archive = <B as ArchiveBuilder>::new(sess, &dst, Some(cratepath));
|
let mut archive = <B as ArchiveBuilder>::new(sess, &dst, Some(cratepath));
|
||||||
archive.update_symbols();
|
|
||||||
|
|
||||||
let mut any_objects = false;
|
let mut any_objects = false;
|
||||||
for f in archive.src_files() {
|
for f in archive.src_files() {
|
||||||
|
Loading…
Reference in New Issue
Block a user