r230255 - Only lower __builtin_setjmp / __builtin_longjmp to

John McCall rjmccall at gmail.com
Mon Mar 2 18:02:32 PST 2015


This patch is pretty scary.  __builtin_setjmp/longjmp are definitely not
just libc functions with a __builtin_ prefix attached.  They do not
interoperate with setjmp/longjmp and expect a significantly smaller buffer,
so silently rewriting them to setjmp/longjmp is ABI-breaking.  This might
fix Ruby, but only if Ruby is actually passing a full jmp_buf, and only if
everything that does a __builtin_setjmp/__builtin_longjmp is recompiled in
a way that does the rewrite.  I'm very concerned about this introducing ABI
problems for a Clang-compiled Ruby with GCC-compiled extensions or
vice-versa.  FWIW, Ruby seems to already have target-specific configuration
logic for when to use them.

Therefore, if we don't actually consistently support these builtins in the
backend in a GCC-compatible way (quite plausible), I would be much more
comfortable diagnosing that than silently rewriting them to setjmp/longjmp,
unless there are platforms where GCC does actually rewrite them.  Have you
done that investigation?

John.

On Mon, Mar 2, 2015 at 8:14 AM, Joerg Sonnenberger <joerg at britannica.bec.de>
wrote:

> On Mon, Feb 23, 2015 at 10:28:51PM +0100, Joerg Sonnenberger wrote:
> > On Mon, Feb 23, 2015 at 08:23:48PM -0000, Joerg Sonnenberger wrote:
> > > Author: joerg
> > > Date: Mon Feb 23 14:23:47 2015
> > > New Revision: 230255
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=230255&view=rev
> > > Log:
> > > Only lower __builtin_setjmp / __builtin_longjmp to
> > > llvm.eh.sjlj.setjmp / llvm.eh.sjlj.longjmp, if the backend is known to
> > > support them outside the Exception Handling context. The default
> > > handling in LLVM codegen doesn't work and will create incorrect code.
> > > The ARM backend on the other hand will assert if the intrinsics are
> > > used.
> >
> > This should be merged to the 3.6 branch, it unbreaks Ruby on ARM.
>
> John, can you OK the merge, please?
>
> Joerg
>



-- 
I suppose you'd like my real thoughts as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150302/e97ba83a/attachment.html>


More information about the cfe-commits mailing list