__rg_oom calls the rust_oom symbol (aka the "oom" weak lang item). This symbol is not defined when using default_alloc_error_handler.
|
// 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.
__rg_oomcalls therust_oomsymbol (aka the "oom" weak lang item). This symbol is not defined when usingdefault_alloc_error_handler.rust/library/alloc/src/alloc.rs
Lines 403 to 412 in 352e621
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=noby 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.