Skip to content

Commit a8f0611

Browse files
authored
Fix two files with different extensions having the same object name (#1295)
1 parent 29d6ca1 commit a8f0611

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/command_helpers.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ pub(crate) fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<
327327
};
328328

329329
hasher.write(dirname.as_bytes());
330+
if let Some(extension) = file.extension() {
331+
hasher.write(extension.to_string_lossy().as_bytes());
332+
}
330333
let obj = dst
331334
.join(format!("{:016x}-{}", hasher.finish(), basename))
332335
.with_extension("o");

tests/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn gnu_smoke() {
2727
.must_have("-ffunction-sections")
2828
.must_have("-fdata-sections");
2929
test.cmd(1)
30-
.must_have(test.td.path().join("d1fba762150c532c-foo.o"));
30+
.must_have(test.td.path().join("db3b6bfb95261072-foo.o"));
3131
}
3232

3333
#[test]
@@ -434,7 +434,7 @@ fn msvc_smoke() {
434434
.must_have("-c")
435435
.must_have("-MD");
436436
test.cmd(1)
437-
.must_have(test.td.path().join("d1fba762150c532c-foo.o"));
437+
.must_have(test.td.path().join("db3b6bfb95261072-foo.o"));
438438
}
439439

440440
#[test]

0 commit comments

Comments
 (0)