Skip to content

Commit 36c060e

Browse files
committed
[software] Jump to _eoc on abort
1 parent 4f6650a commit 36c060e

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

software/runtime/kmp/cppsupport.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ extern "C" {
1313
#include "runtime.h"
1414
}
1515

16+
extern void (*_eoc)(void);
17+
1618
kmp::Mutex allocLock;
1719

1820
void *operator new(size_t size) {
@@ -40,10 +42,18 @@ void __throw_length_error(const char *msg) {
4042
abort();
4143
}
4244

43-
void __throw_bad_optional_access() { printf("Bad optional access\n"); }
45+
void __throw_bad_optional_access() {
46+
printf("Bad optional access\n");
47+
abort();
48+
}
4449
} // namespace std
4550

46-
extern "C" void abort() { printf("Aborting\n"); }
51+
extern "C" void abort() {
52+
printf("Aborting\n");
53+
while (true) {
54+
asm("j _eoc");
55+
}
56+
}
4757

4858
extern "C" int __cxa_atexit(void (*func)(void *), void *arg, void *dso_handle) {
4959
(void)func;

0 commit comments

Comments
 (0)