diff --git a/src/task.c b/src/task.c index 5460e79618ba67..345176a98dd5fa 100644 --- a/src/task.c +++ b/src/task.c @@ -807,10 +807,25 @@ STATIC_OR_JS void NOINLINE JL_NORETURN start_task(void) { #ifdef _OS_WINDOWS_ #if defined(_CPU_X86_64_) - // install the unhandled exception hanlder at the top of our stack + // install the unhandled exception handler at the top of our stack // to call directly into our personality handler asm volatile ("\t.seh_handler __julia_personality, @except\n\t.text"); #endif +#else + // wipe out the call-stack unwind capability beyond this function + // (we are noreturn, so it is not a total lie) +#if defined(_CPU_X86_64_) + // per nongnu libunwind: "x86_64 ABI specifies that end of call-chain is marked with a NULL RBP or undefined return address" + // so we do all 3, to be extra certain of it + asm volatile ("\t.cfi_undefined rip"); + asm volatile ("\t.cfi_undefined rbp"); + asm volatile ("\t.cfi_return_column rbp"); +#else + // per nongnu libunwind: "DWARF spec says undefined return address location means end of stack" + // we use whatever happens to be register 1 on this platform for this + asm volatile ("\t.cfi_undefined 1"); + asm volatile ("\t.cfi_return_column 1"); +#endif #endif // this runs the first time we switch to a task