Skip to content

Commit 6097847

Browse files
committed
Unconditionally update symbols
All paths to an ArchiveBuilder::build call update_symbols first.
1 parent 203b622 commit 6097847

File tree

5 files changed

+1
-22
lines changed

5 files changed

+1
-22
lines changed

compiler/rustc_codegen_cranelift/src/archive.rs

-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
105105
Ok(())
106106
}
107107

108-
fn update_symbols(&mut self) {}
109-
110108
fn build(mut self) {
111109
enum BuilderKind {
112110
Bsd(ar::Builder<File>),

compiler/rustc_codegen_gcc/src/archive.rs

-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
113113
Ok(())
114114
}
115115

116-
fn update_symbols(&mut self) {
117-
}
118-
119116
fn build(mut self) {
120117
use std::process::Command;
121118

compiler/rustc_codegen_llvm/src/back/archive.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub struct LlvmArchiveBuilder<'a> {
2727
config: ArchiveConfig<'a>,
2828
removals: Vec<String>,
2929
additions: Vec<Addition>,
30-
should_update_symbols: bool,
3130
src_archive: Option<Option<ArchiveRO>>,
3231
}
3332

@@ -75,7 +74,6 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
7574
config,
7675
removals: Vec::new(),
7776
additions: Vec::new(),
78-
should_update_symbols: false,
7977
src_archive: None,
8078
}
8179
}
@@ -129,12 +127,6 @@ impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> {
129127
.push(Addition::File { path: file.to_path_buf(), name_in_archive: name.to_owned() });
130128
}
131129

132-
/// Indicate that the next call to `build` should update all symbols in
133-
/// the archive (equivalent to running 'ar s' over it).
134-
fn update_symbols(&mut self) {
135-
self.should_update_symbols = true;
136-
}
137-
138130
/// Combine the provided files, rlibs, and native libraries into a single
139131
/// `Archive`.
140132
fn build(mut self) {
@@ -313,7 +305,6 @@ impl<'a> LlvmArchiveBuilder<'a> {
313305
let mut members = Vec::new();
314306

315307
let dst = CString::new(self.config.dst.to_str().unwrap())?;
316-
let should_update_symbols = self.should_update_symbols;
317308

318309
unsafe {
319310
if let Some(archive) = self.src_archive() {
@@ -385,7 +376,7 @@ impl<'a> LlvmArchiveBuilder<'a> {
385376
dst.as_ptr(),
386377
members.len() as libc::size_t,
387378
members.as_ptr() as *const &_,
388-
should_update_symbols,
379+
true,
389380
kind,
390381
);
391382
let ret = if r.into_result().is_err() {

compiler/rustc_codegen_ssa/src/back/archive.rs

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ pub trait ArchiveBuilder<'a> {
5151
fn add_archive<F>(&mut self, archive: &Path, skip: F) -> io::Result<()>
5252
where
5353
F: FnMut(&str) -> bool + 'static;
54-
fn update_symbols(&mut self);
5554

5655
fn build(self);
5756

compiler/rustc_codegen_ssa/src/back/link.rs

-6
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ fn link_rlib<'a, B: ArchiveBuilder<'a>>(
371371
}
372372
}
373373

374-
// After adding all files to the archive, we need to update the
375-
// symbol table of the archive.
376-
ab.update_symbols();
377-
378374
return Ok(ab);
379375
}
380376

@@ -503,7 +499,6 @@ fn link_staticlib<'a, B: ArchiveBuilder<'a>>(
503499
sess.fatal(&e);
504500
}
505501

506-
ab.update_symbols();
507502
ab.build();
508503

509504
if !all_native_libs.is_empty() {
@@ -2304,7 +2299,6 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
23042299

23052300
sess.prof.generic_activity_with_arg("link_altering_rlib", name).run(|| {
23062301
let mut archive = <B as ArchiveBuilder>::new(sess, &dst, Some(cratepath));
2307-
archive.update_symbols();
23082302

23092303
let mut any_objects = false;
23102304
for f in archive.src_files() {

0 commit comments

Comments
 (0)