-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-craneliftThings relevant to the [future] cranelift backendThings relevant to the [future] cranelift backendC-bugCategory: This is a bug.Category: This is a bug.
Description
__rg_oom calls the rust_oom symbol (aka the "oom" weak lang item). This symbol is not defined when using default_alloc_error_handler.
rust/library/alloc/src/alloc.rs
Lines 403 to 412 in 352e621
| // if there is an `#[alloc_error_handler]` | |
| #[rustc_std_internal_symbol] | |
| pub unsafe extern "C-unwind" fn __rg_oom(size: usize, align: usize) -> ! { | |
| let layout = unsafe { Layout::from_size_align_unchecked(size, align) }; | |
| extern "Rust" { | |
| #[lang = "oom"] | |
| fn oom_impl(layout: Layout) -> !; | |
| } | |
| unsafe { oom_impl(layout) } | |
| } |
This causes https://github.com/rust-lang/rust/blob/31535841701e0bf7ef33998024376f2cedd8b3e3/src/test/ui/allocator/no_std-alloc-error-handler-default.rs to fail with cg_clif as it uses -Zfunction-sections=no by default. I suspect it would also cause it to fail for windows as windows has this default too.
Applying the approach of #86844 to the alloc error handler too should trivially fix this. This PR is still pending decision if it should be done or not.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-craneliftThings relevant to the [future] cranelift backendThings relevant to the [future] cranelift backendC-bugCategory: This is a bug.Category: This is a bug.