This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Repair __builtin_setjmp/__builtin_longjmp


> I think the approach you've taken is fundamentally sound.

Thanks for the quick review.

> Have you done anything to prevent the new builtin_setjmp_* from being
> called directly by users?  If not, I think you should.  If we really
> want user code to be able to use these, we need to document them in the
> user manual.

Could you elaborate?  Do you want me to preclude users from calling the 3 new 
builtins and document that their names are reserved?  If so, aren't all names 
prefixed with __builtin_ reserved by the compiler?

Note that other implementation builtins like

DEF_BUILTIN_STUB (BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline")
DEF_BUILTIN_STUB (BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline")
DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto")

DEF_BUILTIN_STUB (BUILT_IN_STACK_SAVE, "__builtin_stack_save")
DEF_BUILTIN_STUB (BUILT_IN_STACK_RESTORE, "__builtin_stack_restore")

don't have any kind of "protection" either.


Btw, there is something I'm unclear about: does --enable-sjlj-exceptions use 
__builtin_setjmp directly?  My understanding is that it does not, despite

@item --enable-sjlj-exceptions
Force use of @code{builtin_setjmp} for exceptions.  @samp{configure}
ordinarily picks the correct value based on the platform.  Only use
this option if you are sure you need a different setting.

It uses __builtin_longjmp (unless DONT_USE_BUILTIN_SETJMP) in unwind-sjlj.c, 
but calls expand_builtin_setjmp_setup and expand_builtin_setjmp_receiver 
directly in except.c (unless DONT_USE_BUILTIN_SETJMP), so my changes should 
be a nop for platforms using standard SJLJ EH.

What do you think about clarifying that in the process?  Both in install.texi, 
except.c and unwind-sjlj.c.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]