2003-07-30 09:34:45 +02:00
|
|
|
|
/* SJLJ exception handling and frame unwind runtime interface routines.
|
2009-04-09 17:00:19 +02:00
|
|
|
|
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
|
Move libgcc_tm_file to toplevel libgcc
gcc:
* configure.ac (libgcc_tm_file_list, libgcc_tm_include_list):
Remove.
* configure: Regenerate.
* Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list): Remove.
(TM_H): Remove libgcc_tm.h, $(libgcc_tm_file_list).
(libgcc_tm.h, cs-libgcc_tm.h): Remove.
(clean): Remove libgcc_tm.h
* mkconfig.sh: Don't include libgcc_tm.h in tm.h.
* config.gcc (libgcc_tm_file): Remove.
(arm*-*-linux*): Remove libgcc_tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Remove libgcc_tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Remove libgcc_tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf*): Likewise.
(tic6x-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
libgcc:
* configure.ac (tm_file_): New variable.
Determine from tm_file.
(tm_file, tm_defines): Substitute.
* configure: Regenerate.
* mkheader.sh: New file.
* Makefile.in (clean): Remove libgcc_tm.h.
($(objects)): Depend on libgcc_tm.h.
(libgcc_tm_defines, libgcc_tm_file): New variables.
(libgcc_tm.h, libgcc_tm.stamp): New targets.
($(libgcc-objects), $(libgcc-s-objects), $(libgcc-eh-objects))
($(libgcov-objects), $(libunwind-objects), $(libunwind-s-objects))
($(extra-parts)): Depend on libgcc_tm.h.
* config.host (tm_defines, tm_file): New variable.
(arm*-*-linux*): Set tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Set tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Set tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(tic6x-*-elf): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
* config/alpha/gthr-posix.c: Include libgcc_tm.h.
* config/i386/cygming-crtbegin.c: Likewise.
* config/i386/cygming-crtend.c: Likewise.
* config/ia64/fde-vms.c: Likewise.
* config/ia64/unwind-ia64.c: Likewise.
* config/libbid/bid_gcc_intrinsics.h: Likewise.
* config/rs6000/darwin-fallback.c: Likewise.
* config/stormy16/lib2funcs.c: Likewise.
* config/xtensa/unwind-dw2-xtensa.c: Likewise.
* crtstuff.c: Likewise.
* dfp-bit.h: Likewise.
* emutls.c: Likewise.
* fixed-bit.c: Likewise.
* fp-bit.c: Likewise.
* generic-morestack-thread.c: Likewise.
* generic-morestack.c: Likewise.
* libgcc2.c: Likewise.
* libgcov.c: Likewise.
* unwind-dw2-fde-dip.c: Likewise.
* unwind-dw2-fde.c: Likewise.
* unwind-dw2.c: Likewise.
* unwind-sjlj.c: Likewise.
Co-Authored-By: Paolo Bonzini <bonzini@gnu.org>
From-SVN: r180775
2011-11-02 16:26:35 +01:00
|
|
|
|
2009, 2011 Free Software Foundation, Inc.
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
This file is part of GCC.
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify it
|
|
|
|
|
under the terms of the GNU General Public License as published by
|
2009-04-09 17:00:19 +02:00
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
2001-03-28 13:04:51 +02:00
|
|
|
|
any later version.
|
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
|
License for more details.
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
#include "tconfig.h"
|
|
|
|
|
#include "tsystem.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
Move libgcc_tm_file to toplevel libgcc
gcc:
* configure.ac (libgcc_tm_file_list, libgcc_tm_include_list):
Remove.
* configure: Regenerate.
* Makefile.in (libgcc_tm_file_list, libgcc_tm_include_list): Remove.
(TM_H): Remove libgcc_tm.h, $(libgcc_tm_file_list).
(libgcc_tm.h, cs-libgcc_tm.h): Remove.
(clean): Remove libgcc_tm.h
* mkconfig.sh: Don't include libgcc_tm.h in tm.h.
* config.gcc (libgcc_tm_file): Remove.
(arm*-*-linux*): Remove libgcc_tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Remove libgcc_tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Remove libgcc_tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf*): Likewise.
(tic6x-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
libgcc:
* configure.ac (tm_file_): New variable.
Determine from tm_file.
(tm_file, tm_defines): Substitute.
* configure: Regenerate.
* mkheader.sh: New file.
* Makefile.in (clean): Remove libgcc_tm.h.
($(objects)): Depend on libgcc_tm.h.
(libgcc_tm_defines, libgcc_tm_file): New variables.
(libgcc_tm.h, libgcc_tm.stamp): New targets.
($(libgcc-objects), $(libgcc-s-objects), $(libgcc-eh-objects))
($(libgcov-objects), $(libunwind-objects), $(libunwind-s-objects))
($(extra-parts)): Depend on libgcc_tm.h.
* config.host (tm_defines, tm_file): New variable.
(arm*-*-linux*): Set tm_file for arm*-*-linux-*eabi.
(arm*-*-uclinux*): Set tm_file for arm*-*-uclinux*eabi.
(arm*-*-eabi*, arm*-*-symbianelf*): Set tm_file.
(avr-*-rtems*): Likewise.
(avr-*-*): Likewise.
(frv-*-elf): Likewise.
(frv-*-*linux*): Likewise.
(h8300-*-rtems*): Likewise.
(h8300-*-elf*): Likewise.
(i[34567]86-*-darwin*): Likewise.
(x86_64-*-darwin*): Likewise.
(rx-*-elf): Likewise.
(tic6x-*-uclinux): Likewise.
(tic6x-*-elf): Likewise.
(i[34567]86-*-linux*, x86_64-*-linux*): Likewise.
* config/alpha/gthr-posix.c: Include libgcc_tm.h.
* config/i386/cygming-crtbegin.c: Likewise.
* config/i386/cygming-crtend.c: Likewise.
* config/ia64/fde-vms.c: Likewise.
* config/ia64/unwind-ia64.c: Likewise.
* config/libbid/bid_gcc_intrinsics.h: Likewise.
* config/rs6000/darwin-fallback.c: Likewise.
* config/stormy16/lib2funcs.c: Likewise.
* config/xtensa/unwind-dw2-xtensa.c: Likewise.
* crtstuff.c: Likewise.
* dfp-bit.h: Likewise.
* emutls.c: Likewise.
* fixed-bit.c: Likewise.
* fp-bit.c: Likewise.
* generic-morestack-thread.c: Likewise.
* generic-morestack.c: Likewise.
* libgcc2.c: Likewise.
* libgcov.c: Likewise.
* unwind-dw2-fde-dip.c: Likewise.
* unwind-dw2-fde.c: Likewise.
* unwind-dw2.c: Likewise.
* unwind-sjlj.c: Likewise.
Co-Authored-By: Paolo Bonzini <bonzini@gnu.org>
From-SVN: r180775
2011-11-02 16:26:35 +01:00
|
|
|
|
#include "libgcc_tm.h"
|
2001-03-28 13:04:51 +02:00
|
|
|
|
#include "unwind.h"
|
|
|
|
|
#include "gthr.h"
|
|
|
|
|
|
2002-01-08 20:03:20 +01:00
|
|
|
|
#ifdef __USING_SJLJ_EXCEPTIONS__
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
#ifdef DONT_USE_BUILTIN_SETJMP
|
2001-09-21 22:26:44 +02:00
|
|
|
|
#ifndef inhibit_libc
|
2001-03-28 13:04:51 +02:00
|
|
|
|
#include <setjmp.h>
|
|
|
|
|
#else
|
2001-09-21 22:26:44 +02:00
|
|
|
|
typedef void *jmp_buf[JMP_BUF_SIZE];
|
|
|
|
|
extern void longjmp(jmp_buf, int) __attribute__((noreturn));
|
|
|
|
|
#endif
|
|
|
|
|
#else
|
2001-03-28 13:04:51 +02:00
|
|
|
|
#define longjmp __builtin_longjmp
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-09-29 08:32:58 +02:00
|
|
|
|
/* The setjmp side is dealt with in the except.c file. */
|
|
|
|
|
#undef setjmp
|
|
|
|
|
#define setjmp setjmp_should_not_be_used_in_this_file
|
|
|
|
|
|
|
|
|
|
|
2001-03-28 13:04:51 +02:00
|
|
|
|
/* 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
|
|
|
|
|
{
|
|
|
|
|
/* This is the chain through all registered contexts. It is
|
|
|
|
|
filled in by _Unwind_SjLj_Register. */
|
|
|
|
|
struct SjLj_Function_Context *prev;
|
|
|
|
|
|
|
|
|
|
/* This is assigned in by the target function before every call
|
|
|
|
|
to the index of the call site in the lsda. It is assigned by
|
|
|
|
|
the personality routine to the landing pad index. */
|
|
|
|
|
int call_site;
|
|
|
|
|
|
|
|
|
|
/* This is how data is returned from the personality routine to
|
|
|
|
|
the target function's handler. */
|
|
|
|
|
_Unwind_Word data[4];
|
|
|
|
|
|
|
|
|
|
/* These are filled in once by the target function before any
|
|
|
|
|
exceptions are expected to be handled. */
|
|
|
|
|
_Unwind_Personality_Fn personality;
|
|
|
|
|
void *lsda;
|
|
|
|
|
|
|
|
|
|
#ifdef DONT_USE_BUILTIN_SETJMP
|
|
|
|
|
/* We don't know what sort of alignment requirements the system
|
|
|
|
|
jmp_buf has. We over estimated in except.c, and now we have
|
2002-06-01 00:15:42 +02:00
|
|
|
|
to match that here just in case the system *didn't* have more
|
2001-03-28 13:04:51 +02:00
|
|
|
|
restrictive requirements. */
|
|
|
|
|
jmp_buf jbuf __attribute__((aligned));
|
|
|
|
|
#else
|
|
|
|
|
void *jbuf[];
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _Unwind_Context
|
|
|
|
|
{
|
|
|
|
|
struct SjLj_Function_Context *fc;
|
|
|
|
|
};
|
|
|
|
|
|
2002-06-01 00:15:42 +02:00
|
|
|
|
typedef struct
|
2001-03-28 13:04:51 +02:00
|
|
|
|
{
|
|
|
|
|
_Unwind_Personality_Fn personality;
|
|
|
|
|
} _Unwind_FrameState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Manage the chain of registered function contexts. */
|
|
|
|
|
|
|
|
|
|
/* Single threaded fallback chain. */
|
|
|
|
|
static struct SjLj_Function_Context *fc_static;
|
|
|
|
|
|
|
|
|
|
#if __GTHREADS
|
|
|
|
|
static __gthread_key_t fc_key;
|
|
|
|
|
static int use_fc_key = -1;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fc_key_init (void)
|
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
|
use_fc_key = __gthread_key_create (&fc_key, 0) == 0;
|
2001-03-28 13:04:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fc_key_init_once (void)
|
|
|
|
|
{
|
|
|
|
|
static __gthread_once_t once = __GTHREAD_ONCE_INIT;
|
|
|
|
|
if (__gthread_once (&once, fc_key_init) != 0 || use_fc_key < 0)
|
|
|
|
|
use_fc_key = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Unwind_SjLj_Register (struct SjLj_Function_Context *fc)
|
|
|
|
|
{
|
|
|
|
|
#if __GTHREADS
|
|
|
|
|
if (use_fc_key < 0)
|
|
|
|
|
fc_key_init_once ();
|
|
|
|
|
|
|
|
|
|
if (use_fc_key)
|
|
|
|
|
{
|
|
|
|
|
fc->prev = __gthread_getspecific (fc_key);
|
|
|
|
|
__gthread_setspecific (fc_key, fc);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
|
|
|
|
fc->prev = fc_static;
|
|
|
|
|
fc_static = fc;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct SjLj_Function_Context *
|
|
|
|
|
_Unwind_SjLj_GetContext (void)
|
|
|
|
|
{
|
|
|
|
|
#if __GTHREADS
|
|
|
|
|
if (use_fc_key < 0)
|
|
|
|
|
fc_key_init_once ();
|
|
|
|
|
|
|
|
|
|
if (use_fc_key)
|
|
|
|
|
return __gthread_getspecific (fc_key);
|
|
|
|
|
#endif
|
|
|
|
|
return fc_static;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
_Unwind_SjLj_SetContext (struct SjLj_Function_Context *fc)
|
|
|
|
|
{
|
|
|
|
|
#if __GTHREADS
|
|
|
|
|
if (use_fc_key < 0)
|
|
|
|
|
fc_key_init_once ();
|
|
|
|
|
|
|
|
|
|
if (use_fc_key)
|
|
|
|
|
__gthread_setspecific (fc_key, fc);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
fc_static = fc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Unwind_SjLj_Unregister (struct SjLj_Function_Context *fc)
|
|
|
|
|
{
|
|
|
|
|
_Unwind_SjLj_SetContext (fc->prev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get/set the return data value at INDEX in CONTEXT. */
|
|
|
|
|
|
|
|
|
|
_Unwind_Word
|
|
|
|
|
_Unwind_GetGR (struct _Unwind_Context *context, int index)
|
|
|
|
|
{
|
|
|
|
|
return context->fc->data[index];
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-03 04:06:55 +02:00
|
|
|
|
/* Get the value of the CFA as saved in CONTEXT. */
|
|
|
|
|
|
|
|
|
|
_Unwind_Word
|
2003-10-28 04:47:37 +01:00
|
|
|
|
_Unwind_GetCFA (struct _Unwind_Context *context __attribute__((unused)))
|
2003-04-03 04:06:55 +02:00
|
|
|
|
{
|
|
|
|
|
/* ??? Ideally __builtin_setjmp places the CFA in the jmpbuf. */
|
2005-11-16 23:09:52 +01:00
|
|
|
|
|
|
|
|
|
#ifndef DONT_USE_BUILTIN_SETJMP
|
|
|
|
|
/* This is a crude imitation of the CFA: the saved stack pointer.
|
|
|
|
|
This is roughly the CFA of the frame before CONTEXT. When using the
|
|
|
|
|
DWARF-2 unwinder _Unwind_GetCFA returns the CFA of the frame described
|
|
|
|
|
by CONTEXT instead; but for DWARF-2 the cleanups associated with
|
|
|
|
|
CONTEXT have already been run, and for SJLJ they have not yet been. */
|
|
|
|
|
if (context->fc != NULL)
|
|
|
|
|
return (_Unwind_Word) context->fc->jbuf[2];
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Otherwise we're out of luck for now. */
|
2003-11-02 01:00:08 +01:00
|
|
|
|
return (_Unwind_Word) 0;
|
2003-04-03 04:06:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-28 13:04:51 +02:00
|
|
|
|
void
|
|
|
|
|
_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
|
|
|
|
|
{
|
|
|
|
|
context->fc->data[index] = val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the call-site index as saved in CONTEXT. */
|
|
|
|
|
|
|
|
|
|
_Unwind_Ptr
|
|
|
|
|
_Unwind_GetIP (struct _Unwind_Context *context)
|
|
|
|
|
{
|
|
|
|
|
return context->fc->call_site + 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 18:26:26 +01:00
|
|
|
|
_Unwind_Ptr
|
|
|
|
|
_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
|
|
|
|
{
|
|
|
|
|
*ip_before_insn = 0;
|
2007-07-15 19:37:43 +02:00
|
|
|
|
if (context->fc != NULL)
|
|
|
|
|
return context->fc->call_site + 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
2006-02-27 18:26:26 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-28 13:04:51 +02:00
|
|
|
|
/* Set the return landing pad index in CONTEXT. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
|
|
|
|
|
{
|
|
|
|
|
context->fc->call_site = val - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
|
|
|
|
|
{
|
|
|
|
|
return context->fc->lsda;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_Unwind_Ptr
|
2001-10-02 01:31:47 +02:00
|
|
|
|
_Unwind_GetRegionStart (struct _Unwind_Context *context __attribute__((unused)) )
|
2001-03-28 13:04:51 +02:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-25 18:20:10 +01:00
|
|
|
|
void *
|
2003-10-28 04:47:37 +01:00
|
|
|
|
_Unwind_FindEnclosingFunction (void *pc __attribute__((unused)))
|
2002-11-25 18:20:10 +01:00
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-16 05:08:28 +02:00
|
|
|
|
#ifndef __ia64__
|
|
|
|
|
_Unwind_Ptr
|
2001-10-02 01:31:47 +02:00
|
|
|
|
_Unwind_GetDataRelBase (struct _Unwind_Context *context __attribute__((unused)) )
|
2001-05-16 05:08:28 +02:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_Unwind_Ptr
|
2001-10-02 01:31:47 +02:00
|
|
|
|
_Unwind_GetTextRelBase (struct _Unwind_Context *context __attribute__((unused)) )
|
2001-05-16 05:08:28 +02:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
static inline _Unwind_Reason_Code
|
|
|
|
|
uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
|
|
|
|
|
{
|
|
|
|
|
if (context->fc == NULL)
|
|
|
|
|
{
|
|
|
|
|
fs->personality = NULL;
|
|
|
|
|
return _URC_END_OF_STACK;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fs->personality = context->fc->personality;
|
|
|
|
|
return _URC_NO_REASON;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
uw_update_context (struct _Unwind_Context *context,
|
|
|
|
|
_Unwind_FrameState *fs __attribute__((unused)) )
|
|
|
|
|
{
|
|
|
|
|
context->fc = context->fc->prev;
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-16 23:10:39 +01:00
|
|
|
|
static void
|
|
|
|
|
uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs)
|
|
|
|
|
{
|
|
|
|
|
_Unwind_SjLj_Unregister (context->fc);
|
|
|
|
|
uw_update_context (context, fs);
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-01 00:15:42 +02:00
|
|
|
|
static inline void
|
2001-03-28 13:04:51 +02:00
|
|
|
|
uw_init_context (struct _Unwind_Context *context)
|
|
|
|
|
{
|
|
|
|
|
context->fc = _Unwind_SjLj_GetContext ();
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
static void __attribute__((noreturn))
|
|
|
|
|
uw_install_context (struct _Unwind_Context *current __attribute__((unused)),
|
|
|
|
|
struct _Unwind_Context *target)
|
|
|
|
|
{
|
|
|
|
|
_Unwind_SjLj_SetContext (target->fc);
|
|
|
|
|
longjmp (target->fc->jbuf, 1);
|
|
|
|
|
}
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
static inline _Unwind_Ptr
|
|
|
|
|
uw_identify_context (struct _Unwind_Context *context)
|
|
|
|
|
{
|
|
|
|
|
return (_Unwind_Ptr) context->fc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Play games with unwind symbols so that we can have call frame
|
|
|
|
|
and sjlj symbols in the same shared library. Not that you can
|
|
|
|
|
use them simultaneously... */
|
|
|
|
|
#define _Unwind_RaiseException _Unwind_SjLj_RaiseException
|
|
|
|
|
#define _Unwind_ForcedUnwind _Unwind_SjLj_ForcedUnwind
|
|
|
|
|
#define _Unwind_Resume _Unwind_SjLj_Resume
|
2003-05-08 00:11:38 +02:00
|
|
|
|
#define _Unwind_Resume_or_Rethrow _Unwind_SjLj_Resume_or_Rethrow
|
2001-03-28 13:04:51 +02:00
|
|
|
|
|
|
|
|
|
#include "unwind.inc"
|
|
|
|
|
|
|
|
|
|
#endif /* USING_SJLJ_EXCEPTIONS */
|