Repository: rust-lang/cc-rs (rust)

Issue:
Two source files with same name, different extension generate same object file name
Hi,

When building a project that has 2 sibling files with same name but different extension, they both result in the same filename for the object file. In my case:
```rs
...
.file("rv003usb.c")
.file("rv003usb.S")
```
produces two `rv003usb.o` files, with the latter overwriting the former. Thus, the resulting build either fails or is missing some symbols. I traced this to this line: https://github.com/rust-lang/cc-rs/blob/29d6ca194cca33f96071355764da436e21c34d12/src/command_helpers.rs#L330-L332

Pull request description:
Fix two files with different extensions having the same object name
Fix #1294

Patch:
diff --git a/src/command_helpers.rs b/src/command_helpers.rs
index adedab2..62e3662 100644
--- a/src/command_helpers.rs
+++ b/src/command_helpers.rs
@@ -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");


Test patch:
diff --git a/tests/test.rs b/tests/test.rs
index 62976d6..b88a819 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -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]
@@ -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]