emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building scratch/igc with -fno-omit-frame-pointer


From: Pip Cet
Subject: Re: Building scratch/igc with -fno-omit-frame-pointer
Date: Sat, 28 Dec 2024 20:38:37 +0000

"Stefan Kangas" <stefankangas@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>>> Cc: "Pip Cet via \"Emacs development discussions.\"" <emacs-devel@gnu.org>,
>>>  Helmut Eller <eller.helmut@gmail.com>
>>> Date: Thu, 19 Dec 2024 20:57:45 +0100
>>>
>>> Pip Cet <pipcet@protonmail.com> writes:
>>>
>>> > Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>>> >
>>> >> Pip Cet via "Emacs development discussions." <emacs-devel@gnu.org>
>>> >> writes:
>>> >>
>>> >>> Does anyone remember what our conclusion was wrt
>>> >>> -fno-omit-frame-pointer?  I seem to remember there was a patch to MPS to
>>> >>> avoid relying on setjmp() to save all registers, but I'd still be
>>> >>> happier if we enabled that for all MPS builds, since we don't know
>>> >>> whether our MPS has the patch.
>>> >>
>>> >> I'm using -fno-omit-frame-pointer, but I don't remember why. I think
>>> >> Helmut said something or so (in CC).
>>> >
>>> > We tried not using it, it caused a bug, I spent too many hours tracking
>>> > that one down, so now I think we should make configure.ac always enable
>>> > it, even though it should be a no-op on some architectures (I think
>>> > macOS on aarch64 is one of them).
>
> I took a look in the archives, and the reason is that there is a bug
> with register scanning that -fno-omit-frame-pointer fixes:
>     https://github.com/Ravenbrook/mps/pull/38

Thanks!  FWIW, I think this isn't a mistake in MPS.  C libraries changed
to "scramble" the stack pointer and base pointer in the jump buffer in
setjmp().  They provided no good alternative way to do what MPS needs.
Assembly register spilling isn't a good option.  Emacs uses
__builtin_unwind_init, FWIW.

> diff --git a/configure.ac b/configure.ac
> index 885075a2f1d..1d8f69ff119 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -5622,6 +5622,7 @@ AC_DEFUN
>  HAVE_MPS=no
>  LIBMPS=
>  IGCOBJ=
> +MPS_CFLAGS=
>  if test "${with_mps}" != "no"; then
>    AC_CHECK_HEADER([mps.h],
>      [AC_CHECK_LIB([mps], [mps_arena_create], [HAVE_MPS=yes], [],
> [$LIB_PTHREAD])])
> @@ -5635,12 +5636,16 @@ AC_DEFUN
>      else
>        LIBMPS="-lmps $LIB_PTHREAD"
>      fi
> +    # Force -fno-omit-frame-pointer to avoid MPS bug with register scanning:

As explained above, I'd prefer not calling it "MPS bug".  Let's just
call it "bug"?

Pip




reply via email to

[Prev in Thread] Current Thread [Next in Thread]