Skip to content

Commit 9638ba0

Browse files
committed
fix linux unwind info, per x86_64 ABI
Closes #23074 Fixes #35155
1 parent bf15b70 commit 9638ba0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/task.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,25 @@ STATIC_OR_JS void NOINLINE JL_NORETURN start_task(void)
807807
{
808808
#ifdef _OS_WINDOWS_
809809
#if defined(_CPU_X86_64_)
810-
// install the unhandled exception hanlder at the top of our stack
810+
// install the unhandled exception handler at the top of our stack
811811
// to call directly into our personality handler
812812
asm volatile ("\t.seh_handler __julia_personality, @except\n\t.text");
813813
#endif
814+
#else
815+
// wipe out the call-stack unwind capability beyond this function
816+
// (we are noreturn, so it is not a total lie)
817+
#if defined(_CPU_X86_64_)
818+
// per nongnu libunwind: "x86_64 ABI specifies that end of call-chain is marked with a NULL RBP or undefined return address"
819+
// so we do all 3, to be extra certain of it
820+
asm volatile ("\t.cfi_undefined rip");
821+
asm volatile ("\t.cfi_undefined rbp");
822+
asm volatile ("\t.cfi_return_column rbp");
823+
#else
824+
// per nongnu libunwind: "DWARF spec says undefined return address location means end of stack"
825+
// we use whatever happens to be register 1 on this platform for this
826+
asm volatile ("\t.cfi_undefined 1");
827+
asm volatile ("\t.cfi_return_column 1");
828+
#endif
814829
#endif
815830

816831
// this runs the first time we switch to a task

0 commit comments

Comments
 (0)