Skip to content

Commit df625e4

Browse files
authored
Fix runtime5 on macOS x86 (#4008)
1 parent 193c607 commit df625e4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

runtime/signals.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,12 @@ CAMLexport int caml_rev_convert_signal_number(int signo)
588588
return signo;
589589
}
590590

591+
#ifdef __linux__
591592
static size_t max_size_t(size_t a, size_t b)
592593
{
593594
return (a > b) ? a : b;
594595
}
596+
#endif
595597

596598
void * caml_init_signal_stack(size_t* signal_stack_size)
597599
{

runtime/signals_nat.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ DECLARE_SIGNAL_HANDLER(segv_handler)
113113
char* protected_low = Protected_stack_page(block);
114114
char* protected_high = protected_low + caml_plat_pagesize;
115115
if ((fault_addr >= protected_low) && (fault_addr < protected_high)) {
116+
#ifdef SYS_macosx
117+
context->uc_mcontext->__ss.__rip = (unsigned long long) &caml_raise_stack_overflow_nat;
118+
#else
116119
context->uc_mcontext.gregs[REG_RIP]= (greg_t) &caml_raise_stack_overflow_nat;
120+
#endif
117121
} else {
118122
act.sa_handler = SIG_DFL;
119123
act.sa_flags = 0;

0 commit comments

Comments
 (0)