Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 932d198

Browse files
authored
Rollup merge of #143260 - dpaoliello:arm64eclinkagain, r=bjorn3
Use the correct export kind for __rust_alloc_error_handler_should_panic Fixes #143253 `__rust_alloc_error_handler_should_panic` is a static but was being exported as a function. For most targets this doesn't matter, but Arm64EC Windows uses different decorations for exported variables vs functions, hence it fails to link when `-Z oom=abort` is enabled. Fix is to export the symbol as data. r? `@bjorn3`
2 parents c017748 + c073286 commit 932d198

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

‎compiler/rustc_codegen_ssa/src/back/symbol_export.rs‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,18 @@ fn exported_non_generic_symbols_provider_local<'tcx>(
219219

220220
// Mark allocator shim symbols as exported only if they were generated.
221221
if allocator_kind_for_codegen(tcx).is_some() {
222-
for symbol_name in ALLOCATOR_METHODS
222+
for (symbol_name, export_kind) in ALLOCATOR_METHODS
223223
.iter()
224-
.map(|method| mangle_internal_symbol(tcx, global_fn_name(method.name).as_str()))
224+
.map(|method| {
225+
(
226+
mangle_internal_symbol(tcx, global_fn_name(method.name).as_str()),
227+
SymbolExportKind::Text,
228+
)
229+
})
225230
.chain([
226-
mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),
227-
mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
228-
mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
231+
(mangle_internal_symbol(tcx, "__rust_alloc_error_handler"),SymbolExportKind::Text),
232+
(mangle_internal_symbol(tcx, OomStrategy::SYMBOL),SymbolExportKind::Data),
233+
(mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),SymbolExportKind::Text),
229234
])
230235
{
231236
let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name));
@@ -234,7 +239,7 @@ fn exported_non_generic_symbols_provider_local<'tcx>(
234239
exported_symbol,
235240
SymbolExportInfo {
236241
level: SymbolExportLevel::Rust,
237-
kind: SymbolExportKind::Text,
242+
kind: export_kind,
238243
used: false,
239244
rustc_std_internal_symbol: true,
240245
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /