aboutsummaryrefslogtreecommitdiff
path: root/ctr-std/src/alloc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ctr-std/src/alloc.rs')
-rw-r--r--ctr-std/src/alloc.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/ctr-std/src/alloc.rs b/ctr-std/src/alloc.rs
index ff578ec..a857840 100644
--- a/ctr-std/src/alloc.rs
+++ b/ctr-std/src/alloc.rs
@@ -13,10 +13,18 @@
#![unstable(issue = "32838", feature = "allocator_api")]
#[doc(inline)] #[allow(deprecated)] pub use alloc_crate::alloc::Heap;
-#[doc(inline)] pub use alloc_crate::alloc::Global;
+#[doc(inline)] pub use alloc_crate::alloc::{Global, oom};
#[doc(inline)] pub use alloc_system::System;
#[doc(inline)] pub use core::alloc::*;
+#[cfg(not(stage0))]
+#[cfg(not(test))]
+#[doc(hidden)]
+#[lang = "oom"]
+pub extern fn rust_oom() -> ! {
+ rtabort!("memory allocation failed");
+}
+
#[cfg(not(test))]
#[doc(hidden)]
#[allow(unused_attributes)]
@@ -35,10 +43,11 @@ pub mod __default_lib_allocator {
System.alloc(layout) as *mut u8
}
+ #[cfg(stage0)]
#[no_mangle]
#[rustc_std_internal_symbol]
pub unsafe extern fn __rdl_oom() -> ! {
- System.oom()
+ super::oom()
}
#[no_mangle]