Skip to content

Commit d01f393

Browse files
authored
Unrolled build for rust-lang#123467
Rollup merge of rust-lang#123467 - dpaoliello:archcoff, r=wesleywiser MSVC targets should use COFF as their archive format While adding support for Arm64EC I ran into an issue where the standard library's rlib was missing the "EC Symbol Table" which is required for the MSVC linker to find import library symbols (generated by Rust's `raw-dylib` feature) when building for EC. The root cause of the issue is that LLVM only generated symbol tables (including the EC Symbol Table) if the `ArchiveKind` is `COFF`, but the MSVC targets didn't set their archive format, so it was defaulting to GNU.
2 parents 8d490e3 + 9d70907 commit d01f393

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_codegen_ssa/src/back/archive.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,11 @@ impl<'a> ArArchiveBuilder<'a> {
231231
"gnu" => ArchiveKind::Gnu,
232232
"bsd" => ArchiveKind::Bsd,
233233
"darwin" => ArchiveKind::Darwin,
234-
"coff" => ArchiveKind::Coff,
234+
"coff" => {
235+
// FIXME: ar_archive_writer doesn't support COFF archives yet.
236+
// https://github.com/rust-lang/ar_archive_writer/issues/9
237+
ArchiveKind::Gnu
238+
}
235239
"aix_big" => ArchiveKind::AixBig,
236240
kind => {
237241
self.sess.dcx().emit_fatal(UnknownArchiveKind { kind });

compiler/rustc_target/src/spec/base/msvc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub fn opts() -> TargetOptions {
1414
pre_link_args,
1515
abi_return_struct_as_int: true,
1616
emit_debug_gdb_scripts: false,
17+
archive_format: "coff".into(),
1718

1819
// Currently this is the only supported method of debuginfo on MSVC
1920
// where `*.pdb` files show up next to the final artifact.

0 commit comments

Comments
 (0)