Skip to content

Commit ae13436

Browse files
committed
rustc_back: Don't pass 'u' to ar invocations
This flag indicates that when files are being replaced or added to archives (the `r` flag) that the new file should not be inserted if it is not newer than the file that already exists in the archive. The compiler never actually has a use case of *not* wanting to insert a file because it already exists, and this causes rlibs to not be updated in some cases when the compiler was re-run too quickly. Closes #18913
1 parent 5a341ec commit ae13436

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

Diff for: src/librustc_back/archive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<'a> ArchiveBuilder<'a> {
259259
// Add the archive members seen so far, without updating the
260260
// symbol table (`S`).
261261
run_ar(self.archive.handler, &self.archive.maybe_ar_prog,
262-
"cruS", Some(self.work_dir.path()), &args[..]);
262+
"crS", Some(self.work_dir.path()), &args[..]);
263263

264264
args.clear();
265265
args.push(&abs_dst);
@@ -272,7 +272,7 @@ impl<'a> ArchiveBuilder<'a> {
272272

273273
// Add the remaining archive members, and update the symbol table if
274274
// necessary.
275-
let flags = if self.should_update_symbols { "crus" } else { "cruS" };
275+
let flags = if self.should_update_symbols { "crs" } else { "crS" };
276276
run_ar(self.archive.handler, &self.archive.maybe_ar_prog,
277277
flags, Some(self.work_dir.path()), &args[..]);
278278

Diff for: src/test/auxiliary/issue-18913-1.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// no-prefer-dynamic
12+
13+
#![crate_type = "rlib"]
14+
#![crate_name = "foo"]
15+
16+
pub fn foo() -> i32 { 0 }

Diff for: src/test/auxiliary/issue-18913-2.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// no-prefer-dynamic
12+
13+
#![crate_type = "rlib"]
14+
#![crate_name = "foo"]
15+
16+
pub fn foo() -> i32 { 1 }

Diff for: src/test/run-pass/issue-18913.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-18913-1.rs
12+
// aux-build:issue-18913-2.rs
13+
14+
extern crate foo;
15+
16+
fn main() {
17+
assert_eq!(foo::foo(), 1);
18+
}

0 commit comments

Comments
 (0)