Skip to content

Commit 52c6a94

Browse files
committed
rustc_back: Only use archive member filenames
I've been working with some archives generated by MSVC's `lib.exe` tool lately, and it looks like the embedded name of the members in those archives sometimes have slahes in the name (e.g. `foo/bar/baz.obj`). Currently the compiler chokes on these paths as it assumes that each file in the archive is only the filename (which is what unix does). This commit interprets the name of each file in all archives as a path and then only uses the `file_name` portion of the path to extract the file to a separate location and then reassemble it back into a new archive later. Note that duplicate filenames are already handled, so this won't introduce any conflicts.
1 parent 7132092 commit 52c6a94

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustc_back/archive.rs

+2
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ impl<'a> ArchiveBuilder<'a> {
305305
};
306306
if filename.contains(".SYMDEF") { continue }
307307
if skip(filename) { continue }
308+
let filename = Path::new(filename).file_name().unwrap()
309+
.to_str().unwrap();
308310

309311
// An archive can contain files of the same name multiple times, so
310312
// we need to be sure to not have them overwrite one another when we

0 commit comments

Comments
 (0)