-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Description
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.
Metadata
Metadata
Assignees
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows