Skip to content

Commit

Permalink
Merge pull request #39400 from JuliaLang/jn/23074
Browse files Browse the repository at this point in the history
fix linux unwind info stop, per x86_64 ABI
  • Loading branch information
vtjnash authored Jan 27, 2021
2 parents f3e9556 + d1fa5a5 commit 527d6b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deps/unwind.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-static-arm.patch-applied: $(SRCCAC
$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-static-arm.patch-applied
mkdir -p $(dir $@)
cd $(dir $@) && \
$(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" --disable-shared --disable-minidebuginfo --disable-tests
$(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" --enable-shared --disable-minidebuginfo --disable-tests
echo 1 > $@

$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-compiled: $(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured
Expand Down
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 527d6b6

Please sign in to comment.