Skip to content

Commit

Permalink
fix linux unwind info, per x86_64 ABI
Browse files Browse the repository at this point in the history
Closes #23074
Fixes #35155
  • Loading branch information
vtjnash committed Jan 26, 2021
1 parent bf15b70 commit 9638ba0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9638ba0

Please sign in to comment.