Skip to content

Commit

Permalink
Fix two files with different extensions having the same object name (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
NobodyXu authored Nov 20, 2024
1 parent 29d6ca1 commit a8f0611
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/command_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ pub(crate) fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<
};

hasher.write(dirname.as_bytes());
if let Some(extension) = file.extension() {
hasher.write(extension.to_string_lossy().as_bytes());
}
let obj = dst
.join(format!("{:016x}-{}", hasher.finish(), basename))
.with_extension("o");
Expand Down
4 changes: 2 additions & 2 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn gnu_smoke() {
.must_have("-ffunction-sections")
.must_have("-fdata-sections");
test.cmd(1)
.must_have(test.td.path().join("d1fba762150c532c-foo.o"));
.must_have(test.td.path().join("db3b6bfb95261072-foo.o"));
}

#[test]
Expand Down Expand Up @@ -434,7 +434,7 @@ fn msvc_smoke() {
.must_have("-c")
.must_have("-MD");
test.cmd(1)
.must_have(test.td.path().join("d1fba762150c532c-foo.o"));
.must_have(test.td.path().join("db3b6bfb95261072-foo.o"));
}

#[test]
Expand Down

0 comments on commit a8f0611

Please sign in to comment.