Commit b8c6c850 authored by Matthijs Kooijman's avatar Matthijs Kooijman

Add weak `std::terminate()` implementation

This allows calling it from other places later. The default
implementation calls `abort()`, but making it weak allows user code to
override this function (either directly, or by including a library like
uclibc++ that implements `std::set_terminate()`).

Note that this does not add a declaration for this function, since the
standard dictates this to be in `<exception>`, but we cannot
meaningfully or completely implement that header, so better leave it to
be overridden by e.g. libraries like uclibc++.
parent 4e469e0c
......@@ -21,6 +21,12 @@
extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__));
extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
namespace std {
[[gnu::weak, noreturn]] void terminate() {
abort();
}
}
void __cxa_pure_virtual(void) {
// We might want to write some diagnostics to uart in this case
//std::terminate();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment