This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed
compiler/rustc_codegen_ssa/src/back
src/test/run-make/issue-96498 Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1700,6 +1700,29 @@ fn add_linked_symbol_object(
17001700 // We handle the name decoration of COFF targets in `symbol_export.rs`, so disable the
17011701 // default mangler in `object` crate.
17021702 file. set_mangling ( object:: write:: Mangling :: None ) ;
1703+
1704+ // Add feature flags to the object file. On MSVC this is optional but LLD will complain if
1705+ // not present.
1706+ let mut feature = 0 ;
1707+
1708+ if file. architecture ( ) == object:: Architecture :: I386 {
1709+ // Indicate that all SEH handlers are registered in .sxdata section.
1710+ // We don't have generate any code, so we don't need .sxdata section but LLD still
1711+ // expects us to set this bit (see #96498).
1712+ // Reference: https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
1713+ feature |= 1 ;
1714+ }
1715+
1716+ file. add_symbol ( object:: write:: Symbol {
1717+ name : "@feat.00" . into ( ) ,
1718+ value : feature,
1719+ size : 0 ,
1720+ kind : object:: SymbolKind :: Data ,
1721+ scope : object:: SymbolScope :: Compilation ,
1722+ weak : false ,
1723+ section : object:: write:: SymbolSection :: Absolute ,
1724+ flags : object:: SymbolFlags :: None ,
1725+ } ) ;
17031726 }
17041727
17051728 for ( sym, kind) in symbols. iter ( ) {
Original file line number Diff line number Diff line change 1+ # only-windows
2+ # needs-rust-lld
3+
4+ -include ../../run-make-fulldeps/tools.mk
5+
6+ # Ensure that LLD can link
7+ all :
8+ $(RUSTC ) -C linker=rust-lld foo.rs
Original file line number Diff line number Diff line change 1+ #![ crate_type = "cdylib" ]
2+
3+ #[ no_mangle]
4+ extern "C" fn foo ( ) { }
You can’t perform that action at this time.
0 commit comments