cc #9839. Right now if you don't link to the standard library you get a link error because __morestack expects a symbol called rust_stack_exhausted to exist.
Add a "stack_exhausted" lang item. For every compilation unit, if the lang item doesn't exist, emit the code
extern "rust-intrinsic" { fn abort() -> !; }
#[no_mangle] pub extern "C" fn __rust_stack_exhausted() {
unsafe { abort() }
}
If it does exist, emit the same function, but call the lang item.
This would work in our current scheme where std defines what happens when the stack runs out, but not if we refactored std like #11828, so that the lowest levels of the crate hierarchy don't know the failure policy.
cc #9839. Right now if you don't link to the standard library you get a link error because
__morestackexpects a symbol calledrust_stack_exhaustedto exist.Add a "stack_exhausted" lang item. For every compilation unit, if the lang item doesn't exist, emit the code
If it does exist, emit the same function, but call the lang item.
This would work in our current scheme where std defines what happens when the stack runs out, but not if we refactored std like #11828, so that the lowest levels of the crate hierarchy don't know the failure policy.