This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Repair __builtin_setjmp/__builtin_longjmp
> Unfortunately, tm.texi doesn't document DONT_USE_BUILTIN_SETJMP. The
> stormy16 configuration gives a bit of explanation about why it defines
> that; the ia64 configuration does not. (Those are the only two
> platforms that define the macro.) So, we should certainly document that
>
> and fix:
> > @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.
>
> to say "setjmp or __builtin_setjmp".
Proposed changes attached. Tested by building an --enable-sjlj-exceptions
compiler on AMD64/Linux.
* unwind-sjlj.c: Poison setjmp.
* doc/install.texi (enable-sjlj-exceptions): Use more general wording.
* doc/tm.texi (DWARF2_UNWIND_INFO): Likewise.
(TARGET_UNWIND_TABLES_DEFAULT): Fix typo.
(DONT_USE_BUILTIN_SETJMP): Document it.
--
Eric Botcazou
Index: unwind-sjlj.c
===================================================================
--- unwind-sjlj.c (revision 117190)
+++ unwind-sjlj.c (working copy)
@@ -1,5 +1,5 @@
/* SJLJ exception handling and frame unwind runtime interface routines.
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -45,10 +45,13 @@ typedef void *jmp_buf[JMP_BUF_SIZE];
extern void longjmp(jmp_buf, int) __attribute__((noreturn));
#endif
#else
-#define setjmp __builtin_setjmp
#define longjmp __builtin_longjmp
#endif
+/* The setjmp side is dealt with in the except.c file. */
+#define setjmp setjmp_should_not_be_used_in_this_file
+
+
/* This structure is allocated on the stack of the target function.
This must match the definition created in except.c:init_eh. */
struct SjLj_Function_Context
Index: doc/install.texi
===================================================================
--- doc/install.texi (revision 117190)
+++ doc/install.texi (working copy)
@@ -1453,9 +1453,9 @@ file to compile into a @file{.class} fil
Search for libiconv in @file{DIR/include} and @file{DIR/lib}.
@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.
+Force use of the @code{setjmp}/@code{longjmp}-based scheme 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.
@item --with-system-zlib
Use installed @samp{zlib} rather than that included with GCC@.
Index: doc/tm.texi
===================================================================
--- doc/tm.texi (revision 117190)
+++ doc/tm.texi (working copy)
@@ -7924,8 +7924,7 @@ Define this macro to 0 if your target su
information, but it does not yet work with exception handling.
Otherwise, if your target supports this information (if it defines
@samp{INCOMING_RETURN_ADDR_RTX} and either @samp{UNALIGNED_INT_ASM_OP}
-or @samp{OBJECT_FORMAT_ELF}), GCC will provide a default definition of
-1.
+or @samp{OBJECT_FORMAT_ELF}), GCC will provide a default definition of 1.
If @code{TARGET_UNWIND_INFO} is defined, the target specific unwinder
will be used in all cases. Defining this macro will enable the generation
@@ -7933,7 +7932,8 @@ of DWARF 2 frame debugging information.
If @code{TARGET_UNWIND_INFO} is not defined, and this macro is defined to 1,
the DWARF 2 unwinder will be the default exception handling mechanism;
-otherwise, @code{setjmp}/@code{longjmp} will be used by default.
+otherwise, the @code{setjmp}/@code{longjmp}-based scheme will be used by
+default.
@end defmac
@defmac TARGET_UNWIND_INFO
@@ -7941,7 +7941,7 @@ Define this macro if your target has ABI
these will be output by @code{TARGET_UNWIND_EMIT}.
@end defmac
-@deftypevar {Target Hook} bool TARGET_UNWID_TABLES_DEFAULT
+@deftypevar {Target Hook} bool TARGET_UNWIND_TABLES_DEFAULT
This variable should be set to @code{true} if the target ABI requires unwinding
tables even when exceptions are not used.
@end deftypevar
@@ -7949,8 +7949,14 @@ tables even when exceptions are not used
@defmac MUST_USE_SJLJ_EXCEPTIONS
This macro need only be defined if @code{DWARF2_UNWIND_INFO} is
runtime-variable. In that case, @file{except.h} cannot correctly
-determine the corresponding definition of
-@code{MUST_USE_SJLJ_EXCEPTIONS}, so the target must provide it directly.
+determine the corresponding definition of @code{MUST_USE_SJLJ_EXCEPTIONS},
+so the target must provide it directly.
+@end defmac
+
+@defmac DONT_USE_BUILTIN_SETJMP
+Define this macro to 1 if the @code{setjmp}/@code{longjmp}-based scheme
+should use the @code{setjmp}/@code{longjmp} functions from the C library
+instead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery.
@end defmac
@defmac DWARF_CIE_DATA_ALIGNMENT