Skip to content

Commit 9ebeb28

Browse files
committed
Fix MSVC hang issue
1 parent 8693227 commit 9ebeb28

File tree

1 file changed

+6
-0
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+6
-0
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,12 @@ fn add_linked_symbol_object(
16911691
return;
16921692
};
16931693

1694+
// NOTE(nbdd0121): MSVC will hang if the input object file contains no sections,
1695+
// so add an empty section.
1696+
if file.format() == object::BinaryFormat::Coff {
1697+
file.add_section(Vec::new(), ".text".into(), object::SectionKind::Text);
1698+
}
1699+
16941700
for (sym, kind) in symbols.iter() {
16951701
file.add_symbol(object::write::Symbol {
16961702
name: sym.clone().into(),

0 commit comments

Comments
 (0)