From 77990d14e3947c0d5fd16053da5e9c95dd666e04 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Thu, 19 Dec 2013 13:29:20 +0000 Subject: [PATCH] sdk: libsupc++ && gcc_eh git-svn-id: svn://kolibrios.org@4383 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/sdk/sources/gcc_eh/Makefile | 55 + contrib/sdk/sources/gcc_eh/ansidecl.h | 423 +++ contrib/sdk/sources/gcc_eh/auto-host.h | 1911 +++++++++++++ contrib/sdk/sources/gcc_eh/config/dbxcoff.h | 62 + contrib/sdk/sources/gcc_eh/config/i386/bsd.h | 100 + .../sdk/sources/gcc_eh/config/i386/cygming.h | 448 +++ contrib/sdk/sources/gcc_eh/config/i386/gas.h | 124 + contrib/sdk/sources/gcc_eh/config/i386/i386.h | 2499 +++++++++++++++++ .../sources/gcc_eh/config/i386/mingw-stdint.h | 50 + .../sdk/sources/gcc_eh/config/i386/mingw32.h | 249 ++ contrib/sdk/sources/gcc_eh/config/i386/unix.h | 81 + .../sources/gcc_eh/config/i386/w32-unwind.h | 212 ++ contrib/sdk/sources/gcc_eh/config/tm-dwarf2.h | 4 + .../sdk/sources/gcc_eh/config/vxworks-dummy.h | 40 + contrib/sdk/sources/gcc_eh/coretypes.h | 128 + contrib/sdk/sources/gcc_eh/defaults.h | 1168 ++++++++ contrib/sdk/sources/gcc_eh/dwarf2.h | 914 ++++++ contrib/sdk/sources/gcc_eh/filenames.h | 60 + contrib/sdk/sources/gcc_eh/gthr-single.h | 292 ++ contrib/sdk/sources/gcc_eh/gthr.h | 173 ++ contrib/sdk/sources/gcc_eh/options.h | 1608 +++++++++++ contrib/sdk/sources/gcc_eh/tconfig.h | 11 + contrib/sdk/sources/gcc_eh/tm.h | 21 + contrib/sdk/sources/gcc_eh/tsystem.h | 134 + contrib/sdk/sources/gcc_eh/unwind-c.c | 229 ++ contrib/sdk/sources/gcc_eh/unwind-dw2-fde.c | 1028 +++++++ contrib/sdk/sources/gcc_eh/unwind-dw2-fde.h | 183 ++ contrib/sdk/sources/gcc_eh/unwind-dw2.c | 1594 +++++++++++ contrib/sdk/sources/gcc_eh/unwind-dw2.h | 87 + contrib/sdk/sources/gcc_eh/unwind-pe.h | 289 ++ contrib/sdk/sources/gcc_eh/unwind.inc | 307 ++ contrib/sdk/sources/gcc_eh/xm-mingw32.h | 35 + contrib/sdk/sources/libsupc++/Makefile | 81 + contrib/sdk/sources/libsupc++/bad_alloc.cc | 34 + .../sdk/sources/libsupc++/class_type_info.cc | 111 + contrib/sdk/sources/libsupc++/del_op.cc | 49 + contrib/sdk/sources/libsupc++/del_opv.cc | 34 + contrib/sdk/sources/libsupc++/eh_alloc.cc | 220 ++ .../sdk/sources/libsupc++/eh_aux_runtime.cc | 51 + contrib/sdk/sources/libsupc++/eh_call.cc | 159 ++ contrib/sdk/sources/libsupc++/eh_catch.cc | 138 + contrib/sdk/sources/libsupc++/eh_exception.cc | 52 + contrib/sdk/sources/libsupc++/eh_globals.cc | 160 ++ .../sdk/sources/libsupc++/eh_personality.cc | 781 ++++++ .../sdk/sources/libsupc++/eh_term_handler.cc | 46 + contrib/sdk/sources/libsupc++/eh_terminate.cc | 80 + contrib/sdk/sources/libsupc++/eh_throw.cc | 117 + contrib/sdk/sources/libsupc++/eh_type.cc | 54 + .../sdk/sources/libsupc++/eh_unex_handler.cc | 29 + contrib/sdk/sources/libsupc++/exception | 158 ++ .../sdk/sources/libsupc++/exception_defines.h | 47 + contrib/sdk/sources/libsupc++/gthr-default.h | 772 +++++ contrib/sdk/sources/libsupc++/gthr_mutex.c | 27 + contrib/sdk/sources/libsupc++/guard.cc | 416 +++ contrib/sdk/sources/libsupc++/guard_error.cc | 31 + .../sdk/sources/libsupc++/initializer_list | 107 + contrib/sdk/sources/libsupc++/new | 124 + contrib/sdk/sources/libsupc++/new_handler.cc | 41 + contrib/sdk/sources/libsupc++/new_op.cc | 67 + contrib/sdk/sources/libsupc++/new_opnt.cc | 63 + contrib/sdk/sources/libsupc++/new_opv.cc | 34 + .../sdk/sources/libsupc++/pbase_type_info.cc | 66 + contrib/sdk/sources/libsupc++/pure.cc | 58 + .../sources/libsupc++/si_class_type_info.cc | 85 + contrib/sdk/sources/libsupc++/tinfo.cc | 84 + contrib/sdk/sources/libsupc++/tinfo.h | 183 ++ contrib/sdk/sources/libsupc++/typeinfo | 224 ++ contrib/sdk/sources/libsupc++/unwind-cxx.h | 382 +++ contrib/sdk/sources/libsupc++/unwind-pe.h | 289 ++ .../sources/libsupc++/vmi_class_type_info.cc | 391 +++ contrib/sdk/sources/libsupc++/vterminate.cc | 101 + 71 files changed, 20465 insertions(+) create mode 100644 contrib/sdk/sources/gcc_eh/Makefile create mode 100644 contrib/sdk/sources/gcc_eh/ansidecl.h create mode 100644 contrib/sdk/sources/gcc_eh/auto-host.h create mode 100644 contrib/sdk/sources/gcc_eh/config/dbxcoff.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/bsd.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/cygming.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/gas.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/i386.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/mingw-stdint.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/mingw32.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/unix.h create mode 100644 contrib/sdk/sources/gcc_eh/config/i386/w32-unwind.h create mode 100644 contrib/sdk/sources/gcc_eh/config/tm-dwarf2.h create mode 100644 contrib/sdk/sources/gcc_eh/config/vxworks-dummy.h create mode 100644 contrib/sdk/sources/gcc_eh/coretypes.h create mode 100644 contrib/sdk/sources/gcc_eh/defaults.h create mode 100644 contrib/sdk/sources/gcc_eh/dwarf2.h create mode 100644 contrib/sdk/sources/gcc_eh/filenames.h create mode 100644 contrib/sdk/sources/gcc_eh/gthr-single.h create mode 100644 contrib/sdk/sources/gcc_eh/gthr.h create mode 100644 contrib/sdk/sources/gcc_eh/options.h create mode 100644 contrib/sdk/sources/gcc_eh/tconfig.h create mode 100644 contrib/sdk/sources/gcc_eh/tm.h create mode 100644 contrib/sdk/sources/gcc_eh/tsystem.h create mode 100644 contrib/sdk/sources/gcc_eh/unwind-c.c create mode 100644 contrib/sdk/sources/gcc_eh/unwind-dw2-fde.c create mode 100644 contrib/sdk/sources/gcc_eh/unwind-dw2-fde.h create mode 100644 contrib/sdk/sources/gcc_eh/unwind-dw2.c create mode 100644 contrib/sdk/sources/gcc_eh/unwind-dw2.h create mode 100644 contrib/sdk/sources/gcc_eh/unwind-pe.h create mode 100644 contrib/sdk/sources/gcc_eh/unwind.inc create mode 100644 contrib/sdk/sources/gcc_eh/xm-mingw32.h create mode 100644 contrib/sdk/sources/libsupc++/Makefile create mode 100644 contrib/sdk/sources/libsupc++/bad_alloc.cc create mode 100644 contrib/sdk/sources/libsupc++/class_type_info.cc create mode 100644 contrib/sdk/sources/libsupc++/del_op.cc create mode 100644 contrib/sdk/sources/libsupc++/del_opv.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_alloc.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_aux_runtime.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_call.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_catch.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_exception.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_globals.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_personality.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_term_handler.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_terminate.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_throw.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_type.cc create mode 100644 contrib/sdk/sources/libsupc++/eh_unex_handler.cc create mode 100644 contrib/sdk/sources/libsupc++/exception create mode 100644 contrib/sdk/sources/libsupc++/exception_defines.h create mode 100644 contrib/sdk/sources/libsupc++/gthr-default.h create mode 100644 contrib/sdk/sources/libsupc++/gthr_mutex.c create mode 100644 contrib/sdk/sources/libsupc++/guard.cc create mode 100644 contrib/sdk/sources/libsupc++/guard_error.cc create mode 100644 contrib/sdk/sources/libsupc++/initializer_list create mode 100644 contrib/sdk/sources/libsupc++/new create mode 100644 contrib/sdk/sources/libsupc++/new_handler.cc create mode 100644 contrib/sdk/sources/libsupc++/new_op.cc create mode 100644 contrib/sdk/sources/libsupc++/new_opnt.cc create mode 100644 contrib/sdk/sources/libsupc++/new_opv.cc create mode 100644 contrib/sdk/sources/libsupc++/pbase_type_info.cc create mode 100644 contrib/sdk/sources/libsupc++/pure.cc create mode 100644 contrib/sdk/sources/libsupc++/si_class_type_info.cc create mode 100644 contrib/sdk/sources/libsupc++/tinfo.cc create mode 100644 contrib/sdk/sources/libsupc++/tinfo.h create mode 100644 contrib/sdk/sources/libsupc++/typeinfo create mode 100644 contrib/sdk/sources/libsupc++/unwind-cxx.h create mode 100644 contrib/sdk/sources/libsupc++/unwind-pe.h create mode 100644 contrib/sdk/sources/libsupc++/vmi_class_type_info.cc create mode 100644 contrib/sdk/sources/libsupc++/vterminate.cc diff --git a/contrib/sdk/sources/gcc_eh/Makefile b/contrib/sdk/sources/gcc_eh/Makefile new file mode 100644 index 0000000000..8fef0b7df2 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/Makefile @@ -0,0 +1,55 @@ + +LIBRARY= gcc_eh + +CC=gcc +CPP=g++ +CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fomit-frame-pointer + +LD = ld + +AR= ar + +STRIP = $(PREFIX)strip + +INCLUDES= -I. -I../newlib/include + + +LIBS:= -ldll -lc.dll + + +DEFINES= -DIN_GCC -DUSE_EMUTLS=1 + + +SOURCES = unwind-c.c \ + unwind-dw2.c \ + unwind-dw2-fde.c + + +OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES))) + + + +# targets + + +all:$(LIBRARY).a + + +$(LIBRARY).a: $(OBJECTS) Makefile + ar cvrs $(LIBRARY).a $(OBJECTS) + mv -f $(LIBRARY).a ../../lib + + +%.o : %.c Makefile + $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + +%.o : %.cc Makefile + $(CPP) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + + +clean: + -rm -f *.o + + + + diff --git a/contrib/sdk/sources/gcc_eh/ansidecl.h b/contrib/sdk/sources/gcc_eh/ansidecl.h new file mode 100644 index 0000000000..8b76647426 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/ansidecl.h @@ -0,0 +1,423 @@ +/* ANSI and traditional C compatability macros + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* ANSI and traditional C compatibility macros + + ANSI C is assumed if __STDC__ is #defined. + + Macro ANSI C definition Traditional C definition + ----- ---- - ---------- ----------- - ---------- + ANSI_PROTOTYPES 1 not defined + PTR `void *' `char *' + PTRCONST `void *const' `char *' + LONG_DOUBLE `long double' `double' + const not defined `' + volatile not defined `' + signed not defined `' + VA_START(ap, var) va_start(ap, var) va_start(ap) + + Note that it is safe to write "void foo();" indicating a function + with no return value, in all K+R compilers we have been able to test. + + For declaring functions with prototypes, we also provide these: + + PARAMS ((prototype)) + -- for functions which take a fixed number of arguments. Use this + when declaring the function. When defining the function, write a + K+R style argument list. For example: + + char *strcpy PARAMS ((char *dest, char *source)); + ... + char * + strcpy (dest, source) + char *dest; + char *source; + { ... } + + + VPARAMS ((prototype, ...)) + -- for functions which take a variable number of arguments. Use + PARAMS to declare the function, VPARAMS to define it. For example: + + int printf PARAMS ((const char *format, ...)); + ... + int + printf VPARAMS ((const char *format, ...)) + { + ... + } + + For writing functions which take variable numbers of arguments, we + also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These + hide the differences between K+R and C89 more + thoroughly than the simple VA_START() macro mentioned above. + + VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end. + Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls + corresponding to the list of fixed arguments. Then use va_arg + normally to get the variable arguments, or pass your va_list object + around. You do not declare the va_list yourself; VA_OPEN does it + for you. + + Here is a complete example: + + int + printf VPARAMS ((const char *format, ...)) + { + int result; + + VA_OPEN (ap, format); + VA_FIXEDARG (ap, const char *, format); + + result = vfprintf (stdout, format, ap); + VA_CLOSE (ap); + + return result; + } + + + You can declare variables either before or after the VA_OPEN, + VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning + and end of a block. They must appear at the same nesting level, + and any variables declared after VA_OPEN go out of scope at + VA_CLOSE. Unfortunately, with a K+R compiler, that includes the + argument list. You can have multiple instances of VA_OPEN/VA_CLOSE + pairs in a single function in case you need to traverse the + argument list more than once. + + For ease of writing code which uses GCC extensions but needs to be + portable to other compilers, we provide the GCC_VERSION macro that + simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various + wrappers around __attribute__. Also, __extension__ will be #defined + to nothing if it doesn't work. See below. + + This header also defines a lot of obsolete macros: + CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, + AND, DOTS, NOARGS. Don't use them. */ + +#ifndef _ANSIDECL_H +#define _ANSIDECL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Every source file includes this file, + so they will all get the switch for lint. */ +/* LINTLIBRARY */ + +/* Using MACRO(x,y) in cpp #if conditionals does not work with some + older preprocessors. Thus we can't define something like this: + +#define HAVE_GCC_VERSION(MAJOR, MINOR) \ + (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR))) + +and then test "#if HAVE_GCC_VERSION(2,7)". + +So instead we use the macro below and test it against specific values. */ + +/* This macro simplifies testing whether we are using gcc, and if it + is of a particular minimum version. (Both major & minor numbers are + significant.) This macro will evaluate to 0 if we are not using + gcc at all. */ +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif /* GCC_VERSION */ + +#if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) +/* All known AIX compilers implement these things (but don't always + define __STDC__). The RISC/OS MIPS compiler defines these things + in SVR4 mode, but does not define __STDC__. */ +/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other + C++ compilers, does not define __STDC__, though it acts as if this + was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */ + +#define ANSI_PROTOTYPES 1 +#define PTR void * +#define PTRCONST void *const +#define LONG_DOUBLE long double + +/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in + a #ifndef. */ +#ifndef PARAMS +#define PARAMS(ARGS) ARGS +#endif + +#define VPARAMS(ARGS) ARGS +#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR) + +/* variadic function helper macros */ +/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's + use without inhibiting further decls and without declaring an + actual variable. */ +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy +#define VA_CLOSE(AP) } va_end(AP); } +#define VA_FIXEDARG(AP, T, N) struct Qdmy + +#undef const +#undef volatile +#undef signed + +/* inline requires special treatment; it's in C99, and GCC >=2.7 supports + it too, but it's not in C89. */ +#undef inline +#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__)) +/* it's a keyword */ +#else +# if GCC_VERSION >= 2007 +# define inline __inline__ /* __inline__ prevents -pedantic warnings */ +# else +# define inline /* nothing */ +# endif +#endif + +/* These are obsolete. Do not use. */ +#ifndef IN_GCC +#define CONST const +#define VOLATILE volatile +#define SIGNED signed + +#define PROTO(type, name, arglist) type name arglist +#define EXFUN(name, proto) name proto +#define DEFUN(name, arglist, args) name(args) +#define DEFUN_VOID(name) name(void) +#define AND , +#define DOTS , ... +#define NOARGS void +#endif /* ! IN_GCC */ + +#else /* Not ANSI C. */ + +#undef ANSI_PROTOTYPES +#define PTR char * +#define PTRCONST PTR +#define LONG_DOUBLE double + +#define PARAMS(args) () +#define VPARAMS(args) (va_alist) va_dcl +#define VA_START(va_list, var) va_start(va_list) + +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy +#define VA_CLOSE(AP) } va_end(AP); } +#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE) + +/* some systems define these in header files for non-ansi mode */ +#undef const +#undef volatile +#undef signed +#undef inline +#define const +#define volatile +#define signed +#define inline + +#ifndef IN_GCC +#define CONST +#define VOLATILE +#define SIGNED + +#define PROTO(type, name, arglist) type name () +#define EXFUN(name, proto) name() +#define DEFUN(name, arglist, args) name arglist args; +#define DEFUN_VOID(name) name() +#define AND ; +#define DOTS +#define NOARGS +#endif /* ! IN_GCC */ + +#endif /* ANSI C. */ + +/* Define macros for some gcc attributes. This permits us to use the + macros freely, and know that they will come into play for the + version of gcc in which they are supported. */ + +#if (GCC_VERSION < 2007) +# define __attribute__(x) +#endif + +/* Attribute __malloc__ on functions was valid as of gcc 2.96. */ +#ifndef ATTRIBUTE_MALLOC +# if (GCC_VERSION >= 2096) +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define ATTRIBUTE_MALLOC +# endif /* GNUC >= 2.96 */ +#endif /* ATTRIBUTE_MALLOC */ + +/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5. For + g++ an attribute on a label must be followed by a semicolon. */ +#ifndef ATTRIBUTE_UNUSED_LABEL +# ifndef __cplusplus +# if GCC_VERSION >= 2093 +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED +# else +# define ATTRIBUTE_UNUSED_LABEL +# endif +# else +# if GCC_VERSION >= 4005 +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ; +# else +# define ATTRIBUTE_UNUSED_LABEL +# endif +# endif +#endif + +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#endif /* ATTRIBUTE_UNUSED */ + +/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the + identifier name. */ +#if ! defined(__cplusplus) || (GCC_VERSION >= 3004) +# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED +#else /* !__cplusplus || GNUC >= 3.4 */ +# define ARG_UNUSED(NAME) NAME +#endif /* !__cplusplus || GNUC >= 3.4 */ + +#ifndef ATTRIBUTE_NORETURN +#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#endif /* ATTRIBUTE_NORETURN */ + +/* Attribute `nonnull' was valid as of gcc 3.3. */ +#ifndef ATTRIBUTE_NONNULL +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) +# else +# define ATTRIBUTE_NONNULL(m) +# endif /* GNUC >= 3.3 */ +#endif /* ATTRIBUTE_NONNULL */ + +/* Attribute `pure' was valid as of gcc 3.0. */ +#ifndef ATTRIBUTE_PURE +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define ATTRIBUTE_PURE +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_PURE */ + +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL. + This was the case for the `printf' format attribute by itself + before GCC 3.3, but as of 3.3 we need to add the `nonnull' + attribute to retain this behavior. */ +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +#endif /* ATTRIBUTE_PRINTF */ + +/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on + a function pointer. Format attributes were allowed on function + pointers as of gcc 3.1. */ +#ifndef ATTRIBUTE_FPTR_PRINTF +# if (GCC_VERSION >= 3001) +# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n) +# else +# define ATTRIBUTE_FPTR_PRINTF(m, n) +# endif /* GNUC >= 3.1 */ +# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2) +# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3) +# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4) +# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5) +# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6) +#endif /* ATTRIBUTE_FPTR_PRINTF */ + +/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A + NULL format specifier was allowed as of gcc 3.3. */ +#ifndef ATTRIBUTE_NULL_PRINTF +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# else +# define ATTRIBUTE_NULL_PRINTF(m, n) +# endif /* GNUC >= 3.3 */ +# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2) +# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3) +# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4) +# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5) +# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6) +#endif /* ATTRIBUTE_NULL_PRINTF */ + +/* Attribute `sentinel' was valid as of gcc 3.5. */ +#ifndef ATTRIBUTE_SENTINEL +# if (GCC_VERSION >= 3005) +# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# else +# define ATTRIBUTE_SENTINEL +# endif /* GNUC >= 3.5 */ +#endif /* ATTRIBUTE_SENTINEL */ + + +#ifndef ATTRIBUTE_ALIGNED_ALIGNOF +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m)))) +# else +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */ + +/* Useful for structures whose layout must much some binary specification + regardless of the alignment and padding qualities of the compiler. */ +#ifndef ATTRIBUTE_PACKED +# define ATTRIBUTE_PACKED __attribute__ ((packed)) +#endif + +/* Attribute `hot' and `cold' was valid as of gcc 4.3. */ +#ifndef ATTRIBUTE_COLD +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define ATTRIBUTE_COLD +# endif /* GNUC >= 4.3 */ +#endif /* ATTRIBUTE_COLD */ +#ifndef ATTRIBUTE_HOT +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_HOT __attribute__ ((__hot__)) +# else +# define ATTRIBUTE_HOT +# endif /* GNUC >= 4.3 */ +#endif /* ATTRIBUTE_HOT */ + +/* We use __extension__ in some places to suppress -pedantic warnings + about GCC extensions. This feature didn't work properly before + gcc 2.8. */ +#if GCC_VERSION < 2008 +#define __extension__ +#endif + +/* This is used to declare a const variable which should be visible + outside of the current compilation unit. Use it as + EXPORTED_CONST int i = 1; + This is because the semantics of const are different in C and C++. + "extern const" is permitted in C but it looks strange, and gcc + warns about it when -Wc++-compat is not used. */ +#ifdef __cplusplus +#define EXPORTED_CONST extern const +#else +#define EXPORTED_CONST const +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ansidecl.h */ diff --git a/contrib/sdk/sources/gcc_eh/auto-host.h b/contrib/sdk/sources/gcc_eh/auto-host.h new file mode 100644 index 0000000000..d84a11589c --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/auto-host.h @@ -0,0 +1,1911 @@ +/* auto-host.h. Generated from config.in by configure. */ +/* config.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#ifndef USED_FOR_TARGET +/* #undef AC_APPLE_UNIVERSAL_BUILD */ +#endif + + +/* Define as the number of bits in a byte, if `limits.h' doesn't. */ +#ifndef USED_FOR_TARGET +/* #undef CHAR_BIT */ +#endif + + +/* Define 0/1 to force the choice for exception handling model. */ +#ifndef USED_FOR_TARGET +#define CONFIG_SJLJ_EXCEPTIONS 0 +#endif + + +/* Define to enable the use of a default assembler. */ +#ifndef USED_FOR_TARGET +/* #undef DEFAULT_ASSEMBLER */ +#endif + + +/* Define to enable the use of a default linker. */ +#ifndef USED_FOR_TARGET +/* #undef DEFAULT_LINKER */ +#endif + + +/* Define if you want to use __cxa_atexit, rather than atexit, to register C++ + destructors for local statics and global objects. This is essential for + fully standards-compliant handling of destructors, but requires + __cxa_atexit in libc. */ +#ifndef USED_FOR_TARGET +#define DEFAULT_USE_CXA_ATEXIT 2 +#endif + + +/* Define if you want assertions enabled. This is a cheap check. */ +#ifndef USED_FOR_TARGET +#define ENABLE_ASSERT_CHECKING 1 +#endif + + +/* Define if you want more run-time sanity checks. This one gets a grab bag of + miscellaneous but relatively cheap checks. */ +#ifndef USED_FOR_TARGET +#define ENABLE_CHECKING 1 +#endif + + +/* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ +#ifndef USED_FOR_TARGET +#define ENABLE_DECIMAL_BID_FORMAT 0 +#endif + + +/* Define to 1 to enable decimal float extension to C. */ +#ifndef USED_FOR_TARGET +#define ENABLE_DECIMAL_FLOAT 0 +#endif + + +/* Define if you want more run-time sanity checks for dataflow. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_DF_CHECKING */ +#endif + + +/* Define to 1 to enable fixed-point arithmetic extension to C. */ +#ifndef USED_FOR_TARGET +#define ENABLE_FIXED_POINT 0 +#endif + + +/* Define if you want fold checked that it never destructs its argument. This + is quite expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_FOLD_CHECKING */ +#endif + + +/* Define if you want the garbage collector to operate in maximally paranoid + mode, validating the entire heap and collecting garbage at every + opportunity. This is extremely expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_GC_ALWAYS_COLLECT */ +#endif + + +/* Define if you want the garbage collector to do object poisoning and other + memory allocation checks. This is quite expensive. */ +#ifndef USED_FOR_TARGET +#define ENABLE_GC_CHECKING 1 +#endif + + +/* Define if you want operations on GIMPLE (the basic data structure of the + high-level optimizers) to be checked for dynamic type safety at runtime. + This is moderately expensive. */ +#ifndef USED_FOR_TARGET +#define ENABLE_GIMPLE_CHECKING 1 +#endif + + +/* Define if gcc should always pass --build-id to linker. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_LD_BUILDID */ +#endif + + +/* Define to enable LTO support. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_LTO */ +#endif + + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#ifndef USED_FOR_TARGET +#define ENABLE_NLS 1 +#endif + + +/* Define to enable plugin support. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_PLUGIN */ +#endif + + +/* Define if you want all operations on RTL (the basic data structure of the + optimizer and back end) to be checked for dynamic type safety at runtime. + This is quite expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_RTL_CHECKING */ +#endif + + +/* Define if you want RTL flag accesses to be checked against the RTL codes + that are supported for each access macro. This is relatively cheap. */ +#ifndef USED_FOR_TARGET +#define ENABLE_RTL_FLAG_CHECKING 1 +#endif + + +/* Define if you want runtime assertions enabled. This is a cheap check. */ +#define ENABLE_RUNTIME_CHECKING 1 + +/* Define if you want all operations on trees (the basic data structure of the + front ends) to be checked for dynamic type safety at runtime. This is + moderately expensive. The tree browser debugging routines will also be + enabled by this option. */ +#ifndef USED_FOR_TARGET +#define ENABLE_TREE_CHECKING 1 +#endif + + +/* Define if you want all gimple types to be verified after gimplifiation. + This is cheap. */ +#ifndef USED_FOR_TARGET +#define ENABLE_TYPES_CHECKING 1 +#endif + + +/* Define if you want to run subprograms and generated programs through + valgrind (a memory checker). This is extremely expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_VALGRIND_CHECKING */ +#endif + + +/* Define to 1 if installation paths should be looked up in the Windows + Registry. Ignored on non-Windows hosts. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_WIN32_REGISTRY */ +#endif + + +/* Define to the name of a file containing a list of extra machine modes for + this architecture. */ +#ifndef USED_FOR_TARGET +#define EXTRA_MODES_FILE "config/i386/i386-modes.def" +#endif + + +/* Define to enable detailed memory allocation stats gathering. */ +#ifndef USED_FOR_TARGET +/* #undef GATHER_STATISTICS */ +#endif + + +/* Define if the zone collector is in use */ +#ifndef USED_FOR_TARGET +/* #undef GGC_ZONE */ +#endif + + +/* mcontext_t fields start with __ */ +#ifndef USED_FOR_TARGET +/* #undef HAS_MCONTEXT_T_UNDERSCORES */ +#endif + + +/* Define if your assembler supports cmpb. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_CMPB */ +#endif + + +/* Define if your assembler supports the DCI/ICI instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_DCI */ +#endif + + +/* Define if your assembler supports the --debug-prefix-map option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DEBUG_PREFIX_MAP 1 +#endif + + +/* Define if your assembler supports DFP instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_DFP */ +#endif + + +/* Define if your assembler supports .dtprelword. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_DTPRELWORD */ +#endif + + +/* Define if your assembler supports dwarf2 .file/.loc directives, and + preserves file table indices exactly as given. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DWARF2_DEBUG_LINE 1 +#endif + + +/* Define if your assembler supports explicit relocations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_EXPLICIT_RELOCS */ +#endif + + +/* Define if your assembler supports fprnd. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_FPRND */ +#endif + + +/* Define if your assembler supports the --gdwarf2 option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GDWARF2_DEBUG_FLAG 1 +#endif + + +/* Define if your assembler supports .gnu_attribute. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_GNU_ATTRIBUTE */ +#endif + + +/* Define true if the assembler supports '.long foo@GOTOFF'. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GOTOFF_IN_DATA 1 +#endif + + +/* Define if your assembler supports the --gstabs option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GSTABS_DEBUG_FLAG 1 +#endif + + +/* Define if your assembler supports the Sun syntax for cmov. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_CMOV_SUN_SYNTAX */ +#endif + + +/* Define if your assembler supports the subtraction of symbols in different + sections. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_DIFF_SECT_DELTA 1 +#endif + + +/* Define if your assembler supports the ffreep mnemonic. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_FFREEP 1 +#endif + + +/* Define if your assembler uses fildq and fistq mnemonics. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_FILDQ 1 +#endif + + +/* Define if your assembler uses filds and fists mnemonics. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_FILDS 1 +#endif + + +/* Define if your assembler supports the .quad directive. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_QUAD 1 +#endif + + +/* Define true if the assembler supports 'rep , lock '. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_REP_LOCK_PREFIX 1 +#endif + + +/* Define if your assembler supports the sahf mnemonic in 64bit mode. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_SAHF 1 +#endif + + +/* Define if your assembler supports the swap suffix. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_IX86_SWAP 1 +#endif + + +/* Define if your assembler supports the lituse_jsrdirect relocation. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_JSRDIRECT_RELOCS */ +#endif + + +/* Define if your assembler supports .sleb128 and .uleb128. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_LEB128 1 +#endif + + +/* Define if the assembler won't complain about a line such as # 0 "" 2. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_LINE_ZERO 1 +#endif + + +/* Define if your assembler supports ltoffx and ldxmov relocations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_LTOFFX_LDXMOV_RELOCS */ +#endif + + +/* Define if your assembler supports LWSYNC instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_LWSYNC */ +#endif + + +/* Define if your assembler supports mfcr field. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MFCRF */ +#endif + + +/* Define if your assembler supports mffgpr and mftgpr. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MFPGPR */ +#endif + + +/* Define if your assembler supports the -no-mul-bug-abort option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION */ +#endif + + +/* Define if the assembler understands -mno-shared. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_NO_SHARED */ +#endif + + +/* Define if your assembler supports offsetable %lo(). */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_OFFSETABLE_LO10 */ +#endif + + +/* Define if your assembler supports popcntb field. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POPCNTB */ +#endif + + +/* Define if your assembler supports POPCNTD instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POPCNTD */ +#endif + + +/* Define if your assembler supports .ref */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REF */ +#endif + + +/* Define if your assembler supports .register. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ +#endif + + +/* Define if your assembler supports R_PPC_REL16 relocs. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REL16 */ +#endif + + +/* Define if your assembler supports -relax option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_RELAX_OPTION */ +#endif + + +/* Define if your assembler and linker support GOTDATA_OP relocs. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_GOTDATA_OP */ +#endif + + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_UA_PCREL */ +#endif + + +/* Define if your assembler and linker support unaligned PC relative relocs + against hidden symbols. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_UA_PCREL_HIDDEN */ +#endif + + +/* Define if your assembler supports thread-local storage. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_TLS */ +#endif + + +/* Define if your assembler supports arg info for __tls_get_addr. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_TLS_MARKERS */ +#endif + + +/* Define if your assembler supports VSX instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_VSX */ +#endif + + +/* Define to 1 if you have the `atoll' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_ATOLL 1 +#endif + + +/* Define to 1 if you have the `atoq' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ATOQ */ +#endif + + +/* Define to 1 if you have the `clearerr_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_CLEARERR_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `clock' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_CLOCK 1 +#endif + + +/* Define if defines clock_t. */ +#ifndef USED_FOR_TARGET +#define HAVE_CLOCK_T 1 +#endif + + +/* Define 0/1 if your assembler and linker support COMDAT groups. */ +#ifndef USED_FOR_TARGET +#define HAVE_COMDAT_GROUP 0 +#endif + + +/* Define to 1 if we found a declaration for 'abort', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ABORT 1 +#endif + + +/* Define to 1 if we found a declaration for 'asprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ASPRINTF 0 +#endif + + +/* Define to 1 if we found a declaration for 'atof', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ATOF 1 +#endif + + +/* Define to 1 if we found a declaration for 'atol', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ATOL 1 +#endif + + +/* Define to 1 if we found a declaration for 'basename', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_BASENAME 0 +#endif + + +/* Define to 1 if we found a declaration for 'calloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'clearerr_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CLEARERR_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'clock', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CLOCK 1 +#endif + + +/* Define to 1 if we found a declaration for 'errno', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ERRNO 1 +#endif + + +/* Define to 1 if we found a declaration for 'feof_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FEOF_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'ferror_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FERROR_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fflush_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FFLUSH_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fgetc_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FGETC_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fgets_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FGETS_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fileno_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FILENO_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fprintf_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPRINTF_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fputc_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPUTC_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fputs_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPUTS_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fread_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FREAD_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'free', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FREE 1 +#endif + + +/* Define to 1 if we found a declaration for 'fwrite_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FWRITE_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'getchar_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETCHAR_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'getcwd', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETCWD 1 +#endif + + +/* Define to 1 if we found a declaration for 'getc_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETC_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'getenv', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETENV 1 +#endif + + +/* Define to 1 if we found a declaration for 'getopt', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETOPT 0 +#endif + + +/* Define to 1 if we found a declaration for 'getpagesize', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETPAGESIZE 0 +#endif + + +/* Define to 1 if we found a declaration for 'getrlimit', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETRLIMIT 0 +#endif + + +/* Define to 1 if we found a declaration for 'getrusage', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETRUSAGE 0 +#endif + + +/* Define to 1 if we found a declaration for 'getwd', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETWD 0 +#endif + + +/* Define to 1 if we found a declaration for 'ldgetname', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_LDGETNAME 0 +#endif + + +/* Define to 1 if we found a declaration for 'malloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_MALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'putchar_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_PUTCHAR_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'putc_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_PUTC_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'realloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_REALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'sbrk', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SBRK 0 +#endif + + +/* Define to 1 if we found a declaration for 'setrlimit', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SETRLIMIT 0 +#endif + + +/* Define to 1 if we found a declaration for 'sigaltstack', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SIGALTSTACK 0 +#endif + + +/* Define to 1 if we found a declaration for 'snprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SNPRINTF 1 +#endif + + +/* Define to 1 if we found a declaration for 'strsignal', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRSIGNAL 1 +#endif + + +/* Define to 1 if we found a declaration for 'strstr', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRSTR 1 +#endif + + +/* Define to 1 if we found a declaration for 'strverscmp', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRVERSCMP 0 +#endif + + +/* Define to 1 if we found a declaration for 'times', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_TIMES 0 +#endif + + +/* Define to 1 if we found a declaration for 'vasprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_VASPRINTF 0 +#endif + + +/* Define to 1 if we found a declaration for 'vsnprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_VSNPRINTF 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_DIRECT_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_DLFCN_H */ +#endif + + +/* Define to 1 if you have the `elf_getshdrstrndx' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ELF_GETSHDRSTRNDX */ +#endif + + +/* Define to 1 if you have the `elf_getshstrndx' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ELF_GETSHSTRNDX */ +#endif + + +/* Define if elf_getshstrndx has gABI conformant return values. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ELF_GETSHSTRNDX_GABI */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_FCNTL_H 1 +#endif + + +/* Define to 1 if you have the `feof_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FEOF_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `ferror_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FERROR_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fflush_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FFLUSH_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fgetc_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FGETC_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fgets_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FGETS_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fileno_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FILENO_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fork' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FORK */ +#endif + + +/* Define to 1 if you have the `fprintf_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FPRINTF_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fputc_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FPUTC_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fputs_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FPUTS_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fread_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FREAD_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fwrite_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FWRITE_UNLOCKED */ +#endif + + +/* Define if your assembler supports specifying the alignment of objects + allocated using the GAS .comm command. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_ALIGNED_COMM 1 +#endif + + +/* Define if your assembler supports .balign and .p2align. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 +#endif + + +/* Define 0/1 if your assembler supports CFI directives. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_CFI_DIRECTIVE 0 +#endif + + +/* Define 0/1 if your assembler supports .cfi_personality. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_CFI_PERSONALITY_DIRECTIVE 1 +#endif + + +/* Define 0/1 if your assembler supports .cfi_sections. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_CFI_SECTIONS_DIRECTIVE 1 +#endif + + +/* Define if your assembler supports the .loc discriminator sub-directive. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_DISCRIMINATOR 1 +#endif + + +/* Define if your assembler supports @gnu_unique_object. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_GNU_UNIQUE_OBJECT */ +#endif + + +/* Define if your assembler and linker support .hidden. */ +/* #undef HAVE_GAS_HIDDEN */ + +/* Define if your assembler supports .lcomm with an alignment field. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_LCOMM_WITH_ALIGNMENT 1 +#endif + + +/* Define if your assembler supports .literal16. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_LITERAL16 */ +#endif + + +/* Define if your assembler supports specifying the maximum number of bytes to + skip when using the GAS .p2align command. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 +#endif + + +/* Define if your assembler supports .nsubspa comdat option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_NSUBSPA_COMDAT */ +#endif + + +/* Define if your assembler and linker support 32-bit section relative relocs + via '.secrel32 label'. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_PE_SECREL32_RELOC 1 +#endif + + +/* Define 0/1 if your assembler supports marking sections with SHF_MERGE flag. + */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_SHF_MERGE 0 +#endif + + +/* Define if your assembler supports .subsection and .subsection -1 starts + emitting at the beginning of your section. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_SUBSECTION_ORDERING */ +#endif + + +/* Define if your assembler supports .weak. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_WEAK 1 +#endif + + +/* Define if your assembler supports .weakref. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_WEAKREF 1 +#endif + + +/* Define to 1 if you have the `getchar_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GETCHAR_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `getc_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GETC_UNLOCKED */ +#endif + + +/* Define if _Unwind_GetIPInfo is available. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETIPINFO 1 +#endif + + +/* Define to 1 if you have the `getrlimit' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GETRLIMIT */ +#endif + + +/* Define to 1 if you have the `getrusage' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GETRUSAGE */ +#endif + + +/* Define to 1 if you have the `gettimeofday' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETTIMEOFDAY 1 +#endif + + +/* Define if using GNU as. */ +#ifndef USED_FOR_TARGET +#define HAVE_GNU_AS 0 +#endif + + +/* Define if using GNU ld. */ +#ifndef USED_FOR_TARGET +#define HAVE_GNU_LD 0 +#endif + + +/* Define if you have the iconv() function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ICONV */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ICONV_H */ +#endif + + +/* Define .init_array/.fini_array sections are available and working. */ +#ifndef USED_FOR_TARGET +#define HAVE_INITFINI_ARRAY 1 +#endif + + +/* Define to 1 if the system has the type `intmax_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTMAX_T 1 +#endif + + +/* Define to 1 if the system has the type `intptr_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTPTR_T 1 +#endif + + +/* Define if you have a working header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTTYPES_H 1 +#endif + + +/* Define to 1 if you have the `kill' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_KILL */ +#endif + + +/* Define if you have and nl_langinfo(CODESET). */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LANGINFO_CODESET */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LANGINFO_H */ +#endif + + +/* Define if your file defines LC_MESSAGES. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LC_MESSAGES */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LDFCN_H */ +#endif + + +/* Define if your linker supports --as-needed and --no-as-needed options. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_AS_NEEDED 1 +#endif + + +/* Define if your linker supports --build-id. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_BUILDID */ +#endif + + +/* Define if your linker supports --demangle option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_DEMANGLE */ +#endif + + +/* Define if your linker supports --eh-frame-hdr option. */ +/* #undef HAVE_LD_EH_FRAME_HDR */ + +/* Define if your linker supports garbage collection of sections in presence + of EH frames. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_EH_GC_SECTIONS */ +#endif + + +/* Define if your PowerPC64 linker only needs function descriptor syms. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_NO_DOT_SYMS */ +#endif + + +/* Define if your linker can relax absolute .eh_frame personality pointers + into PC-relative form. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_PERSONALITY_RELAXATION */ +#endif + + +/* Define if your linker supports -pie option. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_PIE 1 +#endif + + +/* Define if your linker links a mix of read-only and read-write sections into + a read-write section. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_RO_RW_SECTION_MIXING */ +#endif + + +/* Define if your linker supports the *_sol2 emulations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_SOL2_EMULATION */ +#endif + + +/* Define if your linker supports -Bstatic/-Bdynamic option. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_STATIC_DYNAMIC 1 +#endif + + +/* Define if your linker supports --sysroot. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_SYSROOT 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_LIMITS_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_LOCALE_H 1 +#endif + + +/* Define to 1 if the system has the type `long long'. */ +#ifndef USED_FOR_TARGET +#define HAVE_LONG_LONG 1 +#endif + + +/* Define to 1 if the system has the type `long long int'. */ +#ifndef USED_FOR_TARGET +#define HAVE_LONG_LONG_INT 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_MALLOC_H 1 +#endif + + +/* Define to 1 if you have the `mbstowcs' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_MBSTOWCS 1 +#endif + + +/* Define if valgrind's memcheck.h header is installed. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MEMCHECK_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_MEMORY_H 1 +#endif + + +/* Define to 1 if you have the `mincore' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MINCORE */ +#endif + + +/* Define to 1 if you have the `mmap' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MMAP */ +#endif + + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MMAP_ANON */ +#endif + + +/* Define if mmap of /dev/zero works. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MMAP_DEV_ZERO */ +#endif + + +/* Define if read-only mmap of a plain file works. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MMAP_FILE */ +#endif + + +/* Define to 1 if you have the `nl_langinfo' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_NL_LANGINFO */ +#endif + + +/* Define to 1 if you have the `putchar_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_PUTCHAR_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `putc_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_PUTC_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `setlocale' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_SETLOCALE 1 +#endif + + +/* Define to 1 if you have the `setrlimit' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SETRLIMIT */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDDEF_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDINT_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDLIB_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRINGS_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRING_H 1 +#endif + + +/* Define to 1 if you have the `strsignal' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_STRSIGNAL */ +#endif + + +/* Define if defines struct tms. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_STRUCT_TMS */ +#endif + + +/* Define to 1 if you have the `sysconf' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SYSCONF */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_FILE_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SYS_MMAN_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_PARAM_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SYS_RESOURCE_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_STAT_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SYS_TIMES_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_TIME_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_TYPES_H 1 +#endif + + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SYS_WAIT_H */ +#endif + + +/* Define to 1 if you have the `times' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_TIMES */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_TIME_H 1 +#endif + + +/* Define to 1 if the system has the type `uintmax_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UINTMAX_T 1 +#endif + + +/* Define to 1 if the system has the type `uintptr_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UINTPTR_T 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_UNISTD_H 1 +#endif + + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UNSIGNED_LONG_LONG_INT 1 +#endif + + +/* Define if valgrind's valgrind/memcheck.h header is installed. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_VALGRIND_MEMCHECK_H */ +#endif + + +/* Define to 1 if you have the `vfork' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_VFORK */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_VFORK_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_WCHAR_H 1 +#endif + + +/* Define to 1 if you have the `wcswidth' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_WCSWIDTH */ +#endif + + +/* Define to 1 if `fork' works. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_WORKING_FORK */ +#endif + + +/* Define this macro if mbstowcs does not crash when its first argument is + NULL. */ +#ifndef USED_FOR_TARGET +#define HAVE_WORKING_MBSTOWCS 1 +#endif + + +/* Define to 1 if `vfork' works. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_WORKING_VFORK */ +#endif + + +/* Define to 1 if the system has the type `__int64'. */ +#ifndef USED_FOR_TARGET +#define HAVE___INT64 1 +#endif + + +/* Define if cloog is in use. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_cloog */ +#endif + + +/* Define if libelf is in use. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_libelf */ +#endif + + +/* Define as const if the declaration of iconv() needs const. */ +#ifndef USED_FOR_TARGET +/* #undef ICONV_CONST */ +#endif + + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#ifndef USED_FOR_TARGET +#define LT_OBJDIR ".libs/" +#endif + + +/* Define if host mkdir takes a single argument. */ +#ifndef USED_FOR_TARGET +#define MKDIR_TAKES_ONE_ARG 1 +#endif + + +/* Define to 1 if HOST_WIDE_INT must be 64 bits wide (see hwint.h). */ +#ifndef USED_FOR_TARGET +/* #undef NEED_64BIT_HOST_WIDE_INT */ +#endif + + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#ifndef USED_FOR_TARGET +/* #undef NO_MINUS_C_MINUS_O */ +#endif + + +/* Define to the address where bug reports for this package should be sent. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_BUGREPORT "" +#endif + + +/* Define to the full name of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_NAME "" +#endif + + +/* Define to the full name and version of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_STRING "" +#endif + + +/* Define to the one symbol short name of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_TARNAME "" +#endif + + +/* Define to the home page for this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_URL "" +#endif + + +/* Define to the version of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_VERSION "" +#endif + + +/* Specify plugin linker */ +#ifndef USED_FOR_TARGET +#define PLUGIN_LD "ld" +#endif + + +/* Define to PREFIX/include if cpp should also search that directory. */ +#ifndef USED_FOR_TARGET +#define PREFIX_INCLUDE_DIR "/mingw/include" +#endif + + +/* The size of `int', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_INT 4 +#endif + + +/* The size of `long', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_LONG 4 +#endif + + +/* The size of `long long', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_LONG_LONG 8 +#endif + + +/* The size of `short', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_SHORT 2 +#endif + + +/* The size of `void *', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_VOID_P 4 +#endif + + +/* The size of `__int64', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF___INT64 8 +#endif + + +/* Define to 1 if you have the ANSI C header files. */ +#ifndef USED_FOR_TARGET +#define STDC_HEADERS 1 +#endif + + +/* Define if you can safely include both and . */ +#ifndef USED_FOR_TARGET +#define STRING_WITH_STRINGS 1 +#endif + + +/* Define if TFmode long double should be the default */ +#ifndef USED_FOR_TARGET +/* #undef TARGET_DEFAULT_LONG_DOUBLE_128 */ +#endif + + +/* Define if your target C library provides stack protector support */ +#ifndef USED_FOR_TARGET +/* #undef TARGET_LIBC_PROVIDES_SSP */ +#endif + + +/* Define to 1 if you can safely include both and . */ +#ifndef USED_FOR_TARGET +#define TIME_WITH_SYS_TIME 1 +#endif + + +/* Define to the flag used to mark TLS sections if the default (`T') doesn't + work. */ +#ifndef USED_FOR_TARGET +/* #undef TLS_SECTION_ASM_FLAG */ +#endif + + +/* Define if your assembler mis-optimizes .eh_frame data. */ +#ifndef USED_FOR_TARGET +/* #undef USE_AS_TRADITIONAL_FORMAT */ +#endif + + +/* Define if you want to generate code by default that assumes that the Cygwin + DLL exports wrappers to support libstdc++ function replacement. */ +#ifndef USED_FOR_TARGET +/* #undef USE_CYGWIN_LIBSTDCXX_WRAPPERS */ +#endif + + +/* Define to 1 if the 'long long' (or '__int64') is wider than 'long' but + still efficiently supported by the host hardware. */ +#ifndef USED_FOR_TARGET +/* #undef USE_LONG_LONG_FOR_WIDEST_FAST_INT */ +#endif + + +/* Define if we should use leading underscore on 64 bit mingw targets */ +#ifndef USED_FOR_TARGET +/* #undef USE_MINGW64_LEADING_UNDERSCORES */ +#endif + + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define to be the last component of the Windows registry key under which to + look for installation paths. The full key used will be + HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}. + The default is the GCC version number. */ +#ifndef USED_FOR_TARGET +/* #undef WIN32_REGISTRY_KEY */ +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if on MINIX. */ +#ifndef USED_FOR_TARGET +/* #undef _MINIX */ +#endif + + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#ifndef USED_FOR_TARGET +/* #undef _POSIX_1_SOURCE */ +#endif + + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#ifndef USED_FOR_TARGET +/* #undef _POSIX_SOURCE */ +#endif + + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT32_T */ +#endif + + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT64_T */ +#endif + + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT8_T */ +#endif + + +/* Define to `char *' if does not define. */ +#ifndef USED_FOR_TARGET +#define caddr_t char * +#endif + + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int16_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int32_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int64_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int8_t */ +#endif + + +/* Define to the widest signed integer type if and do + not define. */ +#ifndef USED_FOR_TARGET +/* #undef intmax_t */ +#endif + + +/* Define to the type of a signed integer type wide enough to hold a pointer, + if such a type exists, and if the system does not define it. */ +#ifndef USED_FOR_TARGET +/* #undef intptr_t */ +#endif + + +/* Define to `int' if does not define. */ +#ifndef USED_FOR_TARGET +/* #undef pid_t */ +#endif + + +/* Define to `long' if doesn't define. */ +#ifndef USED_FOR_TARGET +#define rlim_t long +#endif + + +/* Define to `int' if does not define. */ +#ifndef USED_FOR_TARGET +/* #undef ssize_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint16_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint32_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint64_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint8_t */ +#endif + + +/* Define to the widest unsigned integer type if and + do not define. */ +#ifndef USED_FOR_TARGET +/* #undef uintmax_t */ +#endif + + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uintptr_t */ +#endif + + +/* Define as `fork' if `vfork' does not work. */ +#ifndef USED_FOR_TARGET +#define vfork fork +#endif + diff --git a/contrib/sdk/sources/gcc_eh/config/dbxcoff.h b/contrib/sdk/sources/gcc_eh/config/dbxcoff.h new file mode 100644 index 0000000000..a2b36c0d60 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/dbxcoff.h @@ -0,0 +1,62 @@ +/* Definitions needed when using stabs embedded in COFF sections. + Copyright (C) 1996, 2004, 2007 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This file may be included by any COFF target which wishes to + support -gstabs generating stabs in sections, as produced by gas + and understood by gdb. */ + +/* Output DBX (stabs) debugging information if doing -gstabs. */ + +#define DBX_DEBUGGING_INFO 1 + +/* Generate SDB debugging information by default. */ + +#ifndef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG +#endif + +/* Be function-relative for block and source line stab directives. */ + +#define DBX_BLOCKS_FUNCTION_RELATIVE 1 + +/* but, to make this work, functions must appear prior to line info. */ + +#define DBX_FUNCTION_FIRST + +/* Generate a blank trailing N_SO to mark the end of the .o file, since + we can't depend upon the linker to mark .o file boundaries with + embedded stabs. */ + +#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END + +/* Like block addresses, stabs line numbers are relative to the + current function. */ + +#define DBX_LINES_FUNCTION_RELATIVE 1 + +/* When generating stabs debugging, use N_BINCL entries. */ + +#undef DBX_USE_BINCL +#define DBX_USE_BINCL + +/* There is no limit to the length of stabs strings. */ + +#ifndef DBX_CONTIN_LENGTH +#define DBX_CONTIN_LENGTH 0 +#endif diff --git a/contrib/sdk/sources/gcc_eh/config/i386/bsd.h b/contrib/sdk/sources/gcc_eh/config/i386/bsd.h new file mode 100644 index 0000000000..e408ccdb03 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/bsd.h @@ -0,0 +1,100 @@ +/* Definitions for BSD assembler syntax for Intel 386 + (actually AT&T syntax for insns and operands, + adapted to BSD conventions for symbol names and debugging.) + Copyright (C) 1988, 1996, 2000, 2002, 2007, 2008 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Use the Sequent Symmetry assembler syntax. */ + +/* Define the syntax of pseudo-ops, labels and comments. */ + +/* Prefix for internally generated assembler labels. If we aren't using + underscores, we are using prefix `.'s to identify labels that should + be ignored, as in `i386/gas.h' --karl@cs.umb.edu */ + +#define LPREFIX "L" + +/* Assembler pseudos to introduce constants of various size. */ + +#define ASM_BYTE "\t.byte\t" +#define ASM_SHORT "\t.word\t" +#define ASM_LONG "\t.long\t" +#define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */ + +/* This was suggested, but it shouldn't be right for DBX output. -- RMS + #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */ + + +/* Define the syntax of labels and symbol definitions/declarations. */ + +/* This is how to output an assembler line + that says to advance the location counter by SIZE bytes. */ + +#define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)) + +/* Define the syntax of labels and symbol definitions/declarations. */ + +/* This says how to output an assembler line + to define a global common symbol. */ + +#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".comm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (int)(ROUNDED))) + +/* This says how to output an assembler line + to define a local common symbol. */ + +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ +( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (int)(ROUNDED))) + +#ifdef HAVE_GAS_LCOMM_WITH_ALIGNMENT +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNMENT) \ +( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (int)(ALIGNMENT) / BITS_PER_UNIT)) +#endif + +/* This is how to output an assembler line + that says to advance the location counter + to a multiple of 2**LOG bytes. */ + +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG)) + +/* This is how to store into the string BUF + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. */ + +#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ + sprintf ((BUF), "*%s%ld", (PREFIX), (long)(NUMBER)) + +/* The prefix to add to user-visible assembler symbols. */ + +#define USER_LABEL_PREFIX "_" + +/* Sequent has some changes in the format of DBX symbols. */ +#define DBX_NO_XREFS 1 + +/* Don't split DBX symbols into continuations. */ +#define DBX_CONTIN_LENGTH 0 diff --git a/contrib/sdk/sources/gcc_eh/config/i386/cygming.h b/contrib/sdk/sources/gcc_eh/config/i386/cygming.h new file mode 100644 index 0000000000..b84b750632 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/cygming.h @@ -0,0 +1,448 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows32, using a Unix style C library and tools. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define DBX_DEBUGGING_INFO 1 +#define SDB_DEBUGGING_INFO 1 +#if TARGET_64BIT_DEFAULT || defined (HAVE_GAS_PE_SECREL32_RELOC) +#define DWARF2_DEBUGGING_INFO 1 +#endif + +#undef PREFERRED_DEBUGGING_TYPE +#if (DWARF2_DEBUGGING_INFO) +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#else +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +#endif + +#undef TARGET_64BIT_MS_ABI +#define TARGET_64BIT_MS_ABI (!cfun ? ix86_abi == MS_ABI : TARGET_64BIT && cfun->machine->call_abi == MS_ABI) + +#undef DEFAULT_ABI +#define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI) + +#if ! defined (USE_MINGW64_LEADING_UNDERSCORES) +#undef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_") + +#undef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX (TARGET_64BIT ? "." : "") + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ + sprintf ((BUF), "*%s%s%ld", LOCAL_LABEL_PREFIX, \ + (PREFIX), (long)(NUMBER)) + +#undef LPREFIX +#define LPREFIX (TARGET_64BIT ? ".L" : "L") + +#endif + +#undef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(n) \ + (TARGET_64BIT ? dbx64_register_map[n] \ + : (write_symbols == DWARF2_DEBUG \ + ? svr4_dbx_register_map[n] : dbx_register_map[n])) + +/* Map gcc register number to DWARF 2 CFA column number. For 32 bit + target, always use the svr4_dbx_register_map for DWARF .eh_frame + even if we don't use DWARF .debug_frame. */ +#undef DWARF_FRAME_REGNUM +#define DWARF_FRAME_REGNUM(n) \ + (TARGET_64BIT ? dbx64_register_map[(n)] \ + : svr4_dbx_register_map[(n)]) + +#ifdef HAVE_GAS_PE_SECREL32_RELOC +/* Use section relative relocations for debugging offsets. Unlike + other targets that fake this by putting the section VMA at 0, PE + won't allow it. */ +#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION) \ + do { \ + switch (SIZE) \ + { \ + case 4: \ + fputs ("\t.secrel32\t", FILE); \ + assemble_name (FILE, LABEL); \ + break; \ + case 8: \ + /* This is a hack. There is no 64-bit section relative \ + relocation. However, the COFF format also does not \ + support 64-bit file offsets; 64-bit applications are \ + limited to 32-bits of code+data in any one module. \ + Fake the 64-bit offset by zero-extending it. */ \ + fputs ("\t.secrel32\t", FILE); \ + assemble_name (FILE, LABEL); \ + fputs ("\n\t.long\t0", FILE); \ + break; \ + default: \ + gcc_unreachable (); \ + } \ + } while (0) +#endif + +#define TARGET_EXECUTABLE_SUFFIX ".exe" + +#include + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + if (!TARGET_64BIT) \ + builtin_define ("_X86_=1"); \ + builtin_assert ("system=winnt"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__fastcall=__attribute__((__fastcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + if (!flag_iso) \ + { \ + builtin_define ("_stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("_fastcall=__attribute__((__fastcall__))"); \ + builtin_define ("_cdecl=__attribute__((__cdecl__))"); \ + } \ + /* Even though linkonce works with static libs, this is needed \ + to compare typeinfo symbols across dll boundaries. */ \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ + EXTRA_OS_CPP_BUILTINS (); \ + } \ + while (0) + +/* Get tree.c to declare a target-specific specialization of + merge_decl_attributes. */ +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1 + +/* This macro defines names of additional specifications to put in the specs + that can be used in various specifications like CC1_SPEC. Its definition + is an initializer with a subgrouping for each command option. + + Each subgrouping contains a string constant, that defines the + specification name, and a string constant that used by the GCC driver + program. + + Do not define this macro if it does not need to do anything. */ + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "mingw_include_path", DEFAULT_TARGET_MACHINE } + +#undef MATH_LIBRARY +#define MATH_LIBRARY "" + +#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int") +#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int") + +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" + +/* Windows64 continues to use a 32-bit long type. */ +#undef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE 32 + +/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ +#define HANDLE_PRAGMA_PACK_PUSH_POP 1 + +union tree_node; +#define TREE union tree_node * + +#define drectve_section() \ + (fprintf (asm_out_file, "\t.section .drectve\n"), \ + in_section = NULL) + +/* Older versions of gas don't handle 'r' as data. + Explicitly set data flag with 'd'. */ +#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\"" + +/* Don't allow flag_pic to propagate since gas may produce invalid code + otherwise. */ + +#undef SUBTARGET_OVERRIDE_OPTIONS +#define SUBTARGET_OVERRIDE_OPTIONS \ +do { \ + if (TARGET_64BIT && flag_pic != 1) \ + { \ + if (flag_pic > 1) \ + warning (0, \ + "-fPIC ignored for target (all code is position independent)"\ + ); \ + flag_pic = 1; \ + } \ + else if (!TARGET_64BIT && flag_pic) \ + { \ + warning (0, "-f%s ignored for target (all code is position independent)",\ + (flag_pic > 1) ? "PIC" : "pic"); \ + flag_pic = 0; \ + } \ +} while (0) \ + +/* Define this macro if references to a symbol must be treated + differently depending on something about the variable or + function named by the symbol (such as what section it is in). + + On i386 running Windows NT, modify the assembler name with a suffix + consisting of an atsign (@) followed by string of digits that represents + the number of bytes of arguments passed to the function, if it has the + attribute STDCALL. + + In addition, we must mark dll symbols specially. Definitions of + dllexport'd objects install some info in the .drectve section. + References to dllimport'd objects are fetched indirectly via + _imp__. If both are declared, dllexport overrides. This is also + needed to implement one-only vtables: they go into their own + section and we need to set DECL_SECTION_NAME so we do that here. + Note that we can be called twice on the same decl. */ + +#define SUBTARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info + +/* Output a common block. */ +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON +#define ASM_OUTPUT_ALIGNED_DECL_COMMON \ + i386_pe_asm_output_aligned_decl_common + +/* Output the label for an initialized variable. */ +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ +do { \ + i386_pe_maybe_record_exported_symbol (DECL, NAME, 1); \ + ASM_OUTPUT_LABEL ((STREAM), (NAME)); \ +} while (0) + +/* Output a reference to a label. Fastcall function symbols + keep their '@' prefix, while other symbols are prefixed + with user_label_prefix. */ +#undef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(STREAM, NAME) \ +do { \ + if ((NAME)[0] != FASTCALL_PREFIX) \ + fputs (user_label_prefix, (STREAM)); \ + fputs ((NAME), (STREAM)); \ +} while (0) + + +/* Emit code to check the stack when allocating more than 4000 + bytes in one go. */ +#define CHECK_STACK_LIMIT 4000 + +#undef STACK_BOUNDARY +#define STACK_BOUNDARY (ix86_abi == MS_ABI ? 128 : BITS_PER_WORD) + +/* By default, target has a 80387, uses IEEE compatible arithmetic, + returns float values in the 387 and needs stack probes. + We also align doubles to 64-bits for MSVC default compatibility. */ + +#undef TARGET_SUBTARGET_DEFAULT +#define TARGET_SUBTARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \ + | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE) + +#undef TARGET_SUBTARGET64_DEFAULT +#define TARGET_SUBTARGET64_DEFAULT \ + MASK_128BIT_LONG_DOUBLE + +/* This is how to output an assembler line + that says to advance the location counter + to a multiple of 2**LOG bytes. */ + +#undef ASM_OUTPUT_ALIGN +#define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG)) + +/* Windows uses explicit import from shared libraries. */ +#define MULTIPLE_SYMBOL_SPACES 1 + +#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section +#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section + +#define SUPPORTS_ONE_ONLY 1 + +/* Switch into a generic section. */ +#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section + +/* Select attributes for named sections. */ +#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags + +/* Write the extra assembler code needed to declare a function + properly. If we are generating SDB debugging information, this + will happen automatically, so we only need to handle other cases. */ +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + i386_pe_maybe_record_exported_symbol (DECL, NAME, 0); \ + if (write_symbols != SDB_DEBUG) \ + i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + } \ + while (0) + +/* Add an external function to the list of functions to be declared at + the end of the file. */ +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ + do \ + { \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + i386_pe_record_external_function ((DECL), (NAME)); \ + } \ + while (0) + +/* Declare the type properly for any external libcall. */ +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1) + +/* This says out to put a global symbol in the BSS section. */ +#undef ASM_OUTPUT_ALIGNED_BSS +#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ + asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN)) + +/* Output function declarations at the end of the file. */ +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END i386_pe_file_end + +#undef ASM_COMMENT_START +#define ASM_COMMENT_START " #" + +#ifndef DWARF2_UNWIND_INFO +/* If configured with --disable-sjlj-exceptions, use DWARF2, else + default to SJLJ. */ +#if (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS) +/* The logic of this #if must be kept synchronised with the logic + for selecting the tmake_eh_file fragment in config.gcc. */ +#define DWARF2_UNWIND_INFO 1 +/* If multilib is selected break build as sjlj is required. */ +#if defined (TARGET_BI_ARCH) +#error For 64-bit windows and 32-bit based multilib version of gcc just SJLJ exceptions are supported. +#endif +#else +#define DWARF2_UNWIND_INFO 0 +#endif +#endif + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +#undef PROFILE_HOOK +#define PROFILE_HOOK(LABEL) \ + if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \ + { \ + emit_call_insn (gen_rtx_CALL (VOIDmode, \ + gen_rtx_MEM (FUNCTION_MODE, \ + gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \ + const0_rtx)); \ + } + +/* Java Native Interface (JNI) methods on Win32 are invoked using the + stdcall calling convention. */ +#undef MODIFY_JNI_METHOD_CALL +#define MODIFY_JNI_METHOD_CALL(MDECL) \ + build_type_attribute_variant ((MDECL), \ + build_tree_list (get_identifier ("stdcall"), \ + NULL)) + +/* For Win32 ABI compatibility */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 0 + +/* MSVC returns aggregate types of up to 8 bytes via registers. + See i386.c:ix86_return_in_memory. */ +#undef MS_AGGREGATE_RETURN +#define MS_AGGREGATE_RETURN 1 + +/* Biggest alignment supported by the object file format of this + machine. Use this macro to limit the alignment which can be + specified using the `__attribute__ ((aligned (N)))' construct. If + not defined, the default value is `BIGGEST_ALIGNMENT'. */ +/* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag + specified in the PECOFF60 spec. Native MS compiler also limits + user-specified alignment to 8192 bytes. */ +#undef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT (8192 * 8) + +/* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc, There, we + align internal doubles in structures on dword boundaries. Otherwise, + support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h. */ +#ifdef IN_TARGET_LIBS +#undef BIGGEST_FIELD_ALIGNMENT +#define BIGGEST_FIELD_ALIGNMENT 64 +#endif + +/* A bit-field declared as `int' forces `int' alignment for the struct. */ +#undef PCC_BITFIELD_TYPE_MATTERS +#define PCC_BITFIELD_TYPE_MATTERS 1 +#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec) + +/* Enable alias attribute support. */ +#ifndef SET_ASM_OP +#define SET_ASM_OP "\t.set\t" +#endif + +/* This implements the `alias' attribute, keeping any stdcall or + fastcall decoration. */ +#undef ASM_OUTPUT_DEF_FROM_DECLS +#define ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET) \ + do \ + { \ + const char *alias \ + = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \ + i386_pe_maybe_record_exported_symbol (DECL, alias, 0); \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + i386_pe_declare_function_type (STREAM, alias, \ + TREE_PUBLIC (DECL)); \ + ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET)); \ + } while (0) + +/* GNU as supports weak symbols on PECOFF. */ +#ifdef HAVE_GAS_WEAK +#define ASM_WEAKEN_LABEL(FILE, NAME) \ + do \ + { \ + fputs ("\t.weak\t", (FILE)); \ + assemble_name ((FILE), (NAME)); \ + fputc ('\n', (FILE)); \ + } \ + while (0) +#endif /* HAVE_GAS_WEAK */ + +/* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true, + but for .jcr section to work we also need crtbegin and crtend + objects. */ +#define TARGET_USE_JCR_SECTION 1 + +/* Decide whether it is safe to use a local alias for a virtual function + when constructing thunks. */ +#undef TARGET_USE_LOCAL_THUNK_ALIAS_P +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL)) + +#define SUBTARGET_ATTRIBUTE_TABLE \ + { "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute } + /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ + +/* mcount() does not need a counter variable. */ +#undef NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 + +#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p +#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition +#define TARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name + +#undef TREE + +#ifndef BUFSIZ +# undef FILE +#endif diff --git a/contrib/sdk/sources/gcc_eh/config/i386/gas.h b/contrib/sdk/sources/gcc_eh/config/i386/gas.h new file mode 100644 index 0000000000..4c7c9d1ac6 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/gas.h @@ -0,0 +1,124 @@ +/* Definitions for Intel 386 using GAS. + Copyright (C) 1988, 1993, 1994, 1996, 2002, 2004, 2007, 2008 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Note that i386/seq-gas.h is a GAS configuration that does not use this + file. */ + +/* Use the bsd assembler syntax. */ +/* we need to do this because gas is really a bsd style assembler, + * and so doesn't work well this these att-isms: + * + * ASM_OUTPUT_SKIP is .set .,.+N, which isn't implemented in gas + * ASM_OUTPUT_LOCAL is done with .set .,.+N, but that can't be + * used to define bss static space + * + * Next is the question of whether to uses underscores. RMS didn't + * like this idea at first, but since it is now obvious that we + * need this separate tm file for use with gas, at least to get + * dbx debugging info, I think we should also switch to underscores. + * We can keep i386v for real att style output, and the few + * people who want both form will have to compile twice. + */ + +/* these come from i386/bsd.h, but are specific to sequent */ +#undef DBX_NO_XREFS +#undef DBX_CONTIN_LENGTH + +/* Ask for COFF symbols. */ + +#define SDB_DEBUGGING_INFO 1 + +/* Output #ident as a .ident. */ + +#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); + +/* In the past there was confusion as to what the argument to .align was + in GAS. For the last several years the rule has been this: for a.out + file formats that argument is LOG, and for all other file formats the + argument is 1<. */ + +/* The purpose of this file is to define the characteristics of the i386, + independent of assembler syntax or operating system. + + Three other files build on this one to describe a specific assembler syntax: + bsd386.h, att386.h, and sun386.h. + + The actual tm.h file for a particular system should include + this file, and then the file for the appropriate assembler syntax. + + Many macros that specify assembler syntax are omitted entirely from + this file because they really belong in the files for particular + assemblers. These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR, + ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many + that start with ASM_ or end in ASM_OP. */ + +/* Redefines for option macros. */ + +#define TARGET_64BIT OPTION_ISA_64BIT +#define TARGET_MMX OPTION_ISA_MMX +#define TARGET_3DNOW OPTION_ISA_3DNOW +#define TARGET_3DNOW_A OPTION_ISA_3DNOW_A +#define TARGET_SSE OPTION_ISA_SSE +#define TARGET_SSE2 OPTION_ISA_SSE2 +#define TARGET_SSE3 OPTION_ISA_SSE3 +#define TARGET_SSSE3 OPTION_ISA_SSSE3 +#define TARGET_SSE4_1 OPTION_ISA_SSE4_1 +#define TARGET_SSE4_2 OPTION_ISA_SSE4_2 +#define TARGET_AVX OPTION_ISA_AVX +#define TARGET_FMA OPTION_ISA_FMA +#define TARGET_SSE4A OPTION_ISA_SSE4A +#define TARGET_FMA4 OPTION_ISA_FMA4 +#define TARGET_XOP OPTION_ISA_XOP +#define TARGET_LWP OPTION_ISA_LWP +#define TARGET_ROUND OPTION_ISA_ROUND +#define TARGET_ABM OPTION_ISA_ABM +#define TARGET_POPCNT OPTION_ISA_POPCNT +#define TARGET_SAHF OPTION_ISA_SAHF +#define TARGET_MOVBE OPTION_ISA_MOVBE +#define TARGET_CRC32 OPTION_ISA_CRC32 +#define TARGET_AES OPTION_ISA_AES +#define TARGET_PCLMUL OPTION_ISA_PCLMUL +#define TARGET_CMPXCHG16B OPTION_ISA_CX16 + + +/* SSE4.1 defines round instructions */ +#define OPTION_MASK_ISA_ROUND OPTION_MASK_ISA_SSE4_1 +#define OPTION_ISA_ROUND ((ix86_isa_flags & OPTION_MASK_ISA_ROUND) != 0) + +#include "config/vxworks-dummy.h" + +/* Algorithm to expand string function with. */ +enum stringop_alg +{ + no_stringop, + libcall, + rep_prefix_1_byte, + rep_prefix_4_byte, + rep_prefix_8_byte, + loop_1_byte, + loop, + unrolled_loop +}; + +#define NAX_STRINGOP_ALGS 4 + +/* Specify what algorithm to use for stringops on known size. + When size is unknown, the UNKNOWN_SIZE alg is used. When size is + known at compile time or estimated via feedback, the SIZE array + is walked in order until MAX is greater then the estimate (or -1 + means infinity). Corresponding ALG is used then. + For example initializer: + {{256, loop}, {-1, rep_prefix_4_byte}} + will use loop for blocks smaller or equal to 256 bytes, rep prefix will + be used otherwise. */ +struct stringop_algs +{ + const enum stringop_alg unknown_size; + const struct stringop_strategy { + const int max; + const enum stringop_alg alg; + } size [NAX_STRINGOP_ALGS]; +}; + +/* Define the specific costs for a given cpu */ + +struct processor_costs { + const int add; /* cost of an add instruction */ + const int lea; /* cost of a lea instruction */ + const int shift_var; /* variable shift costs */ + const int shift_const; /* constant shift costs */ + const int mult_init[5]; /* cost of starting a multiply + in QImode, HImode, SImode, DImode, TImode*/ + const int mult_bit; /* cost of multiply per each bit set */ + const int divide[5]; /* cost of a divide/mod + in QImode, HImode, SImode, DImode, TImode*/ + int movsx; /* The cost of movsx operation. */ + int movzx; /* The cost of movzx operation. */ + const int large_insn; /* insns larger than this cost more */ + const int move_ratio; /* The threshold of number of scalar + memory-to-memory move insns. */ + const int movzbl_load; /* cost of loading using movzbl */ + const int int_load[3]; /* cost of loading integer registers + in QImode, HImode and SImode relative + to reg-reg move (2). */ + const int int_store[3]; /* cost of storing integer register + in QImode, HImode and SImode */ + const int fp_move; /* cost of reg,reg fld/fst */ + const int fp_load[3]; /* cost of loading FP register + in SFmode, DFmode and XFmode */ + const int fp_store[3]; /* cost of storing FP register + in SFmode, DFmode and XFmode */ + const int mmx_move; /* cost of moving MMX register. */ + const int mmx_load[2]; /* cost of loading MMX register + in SImode and DImode */ + const int mmx_store[2]; /* cost of storing MMX register + in SImode and DImode */ + const int sse_move; /* cost of moving SSE register. */ + const int sse_load[3]; /* cost of loading SSE register + in SImode, DImode and TImode*/ + const int sse_store[3]; /* cost of storing SSE register + in SImode, DImode and TImode*/ + const int mmxsse_to_integer; /* cost of moving mmxsse register to + integer and vice versa. */ + const int l1_cache_size; /* size of l1 cache, in kilobytes. */ + const int l2_cache_size; /* size of l2 cache, in kilobytes. */ + const int prefetch_block; /* bytes moved to cache for prefetch. */ + const int simultaneous_prefetches; /* number of parallel prefetch + operations. */ + const int branch_cost; /* Default value for BRANCH_COST. */ + const int fadd; /* cost of FADD and FSUB instructions. */ + const int fmul; /* cost of FMUL instruction. */ + const int fdiv; /* cost of FDIV instruction. */ + const int fabs; /* cost of FABS instruction. */ + const int fchs; /* cost of FCHS instruction. */ + const int fsqrt; /* cost of FSQRT instruction. */ + /* Specify what algorithm + to use for stringops on unknown size. */ + struct stringop_algs memcpy[2], memset[2]; + const int scalar_stmt_cost; /* Cost of any scalar operation, excluding + load and store. */ + const int scalar_load_cost; /* Cost of scalar load. */ + const int scalar_store_cost; /* Cost of scalar store. */ + const int vec_stmt_cost; /* Cost of any vector operation, excluding + load, store, vector-to-scalar and + scalar-to-vector operation. */ + const int vec_to_scalar_cost; /* Cost of vect-to-scalar operation. */ + const int scalar_to_vec_cost; /* Cost of scalar-to-vector operation. */ + const int vec_align_load_cost; /* Cost of aligned vector load. */ + const int vec_unalign_load_cost; /* Cost of unaligned vector load. */ + const int vec_store_cost; /* Cost of vector store. */ + const int cond_taken_branch_cost; /* Cost of taken branch for vectorizer + cost model. */ + const int cond_not_taken_branch_cost;/* Cost of not taken branch for + vectorizer cost model. */ +}; + +extern const struct processor_costs *ix86_cost; +extern const struct processor_costs ix86_size_cost; + +#define ix86_cur_cost() \ + (optimize_insn_for_size_p () ? &ix86_size_cost: ix86_cost) + +/* Macros used in the machine description to test the flags. */ + +/* configure can arrange to make this 2, to force a 486. */ + +#ifndef TARGET_CPU_DEFAULT +#define TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT_generic +#endif + +#ifndef TARGET_FPMATH_DEFAULT +#define TARGET_FPMATH_DEFAULT \ + (TARGET_64BIT && TARGET_SSE ? FPMATH_SSE : FPMATH_387) +#endif + +#define TARGET_FLOAT_RETURNS_IN_80387 TARGET_FLOAT_RETURNS + +/* 64bit Sledgehammer mode. For libgcc2 we make sure this is a + compile-time constant. */ +#ifdef IN_LIBGCC2 +#undef TARGET_64BIT +#ifdef __x86_64__ +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#else +#ifndef TARGET_BI_ARCH +#undef TARGET_64BIT +#if TARGET_64BIT_DEFAULT +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#endif +#endif + +#define HAS_LONG_COND_BRANCH 1 +#define HAS_LONG_UNCOND_BRANCH 1 + +#define TARGET_386 (ix86_tune == PROCESSOR_I386) +#define TARGET_486 (ix86_tune == PROCESSOR_I486) +#define TARGET_PENTIUM (ix86_tune == PROCESSOR_PENTIUM) +#define TARGET_PENTIUMPRO (ix86_tune == PROCESSOR_PENTIUMPRO) +#define TARGET_GEODE (ix86_tune == PROCESSOR_GEODE) +#define TARGET_K6 (ix86_tune == PROCESSOR_K6) +#define TARGET_ATHLON (ix86_tune == PROCESSOR_ATHLON) +#define TARGET_PENTIUM4 (ix86_tune == PROCESSOR_PENTIUM4) +#define TARGET_K8 (ix86_tune == PROCESSOR_K8) +#define TARGET_ATHLON_K8 (TARGET_K8 || TARGET_ATHLON) +#define TARGET_NOCONA (ix86_tune == PROCESSOR_NOCONA) +#define TARGET_CORE2 (ix86_tune == PROCESSOR_CORE2) +#define TARGET_GENERIC32 (ix86_tune == PROCESSOR_GENERIC32) +#define TARGET_GENERIC64 (ix86_tune == PROCESSOR_GENERIC64) +#define TARGET_GENERIC (TARGET_GENERIC32 || TARGET_GENERIC64) +#define TARGET_AMDFAM10 (ix86_tune == PROCESSOR_AMDFAM10) +#define TARGET_ATOM (ix86_tune == PROCESSOR_ATOM) + +/* Feature tests against the various tunings. */ +enum ix86_tune_indices { + X86_TUNE_USE_LEAVE, + X86_TUNE_PUSH_MEMORY, + X86_TUNE_ZERO_EXTEND_WITH_AND, + X86_TUNE_UNROLL_STRLEN, + X86_TUNE_DEEP_BRANCH_PREDICTION, + X86_TUNE_BRANCH_PREDICTION_HINTS, + X86_TUNE_DOUBLE_WITH_ADD, + X86_TUNE_USE_SAHF, + X86_TUNE_MOVX, + X86_TUNE_PARTIAL_REG_STALL, + X86_TUNE_PARTIAL_FLAG_REG_STALL, + X86_TUNE_USE_HIMODE_FIOP, + X86_TUNE_USE_SIMODE_FIOP, + X86_TUNE_USE_MOV0, + X86_TUNE_USE_CLTD, + X86_TUNE_USE_XCHGB, + X86_TUNE_SPLIT_LONG_MOVES, + X86_TUNE_READ_MODIFY_WRITE, + X86_TUNE_READ_MODIFY, + X86_TUNE_PROMOTE_QIMODE, + X86_TUNE_FAST_PREFIX, + X86_TUNE_SINGLE_STRINGOP, + X86_TUNE_QIMODE_MATH, + X86_TUNE_HIMODE_MATH, + X86_TUNE_PROMOTE_QI_REGS, + X86_TUNE_PROMOTE_HI_REGS, + X86_TUNE_ADD_ESP_4, + X86_TUNE_ADD_ESP_8, + X86_TUNE_SUB_ESP_4, + X86_TUNE_SUB_ESP_8, + X86_TUNE_INTEGER_DFMODE_MOVES, + X86_TUNE_PARTIAL_REG_DEPENDENCY, + X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, + X86_TUNE_SSE_UNALIGNED_MOVE_OPTIMAL, + X86_TUNE_SSE_SPLIT_REGS, + X86_TUNE_SSE_TYPELESS_STORES, + X86_TUNE_SSE_LOAD0_BY_PXOR, + X86_TUNE_MEMORY_MISMATCH_STALL, + X86_TUNE_PROLOGUE_USING_MOVE, + X86_TUNE_EPILOGUE_USING_MOVE, + X86_TUNE_SHIFT1, + X86_TUNE_USE_FFREEP, + X86_TUNE_INTER_UNIT_MOVES, + X86_TUNE_INTER_UNIT_CONVERSIONS, + X86_TUNE_FOUR_JUMP_LIMIT, + X86_TUNE_SCHEDULE, + X86_TUNE_USE_BT, + X86_TUNE_USE_INCDEC, + X86_TUNE_PAD_RETURNS, + X86_TUNE_EXT_80387_CONSTANTS, + X86_TUNE_SHORTEN_X87_SSE, + X86_TUNE_AVOID_VECTOR_DECODE, + X86_TUNE_PROMOTE_HIMODE_IMUL, + X86_TUNE_SLOW_IMUL_IMM32_MEM, + X86_TUNE_SLOW_IMUL_IMM8, + X86_TUNE_MOVE_M1_VIA_OR, + X86_TUNE_NOT_UNPAIRABLE, + X86_TUNE_NOT_VECTORMODE, + X86_TUNE_USE_VECTOR_FP_CONVERTS, + X86_TUNE_USE_VECTOR_CONVERTS, + X86_TUNE_FUSE_CMP_AND_BRANCH, + X86_TUNE_OPT_AGU, + + X86_TUNE_LAST +}; + +extern unsigned char ix86_tune_features[X86_TUNE_LAST]; + +#define TARGET_USE_LEAVE ix86_tune_features[X86_TUNE_USE_LEAVE] +#define TARGET_PUSH_MEMORY ix86_tune_features[X86_TUNE_PUSH_MEMORY] +#define TARGET_ZERO_EXTEND_WITH_AND \ + ix86_tune_features[X86_TUNE_ZERO_EXTEND_WITH_AND] +#define TARGET_UNROLL_STRLEN ix86_tune_features[X86_TUNE_UNROLL_STRLEN] +#define TARGET_DEEP_BRANCH_PREDICTION \ + ix86_tune_features[X86_TUNE_DEEP_BRANCH_PREDICTION] +#define TARGET_BRANCH_PREDICTION_HINTS \ + ix86_tune_features[X86_TUNE_BRANCH_PREDICTION_HINTS] +#define TARGET_DOUBLE_WITH_ADD ix86_tune_features[X86_TUNE_DOUBLE_WITH_ADD] +#define TARGET_USE_SAHF ix86_tune_features[X86_TUNE_USE_SAHF] +#define TARGET_MOVX ix86_tune_features[X86_TUNE_MOVX] +#define TARGET_PARTIAL_REG_STALL ix86_tune_features[X86_TUNE_PARTIAL_REG_STALL] +#define TARGET_PARTIAL_FLAG_REG_STALL \ + ix86_tune_features[X86_TUNE_PARTIAL_FLAG_REG_STALL] +#define TARGET_USE_HIMODE_FIOP ix86_tune_features[X86_TUNE_USE_HIMODE_FIOP] +#define TARGET_USE_SIMODE_FIOP ix86_tune_features[X86_TUNE_USE_SIMODE_FIOP] +#define TARGET_USE_MOV0 ix86_tune_features[X86_TUNE_USE_MOV0] +#define TARGET_USE_CLTD ix86_tune_features[X86_TUNE_USE_CLTD] +#define TARGET_USE_XCHGB ix86_tune_features[X86_TUNE_USE_XCHGB] +#define TARGET_SPLIT_LONG_MOVES ix86_tune_features[X86_TUNE_SPLIT_LONG_MOVES] +#define TARGET_READ_MODIFY_WRITE ix86_tune_features[X86_TUNE_READ_MODIFY_WRITE] +#define TARGET_READ_MODIFY ix86_tune_features[X86_TUNE_READ_MODIFY] +#define TARGET_PROMOTE_QImode ix86_tune_features[X86_TUNE_PROMOTE_QIMODE] +#define TARGET_FAST_PREFIX ix86_tune_features[X86_TUNE_FAST_PREFIX] +#define TARGET_SINGLE_STRINGOP ix86_tune_features[X86_TUNE_SINGLE_STRINGOP] +#define TARGET_QIMODE_MATH ix86_tune_features[X86_TUNE_QIMODE_MATH] +#define TARGET_HIMODE_MATH ix86_tune_features[X86_TUNE_HIMODE_MATH] +#define TARGET_PROMOTE_QI_REGS ix86_tune_features[X86_TUNE_PROMOTE_QI_REGS] +#define TARGET_PROMOTE_HI_REGS ix86_tune_features[X86_TUNE_PROMOTE_HI_REGS] +#define TARGET_ADD_ESP_4 ix86_tune_features[X86_TUNE_ADD_ESP_4] +#define TARGET_ADD_ESP_8 ix86_tune_features[X86_TUNE_ADD_ESP_8] +#define TARGET_SUB_ESP_4 ix86_tune_features[X86_TUNE_SUB_ESP_4] +#define TARGET_SUB_ESP_8 ix86_tune_features[X86_TUNE_SUB_ESP_8] +#define TARGET_INTEGER_DFMODE_MOVES \ + ix86_tune_features[X86_TUNE_INTEGER_DFMODE_MOVES] +#define TARGET_PARTIAL_REG_DEPENDENCY \ + ix86_tune_features[X86_TUNE_PARTIAL_REG_DEPENDENCY] +#define TARGET_SSE_PARTIAL_REG_DEPENDENCY \ + ix86_tune_features[X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY] +#define TARGET_SSE_UNALIGNED_MOVE_OPTIMAL \ + ix86_tune_features[X86_TUNE_SSE_UNALIGNED_MOVE_OPTIMAL] +#define TARGET_SSE_SPLIT_REGS ix86_tune_features[X86_TUNE_SSE_SPLIT_REGS] +#define TARGET_SSE_TYPELESS_STORES \ + ix86_tune_features[X86_TUNE_SSE_TYPELESS_STORES] +#define TARGET_SSE_LOAD0_BY_PXOR ix86_tune_features[X86_TUNE_SSE_LOAD0_BY_PXOR] +#define TARGET_MEMORY_MISMATCH_STALL \ + ix86_tune_features[X86_TUNE_MEMORY_MISMATCH_STALL] +#define TARGET_PROLOGUE_USING_MOVE \ + ix86_tune_features[X86_TUNE_PROLOGUE_USING_MOVE] +#define TARGET_EPILOGUE_USING_MOVE \ + ix86_tune_features[X86_TUNE_EPILOGUE_USING_MOVE] +#define TARGET_SHIFT1 ix86_tune_features[X86_TUNE_SHIFT1] +#define TARGET_USE_FFREEP ix86_tune_features[X86_TUNE_USE_FFREEP] +#define TARGET_INTER_UNIT_MOVES ix86_tune_features[X86_TUNE_INTER_UNIT_MOVES] +#define TARGET_INTER_UNIT_CONVERSIONS\ + ix86_tune_features[X86_TUNE_INTER_UNIT_CONVERSIONS] +#define TARGET_FOUR_JUMP_LIMIT ix86_tune_features[X86_TUNE_FOUR_JUMP_LIMIT] +#define TARGET_SCHEDULE ix86_tune_features[X86_TUNE_SCHEDULE] +#define TARGET_USE_BT ix86_tune_features[X86_TUNE_USE_BT] +#define TARGET_USE_INCDEC ix86_tune_features[X86_TUNE_USE_INCDEC] +#define TARGET_PAD_RETURNS ix86_tune_features[X86_TUNE_PAD_RETURNS] +#define TARGET_EXT_80387_CONSTANTS \ + ix86_tune_features[X86_TUNE_EXT_80387_CONSTANTS] +#define TARGET_SHORTEN_X87_SSE ix86_tune_features[X86_TUNE_SHORTEN_X87_SSE] +#define TARGET_AVOID_VECTOR_DECODE \ + ix86_tune_features[X86_TUNE_AVOID_VECTOR_DECODE] +#define TARGET_TUNE_PROMOTE_HIMODE_IMUL \ + ix86_tune_features[X86_TUNE_PROMOTE_HIMODE_IMUL] +#define TARGET_SLOW_IMUL_IMM32_MEM \ + ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM32_MEM] +#define TARGET_SLOW_IMUL_IMM8 ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM8] +#define TARGET_MOVE_M1_VIA_OR ix86_tune_features[X86_TUNE_MOVE_M1_VIA_OR] +#define TARGET_NOT_UNPAIRABLE ix86_tune_features[X86_TUNE_NOT_UNPAIRABLE] +#define TARGET_NOT_VECTORMODE ix86_tune_features[X86_TUNE_NOT_VECTORMODE] +#define TARGET_USE_VECTOR_FP_CONVERTS \ + ix86_tune_features[X86_TUNE_USE_VECTOR_FP_CONVERTS] +#define TARGET_USE_VECTOR_CONVERTS \ + ix86_tune_features[X86_TUNE_USE_VECTOR_CONVERTS] +#define TARGET_FUSE_CMP_AND_BRANCH \ + ix86_tune_features[X86_TUNE_FUSE_CMP_AND_BRANCH] +#define TARGET_OPT_AGU ix86_tune_features[X86_TUNE_OPT_AGU] + +/* Feature tests against the various architecture variations. */ +enum ix86_arch_indices { + X86_ARCH_CMOVE, /* || TARGET_SSE */ + X86_ARCH_CMPXCHG, + X86_ARCH_CMPXCHG8B, + X86_ARCH_XADD, + X86_ARCH_BSWAP, + + X86_ARCH_LAST +}; + +extern unsigned char ix86_arch_features[X86_ARCH_LAST]; + +#define TARGET_CMOVE ix86_arch_features[X86_ARCH_CMOVE] +#define TARGET_CMPXCHG ix86_arch_features[X86_ARCH_CMPXCHG] +#define TARGET_CMPXCHG8B ix86_arch_features[X86_ARCH_CMPXCHG8B] +#define TARGET_XADD ix86_arch_features[X86_ARCH_XADD] +#define TARGET_BSWAP ix86_arch_features[X86_ARCH_BSWAP] + +#define TARGET_FISTTP (TARGET_SSE3 && TARGET_80387) + +extern int x86_prefetch_sse; + +#define TARGET_PREFETCH_SSE x86_prefetch_sse + +#define ASSEMBLER_DIALECT (ix86_asm_dialect) + +#define TARGET_SSE_MATH ((ix86_fpmath & FPMATH_SSE) != 0) +#define TARGET_MIX_SSE_I387 \ + ((ix86_fpmath & (FPMATH_SSE | FPMATH_387)) == (FPMATH_SSE | FPMATH_387)) + +#define TARGET_GNU_TLS (ix86_tls_dialect == TLS_DIALECT_GNU) +#define TARGET_GNU2_TLS (ix86_tls_dialect == TLS_DIALECT_GNU2) +#define TARGET_ANY_GNU_TLS (TARGET_GNU_TLS || TARGET_GNU2_TLS) +#define TARGET_SUN_TLS 0 + +extern int ix86_isa_flags; + +#ifndef TARGET_64BIT_DEFAULT +#define TARGET_64BIT_DEFAULT 0 +#endif +#ifndef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT +#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0 +#endif + +/* Fence to use after loop using storent. */ + +extern tree x86_mfence; +#define FENCE_FOLLOWING_MOVNT x86_mfence + +/* Once GDB has been enhanced to deal with functions without frame + pointers, we can change this to allow for elimination of + the frame pointer in leaf functions. */ +#define TARGET_DEFAULT 0 + +/* Extra bits to force. */ +#define TARGET_SUBTARGET_DEFAULT 0 +#define TARGET_SUBTARGET_ISA_DEFAULT 0 + +/* Extra bits to force on w/ 32-bit mode. */ +#define TARGET_SUBTARGET32_DEFAULT 0 +#define TARGET_SUBTARGET32_ISA_DEFAULT 0 + +/* Extra bits to force on w/ 64-bit mode. */ +#define TARGET_SUBTARGET64_DEFAULT 0 +#define TARGET_SUBTARGET64_ISA_DEFAULT 0 + +/* This is not really a target flag, but is done this way so that + it's analogous to similar code for Mach-O on PowerPC. darwin.h + redefines this to 1. */ +#define TARGET_MACHO 0 + +/* Likewise, for the Windows 64-bit ABI. */ +#define TARGET_64BIT_MS_ABI (TARGET_64BIT && ix86_cfun_abi () == MS_ABI) + +/* Available call abi. */ +enum calling_abi +{ + SYSV_ABI = 0, + MS_ABI = 1 +}; + +/* The abi used by target. */ +extern enum calling_abi ix86_abi; + +/* The default abi used by target. */ +#define DEFAULT_ABI SYSV_ABI + +/* Subtargets may reset this to 1 in order to enable 96-bit long double + with the rounding mode forced to 53 bits. */ +#define TARGET_96_ROUND_53_LONG_DOUBLE 0 + +/* Sometimes certain combinations of command options do not make + sense on a particular target machine. You can define a macro + `OVERRIDE_OPTIONS' to take account of this. This macro, if + defined, is executed once just after all the command options have + been parsed. + + Don't use this macro to turn on various extra optimizations for + `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ + +#define OVERRIDE_OPTIONS override_options (true) + +/* Define this to change the optimizations performed by default. */ +#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \ + optimization_options ((LEVEL), (SIZE)) + +/* -march=native handling only makes sense with compiler running on + an x86 or x86_64 chip. If changing this condition, also change + the condition in driver-i386.c. */ +#if defined(__i386__) || defined(__x86_64__) +/* In driver-i386.c. */ +extern const char *host_detect_local_cpu (int argc, const char **argv); +#define EXTRA_SPEC_FUNCTIONS \ + { "local_cpu_detect", host_detect_local_cpu }, +#define HAVE_LOCAL_CPU_DETECT +#endif + +#if TARGET_64BIT_DEFAULT +#define OPT_ARCH64 "!m32" +#define OPT_ARCH32 "m32" +#else +#define OPT_ARCH64 "m64" +#define OPT_ARCH32 "!m64" +#endif + +/* Support for configure-time defaults of some command line options. + The order here is important so that -march doesn't squash the + tune or cpu values. */ +#define OPTION_DEFAULT_SPECS \ + {"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ + {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \ + {"cpu_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \ + {"arch", "%{!march=*:-march=%(VALUE)}"}, \ + {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"}, \ + {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"}, + +/* Specs for the compiler proper */ + +#ifndef CC1_CPU_SPEC +#define CC1_CPU_SPEC_1 "\ +%{mcpu=*:-mtune=%* \ +%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n} \ +% BX_REG && !TARGET_64BIT ? SImode \ + : (MODE)) + +/* Specify the registers used for certain standard purposes. + The values of these macros are register numbers. */ + +/* on the 386 the pc register is %eip, and is not usable as a general + register. The ordinary mov instructions won't work */ +/* #define PC_REGNUM */ + +/* Register to use for pushing function arguments. */ +#define STACK_POINTER_REGNUM 7 + +/* Base register for access to local variables of the function. */ +#define HARD_FRAME_POINTER_REGNUM 6 + +/* Base register for access to local variables of the function. */ +#define FRAME_POINTER_REGNUM 20 + +/* First floating point reg */ +#define FIRST_FLOAT_REG 8 + +/* First & last stack-like regs */ +#define FIRST_STACK_REG FIRST_FLOAT_REG +#define LAST_STACK_REG (FIRST_FLOAT_REG + 7) + +#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1) +#define LAST_SSE_REG (FIRST_SSE_REG + 7) + +#define FIRST_MMX_REG (LAST_SSE_REG + 1) +#define LAST_MMX_REG (FIRST_MMX_REG + 7) + +#define FIRST_REX_INT_REG (LAST_MMX_REG + 1) +#define LAST_REX_INT_REG (FIRST_REX_INT_REG + 7) + +#define FIRST_REX_SSE_REG (LAST_REX_INT_REG + 1) +#define LAST_REX_SSE_REG (FIRST_REX_SSE_REG + 7) + +/* Override this in other tm.h files to cope with various OS lossage + requiring a frame pointer. */ +#ifndef SUBTARGET_FRAME_POINTER_REQUIRED +#define SUBTARGET_FRAME_POINTER_REQUIRED 0 +#endif + +/* Make sure we can access arbitrary call frames. */ +#define SETUP_FRAME_ADDRESSES() ix86_setup_frame_addresses () + +/* Base register for access to arguments of the function. */ +#define ARG_POINTER_REGNUM 16 + +/* Register to hold the addressing base for position independent + code access to data items. We don't use PIC pointer for 64bit + mode. Define the regnum to dummy value to prevent gcc from + pessimizing code dealing with EBX. + + To avoid clobbering a call-saved register unnecessarily, we renumber + the pic register when possible. The change is visible after the + prologue has been emitted. */ + +#define REAL_PIC_OFFSET_TABLE_REGNUM BX_REG + +#define PIC_OFFSET_TABLE_REGNUM \ + ((TARGET_64BIT && ix86_cmodel == CM_SMALL_PIC) \ + || !flag_pic ? INVALID_REGNUM \ + : reload_completed ? REGNO (pic_offset_table_rtx) \ + : REAL_PIC_OFFSET_TABLE_REGNUM) + +#define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_" + +/* This is overridden by . */ +#define MS_AGGREGATE_RETURN 0 + +/* This is overridden by . */ +#define KEEP_AGGREGATE_RETURN_POINTER 0 + +/* Define the classes of registers for register constraints in the + machine description. Also define ranges of constants. + + One of the classes must always be named ALL_REGS and include all hard regs. + If there is more than one class, another class must be named NO_REGS + and contain no registers. + + The name GENERAL_REGS must be the name of a class (or an alias for + another name such as ALL_REGS). This is the class of registers + that is allowed by "g" or "r" in a register constraint. + Also, registers outside this class are allocated only when + instructions express preferences for them. + + The classes must be numbered in nondecreasing order; that is, + a larger-numbered class must never be contained completely + in a smaller-numbered class. + + For any two classes, it is very desirable that there be another + class that represents their union. + + It might seem that class BREG is unnecessary, since no useful 386 + opcode needs reg %ebx. But some systems pass args to the OS in ebx, + and the "b" register constraint is useful in asms for syscalls. + + The flags, fpsr and fpcr registers are in no class. */ + +enum reg_class +{ + NO_REGS, + AREG, DREG, CREG, BREG, SIREG, DIREG, + AD_REGS, /* %eax/%edx for DImode */ + CLOBBERED_REGS, /* call-clobbered integers */ + Q_REGS, /* %eax %ebx %ecx %edx */ + NON_Q_REGS, /* %esi %edi %ebp %esp */ + INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */ + LEGACY_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */ + GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp %r8 - %r15*/ + FP_TOP_REG, FP_SECOND_REG, /* %st(0) %st(1) */ + FLOAT_REGS, + SSE_FIRST_REG, + SSE_REGS, + MMX_REGS, + FP_TOP_SSE_REGS, + FP_SECOND_SSE_REGS, + FLOAT_SSE_REGS, + FLOAT_INT_REGS, + INT_SSE_REGS, + FLOAT_INT_SSE_REGS, + ALL_REGS, LIM_REG_CLASSES +}; + +#define N_REG_CLASSES ((int) LIM_REG_CLASSES) + +#define INTEGER_CLASS_P(CLASS) \ + reg_class_subset_p ((CLASS), GENERAL_REGS) +#define FLOAT_CLASS_P(CLASS) \ + reg_class_subset_p ((CLASS), FLOAT_REGS) +#define SSE_CLASS_P(CLASS) \ + reg_class_subset_p ((CLASS), SSE_REGS) +#define MMX_CLASS_P(CLASS) \ + ((CLASS) == MMX_REGS) +#define MAYBE_INTEGER_CLASS_P(CLASS) \ + reg_classes_intersect_p ((CLASS), GENERAL_REGS) +#define MAYBE_FLOAT_CLASS_P(CLASS) \ + reg_classes_intersect_p ((CLASS), FLOAT_REGS) +#define MAYBE_SSE_CLASS_P(CLASS) \ + reg_classes_intersect_p (SSE_REGS, (CLASS)) +#define MAYBE_MMX_CLASS_P(CLASS) \ + reg_classes_intersect_p (MMX_REGS, (CLASS)) + +#define Q_CLASS_P(CLASS) \ + reg_class_subset_p ((CLASS), Q_REGS) + +/* Give names of register classes as strings for dump file. */ + +#define REG_CLASS_NAMES \ +{ "NO_REGS", \ + "AREG", "DREG", "CREG", "BREG", \ + "SIREG", "DIREG", \ + "AD_REGS", \ + "CLOBBERED_REGS", \ + "Q_REGS", "NON_Q_REGS", \ + "INDEX_REGS", \ + "LEGACY_REGS", \ + "GENERAL_REGS", \ + "FP_TOP_REG", "FP_SECOND_REG", \ + "FLOAT_REGS", \ + "SSE_FIRST_REG", \ + "SSE_REGS", \ + "MMX_REGS", \ + "FP_TOP_SSE_REGS", \ + "FP_SECOND_SSE_REGS", \ + "FLOAT_SSE_REGS", \ + "FLOAT_INT_REGS", \ + "INT_SSE_REGS", \ + "FLOAT_INT_SSE_REGS", \ + "ALL_REGS" } + +/* Define which registers fit in which classes. This is an initializer + for a vector of HARD_REG_SET of length N_REG_CLASSES. + + Note that the default setting of CLOBBERED_REGS is for 32-bit; this + is adjusted by CONDITIONAL_REGISTER_USAGE for the 64-bit ABI in effect. */ + +#define REG_CLASS_CONTENTS \ +{ { 0x00, 0x0 }, \ + { 0x01, 0x0 }, { 0x02, 0x0 }, /* AREG, DREG */ \ + { 0x04, 0x0 }, { 0x08, 0x0 }, /* CREG, BREG */ \ + { 0x10, 0x0 }, { 0x20, 0x0 }, /* SIREG, DIREG */ \ + { 0x03, 0x0 }, /* AD_REGS */ \ + { 0x07, 0x0 }, /* CLOBBERED_REGS */ \ + { 0x0f, 0x0 }, /* Q_REGS */ \ + { 0x1100f0, 0x1fe0 }, /* NON_Q_REGS */ \ + { 0x7f, 0x1fe0 }, /* INDEX_REGS */ \ + { 0x1100ff, 0x0 }, /* LEGACY_REGS */ \ + { 0x1100ff, 0x1fe0 }, /* GENERAL_REGS */ \ + { 0x100, 0x0 }, { 0x0200, 0x0 },/* FP_TOP_REG, FP_SECOND_REG */\ + { 0xff00, 0x0 }, /* FLOAT_REGS */ \ + { 0x200000, 0x0 }, /* SSE_FIRST_REG */ \ +{ 0x1fe00000,0x1fe000 }, /* SSE_REGS */ \ +{ 0xe0000000, 0x1f }, /* MMX_REGS */ \ +{ 0x1fe00100,0x1fe000 }, /* FP_TOP_SSE_REG */ \ +{ 0x1fe00200,0x1fe000 }, /* FP_SECOND_SSE_REG */ \ +{ 0x1fe0ff00,0x3fe000 }, /* FLOAT_SSE_REGS */ \ + { 0x1ffff, 0x1fe0 }, /* FLOAT_INT_REGS */ \ +{ 0x1fe100ff,0x1fffe0 }, /* INT_SSE_REGS */ \ +{ 0x1fe1ffff,0x1fffe0 }, /* FLOAT_INT_SSE_REGS */ \ +{ 0xffffffff,0x1fffff } \ +} + +/* The same information, inverted: + Return the class number of the smallest class containing + reg number REGNO. This could be a conditional expression + or could index an array. */ + +#define REGNO_REG_CLASS(REGNO) (regclass_map[REGNO]) + +/* When defined, the compiler allows registers explicitly used in the + rtl to be used as spill registers but prevents the compiler from + extending the lifetime of these registers. */ + +#define SMALL_REGISTER_CLASSES 1 + +#define QI_REG_P(X) (REG_P (X) && REGNO (X) <= BX_REG) + +#define GENERAL_REGNO_P(N) \ + ((N) <= STACK_POINTER_REGNUM || REX_INT_REGNO_P (N)) + +#define GENERAL_REG_P(X) \ + (REG_P (X) && GENERAL_REGNO_P (REGNO (X))) + +#define ANY_QI_REG_P(X) (TARGET_64BIT ? GENERAL_REG_P(X) : QI_REG_P (X)) + +#define REX_INT_REGNO_P(N) \ + IN_RANGE ((N), FIRST_REX_INT_REG, LAST_REX_INT_REG) +#define REX_INT_REG_P(X) (REG_P (X) && REX_INT_REGNO_P (REGNO (X))) + +#define FP_REG_P(X) (REG_P (X) && FP_REGNO_P (REGNO (X))) +#define FP_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG) +#define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X))) +#define ANY_FP_REGNO_P(N) (FP_REGNO_P (N) || SSE_REGNO_P (N)) + +#define X87_FLOAT_MODE_P(MODE) \ + (TARGET_80387 && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode)) + +#define SSE_REG_P(N) (REG_P (N) && SSE_REGNO_P (REGNO (N))) +#define SSE_REGNO_P(N) \ + (IN_RANGE ((N), FIRST_SSE_REG, LAST_SSE_REG) \ + || REX_SSE_REGNO_P (N)) + +#define REX_SSE_REGNO_P(N) \ + IN_RANGE ((N), FIRST_REX_SSE_REG, LAST_REX_SSE_REG) + +#define SSE_REGNO(N) \ + ((N) < 8 ? FIRST_SSE_REG + (N) : FIRST_REX_SSE_REG + (N) - 8) + +#define SSE_FLOAT_MODE_P(MODE) \ + ((TARGET_SSE && (MODE) == SFmode) || (TARGET_SSE2 && (MODE) == DFmode)) + +#define SSE_VEC_FLOAT_MODE_P(MODE) \ + ((TARGET_SSE && (MODE) == V4SFmode) || (TARGET_SSE2 && (MODE) == V2DFmode)) + +#define AVX_FLOAT_MODE_P(MODE) \ + (TARGET_AVX && ((MODE) == SFmode || (MODE) == DFmode)) + +#define AVX128_VEC_FLOAT_MODE_P(MODE) \ + (TARGET_AVX && ((MODE) == V4SFmode || (MODE) == V2DFmode)) + +#define AVX256_VEC_FLOAT_MODE_P(MODE) \ + (TARGET_AVX && ((MODE) == V8SFmode || (MODE) == V4DFmode)) + +#define AVX_VEC_FLOAT_MODE_P(MODE) \ + (TARGET_AVX && ((MODE) == V4SFmode || (MODE) == V2DFmode \ + || (MODE) == V8SFmode || (MODE) == V4DFmode)) + +#define FMA4_VEC_FLOAT_MODE_P(MODE) \ + (TARGET_FMA4 && ((MODE) == V4SFmode || (MODE) == V2DFmode \ + || (MODE) == V8SFmode || (MODE) == V4DFmode)) + +#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP))) +#define MMX_REGNO_P(N) IN_RANGE ((N), FIRST_MMX_REG, LAST_MMX_REG) + +#define STACK_REG_P(XOP) (REG_P (XOP) && STACK_REGNO_P (REGNO (XOP))) +#define STACK_REGNO_P(N) IN_RANGE ((N), FIRST_STACK_REG, LAST_STACK_REG) + +#define STACK_TOP_P(XOP) (REG_P (XOP) && REGNO (XOP) == FIRST_STACK_REG) + +#define CC_REG_P(X) (REG_P (X) && CC_REGNO_P (REGNO (X))) +#define CC_REGNO_P(X) ((X) == FLAGS_REG || (X) == FPSR_REG) + +/* The class value for index registers, and the one for base regs. */ + +#define INDEX_REG_CLASS INDEX_REGS +#define BASE_REG_CLASS GENERAL_REGS + +/* Place additional restrictions on the register class to use when it + is necessary to be able to hold a value of mode MODE in a reload + register for which class CLASS would ordinarily be used. */ + +#define LIMIT_RELOAD_CLASS(MODE, CLASS) \ + ((MODE) == QImode && !TARGET_64BIT \ + && ((CLASS) == ALL_REGS || (CLASS) == GENERAL_REGS \ + || (CLASS) == LEGACY_REGS || (CLASS) == INDEX_REGS) \ + ? Q_REGS : (CLASS)) + +/* Given an rtx X being reloaded into a reg required to be + in class CLASS, return the class of reg to actually use. + In general this is just CLASS; but on some machines + in some cases it is preferable to use a more restrictive class. + On the 80386 series, we prevent floating constants from being + reloaded into floating registers (since no move-insn can do that) + and we ensure that QImodes aren't reloaded into the esi or edi reg. */ + +/* Put float CONST_DOUBLE in the constant pool instead of fp regs. + QImode must go into class Q_REGS. + Narrow ALL_REGS to GENERAL_REGS. This supports allowing movsf and + movdf to do mem-to-mem moves through integer regs. */ + +#define PREFERRED_RELOAD_CLASS(X, CLASS) \ + ix86_preferred_reload_class ((X), (CLASS)) + +/* Discourage putting floating-point values in SSE registers unless + SSE math is being used, and likewise for the 387 registers. */ + +#define PREFERRED_OUTPUT_RELOAD_CLASS(X, CLASS) \ + ix86_preferred_output_reload_class ((X), (CLASS)) + +/* If we are copying between general and FP registers, we need a memory + location. The same is true for SSE and MMX registers. */ +#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ + ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1) + +/* Get_secondary_mem widens integral modes to BITS_PER_WORD. + There is no need to emit full 64 bit move on 64 bit targets + for integral modes that can be moved using 32 bit move. */ +#define SECONDARY_MEMORY_NEEDED_MODE(MODE) \ + (GET_MODE_BITSIZE (MODE) < 32 && INTEGRAL_MODE_P (MODE) \ + ? mode_for_size (32, GET_MODE_CLASS (MODE), 0) \ + : MODE) + +/* Return the maximum number of consecutive registers + needed to represent mode MODE in a register of class CLASS. */ +/* On the 80386, this is the size of MODE in words, + except in the FP regs, where a single reg is always enough. */ +#define CLASS_MAX_NREGS(CLASS, MODE) \ + (!MAYBE_INTEGER_CLASS_P (CLASS) \ + ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \ + : (((((MODE) == XFmode ? 12 : GET_MODE_SIZE (MODE))) \ + + UNITS_PER_WORD - 1) / UNITS_PER_WORD)) + +/* A C expression whose value is nonzero if pseudos that have been + assigned to registers of class CLASS would likely be spilled + because registers of CLASS are needed for spill registers. + + The default value of this macro returns 1 if CLASS has exactly one + register and zero otherwise. On most machines, this default + should be used. Only define this macro to some other expression + if pseudo allocated by `local-alloc.c' end up in memory because + their hard registers were needed for spill registers. If this + macro returns nonzero for those classes, those pseudos will only + be allocated by `global.c', which knows how to reallocate the + pseudo to another register. If there would not be another + register available for reallocation, you should not change the + definition of this macro since the only effect of such a + definition would be to slow down register allocation. */ + +#define CLASS_LIKELY_SPILLED_P(CLASS) \ + (((CLASS) == AREG) \ + || ((CLASS) == DREG) \ + || ((CLASS) == CREG) \ + || ((CLASS) == BREG) \ + || ((CLASS) == AD_REGS) \ + || ((CLASS) == SIREG) \ + || ((CLASS) == DIREG) \ + || ((CLASS) == SSE_FIRST_REG) \ + || ((CLASS) == FP_TOP_REG) \ + || ((CLASS) == FP_SECOND_REG)) + +/* Return a class of registers that cannot change FROM mode to TO mode. */ + +#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ + ix86_cannot_change_mode_class (FROM, TO, CLASS) + +/* Stack layout; function entry, exit and calling. */ + +/* Define this if pushing a word on the stack + makes the stack pointer a smaller address. */ +#define STACK_GROWS_DOWNWARD + +/* Define this to nonzero if the nominal address of the stack frame + is at the high-address end of the local variables; + that is, each additional local variable allocated + goes at a more negative offset in the frame. */ +#define FRAME_GROWS_DOWNWARD 1 + +/* Offset within stack frame to start allocating local variables at. + If FRAME_GROWS_DOWNWARD, this is the offset to the END of the + first local allocated. Otherwise, it is the offset to the BEGINNING + of the first local allocated. */ +#define STARTING_FRAME_OFFSET 0 + +/* If we generate an insn to push BYTES bytes, + this says how many the stack pointer really advances by. + On 386, we have pushw instruction that decrements by exactly 2 no + matter what the position was, there is no pushb. + But as CIE data alignment factor on this arch is -4, we need to make + sure all stack pointer adjustments are in multiple of 4. + + For 64bit ABI we round up to 8 bytes. + */ + +#define PUSH_ROUNDING(BYTES) \ + (TARGET_64BIT \ + ? (((BYTES) + 7) & (-8)) \ + : (((BYTES) + 3) & (-4))) + +/* If defined, the maximum amount of space required for outgoing arguments will + be computed and placed into the variable + `crtl->outgoing_args_size'. No space will be pushed onto the + stack for each call; instead, the function prologue should increase the stack + frame size by this amount. + + MS ABI seem to require 16 byte alignment everywhere except for function + prologue and apilogue. This is not possible without + ACCUMULATE_OUTGOING_ARGS. */ + +#define ACCUMULATE_OUTGOING_ARGS \ + (TARGET_ACCUMULATE_OUTGOING_ARGS || ix86_cfun_abi () == MS_ABI) + +/* If defined, a C expression whose value is nonzero when we want to use PUSH + instructions to pass outgoing arguments. */ + +#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS) + +/* We want the stack and args grow in opposite directions, even if + PUSH_ARGS is 0. */ +#define PUSH_ARGS_REVERSED 1 + +/* Offset of first parameter from the argument pointer register value. */ +#define FIRST_PARM_OFFSET(FNDECL) 0 + +/* Define this macro if functions should assume that stack space has been + allocated for arguments even when their values are passed in registers. + + The value of this macro is the size, in bytes, of the area reserved for + arguments passed in registers for the function represented by FNDECL. + + This space can be allocated by the caller, or be a part of the + machine-dependent stack frame: `OUTGOING_REG_PARM_STACK_SPACE' says + which. */ +#define REG_PARM_STACK_SPACE(FNDECL) ix86_reg_parm_stack_space (FNDECL) + +#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) \ + (ix86_function_type_abi (FNTYPE) == MS_ABI) + +/* Value is the number of bytes of arguments automatically + popped when returning from a subroutine call. + FUNDECL is the declaration node of the function (as a tree), + FUNTYPE is the data type of the function (as a tree), + or for a library call it is an identifier node for the subroutine name. + SIZE is the number of bytes of arguments passed on the stack. + + On the 80386, the RTD insn may be used to pop them if the number + of args is fixed, but if the number is variable then the caller + must pop them all. RTD can't be used for library calls now + because the library is compiled with the Unix compiler. + Use of RTD is a selectable option, since it is incompatible with + standard Unix calling sequences. If the option is not selected, + the caller must always pop the args. + + The attribute stdcall is equivalent to RTD on a per module basis. */ + +#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, SIZE) \ + ix86_return_pops_args ((FUNDECL), (FUNTYPE), (SIZE)) + +#define FUNCTION_VALUE_REGNO_P(N) ix86_function_value_regno_p (N) + +/* Define how to find the value returned by a library function + assuming the value has mode MODE. */ + +#define LIBCALL_VALUE(MODE) ix86_libcall_value (MODE) + +/* Define the size of the result block used for communication between + untyped_call and untyped_return. The block contains a DImode value + followed by the block used by fnsave and frstor. */ + +#define APPLY_RESULT_SIZE (8+108) + +/* 1 if N is a possible register number for function argument passing. */ +#define FUNCTION_ARG_REGNO_P(N) ix86_function_arg_regno_p (N) + +/* Define a data type for recording info about an argument list + during the scan of that argument list. This data type should + hold all necessary information about the function itself + and about the args processed so far, enough to enable macros + such as FUNCTION_ARG to determine where the next arg should go. */ + +typedef struct ix86_args { + int words; /* # words passed so far */ + int nregs; /* # registers available for passing */ + int regno; /* next available register number */ + int fastcall; /* fastcall calling convention is used */ + int sse_words; /* # sse words passed so far */ + int sse_nregs; /* # sse registers available for passing */ + int warn_avx; /* True when we want to warn about AVX ABI. */ + int warn_sse; /* True when we want to warn about SSE ABI. */ + int warn_mmx; /* True when we want to warn about MMX ABI. */ + int sse_regno; /* next available sse register number */ + int mmx_words; /* # mmx words passed so far */ + int mmx_nregs; /* # mmx registers available for passing */ + int mmx_regno; /* next available mmx register number */ + int maybe_vaarg; /* true for calls to possibly vardic fncts. */ + int float_in_sse; /* 1 if in 32-bit mode SFmode (2 for DFmode) should + be passed in SSE registers. Otherwise 0. */ + enum calling_abi call_abi; /* Set to SYSV_ABI for sysv abi. Otherwise + MS_ABI for ms abi. */ +} CUMULATIVE_ARGS; + +/* Initialize a variable CUM of type CUMULATIVE_ARGS + for a call to a function whose data type is FNTYPE. + For a library call, FNTYPE is 0. */ + +#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ + init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (FNDECL)) + +/* Update the data in CUM to advance over an argument + of mode MODE and data type TYPE. + (TYPE is null for libcalls where that information may not be available.) */ + +#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ + function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED)) + +/* Define where to put the arguments to a function. + Value is zero to push the argument on the stack, + or a hard register in which to store the argument. + + MODE is the argument's machine mode. + TYPE is the data type of the argument (as a tree). + This is null for libcalls where that information may + not be available. + CUM is a variable of type CUMULATIVE_ARGS which gives info about + the preceding args and about the function being called. + NAMED is nonzero if this argument is a named parameter + (otherwise it is an extra parameter matching an ellipsis). */ + +#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ + function_arg (&(CUM), (MODE), (TYPE), (NAMED)) + +/* Output assembler code to FILE to increment profiler label # LABELNO + for profiling a function entry. */ + +#define FUNCTION_PROFILER(FILE, LABELNO) x86_function_profiler (FILE, LABELNO) + +#define MCOUNT_NAME "_mcount" + +#define PROFILE_COUNT_REGISTER "edx" + +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, + the stack pointer does not matter. The value is tested only in + functions that have frame pointers. + No definition is equivalent to always zero. */ +/* Note on the 386 it might be more efficient not to define this since + we have to restore it ourselves from the frame pointer, in order to + use pop */ + +#define EXIT_IGNORE_STACK 1 + +/* Output assembler code for a block containing the constant parts + of a trampoline, leaving space for the variable parts. */ + +/* On the 386, the trampoline contains two instructions: + mov #STATIC,ecx + jmp FUNCTION + The trampoline is generated entirely at runtime. The operand of JMP + is the address of FUNCTION relative to the instruction following the + JMP (which is 5 bytes long). */ + +/* Length in units of the trampoline for entering a nested function. */ + +#define TRAMPOLINE_SIZE (TARGET_64BIT ? 24 : 10) + +/* Definitions for register eliminations. + + This is an array of structures. Each structure initializes one pair + of eliminable registers. The "from" register number is given first, + followed by "to". Eliminations of the same "from" register are listed + in order of preference. + + There are two registers that can always be eliminated on the i386. + The frame pointer and the arg pointer can be replaced by either the + hard frame pointer or to the stack pointer, depending upon the + circumstances. The hard frame pointer is not used before reload and + so it is not eligible for elimination. */ + +#define ELIMINABLE_REGS \ +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \ + +/* Define the offset between two registers, one to be eliminated, and the other + its replacement, at the start of a routine. */ + +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ + ((OFFSET) = ix86_initial_elimination_offset ((FROM), (TO))) + +/* Addressing modes, and classification of registers for them. */ + +/* Macros to check register numbers against specific register classes. */ + +/* These assume that REGNO is a hard or pseudo reg number. + They give nonzero only if REGNO is a hard reg of the suitable class + or a pseudo reg currently allocated to a suitable hard reg. + Since they use reg_renumber, they are safe only once reg_renumber + has been allocated, which happens in local-alloc.c. */ + +#define REGNO_OK_FOR_INDEX_P(REGNO) \ + ((REGNO) < STACK_POINTER_REGNUM \ + || REX_INT_REGNO_P (REGNO) \ + || (unsigned) reg_renumber[(REGNO)] < STACK_POINTER_REGNUM \ + || REX_INT_REGNO_P ((unsigned) reg_renumber[(REGNO)])) + +#define REGNO_OK_FOR_BASE_P(REGNO) \ + (GENERAL_REGNO_P (REGNO) \ + || (REGNO) == ARG_POINTER_REGNUM \ + || (REGNO) == FRAME_POINTER_REGNUM \ + || GENERAL_REGNO_P ((unsigned) reg_renumber[(REGNO)])) + +/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx + and check its validity for a certain class. + We have two alternate definitions for each of them. + The usual definition accepts all pseudo regs; the other rejects + them unless they have been allocated suitable hard regs. + The symbol REG_OK_STRICT causes the latter definition to be used. + + Most source files want to accept pseudo regs in the hope that + they will get allocated to the class that the insn wants them to be in. + Source files for reload pass need to be strict. + After reload, it makes no difference, since pseudo regs have + been eliminated by then. */ + + +/* Non strict versions, pseudos are ok. */ +#define REG_OK_FOR_INDEX_NONSTRICT_P(X) \ + (REGNO (X) < STACK_POINTER_REGNUM \ + || REX_INT_REGNO_P (REGNO (X)) \ + || REGNO (X) >= FIRST_PSEUDO_REGISTER) + +#define REG_OK_FOR_BASE_NONSTRICT_P(X) \ + (GENERAL_REGNO_P (REGNO (X)) \ + || REGNO (X) == ARG_POINTER_REGNUM \ + || REGNO (X) == FRAME_POINTER_REGNUM \ + || REGNO (X) >= FIRST_PSEUDO_REGISTER) + +/* Strict versions, hard registers only */ +#define REG_OK_FOR_INDEX_STRICT_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) +#define REG_OK_FOR_BASE_STRICT_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) + +#ifndef REG_OK_STRICT +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_NONSTRICT_P (X) +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_NONSTRICT_P (X) + +#else +#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_INDEX_STRICT_P (X) +#define REG_OK_FOR_BASE_P(X) REG_OK_FOR_BASE_STRICT_P (X) +#endif + +/* TARGET_LEGITIMATE_ADDRESS_P recognizes an RTL expression + that is a valid memory address for an instruction. + The MODE argument is the machine mode for the MEM expression + that wants to use this address. + + The other macros defined here are used only in TARGET_LEGITIMATE_ADDRESS_P, + except for CONSTANT_ADDRESS_P which is usually machine-independent. + + See legitimize_pic_address in i386.c for details as to what + constitutes a legitimate address when -fpic is used. */ + +#define MAX_REGS_PER_ADDRESS 2 + +#define CONSTANT_ADDRESS_P(X) constant_address_p (X) + +/* Nonzero if the constant value X is a legitimate general operand. + It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ + +#define LEGITIMATE_CONSTANT_P(X) legitimate_constant_p (X) + +/* If defined, a C expression to determine the base term of address X. + This macro is used in only one place: `find_base_term' in alias.c. + + It is always safe for this macro to not be defined. It exists so + that alias analysis can understand machine-dependent addresses. + + The typical use of this macro is to handle addresses containing + a label_ref or symbol_ref within an UNSPEC. */ + +#define FIND_BASE_TERM(X) ix86_find_base_term (X) + +/* Nonzero if the constant value X is a legitimate general operand + when generating PIC code. It is given that flag_pic is on and + that X satisfies CONSTANT_P or is a CONST_DOUBLE. */ + +#define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X) + +#define SYMBOLIC_CONST(X) \ + (GET_CODE (X) == SYMBOL_REF \ + || GET_CODE (X) == LABEL_REF \ + || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) + +/* Max number of args passed in registers. If this is more than 3, we will + have problems with ebx (register #4), since it is a caller save register and + is also used as the pic register in ELF. So for now, don't allow more than + 3 registers to be passed in registers. */ + +/* Abi specific values for REGPARM_MAX and SSE_REGPARM_MAX */ +#define X86_64_REGPARM_MAX 6 +#define X86_64_MS_REGPARM_MAX 4 + +#define X86_32_REGPARM_MAX 3 + +#define REGPARM_MAX \ + (TARGET_64BIT ? (TARGET_64BIT_MS_ABI ? X86_64_MS_REGPARM_MAX \ + : X86_64_REGPARM_MAX) \ + : X86_32_REGPARM_MAX) + +#define X86_64_SSE_REGPARM_MAX 8 +#define X86_64_MS_SSE_REGPARM_MAX 4 + +#define X86_32_SSE_REGPARM_MAX (TARGET_SSE ? (TARGET_MACHO ? 4 : 3) : 0) + +#define SSE_REGPARM_MAX \ + (TARGET_64BIT ? (TARGET_64BIT_MS_ABI ? X86_64_MS_SSE_REGPARM_MAX \ + : X86_64_SSE_REGPARM_MAX) \ + : X86_32_SSE_REGPARM_MAX) + +#define MMX_REGPARM_MAX (TARGET_64BIT ? 0 : (TARGET_MMX ? 3 : 0)) + + +/* Specify the machine mode that this machine uses + for the index in the tablejump instruction. */ +#define CASE_VECTOR_MODE \ + (!TARGET_64BIT || (flag_pic && ix86_cmodel != CM_LARGE_PIC) ? SImode : DImode) + +/* Define this as 1 if `char' should by default be signed; else as 0. */ +#define DEFAULT_SIGNED_CHAR 1 + +/* Max number of bytes we can move from memory to memory + in one reasonably fast instruction. */ +#define MOVE_MAX 16 + +/* MOVE_MAX_PIECES is the number of bytes at a time which we can + move efficiently, as opposed to MOVE_MAX which is the maximum + number of bytes we can move with a single instruction. */ +#define MOVE_MAX_PIECES (TARGET_64BIT ? 8 : 4) + +/* If a memory-to-memory move would take MOVE_RATIO or more simple + move-instruction pairs, we will do a movmem or libcall instead. + Increasing the value will always make code faster, but eventually + incurs high cost in increased code size. + + If you don't define this, a reasonable default is used. */ + +#define MOVE_RATIO(speed) ((speed) ? ix86_cost->move_ratio : 3) + +/* If a clear memory operation would take CLEAR_RATIO or more simple + move-instruction sequences, we will do a clrmem or libcall instead. */ + +#define CLEAR_RATIO(speed) ((speed) ? MIN (6, ix86_cost->move_ratio) : 2) + +/* Define if shifts truncate the shift count + which implies one can omit a sign-extension or zero-extension + of a shift count. */ +/* On i386, shifts do truncate the count. But bit opcodes don't. */ + +/* #define SHIFT_COUNT_TRUNCATED */ + +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits + is done just by pretending it is already truncated. */ +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1 + +/* A macro to update M and UNSIGNEDP when an object whose type is + TYPE and which has the specified mode and signedness is to be + stored in a register. This macro is only called when TYPE is a + scalar type. + + On i386 it is sometimes useful to promote HImode and QImode + quantities to SImode. The choice depends on target type. */ + +#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ +do { \ + if (((MODE) == HImode && TARGET_PROMOTE_HI_REGS) \ + || ((MODE) == QImode && TARGET_PROMOTE_QI_REGS)) \ + (MODE) = SImode; \ +} while (0) + +/* Specify the machine mode that pointers have. + After generation of rtl, the compiler makes no further distinction + between pointers and any other objects of this machine mode. */ +#define Pmode (TARGET_64BIT ? DImode : SImode) + +/* A function address in a call instruction + is a byte address (for indexing purposes) + so give the MEM rtx a byte's mode. */ +#define FUNCTION_MODE QImode + +/* A C expression for the cost of moving data from a register in class FROM to + one in class TO. The classes are expressed using the enumeration values + such as `GENERAL_REGS'. A value of 2 is the default; other values are + interpreted relative to that. + + It is not required that the cost always equal 2 when FROM is the same as TO; + on some machines it is expensive to move between registers if they are not + general registers. */ + +#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ + ix86_register_move_cost ((MODE), (CLASS1), (CLASS2)) + +/* A C expression for the cost of moving data of mode M between a + register and memory. A value of 2 is the default; this cost is + relative to those in `REGISTER_MOVE_COST'. + + If moving between registers and memory is more expensive than + between two registers, you should define this macro to express the + relative cost. */ + +#define MEMORY_MOVE_COST(MODE, CLASS, IN) \ + ix86_memory_move_cost ((MODE), (CLASS), (IN)) + +/* A C expression for the cost of a branch instruction. A value of 1 + is the default; other values are interpreted relative to that. */ + +#define BRANCH_COST(speed_p, predictable_p) \ + (!(speed_p) ? 2 : (predictable_p) ? 0 : ix86_branch_cost) + +/* Define this macro as a C expression which is nonzero if accessing + less than a word of memory (i.e. a `char' or a `short') is no + faster than accessing a word of memory, i.e., if such access + require more than one instruction or if there is no difference in + cost between byte and (aligned) word loads. + + When this macro is not defined, the compiler will access a field by + finding the smallest containing object; when it is defined, a + fullword load will be used if alignment permits. Unless bytes + accesses are faster than word accesses, using word accesses is + preferable since it may eliminate subsequent memory access if + subsequent accesses occur to other fields in the same word of the + structure, but to different bytes. */ + +#define SLOW_BYTE_ACCESS 0 + +/* Nonzero if access to memory by shorts is slow and undesirable. */ +#define SLOW_SHORT_ACCESS 0 + +/* Define this macro to be the value 1 if unaligned accesses have a + cost many times greater than aligned accesses, for example if they + are emulated in a trap handler. + + When this macro is nonzero, the compiler will act as if + `STRICT_ALIGNMENT' were nonzero when generating code for block + moves. This can cause significantly more instructions to be + produced. Therefore, do not set this macro nonzero if unaligned + accesses only add a cycle or two to the time for a memory access. + + If the value of this macro is always zero, it need not be defined. */ + +/* #define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 0 */ + +/* Define this macro if it is as good or better to call a constant + function address than to call an address kept in a register. + + Desirable on the 386 because a CALL with a constant address is + faster than one with a register address. */ + +#define NO_FUNCTION_CSE + +/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE, + return the mode to be used for the comparison. + + For floating-point equality comparisons, CCFPEQmode should be used. + VOIDmode should be used in all other cases. + + For integer comparisons against zero, reduce to CCNOmode or CCZmode if + possible, to allow for more combinations. */ + +#define SELECT_CC_MODE(OP, X, Y) ix86_cc_mode ((OP), (X), (Y)) + +/* Return nonzero if MODE implies a floating point inequality can be + reversed. */ + +#define REVERSIBLE_CC_MODE(MODE) 1 + +/* A C expression whose value is reversed condition code of the CODE for + comparison done in CC_MODE mode. */ +#define REVERSE_CONDITION(CODE, MODE) ix86_reverse_condition ((CODE), (MODE)) + + +/* Control the assembler format that we output, to the extent + this does not vary between assemblers. */ + +/* How to refer to registers in assembler output. + This sequence is indexed by compiler's hard-register-number (see above). */ + +/* In order to refer to the first 8 regs as 32-bit regs, prefix an "e". + For non floating point regs, the following are the HImode names. + + For float regs, the stack top is sometimes referred to as "%st(0)" + instead of just "%st". PRINT_OPERAND handles this with the "y" code. */ + +#define HI_REGISTER_NAMES \ +{"ax","dx","cx","bx","si","di","bp","sp", \ + "st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)", \ + "argp", "flags", "fpsr", "fpcr", "frame", \ + "xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7", \ + "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7", \ + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ + "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"} + +#define REGISTER_NAMES HI_REGISTER_NAMES + +/* Table of additional register names to use in user input. */ + +#define ADDITIONAL_REGISTER_NAMES \ +{ { "eax", 0 }, { "edx", 1 }, { "ecx", 2 }, { "ebx", 3 }, \ + { "esi", 4 }, { "edi", 5 }, { "ebp", 6 }, { "esp", 7 }, \ + { "rax", 0 }, { "rdx", 1 }, { "rcx", 2 }, { "rbx", 3 }, \ + { "rsi", 4 }, { "rdi", 5 }, { "rbp", 6 }, { "rsp", 7 }, \ + { "al", 0 }, { "dl", 1 }, { "cl", 2 }, { "bl", 3 }, \ + { "ah", 0 }, { "dh", 1 }, { "ch", 2 }, { "bh", 3 } } + +/* Note we are omitting these since currently I don't know how +to get gcc to use these, since they want the same but different +number as al, and ax. +*/ + +#define QI_REGISTER_NAMES \ +{"al", "dl", "cl", "bl", "sil", "dil", "bpl", "spl",} + +/* These parallel the array above, and can be used to access bits 8:15 + of regs 0 through 3. */ + +#define QI_HIGH_REGISTER_NAMES \ +{"ah", "dh", "ch", "bh", } + +/* How to renumber registers for dbx and gdb. */ + +#define DBX_REGISTER_NUMBER(N) \ + (TARGET_64BIT ? dbx64_register_map[(N)] : dbx_register_map[(N)]) + +extern int const dbx_register_map[FIRST_PSEUDO_REGISTER]; +extern int const dbx64_register_map[FIRST_PSEUDO_REGISTER]; +extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; + +/* Before the prologue, RA is at 0(%esp). */ +#define INCOMING_RETURN_ADDR_RTX \ + gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM)) + +/* After the prologue, RA is at -4(AP) in the current frame. */ +#define RETURN_ADDR_RTX(COUNT, FRAME) \ + ((COUNT) == 0 \ + ? gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -UNITS_PER_WORD)) \ + : gen_rtx_MEM (Pmode, plus_constant (FRAME, UNITS_PER_WORD))) + +/* PC is dbx register 8; let's use that column for RA. */ +#define DWARF_FRAME_RETURN_COLUMN (TARGET_64BIT ? 16 : 8) + +/* Before the prologue, the top of the frame is at 4(%esp). */ +#define INCOMING_FRAME_SP_OFFSET UNITS_PER_WORD + +/* Describe how we implement __builtin_eh_return. */ +#define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? (N) : INVALID_REGNUM) +#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 2) + + +/* Select a format to encode pointers in exception handling data. CODE + is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is + true if the symbol may be affected by dynamic relocations. + + ??? All x86 object file formats are capable of representing this. + After all, the relocation needed is the same as for the call insn. + Whether or not a particular assembler allows us to enter such, I + guess we'll have to see. */ +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ + asm_preferred_eh_data_format ((CODE), (GLOBAL)) + +/* This is how to output an insn to push a register on the stack. + It need not be very fast code. */ + +#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ +do { \ + if (TARGET_64BIT) \ + asm_fprintf ((FILE), "\tpush{q}\t%%r%s\n", \ + reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ + else \ + asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(REGNO)]); \ +} while (0) + +/* This is how to output an insn to pop a register from the stack. + It need not be very fast code. */ + +#define ASM_OUTPUT_REG_POP(FILE, REGNO) \ +do { \ + if (TARGET_64BIT) \ + asm_fprintf ((FILE), "\tpop{q}\t%%r%s\n", \ + reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ + else \ + asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(REGNO)]); \ +} while (0) + +/* This is how to output an element of a case-vector that is absolute. */ + +#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ + ix86_output_addr_vec_elt ((FILE), (VALUE)) + +/* This is how to output an element of a case-vector that is relative. */ + +#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ + ix86_output_addr_diff_elt ((FILE), (VALUE), (REL)) + +/* When we see %v, we will print the 'v' prefix if TARGET_AVX is + true. */ + +#define ASM_OUTPUT_AVX_PREFIX(STREAM, PTR) \ +{ \ + if ((PTR)[0] == '%' && (PTR)[1] == 'v') \ + { \ + if (TARGET_AVX) \ + (PTR) += 1; \ + else \ + (PTR) += 2; \ + } \ +} + +/* A C statement or statements which output an assembler instruction + opcode to the stdio stream STREAM. The macro-operand PTR is a + variable of type `char *' which points to the opcode name in + its "internal" form--the form that is written in the machine + description. */ + +#define ASM_OUTPUT_OPCODE(STREAM, PTR) \ + ASM_OUTPUT_AVX_PREFIX ((STREAM), (PTR)) + +/* A C statement to output to the stdio stream FILE an assembler + command to pad the location counter to a multiple of 1<machine->stack_locals) +#define ix86_varargs_gpr_size (cfun->machine->varargs_gpr_size) +#define ix86_varargs_fpr_size (cfun->machine->varargs_fpr_size) +#define ix86_optimize_mode_switching (cfun->machine->optimize_mode_switching) +#define ix86_current_function_needs_cld (cfun->machine->needs_cld) +#define ix86_tls_descriptor_calls_expanded_in_cfun \ + (cfun->machine->tls_descriptor_call_expanded_p) +/* Since tls_descriptor_call_expanded is not cleared, even if all TLS + calls are optimized away, we try to detect cases in which it was + optimized away. Since such instructions (use (reg REG_SP)), we can + verify whether there's any such instruction live by testing that + REG_SP is live. */ +#define ix86_current_function_calls_tls_descriptor \ + (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG)) +#define ix86_cfa_state (&cfun->machine->cfa) +#define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack) + +/* Control behavior of x86_file_start. */ +#define X86_FILE_START_VERSION_DIRECTIVE false +#define X86_FILE_START_FLTUSED false + +/* Flag to mark data that is in the large address area. */ +#define SYMBOL_FLAG_FAR_ADDR (SYMBOL_FLAG_MACH_DEP << 0) +#define SYMBOL_REF_FAR_ADDR_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_FAR_ADDR) != 0) + +/* Flags to mark dllimport/dllexport. Used by PE ports, but handy to + have defined always, to avoid ifdefing. */ +#define SYMBOL_FLAG_DLLIMPORT (SYMBOL_FLAG_MACH_DEP << 1) +#define SYMBOL_REF_DLLIMPORT_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0) + +#define SYMBOL_FLAG_DLLEXPORT (SYMBOL_FLAG_MACH_DEP << 2) +#define SYMBOL_REF_DLLEXPORT_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0) + +/* Model costs for vectorizer. */ + +/* Cost of conditional branch. */ +#undef TARG_COND_BRANCH_COST +#define TARG_COND_BRANCH_COST ix86_cost->branch_cost + +/* Enum through the target specific extra va_list types. + Please, do not iterate the base va_list type name. */ +#define TARGET_ENUM_VA_LIST(IDX, PNAME, PTYPE) \ + (TARGET_64BIT ? ix86_enum_va_list (IDX, PNAME, PTYPE) : 0) + +/* Cost of any scalar operation, excluding load and store. */ +#undef TARG_SCALAR_STMT_COST +#define TARG_SCALAR_STMT_COST ix86_cost->scalar_stmt_cost + +/* Cost of scalar load. */ +#undef TARG_SCALAR_LOAD_COST +#define TARG_SCALAR_LOAD_COST ix86_cost->scalar_load_cost + +/* Cost of scalar store. */ +#undef TARG_SCALAR_STORE_COST +#define TARG_SCALAR_STORE_COST ix86_cost->scalar_store_cost + +/* Cost of any vector operation, excluding load, store or vector to scalar + operation. */ +#undef TARG_VEC_STMT_COST +#define TARG_VEC_STMT_COST ix86_cost->vec_stmt_cost + +/* Cost of vector to scalar operation. */ +#undef TARG_VEC_TO_SCALAR_COST +#define TARG_VEC_TO_SCALAR_COST ix86_cost->vec_to_scalar_cost + +/* Cost of scalar to vector operation. */ +#undef TARG_SCALAR_TO_VEC_COST +#define TARG_SCALAR_TO_VEC_COST ix86_cost->scalar_to_vec_cost + +/* Cost of aligned vector load. */ +#undef TARG_VEC_LOAD_COST +#define TARG_VEC_LOAD_COST ix86_cost->vec_align_load_cost + +/* Cost of misaligned vector load. */ +#undef TARG_VEC_UNALIGNED_LOAD_COST +#define TARG_VEC_UNALIGNED_LOAD_COST ix86_cost->vec_unalign_load_cost + +/* Cost of vector store. */ +#undef TARG_VEC_STORE_COST +#define TARG_VEC_STORE_COST ix86_cost->vec_store_cost + +/* Cost of conditional taken branch for vectorizer cost model. */ +#undef TARG_COND_TAKEN_BRANCH_COST +#define TARG_COND_TAKEN_BRANCH_COST ix86_cost->cond_taken_branch_cost + +/* Cost of conditional not taken branch for vectorizer cost model. */ +#undef TARG_COND_NOT_TAKEN_BRANCH_COST +#define TARG_COND_NOT_TAKEN_BRANCH_COST ix86_cost->cond_not_taken_branch_cost + +/* +Local variables: +version-control: t +End: +*/ diff --git a/contrib/sdk/sources/gcc_eh/config/i386/mingw-stdint.h b/contrib/sdk/sources/gcc_eh/config/i386/mingw-stdint.h new file mode 100644 index 0000000000..1403737e8a --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/mingw-stdint.h @@ -0,0 +1,50 @@ +/* Definitions for types on systems using mingw. + Copyright (C) 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE "long long int" +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE "long long unsigned int" + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE "long long int" +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE "long long unsigned int" + +#define INT_FAST8_TYPE "signed char" +#define INT_FAST16_TYPE "short int" +#define INT_FAST32_TYPE "int" +#define INT_FAST64_TYPE "long long int" +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE "short unsigned int" +#define UINT_FAST32_TYPE "unsigned int" +#define UINT_FAST64_TYPE "long long unsigned int" + +#define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int") +#define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int") diff --git a/contrib/sdk/sources/gcc_eh/config/i386/mingw32.h b/contrib/sdk/sources/gcc_eh/config/i386/mingw32.h new file mode 100644 index 0000000000..0258ca0a24 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/mingw32.h @@ -0,0 +1,249 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows32, using GNU tools and the Windows32 API Library. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#undef TARGET_VERSION +#if TARGET_64BIT_DEFAULT +#define TARGET_VERSION fprintf (stderr,"(x86_64 MinGW"); +#else +#define TARGET_VERSION fprintf (stderr," (x86 MinGW)"); +#endif + +/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS + is for compatibility with native compiler. */ +#define EXTRA_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__MSVCRT__"); \ + builtin_define ("__MINGW32__"); \ + builtin_define ("_WIN32"); \ + builtin_define_std ("WIN32"); \ + builtin_define_std ("WINNT"); \ + builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \ + TYPE_PRECISION (intmax_type_node));\ + if (TARGET_64BIT && ix86_abi == MS_ABI) \ + { \ + builtin_define ("__MINGW64__"); \ + builtin_define_std ("WIN64"); \ + builtin_define_std ("_WIN64"); \ + } \ + } \ + while (0) + +#undef SUB_LINK_ENTRY32 +#undef SUB_LINK_ENTRY64 +#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" +#if defined(USE_MINGW64_LEADING_UNDERSCORES) +#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup" +#else +#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup" +#endif + +#undef SUB_LINK_ENTRY +#if TARGET_64BIT_DEFAULT +#define SUB_LINK_ENTRY SUB_LINK_ENTRY64 +#else +#define SUB_LINK_ENTRY SUB_LINK_ENTRY32 +#endif + +/* Override the standard choice of /usr/include as the default prefix + to try when searching for header files. */ +#undef STANDARD_INCLUDE_DIR +#define STANDARD_INCLUDE_DIR "/mingw/include" +#undef STANDARD_INCLUDE_COMPONENT +#define STANDARD_INCLUDE_COMPONENT "MINGW" + +#undef CPP_SPEC +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" + +/* For Windows applications, include more libraries, but always include + kernel32. */ +#undef LIB_SPEC +#define LIB_SPEC "%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} \ + -luser32 -lkernel32 -ladvapi32 -lshell32" + +/* Weak symbols do not get resolved if using a Windows dll import lib. + Make the unwind registration references strong undefs. */ +#if DWARF2_UNWIND_INFO +/* DW2-unwind is just available for 32-bit mode. */ +#if TARGET_64BIT_DEFAULT +#error DW2 unwind is not available for 64-bit. +#endif +#define SHARED_LIBGCC_UNDEFS_SPEC \ + "%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}" +#else +#define SHARED_LIBGCC_UNDEFS_SPEC "" +#endif + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC } + +#define LINK_SPEC "%{mwindows:--subsystem windows} \ + %{mconsole:--subsystem console} \ + %{shared: %{mdll: %eshared and mdll are not compatible}} \ + %{shared: --shared} %{mdll:--dll} \ + %{static:-Bstatic} %{!static:-Bdynamic} \ + %{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \ + %(shared_libgcc_undefs)" + +/* Include in the mingw32 libraries with libgcc */ +#ifdef ENABLE_SHARED_LIBGCC +#define SHARED_LIBGCC_SPEC "%{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh}" +#else +#define SHARED_LIBGCC_SPEC /*empty*/ +#endif +#undef REAL_LIBGCC_SPEC +#define REAL_LIBGCC_SPEC \ + "%{mthreads:-lmingwthrd} -lmingw32 \ + "SHARED_LIBGCC_SPEC" \ + -lgcc \ + -lmoldname -lmingwex -lmsvcrt" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \ + %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \ + crtbegin.o%s" + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ + crtend.o%s" + +/* Override startfile prefix defaults. */ +#ifndef STANDARD_STARTFILE_PREFIX_1 +#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/" +#endif +#ifndef STANDARD_STARTFILE_PREFIX_2 +#define STANDARD_STARTFILE_PREFIX_2 "" +#endif + +/* Put all *tf routines in libgcc. */ +#undef LIBGCC2_HAS_TF_MODE +#define LIBGCC2_HAS_TF_MODE 1 +#undef LIBGCC2_TF_CEXT +#define LIBGCC2_TF_CEXT q +#undef TF_SIZE +#define TF_SIZE 113 + +/* Output STRING, a string representing a filename, to FILE. + We canonicalize it to be in Unix format (backslashes are replaced + forward slashes. */ +#undef OUTPUT_QUOTED_STRING +#define OUTPUT_QUOTED_STRING(FILE, STRING) \ +do { \ + char c; \ + \ + putc ('\"', asm_file); \ + \ + while ((c = *string++) != 0) \ + { \ + if (c == '\\') \ + c = '/'; \ + \ + if (ISPRINT (c)) \ + { \ + if (c == '\"') \ + putc ('\\', asm_file); \ + putc (c, asm_file); \ + } \ + else \ + fprintf (asm_file, "\\%03o", (unsigned char) c); \ + } \ + \ + putc ('\"', asm_file); \ +} while (0) + +/* Define as short unsigned for compatibility with MS runtime. */ +#undef WINT_TYPE +#define WINT_TYPE "short unsigned int" + +/* mingw32 uses the -mthreads option to enable thread support. */ +#undef GOMP_SELF_SPECS +#define GOMP_SELF_SPECS "%{fopenmp: -mthreads}" + +/* mingw32 atexit function is safe to use in shared libraries. Use it + to register C++ static destructors. */ +#define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true + +/* Contains a pointer to type target_ovr_attr defining the target specific + overrides of format attributes. See c-format.h for structure + definition. */ +#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES +#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides + +/* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */ +#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT +#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3 + +/* Custom initialization for warning -Wpedantic-ms-format for c-format. */ +#undef TARGET_OVERRIDES_FORMAT_INIT +#define TARGET_OVERRIDES_FORMAT_INIT msformat_init + +/* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */ +#undef TARGET_FORMAT_TYPES +#define TARGET_FORMAT_TYPES mingw_format_attributes + +#undef TARGET_N_FORMAT_TYPES +#define TARGET_N_FORMAT_TYPES 3 + +/* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */ +#undef TARGET_USE_JCR_SECTION + +#undef MINGW_ENABLE_EXECUTE_STACK +#define MINGW_ENABLE_EXECUTE_STACK \ +extern void __enable_execute_stack (void *); \ +void \ +__enable_execute_stack (void *addr) \ +{ \ + MEMORY_BASIC_INFORMATION b; \ + if (!VirtualQuery (addr, &b, sizeof(b))) \ + abort (); \ + VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, \ + &b.Protect); \ +} + +#undef ENABLE_EXECUTE_STACK +#define ENABLE_EXECUTE_STACK MINGW_ENABLE_EXECUTE_STACK +#undef CHECK_EXECUTE_STACK_ENABLED +#define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable + +#ifdef IN_LIBGCC2 +#include +#endif + +/* For 64-bit Windows we can't use DW2 unwind info. Also for multilib + builds we can't use it, too. */ +#if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH) +#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h" +#endif + +/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */ +/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */ +#if DWARF2_UNWIND_INFO +#define LIBGCC_EH_EXTN "_dw2" +#else +#define LIBGCC_EH_EXTN "_sjlj" +#endif +#define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll" + +/* We should find a way to not have to update this manually. */ +#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-11.dll" + diff --git a/contrib/sdk/sources/gcc_eh/config/i386/unix.h b/contrib/sdk/sources/gcc_eh/config/i386/unix.h new file mode 100644 index 0000000000..aa6c4a38ae --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/unix.h @@ -0,0 +1,81 @@ +/* Definitions for Unix assembler syntax for the Intel 80386. + Copyright (C) 1988, 1994, 1999, 2000, 2001, 2002, 2007, 2009 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +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. + +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 +. */ + +/* This file defines the aspects of assembler syntax + that are the same for all the i386 Unix systems + (though they may differ in non-Unix systems). */ + +/* Define macro used to output shift-double opcodes when the shift + count is in %cl. Some assemblers require %cl as an argument; + some don't. This macro controls what to do: by default, don't + print %cl. */ +#define SHIFT_DOUBLE_OMITS_COUNT 1 + +/* Define the syntax of pseudo-ops, labels and comments. */ + +/* String containing the assembler's comment-starter. + Note the trailing space is necessary in case the character + that immediately follows the comment is '*'. If this happens + and the space is not there the assembler will interpret this + as the start of a C-like slash-star comment and complain when + there is no terminator. */ + +#define ASM_COMMENT_START "/ " + +/* Output to assembler file text saying following lines + may contain character constants, extra white space, comments, etc. */ + +#define ASM_APP_ON "/APP\n" + +/* Output to assembler file text saying following lines + no longer contain unusual constructs. */ + +#define ASM_APP_OFF "/NO_APP\n" + +/* Output before read-only data. */ + +#define TEXT_SECTION_ASM_OP "\t.text" + +/* Output before writable (initialized) data. */ + +#define DATA_SECTION_ASM_OP "\t.data" + +/* Output before writable (uninitialized) data. */ + +#define BSS_SECTION_ASM_OP "\t.bss" + +/* Globalizing directive for a label. */ +#define GLOBAL_ASM_OP ".globl " + +/* By default, target has a 80387, uses IEEE compatible arithmetic, + and returns float values in the 387. */ +#undef TARGET_SUBTARGET_DEFAULT +#define TARGET_SUBTARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) + +/* By default, 64-bit mode uses 128-bit long double. */ +#undef TARGET_SUBTARGET64_DEFAULT +#define TARGET_SUBTARGET64_DEFAULT \ + MASK_128BIT_LONG_DOUBLE diff --git a/contrib/sdk/sources/gcc_eh/config/i386/w32-unwind.h b/contrib/sdk/sources/gcc_eh/config/i386/w32-unwind.h new file mode 100644 index 0000000000..ce8be23694 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/i386/w32-unwind.h @@ -0,0 +1,212 @@ +/* Definitions for Dwarf2 EH unwind support for Windows32 targets + Copyright (C) 2007, 2009 + Free Software Foundation, Inc. + Contributed by Pascal Obry + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + + +/* This file implements the md_fallback_frame_state_for routine for + Windows, triggered when the GCC table based unwinding process hits a + frame for which no unwind info has been registered. This typically + occurs when raising an exception from a signal handler, because the + handler is actually called from the OS kernel. + + The basic idea is to detect that we are indeed trying to unwind past a + signal handler and to fill out the GCC internal unwinding structures for + the OS kernel frame as if it had been directly called from the + interrupted context. + + This is all assuming that the code to set the handler asked the kernel + to pass a pointer to such context information. + + There is three main parts. + + 1) The first thing to do is to check if we are in a signal context. If + not we can just return as there is nothing to do. We are probably on + some foreign code for which no unwind frame can be found. If this is + a call from the Windows signal handler, then: + + 2) We must get the signal context information. + + * With the standard exception filter: + + This is on Windows pointed to by an EXCEPTION_POINTERS. We know that + the signal handle will call an UnhandledExceptionFilter with this + parameter. The spec for this routine is: + + LONG WINAPI UnhandledExceptionFilter(struct _EXCEPTION_POINTERS*); + + So the pointer to struct _EXCEPTION_POINTERS must be somewhere on the + stack. + + This was found experimentally to always be at offset 0 of the context + frame in all cases handled by this implementation. + + * With the SEH exception handler: + + In this case the signal context is directly on the stack as the SEH + exception handler has the following prototype: + + DWORD + SEH_error_handler (PEXCEPTION_RECORD ExceptionRecord, + PVOID EstablisherFrame, + PCONTEXT ContextRecord, + PVOID DispatcherContext) + + This was found experimentally to always be at offset 56 of the + context frame in all cases handled by this implementation. + + 3) When we have the signal context we just have to save some registers + and set the return address based on the program counter (Eip). + + Note that this implementation follows closely the same principles as the + GNU/Linux and OSF ones. */ + +#define WIN32_MEAN_AND_LEAN +#include +/* Patterns found experimentally to be on a Windows signal handler */ + +/* In a standard exception filter */ + +#define SIG_PAT1 \ + (pc_[-2] == 0xff && pc_[-1] == 0xd0 /* call %eax */ \ + && pc_[0] == 0x83 && pc_[1] == 0xf8) /* cmp 0xdepl,%eax */ + +#define SIG_PAT2 \ + (pc_[-5] == 0xe8 && pc_[-4] == 0x68 /* call (depl16) */ \ + && pc_[0] == 0xc3) /* ret */ + +/* In a Win32 SEH handler */ + +#define SIG_SEH1 \ + (pc_[-5] == 0xe8 /* call addr */ \ + && pc_[0] == 0x83 && pc_[1] == 0xc4 /* add 0xval,%esp */ \ + && pc_[3] == 0xb8) /* mov 0xval,%eax */ + +#define SIG_SEH2 \ + (pc_[-5] == 0x8b && pc_[-4] == 0x4d /* mov depl(%ebp),%ecx */ \ + && pc_[0] == 0x64 && pc_[1] == 0x8b) /* mov %fs:(0), */ \ + +/* In the GCC alloca (stack probing) */ + +#define SIG_ALLOCA \ + (pc_[-1] == 0x83 /* orl $0x0,(%ecx) */ \ + && pc_[0] == 0x9 && pc_[1] == 0 \ + && pc_[2] == 0x2d && pc_[3] == 0 /* subl $0x1000,%eax */ \ + && pc_[4] == 0x10 && pc_[5] == 0) + + +#define MD_FALLBACK_FRAME_STATE_FOR i386_w32_fallback_frame_state + +static _Unwind_Reason_Code +i386_w32_fallback_frame_state (struct _Unwind_Context *context, + _Unwind_FrameState *fs) + +{ + void * ctx_ra_ = (void *)(context->ra); /* return address */ + void * ctx_cfa_ = (void *)(context->cfa); /* context frame address */ + unsigned char * pc_ = (unsigned char *) ctx_ra_; + + /* In the test below we look for two specific patterns found + experimentally to be in the Windows signal handler. */ + + if (SIG_PAT1 || SIG_PAT2 || SIG_SEH1 || SIG_SEH2) + { + PEXCEPTION_POINTERS weinfo_; + PCONTEXT proc_ctx_; + long new_cfa_; + + if (SIG_SEH1) + proc_ctx_ = (PCONTEXT) (*(int*)(ctx_cfa_ + 56)); + else if (SIG_SEH2) + proc_ctx_ = (PCONTEXT) (*(int*)(ctx_cfa_ + 8)); + else + { + weinfo_ = (PEXCEPTION_POINTERS) (*(int*)ctx_cfa_); + proc_ctx_ = weinfo_->ContextRecord; + } + + /* The new context frame address is the stack pointer. */ + + new_cfa_ = proc_ctx_->Esp; + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = __builtin_dwarf_sp_column(); + fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_; + + /* Save some registers. */ + + fs->regs.reg[0].how = REG_SAVED_OFFSET; + fs->regs.reg[0].loc.offset = (long)&proc_ctx_->Eax - new_cfa_; + fs->regs.reg[3].how = REG_SAVED_OFFSET; + fs->regs.reg[3].loc.offset = (long)&proc_ctx_->Ebx - new_cfa_; + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = (long)&proc_ctx_->Ecx - new_cfa_; + fs->regs.reg[2].how = REG_SAVED_OFFSET; + fs->regs.reg[2].loc.offset = (long)&proc_ctx_->Edx - new_cfa_; + fs->regs.reg[6].how = REG_SAVED_OFFSET; + fs->regs.reg[6].loc.offset = (long)&proc_ctx_->Esi - new_cfa_; + fs->regs.reg[7].how = REG_SAVED_OFFSET; + fs->regs.reg[7].loc.offset = (long)&proc_ctx_->Edi - new_cfa_; + fs->regs.reg[9].how = REG_SAVED_OFFSET; + fs->regs.reg[9].loc.offset = (long)&proc_ctx_->Eip - new_cfa_; + fs->regs.reg[4].how = REG_SAVED_OFFSET; + fs->regs.reg[4].loc.offset = (long)&proc_ctx_->Ebp - new_cfa_; + + /* Set the return address to Eip + 1. As we can be called multiple + times we use another register for this. */ + + proc_ctx_->Dr0 = proc_ctx_->Eip + 1; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = (long)&proc_ctx_->Dr0 - new_cfa_; + fs->retaddr_column = 8; + return _URC_NO_REASON; + } + + /* Unwinding through _alloca, propagating from a trap triggered by + one of it's probes prior to the real SP adjustment. The only + operations of interest performed is "pushl %ecx", followed by + ecx clobbering. */ + + else if (SIG_ALLOCA) + { + /* Only one push between entry in _alloca and the probe trap. */ + long new_cfa_ = (long) ctx_cfa_ + 4; + + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = __builtin_dwarf_sp_column(); + fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_; + + /* The saved value of %ecx is at CFA - 4 */ + fs->regs.reg[1].how = REG_SAVED_OFFSET; + fs->regs.reg[1].loc.offset = -4; + + /* and what is stored at the CFA is the return address. */ + fs->retaddr_column = 8; + fs->regs.reg[8].how = REG_SAVED_OFFSET; + fs->regs.reg[8].loc.offset = 0; + + return _URC_NO_REASON; + } + else + return _URC_END_OF_STACK; +} diff --git a/contrib/sdk/sources/gcc_eh/config/tm-dwarf2.h b/contrib/sdk/sources/gcc_eh/config/tm-dwarf2.h new file mode 100644 index 0000000000..d08646eccf --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/tm-dwarf2.h @@ -0,0 +1,4 @@ +/* Enable Dwarf2 debugging and make it the default */ +#define DWARF2_DEBUGGING_INFO 1 +#undef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG diff --git a/contrib/sdk/sources/gcc_eh/config/vxworks-dummy.h b/contrib/sdk/sources/gcc_eh/config/vxworks-dummy.h new file mode 100644 index 0000000000..e3ea6ad6a9 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/config/vxworks-dummy.h @@ -0,0 +1,40 @@ +/* Dummy definitions of VxWorks-related macros + Copyright (C) 2007, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +/* True if we're targetting VxWorks. */ +#ifndef TARGET_VXWORKS +#define TARGET_VXWORKS 0 +#endif + +/* True if generating code for a VxWorks RTP. */ +#ifndef TARGET_VXWORKS_RTP +#define TARGET_VXWORKS_RTP false +#endif + +/* The symbol that points to an RTP's table of GOTs. */ +#define VXWORKS_GOTT_BASE (gcc_unreachable (), "") + +/* The symbol that holds the index of the current module's GOT in + VXWORKS_GOTT_BASE. */ +#define VXWORKS_GOTT_INDEX (gcc_unreachable (), "") diff --git a/contrib/sdk/sources/gcc_eh/coretypes.h b/contrib/sdk/sources/gcc_eh/coretypes.h new file mode 100644 index 0000000000..0b8261fc61 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/coretypes.h @@ -0,0 +1,128 @@ +/* GCC core type declarations. + Copyright (C) 2002, 2004, 2007, 2008, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +/* Provide forward declarations of core types which are referred to by + most of the compiler. This allows header files to use these types + (e.g. in function prototypes) without concern for whether the full + definitions are visible. Some other declarations that need to be + universally visible are here, too. + + In the context of tconfig.h, most of these have special definitions + which prevent them from being used except in further type + declarations. This is a kludge; the right thing is to avoid + including the "tm.h" header set in the context of tconfig.h, but + we're not there yet. */ + +#ifndef GCC_CORETYPES_H +#define GCC_CORETYPES_H + +#ifndef GTY +#define GTY(x) /* nothing - marker for gengtype */ +#endif + +#ifndef USED_FOR_TARGET + +struct bitmap_head_def; +typedef struct bitmap_head_def *bitmap; +typedef const struct bitmap_head_def *const_bitmap; +struct rtx_def; +typedef struct rtx_def *rtx; +typedef const struct rtx_def *const_rtx; +struct rtvec_def; +typedef struct rtvec_def *rtvec; +typedef const struct rtvec_def *const_rtvec; +union tree_node; +typedef union tree_node *tree; +union gimple_statement_d; +typedef union gimple_statement_d *gimple; +typedef const union tree_node *const_tree; +typedef const union gimple_statement_d *const_gimple; +union section; +typedef union section section; +struct cl_target_option; +struct cl_optimization; +struct gimple_seq_d; +typedef struct gimple_seq_d *gimple_seq; +typedef const struct gimple_seq_d *const_gimple_seq; +struct gimple_seq_node_d; +typedef struct gimple_seq_node_d *gimple_seq_node; +typedef const struct gimple_seq_node_d *const_gimple_seq_node; + +/* Address space number for named address space support. */ +typedef unsigned char addr_space_t; + +/* The value of addr_space_t that represents the generic address space. */ +#define ADDR_SPACE_GENERIC 0 +#define ADDR_SPACE_GENERIC_P(AS) ((AS) == ADDR_SPACE_GENERIC) + +/* The major intermediate representations of GCC. */ +enum ir_type { + IR_GIMPLE, + IR_RTL_CFGRTL, + IR_RTL_CFGLAYOUT +}; + +/* Provide forward struct declaration so that we don't have to include + all of cpplib.h whenever a random prototype includes a pointer. + Note that the cpp_reader and cpp_token typedefs remain part of + cpplib.h. */ + +struct cpp_reader; +struct cpp_token; + +/* The thread-local storage model associated with a given VAR_DECL + or SYMBOL_REF. This isn't used much, but both trees and RTL refer + to it, so it's here. */ +enum tls_model { + TLS_MODEL_NONE, + TLS_MODEL_EMULATED, + TLS_MODEL_REAL, + TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL, + TLS_MODEL_LOCAL_DYNAMIC, + TLS_MODEL_INITIAL_EXEC, + TLS_MODEL_LOCAL_EXEC +}; + +struct edge_def; +typedef struct edge_def *edge; +typedef const struct edge_def *const_edge; +struct basic_block_def; +typedef struct basic_block_def *basic_block; +typedef const struct basic_block_def *const_basic_block; +#else + +struct _dont_use_rtx_here_; +struct _dont_use_rtvec_here_; +union _dont_use_tree_here_; +#define rtx struct _dont_use_rtx_here_ * +#define const_rtx struct _dont_use_rtx_here_ * +#define rtvec struct _dont_use_rtvec_here * +#define const_rtvec struct _dont_use_rtvec_here * +#define tree union _dont_use_tree_here_ * +#define const_tree union _dont_use_tree_here_ * + +#endif + +#endif /* coretypes.h */ + diff --git a/contrib/sdk/sources/gcc_eh/defaults.h b/contrib/sdk/sources/gcc_eh/defaults.h new file mode 100644 index 0000000000..26f90edf3f --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/defaults.h @@ -0,0 +1,1168 @@ +/* Definitions of various defaults for tm.h macros. + Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. + Contributed by Ron Guilmette (rfg@monkeys.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_DEFAULTS_H +#define GCC_DEFAULTS_H + +#ifndef GET_ENVIRONMENT +#define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0) +#endif + +#define obstack_chunk_alloc ((void *(*) (long)) xmalloc) +#define obstack_chunk_free ((void (*) (void *)) free) +#define OBSTACK_CHUNK_SIZE 0 +#define gcc_obstack_init(OBSTACK) \ + _obstack_begin ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \ + obstack_chunk_alloc, \ + obstack_chunk_free) + +/* Store in OUTPUT a string (made with alloca) containing an + assembler-name for a local static variable or function named NAME. + LABELNO is an integer which is different for each call. */ + +#ifndef ASM_PN_FORMAT +# ifndef NO_DOT_IN_LABEL +# define ASM_PN_FORMAT "%s.%lu" +# else +# ifndef NO_DOLLAR_IN_LABEL +# define ASM_PN_FORMAT "%s$%lu" +# else +# define ASM_PN_FORMAT "__%s_%lu" +# endif +# endif +#endif /* ! ASM_PN_FORMAT */ + +#ifndef ASM_FORMAT_PRIVATE_NAME +# define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ + do { const char *const name_ = (NAME); \ + char *const output_ = (OUTPUT) = \ + (char *) alloca (strlen (name_) + 32); \ + sprintf (output_, ASM_PN_FORMAT, name_, (unsigned long)(LABELNO)); \ + } while (0) +#endif + +/* Choose a reasonable default for ASM_OUTPUT_ASCII. */ + +#ifndef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ + do { \ + FILE *_hide_asm_out_file = (MYFILE); \ + const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \ + int _hide_thissize = (MYLENGTH); \ + { \ + FILE *asm_out_file = _hide_asm_out_file; \ + const unsigned char *p = _hide_p; \ + int thissize = _hide_thissize; \ + int i; \ + fprintf (asm_out_file, "\t.ascii \""); \ + \ + for (i = 0; i < thissize; i++) \ + { \ + int c = p[i]; \ + if (c == '\"' || c == '\\') \ + putc ('\\', asm_out_file); \ + if (ISPRINT(c)) \ + putc (c, asm_out_file); \ + else \ + { \ + fprintf (asm_out_file, "\\%o", c); \ + /* After an octal-escape, if a digit follows, \ + terminate one string constant and start another. \ + The VAX assembler fails to stop reading the escape \ + after three digits, so this is the only way we \ + can get it to parse the data properly. */ \ + if (i < thissize - 1 && ISDIGIT(p[i + 1])) \ + fprintf (asm_out_file, "\"\n\t.ascii \""); \ + } \ + } \ + fprintf (asm_out_file, "\"\n"); \ + } \ + } \ + while (0) +#endif + +/* This is how we tell the assembler to equate two values. */ +#ifdef SET_ASM_OP +#ifndef ASM_OUTPUT_DEF +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do { fprintf ((FILE), "%s", SET_ASM_OP); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, ","); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, "\n"); \ + } while (0) +#endif +#endif + +#ifndef TLS_COMMON_ASM_OP +#define TLS_COMMON_ASM_OP ".tls_common" +#endif + +#if defined (HAVE_AS_TLS) && !defined (ASM_OUTPUT_TLS_COMMON) +#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE) \ + do \ + { \ + fprintf ((FILE), "\t%s\t", TLS_COMMON_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ + (SIZE), DECL_ALIGN (DECL) / BITS_PER_UNIT); \ + } \ + while (0) +#endif + +/* Decide whether to defer emitting the assembler output for an equate + of two values. The default is to not defer output. */ +#ifndef TARGET_DEFERRED_OUTPUT_DEFS +#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) false +#endif + +/* This is how to output the definition of a user-level label named + NAME, such as the label on a static function or variable NAME. */ + +#ifndef ASM_OUTPUT_LABEL +#define ASM_OUTPUT_LABEL(FILE,NAME) \ + do { assemble_name ((FILE), (NAME)); fputs (":\n", (FILE)); } while (0) +#endif + +/* Output the definition of a compiler-generated label named NAME. */ +#ifndef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,NAME) \ + do { \ + assemble_name_raw ((FILE), (NAME)); \ + fputs (":\n", (FILE)); \ + } while (0) +#endif + +/* This is how to output a reference to a user-level label named NAME. */ + +#ifndef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(FILE,NAME) asm_fprintf ((FILE), "%U%s", (NAME)) +#endif + +/* Allow target to print debug info labels specially. This is useful for + VLIW targets, since debug info labels should go into the middle of + instruction bundles instead of breaking them. */ + +#ifndef ASM_OUTPUT_DEBUG_LABEL +#define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \ + (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM) +#endif + +/* This is how we tell the assembler that a symbol is weak. */ +#ifndef ASM_OUTPUT_WEAK_ALIAS +#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF) +#define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \ + do \ + { \ + ASM_WEAKEN_LABEL (STREAM, NAME); \ + if (VALUE) \ + ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \ + } \ + while (0) +#endif +#endif + +/* This is how we tell the assembler that a symbol is a weak alias to + another symbol that doesn't require the other symbol to be defined. + Uses of the former will turn into weak uses of the latter, i.e., + uses that, in case the latter is undefined, will not cause errors, + and will add it to the symbol table as weak undefined. However, if + the latter is referenced directly, a strong reference prevails. */ +#ifndef ASM_OUTPUT_WEAKREF +#if defined HAVE_GAS_WEAKREF +#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE) \ + do \ + { \ + fprintf ((FILE), "\t.weakref\t"); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ","); \ + assemble_name ((FILE), (VALUE)); \ + fprintf ((FILE), "\n"); \ + } \ + while (0) +#endif +#endif + +/* How to emit a .type directive. */ +#ifndef ASM_OUTPUT_TYPE_DIRECTIVE +#if defined TYPE_ASM_OP && defined TYPE_OPERAND_FMT +#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE) \ + do \ + { \ + fputs (TYPE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fputs (", ", STREAM); \ + fprintf (STREAM, TYPE_OPERAND_FMT, TYPE); \ + putc ('\n', STREAM); \ + } \ + while (0) +#endif +#endif + +/* How to emit a .size directive. */ +#ifndef ASM_OUTPUT_SIZE_DIRECTIVE +#ifdef SIZE_ASM_OP +#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE) \ + do \ + { \ + HOST_WIDE_INT size_ = (SIZE); \ + fputs (SIZE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_); \ + } \ + while (0) + +#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME) \ + do \ + { \ + fputs (SIZE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fputs (", .-", STREAM); \ + assemble_name (STREAM, NAME); \ + putc ('\n', STREAM); \ + } \ + while (0) + +#endif +#endif + +/* This determines whether or not we support weak symbols. */ +#ifndef SUPPORTS_WEAK +#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL) +#define SUPPORTS_WEAK 1 +#else +#define SUPPORTS_WEAK 0 +#endif +#endif + +/* This determines whether or not we support the discriminator + attribute in the .loc directive. */ +#ifndef SUPPORTS_DISCRIMINATOR +#ifdef HAVE_GAS_DISCRIMINATOR +#define SUPPORTS_DISCRIMINATOR 1 +#else +#define SUPPORTS_DISCRIMINATOR 0 +#endif +#endif + +/* This determines whether or not we support link-once semantics. */ +#ifndef SUPPORTS_ONE_ONLY +#ifdef MAKE_DECL_ONE_ONLY +#define SUPPORTS_ONE_ONLY 1 +#else +#define SUPPORTS_ONE_ONLY 0 +#endif +#endif + +/* This determines whether weak symbols must be left out of a static + archive's table of contents. Defining this macro to be nonzero has + the consequence that certain symbols will not be made weak that + otherwise would be. The C++ ABI requires this macro to be zero; + see the documentation. */ +#ifndef TARGET_WEAK_NOT_IN_ARCHIVE_TOC +#define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 0 +#endif + +/* This determines whether or not we need linkonce unwind information. */ +#ifndef TARGET_USES_WEAK_UNWIND_INFO +#define TARGET_USES_WEAK_UNWIND_INFO 0 +#endif + +/* By default, there is no prefix on user-defined symbols. */ +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + +/* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to + provide a weak attribute. Else define it to nothing. + + This would normally belong in ansidecl.h, but SUPPORTS_WEAK is + not available at that time. + + Note, this is only for use by target files which we know are to be + compiled by GCC. */ +#ifndef TARGET_ATTRIBUTE_WEAK +# if SUPPORTS_WEAK +# define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak)) +# else +# define TARGET_ATTRIBUTE_WEAK +# endif +#endif + +/* Determines whether we may use common symbols to represent one-only + semantics (a.k.a. "vague linkage"). */ +#ifndef USE_COMMON_FOR_ONE_ONLY +# define USE_COMMON_FOR_ONE_ONLY 1 +#endif + +/* By default we can assume that all global symbols are in one namespace, + across all shared libraries. */ +#ifndef MULTIPLE_SYMBOL_SPACES +# define MULTIPLE_SYMBOL_SPACES 0 +#endif + +/* If the target supports init_priority C++ attribute, give + SUPPORTS_INIT_PRIORITY a nonzero value. */ +#ifndef SUPPORTS_INIT_PRIORITY +#define SUPPORTS_INIT_PRIORITY 1 +#endif /* SUPPORTS_INIT_PRIORITY */ + +/* If duplicate library search directories can be removed from a + linker command without changing the linker's semantics, give this + symbol a nonzero. */ +#ifndef LINK_ELIMINATE_DUPLICATE_LDIRECTORIES +#define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 0 +#endif /* LINK_ELIMINATE_DUPLICATE_LDIRECTORIES */ + +/* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that + the rest of the DWARF 2 frame unwind support is also provided. */ +#if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX) \ + && !defined (TARGET_UNWIND_INFO) +#define DWARF2_UNWIND_INFO 1 +#endif + +/* If we have named sections, and we're using crtstuff to run ctors, + use them for registering eh frame information. */ +#if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \ + && !defined(EH_FRAME_IN_DATA_SECTION) +#ifndef EH_FRAME_SECTION_NAME +#define EH_FRAME_SECTION_NAME ".eh_frame" +#endif +#endif + +/* On many systems, different EH table encodings are used under + difference circumstances. Some will require runtime relocations; + some will not. For those that do not require runtime relocations, + we would like to make the table read-only. However, since the + read-only tables may need to be combined with read-write tables + that do require runtime relocation, it is not safe to make the + tables read-only unless the linker will merge read-only and + read-write sections into a single read-write section. If your + linker does not have this ability, but your system is such that no + encoding used with non-PIC code will ever require a runtime + relocation, then you can define EH_TABLES_CAN_BE_READ_ONLY to 1 in + your target configuration file. */ +#ifndef EH_TABLES_CAN_BE_READ_ONLY +#ifdef HAVE_LD_RO_RW_SECTION_MIXING +#define EH_TABLES_CAN_BE_READ_ONLY 1 +#else +#define EH_TABLES_CAN_BE_READ_ONLY 0 +#endif +#endif + +/* If we have named section and we support weak symbols, then use the + .jcr section for recording java classes which need to be registered + at program start-up time. */ +#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK +#ifndef JCR_SECTION_NAME +#define JCR_SECTION_NAME ".jcr" +#endif +#endif + +/* This decision to use a .jcr section can be overridden by defining + USE_JCR_SECTION to 0 in target file. This is necessary if target + can define JCR_SECTION_NAME but does not have crtstuff or + linker support for .jcr section. */ +#ifndef TARGET_USE_JCR_SECTION +#ifdef JCR_SECTION_NAME +#define TARGET_USE_JCR_SECTION 1 +#else +#define TARGET_USE_JCR_SECTION 0 +#endif +#endif + +/* Number of hardware registers that go into the DWARF-2 unwind info. + If not defined, equals FIRST_PSEUDO_REGISTER */ + +#ifndef DWARF_FRAME_REGISTERS +#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER +#endif + +/* How to renumber registers for dbx and gdb. If not defined, assume + no renumbering is necessary. */ + +#ifndef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(REGNO) (REGNO) +#endif + +/* Default sizes for base C types. If the sizes are different for + your target, you should override these values by defining the + appropriate symbols in your tm.h file. */ + +#ifndef BITS_PER_UNIT +#define BITS_PER_UNIT 8 +#endif + +#ifndef BITS_PER_WORD +#define BITS_PER_WORD (BITS_PER_UNIT * UNITS_PER_WORD) +#endif + +#ifndef CHAR_TYPE_SIZE +#define CHAR_TYPE_SIZE BITS_PER_UNIT +#endif + +#ifndef BOOL_TYPE_SIZE +/* `bool' has size and alignment `1', on almost all platforms. */ +#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE +#endif + +#ifndef SHORT_TYPE_SIZE +#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) +#endif + +#ifndef INT_TYPE_SIZE +#define INT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_LONG_TYPE_SIZE +#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE INT_TYPE_SIZE +#endif + +#ifndef FLOAT_TYPE_SIZE +#define FLOAT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef DOUBLE_TYPE_SIZE +#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef DECIMAL32_TYPE_SIZE +#define DECIMAL32_TYPE_SIZE 32 +#endif + +#ifndef DECIMAL64_TYPE_SIZE +#define DECIMAL64_TYPE_SIZE 64 +#endif + +#ifndef DECIMAL128_TYPE_SIZE +#define DECIMAL128_TYPE_SIZE 128 +#endif + +#ifndef SHORT_FRACT_TYPE_SIZE +#define SHORT_FRACT_TYPE_SIZE BITS_PER_UNIT +#endif + +#ifndef FRACT_TYPE_SIZE +#define FRACT_TYPE_SIZE (BITS_PER_UNIT * 2) +#endif + +#ifndef LONG_FRACT_TYPE_SIZE +#define LONG_FRACT_TYPE_SIZE (BITS_PER_UNIT * 4) +#endif + +#ifndef LONG_LONG_FRACT_TYPE_SIZE +#define LONG_LONG_FRACT_TYPE_SIZE (BITS_PER_UNIT * 8) +#endif + +#ifndef SHORT_ACCUM_TYPE_SIZE +#define SHORT_ACCUM_TYPE_SIZE (SHORT_FRACT_TYPE_SIZE * 2) +#endif + +#ifndef ACCUM_TYPE_SIZE +#define ACCUM_TYPE_SIZE (FRACT_TYPE_SIZE * 2) +#endif + +#ifndef LONG_ACCUM_TYPE_SIZE +#define LONG_ACCUM_TYPE_SIZE (LONG_FRACT_TYPE_SIZE * 2) +#endif + +#ifndef LONG_LONG_ACCUM_TYPE_SIZE +#define LONG_LONG_ACCUM_TYPE_SIZE (LONG_LONG_FRACT_TYPE_SIZE * 2) +#endif + +/* We let tm.h override the types used here, to handle trivial differences + such as the choice of unsigned int or long unsigned int for size_t. + When machines start needing nontrivial differences in the size type, + it would be best to do something here to figure out automatically + from other information what type to use. */ + +#ifndef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" +#endif + +#ifndef PID_TYPE +#define PID_TYPE "int" +#endif + +/* If GCC knows the exact uint_least16_t and uint_least32_t types from + , use them for char16_t and char32_t. Otherwise, use + these guesses; getting the wrong type of a given width will not + affect C++ name mangling because in C++ these are distinct types + not typedefs. */ + +#ifdef UINT_LEAST16_TYPE +#define CHAR16_TYPE UINT_LEAST16_TYPE +#else +#define CHAR16_TYPE "short unsigned int" +#endif + +#ifdef UINT_LEAST32_TYPE +#define CHAR32_TYPE UINT_LEAST32_TYPE +#else +#define CHAR32_TYPE "unsigned int" +#endif + +#ifndef WCHAR_TYPE +#define WCHAR_TYPE "int" +#endif + +/* WCHAR_TYPE gets overridden by -fshort-wchar. */ +#define MODIFIED_WCHAR_TYPE \ + (flag_short_wchar ? "short unsigned int" : WCHAR_TYPE) + +#ifndef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" +#endif + +#ifndef WINT_TYPE +#define WINT_TYPE "unsigned int" +#endif + +#ifndef INTMAX_TYPE +#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "int" \ + : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "long int" \ + : "long long int")) +#endif + +#ifndef UINTMAX_TYPE +#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "unsigned int" \ + : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "long unsigned int" \ + : "long long unsigned int")) +#endif + + +/* There are no default definitions of these types. */ + +#ifndef SIG_ATOMIC_TYPE +#define SIG_ATOMIC_TYPE ((const char *) NULL) +#endif + +#ifndef INT8_TYPE +#define INT8_TYPE ((const char *) NULL) +#endif + +#ifndef INT16_TYPE +#define INT16_TYPE ((const char *) NULL) +#endif + +#ifndef INT32_TYPE +#define INT32_TYPE ((const char *) NULL) +#endif + +#ifndef INT64_TYPE +#define INT64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT8_TYPE +#define UINT8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT16_TYPE +#define UINT16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT32_TYPE +#define UINT32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT64_TYPE +#define UINT64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST8_TYPE +#define INT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST16_TYPE +#define INT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST32_TYPE +#define INT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST64_TYPE +#define INT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST8_TYPE +#define UINT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST16_TYPE +#define UINT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST32_TYPE +#define UINT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST64_TYPE +#define UINT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST8_TYPE +#define INT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST16_TYPE +#define INT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST32_TYPE +#define INT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST64_TYPE +#define INT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST64_TYPE +#define UINT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INTPTR_TYPE +#define INTPTR_TYPE ((const char *) NULL) +#endif + +#ifndef UINTPTR_TYPE +#define UINTPTR_TYPE ((const char *) NULL) +#endif + +/* Width in bits of a pointer. Mind the value of the macro `Pmode'. */ +#ifndef POINTER_SIZE +#define POINTER_SIZE BITS_PER_WORD +#endif + +#ifndef PIC_OFFSET_TABLE_REGNUM +#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM +#endif + +#ifndef TARGET_DLLIMPORT_DECL_ATTRIBUTES +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 0 +#endif + +#ifndef TARGET_DECLSPEC +#if TARGET_DLLIMPORT_DECL_ATTRIBUTES +/* If the target supports the "dllimport" attribute, users are + probably used to the "__declspec" syntax. */ +#define TARGET_DECLSPEC 1 +#else +#define TARGET_DECLSPEC 0 +#endif +#endif + +/* By default, the preprocessor should be invoked the same way in C++ + as in C. */ +#ifndef CPLUSPLUS_CPP_SPEC +#ifdef CPP_SPEC +#define CPLUSPLUS_CPP_SPEC CPP_SPEC +#endif +#endif + +#ifndef ACCUMULATE_OUTGOING_ARGS +#define ACCUMULATE_OUTGOING_ARGS 0 +#endif + +/* Supply a default definition for PUSH_ARGS. */ +#ifndef PUSH_ARGS +#ifdef PUSH_ROUNDING +#define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS +#else +#define PUSH_ARGS 0 +#endif +#endif + +/* Decide whether a function's arguments should be processed + from first to last or from last to first. + + They should if the stack and args grow in opposite directions, but + only if we have push insns. */ + +#ifdef PUSH_ROUNDING + +#ifndef PUSH_ARGS_REVERSED +#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD) +#define PUSH_ARGS_REVERSED PUSH_ARGS +#endif +#endif + +#endif + +#ifndef PUSH_ARGS_REVERSED +#define PUSH_ARGS_REVERSED 0 +#endif + +/* Default value for the alignment (in bits) a C conformant malloc has to + provide. This default is intended to be safe and always correct. */ +#ifndef MALLOC_ABI_ALIGNMENT +#define MALLOC_ABI_ALIGNMENT BITS_PER_WORD +#endif + +/* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY. + STACK_BOUNDARY is required. */ +#ifndef PREFERRED_STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + +/* Set INCOMING_STACK_BOUNDARY to PREFERRED_STACK_BOUNDARY if it is not + defined. */ +#ifndef INCOMING_STACK_BOUNDARY +#define INCOMING_STACK_BOUNDARY PREFERRED_STACK_BOUNDARY +#endif + +#ifndef TARGET_DEFAULT_PACK_STRUCT +#define TARGET_DEFAULT_PACK_STRUCT 0 +#endif + +/* By default, the C++ compiler will use function addresses in the + vtable entries. Setting this nonzero tells the compiler to use + function descriptors instead. The value of this macro says how + many words wide the descriptor is (normally 2). It is assumed + that the address of a function descriptor may be treated as a + pointer to a function. */ +#ifndef TARGET_VTABLE_USES_DESCRIPTORS +#define TARGET_VTABLE_USES_DESCRIPTORS 0 +#endif + +/* By default, the vtable entries are void pointers, the so the alignment + is the same as pointer alignment. The value of this macro specifies + the alignment of the vtable entry in bits. It should be defined only + when special alignment is necessary. */ +#ifndef TARGET_VTABLE_ENTRY_ALIGN +#define TARGET_VTABLE_ENTRY_ALIGN POINTER_SIZE +#endif + +/* There are a few non-descriptor entries in the vtable at offsets below + zero. If these entries must be padded (say, to preserve the alignment + specified by TARGET_VTABLE_ENTRY_ALIGN), set this to the number of + words in each data entry. */ +#ifndef TARGET_VTABLE_DATA_ENTRY_DISTANCE +#define TARGET_VTABLE_DATA_ENTRY_DISTANCE 1 +#endif + +/* Decide whether it is safe to use a local alias for a virtual function + when constructing thunks. */ +#ifndef TARGET_USE_LOCAL_THUNK_ALIAS_P +#ifdef ASM_OUTPUT_DEF +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 1 +#else +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 0 +#endif +#endif + +/* Select a format to encode pointers in exception handling data. We + prefer those that result in fewer dynamic relocations. Assume no + special support here and encode direct references. */ +#ifndef ASM_PREFERRED_EH_DATA_FORMAT +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr +#endif + +/* By default, the C++ compiler will use the lowest bit of the pointer + to function to indicate a pointer-to-member-function points to a + virtual member function. However, if FUNCTION_BOUNDARY indicates + function addresses aren't always even, the lowest bit of the delta + field will be used. */ +#ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION +#define TARGET_PTRMEMFUNC_VBIT_LOCATION \ + (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \ + ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta) +#endif + +#ifndef DEFAULT_GDB_EXTENSIONS +#define DEFAULT_GDB_EXTENSIONS 1 +#endif + +/* If more than one debugging type is supported, you must define + PREFERRED_DEBUGGING_TYPE to choose the default. */ + +#if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) \ + + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \ + + defined (VMS_DEBUGGING_INFO)) +#ifndef PREFERRED_DEBUGGING_TYPE +#error You must define PREFERRED_DEBUGGING_TYPE +#endif /* no PREFERRED_DEBUGGING_TYPE */ + +/* If only one debugging format is supported, define PREFERRED_DEBUGGING_TYPE + here so other code needn't care. */ +#elif defined DBX_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#elif defined SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG + +#elif defined DWARF2_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +#elif defined VMS_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG + +#elif defined XCOFF_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG + +#else +/* No debugging format is supported by this target. */ +#define PREFERRED_DEBUGGING_TYPE NO_DEBUG +#endif + +#ifndef LARGEST_EXPONENT_IS_NORMAL +#define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0 +#endif + +#ifndef ROUND_TOWARDS_ZERO +#define ROUND_TOWARDS_ZERO 0 +#endif + +#ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL +#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false +#endif + +/* True if the targets integer-comparison functions return { 0, 1, 2 + } to indicate { <, ==, > }. False if { -1, 0, 1 } is used + instead. The libgcc routines are biased. */ +#ifndef TARGET_LIB_INT_CMP_BIASED +#define TARGET_LIB_INT_CMP_BIASED (true) +#endif + +/* If FLOAT_WORDS_BIG_ENDIAN is not defined in the header files, + then the word-endianness is the same as for integers. */ +#ifndef FLOAT_WORDS_BIG_ENDIAN +#define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN +#endif + +#ifdef TARGET_FLT_EVAL_METHOD +#define TARGET_FLT_EVAL_METHOD_NON_DEFAULT 1 +#else +#define TARGET_FLT_EVAL_METHOD 0 +#define TARGET_FLT_EVAL_METHOD_NON_DEFAULT 0 +#endif + +#ifndef TARGET_DEC_EVAL_METHOD +#define TARGET_DEC_EVAL_METHOD 2 +#endif + +#ifndef HOT_TEXT_SECTION_NAME +#define HOT_TEXT_SECTION_NAME ".text.hot" +#endif + +#ifndef UNLIKELY_EXECUTED_TEXT_SECTION_NAME +#define UNLIKELY_EXECUTED_TEXT_SECTION_NAME ".text.unlikely" +#endif + +#ifndef HAS_LONG_COND_BRANCH +#define HAS_LONG_COND_BRANCH 0 +#endif + +#ifndef HAS_LONG_UNCOND_BRANCH +#define HAS_LONG_UNCOND_BRANCH 0 +#endif + +/* By default, only attempt to parallelize bitwise operations, and + possibly adds/subtracts using bit-twiddling. */ +#ifndef UNITS_PER_SIMD_WORD +#define UNITS_PER_SIMD_WORD(MODE) UNITS_PER_WORD +#endif + +/* Determine whether __cxa_atexit, rather than atexit, is used to + register C++ destructors for local statics and global objects. */ +#ifndef DEFAULT_USE_CXA_ATEXIT +#define DEFAULT_USE_CXA_ATEXIT 0 +#endif + +/* If none of these macros are defined, the port must use the new + technique of defining constraints in the machine description. + tm_p.h will define those macros that machine-independent code + still uses. */ +#if !defined CONSTRAINT_LEN \ + && !defined REG_CLASS_FROM_LETTER \ + && !defined REG_CLASS_FROM_CONSTRAINT \ + && !defined CONST_OK_FOR_LETTER_P \ + && !defined CONST_OK_FOR_CONSTRAINT_P \ + && !defined CONST_DOUBLE_OK_FOR_LETTER_P \ + && !defined CONST_DOUBLE_OK_FOR_CONSTRAINT_P \ + && !defined EXTRA_CONSTRAINT \ + && !defined EXTRA_CONSTRAINT_STR \ + && !defined EXTRA_MEMORY_CONSTRAINT \ + && !defined EXTRA_ADDRESS_CONSTRAINT + +#define USE_MD_CONSTRAINTS + +#if GCC_VERSION >= 3000 && defined IN_GCC +/* These old constraint macros shouldn't appear anywhere in a + configuration using MD constraint definitions. */ +#pragma GCC poison REG_CLASS_FROM_LETTER CONST_OK_FOR_LETTER_P \ + CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT +#endif + +#else /* old constraint mechanism in use */ + +/* Determine whether extra constraint letter should be handled + via address reload (like 'o'). */ +#ifndef EXTRA_MEMORY_CONSTRAINT +#define EXTRA_MEMORY_CONSTRAINT(C,STR) 0 +#endif + +/* Determine whether extra constraint letter should be handled + as an address (like 'p'). */ +#ifndef EXTRA_ADDRESS_CONSTRAINT +#define EXTRA_ADDRESS_CONSTRAINT(C,STR) 0 +#endif + +/* When a port defines CONSTRAINT_LEN, it should use DEFAULT_CONSTRAINT_LEN + for all the characters that it does not want to change, so things like the + 'length' of a digit in a matching constraint is an implementation detail, + and not part of the interface. */ +#define DEFAULT_CONSTRAINT_LEN(C,STR) 1 + +#ifndef CONSTRAINT_LEN +#define CONSTRAINT_LEN(C,STR) DEFAULT_CONSTRAINT_LEN (C, STR) +#endif + +#if defined (CONST_OK_FOR_LETTER_P) && ! defined (CONST_OK_FOR_CONSTRAINT_P) +#define CONST_OK_FOR_CONSTRAINT_P(VAL,C,STR) CONST_OK_FOR_LETTER_P (VAL, C) +#endif + +#if defined (CONST_DOUBLE_OK_FOR_LETTER_P) && ! defined (CONST_DOUBLE_OK_FOR_CONSTRAINT_P) +#define CONST_DOUBLE_OK_FOR_CONSTRAINT_P(OP,C,STR) \ + CONST_DOUBLE_OK_FOR_LETTER_P (OP, C) +#endif + +#ifndef REG_CLASS_FROM_CONSTRAINT +#define REG_CLASS_FROM_CONSTRAINT(C,STR) REG_CLASS_FROM_LETTER (C) +#endif + +#if defined (EXTRA_CONSTRAINT) && ! defined (EXTRA_CONSTRAINT_STR) +#define EXTRA_CONSTRAINT_STR(OP, C,STR) EXTRA_CONSTRAINT (OP, C) +#endif + +#endif /* old constraint mechanism in use */ + +#ifndef REGISTER_MOVE_COST +#define REGISTER_MOVE_COST(m, x, y) 2 +#endif + +/* Determine whether the entire c99 runtime + is present in the runtime library. */ +#ifndef TARGET_C99_FUNCTIONS +#define TARGET_C99_FUNCTIONS 0 +#endif + +/* Determine whether the target runtime library has + a sincos implementation following the GNU extension. */ +#ifndef TARGET_HAS_SINCOS +#define TARGET_HAS_SINCOS 0 +#endif + +/* Indicate that CLZ and CTZ are undefined at zero. */ +#ifndef CLZ_DEFINED_VALUE_AT_ZERO +#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 +#endif +#ifndef CTZ_DEFINED_VALUE_AT_ZERO +#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 +#endif + +/* Provide a default value for STORE_FLAG_VALUE. */ +#ifndef STORE_FLAG_VALUE +#define STORE_FLAG_VALUE 1 +#endif + +/* This macro is used to determine what the largest unit size that + move_by_pieces can use is. */ + +/* MOVE_MAX_PIECES is the number of bytes at a time which we can + move efficiently, as opposed to MOVE_MAX which is the maximum + number of bytes we can move with a single instruction. */ + +#ifndef MOVE_MAX_PIECES +#define MOVE_MAX_PIECES MOVE_MAX +#endif + +#ifndef STACK_POINTER_OFFSET +#define STACK_POINTER_OFFSET 0 +#endif + +#ifndef LOCAL_REGNO +#define LOCAL_REGNO(REGNO) 0 +#endif + +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, + the stack pointer does not matter. The value is tested only in + functions that have frame pointers. */ +#ifndef EXIT_IGNORE_STACK +#define EXIT_IGNORE_STACK 0 +#endif + +/* Assume that case vectors are not pc-relative. */ +#ifndef CASE_VECTOR_PC_RELATIVE +#define CASE_VECTOR_PC_RELATIVE 0 +#endif + +/* Assume that trampolines need function alignment. */ +#ifndef TRAMPOLINE_ALIGNMENT +#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY +#endif + +/* Register mappings for target machines without register windows. */ +#ifndef INCOMING_REGNO +#define INCOMING_REGNO(N) (N) +#endif + +#ifndef OUTGOING_REGNO +#define OUTGOING_REGNO(N) (N) +#endif + +#ifndef SHIFT_COUNT_TRUNCATED +#define SHIFT_COUNT_TRUNCATED 0 +#endif + +#ifndef LEGITIMATE_PIC_OPERAND_P +#define LEGITIMATE_PIC_OPERAND_P(X) 1 +#endif + +#ifndef TARGET_MEM_CONSTRAINT +#define TARGET_MEM_CONSTRAINT 'm' +#endif + +#ifndef REVERSIBLE_CC_MODE +#define REVERSIBLE_CC_MODE(MODE) 0 +#endif + +/* Biggest alignment supported by the object file format of this machine. */ +#ifndef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT +#endif + +#ifndef FRAME_GROWS_DOWNWARD +#define FRAME_GROWS_DOWNWARD 0 +#endif + +/* On most machines, the CFA coincides with the first incoming parm. */ +#ifndef ARG_POINTER_CFA_OFFSET +#define ARG_POINTER_CFA_OFFSET(FNDECL) \ + (FIRST_PARM_OFFSET (FNDECL) + crtl->args.pretend_args_size) +#endif + +/* On most machines, we use the CFA as DW_AT_frame_base. */ +#ifndef CFA_FRAME_BASE_OFFSET +#define CFA_FRAME_BASE_OFFSET(FNDECL) 0 +#endif + +/* The offset from the incoming value of %sp to the top of the stack frame + for the current function. */ +#ifndef INCOMING_FRAME_SP_OFFSET +#define INCOMING_FRAME_SP_OFFSET 0 +#endif + +#ifndef HARD_REGNO_NREGS_HAS_PADDING +#define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) 0 +#define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) -1 +#endif + +#ifndef OUTGOING_REG_PARM_STACK_SPACE +#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 0 +#endif + +/* MAX_STACK_ALIGNMENT is the maximum stack alignment guaranteed by + the backend. MAX_SUPPORTED_STACK_ALIGNMENT is the maximum best + effort stack alignment supported by the backend. If the backend + supports stack alignment, MAX_SUPPORTED_STACK_ALIGNMENT and + MAX_STACK_ALIGNMENT are the same. Otherwise, the incoming stack + boundary will limit the maximum guaranteed stack alignment. */ +#ifdef MAX_STACK_ALIGNMENT +#define MAX_SUPPORTED_STACK_ALIGNMENT MAX_STACK_ALIGNMENT +#else +#define MAX_STACK_ALIGNMENT STACK_BOUNDARY +#define MAX_SUPPORTED_STACK_ALIGNMENT PREFERRED_STACK_BOUNDARY +#endif + +#define SUPPORTS_STACK_ALIGNMENT (MAX_STACK_ALIGNMENT > STACK_BOUNDARY) + +#ifndef LOCAL_ALIGNMENT +#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT +#endif + +#ifndef STACK_SLOT_ALIGNMENT +#define STACK_SLOT_ALIGNMENT(TYPE,MODE,ALIGN) \ + ((TYPE) ? LOCAL_ALIGNMENT ((TYPE), (ALIGN)) : (ALIGN)) +#endif + +#ifndef LOCAL_DECL_ALIGNMENT +#define LOCAL_DECL_ALIGNMENT(DECL) \ + LOCAL_ALIGNMENT (TREE_TYPE (DECL), DECL_ALIGN (DECL)) +#endif + +#ifndef MINIMUM_ALIGNMENT +#define MINIMUM_ALIGNMENT(EXP,MODE,ALIGN) (ALIGN) +#endif + +/* Alignment value for attribute ((aligned)). */ +#ifndef ATTRIBUTE_ALIGNED_VALUE +#define ATTRIBUTE_ALIGNED_VALUE BIGGEST_ALIGNMENT +#endif + +/* Many ports have no mode-dependent addresses (except possibly autoincrement + and autodecrement addresses, which are handled by target-independent code + in recog.c). */ +#ifndef GO_IF_MODE_DEPENDENT_ADDRESS +#define GO_IF_MODE_DEPENDENT_ADDRESS(X, WIN) +#endif + +/* For most ports anything that evaluates to a constant symbolic + or integer value is acceptable as a constant address. */ +#ifndef CONSTANT_ADDRESS_P +#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X) && GET_CODE (X) != CONST_DOUBLE) +#endif + +#endif /* ! GCC_DEFAULTS_H */ diff --git a/contrib/sdk/sources/gcc_eh/dwarf2.h b/contrib/sdk/sources/gcc_eh/dwarf2.h new file mode 100644 index 0000000000..0b0355232b --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/dwarf2.h @@ -0,0 +1,914 @@ +/* Declarations and definitions of codes relating to the DWARF2 and + DWARF3 symbolic debugging information formats. + Copyright (C) 1992, 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. + + Written by Gary Funck (gary@intrepid.com) The Ada Joint Program + Office (AJPO), Florida State University and Silicon Graphics Inc. + provided support for this effort -- June 21, 1995. + + Derived from the DWARF 1 implementation written by Ron Guilmette + (rfg@netcom.com), November 1990. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + 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. + + 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 + . */ + +/* This file is derived from the DWARF specification (a public document) + Revision 2.0.0 (July 27, 1993) developed by the UNIX International + Programming Languages Special Interest Group (UI/PLSIG) and distributed + by UNIX International. Copies of this specification are available from + UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054. + + This file also now contains definitions from the DWARF 3 specification + published Dec 20, 2005, available from: http://dwarf.freestandards.org. */ + +/* This file is shared between GCC and GDB, and should not contain + prototypes. */ + +#ifndef _ELF_DWARF2_H +#define _ELF_DWARF2_H + +/* Structure found in the .debug_line section. */ +typedef struct +{ + unsigned char li_length [4]; + unsigned char li_version [2]; + unsigned char li_prologue_length [4]; + unsigned char li_min_insn_length [1]; + unsigned char li_default_is_stmt [1]; + unsigned char li_line_base [1]; + unsigned char li_line_range [1]; + unsigned char li_opcode_base [1]; +} +DWARF2_External_LineInfo; + +typedef struct +{ + unsigned long li_length; + unsigned short li_version; + unsigned int li_prologue_length; + unsigned char li_min_insn_length; + unsigned char li_max_ops_per_insn; + unsigned char li_default_is_stmt; + int li_line_base; + unsigned char li_line_range; + unsigned char li_opcode_base; +} +DWARF2_Internal_LineInfo; + +/* Structure found in .debug_pubnames section. */ +typedef struct +{ + unsigned char pn_length [4]; + unsigned char pn_version [2]; + unsigned char pn_offset [4]; + unsigned char pn_size [4]; +} +DWARF2_External_PubNames; + +typedef struct +{ + unsigned long pn_length; + unsigned short pn_version; + unsigned long pn_offset; + unsigned long pn_size; +} +DWARF2_Internal_PubNames; + +/* Structure found in .debug_info section. */ +typedef struct +{ + unsigned char cu_length [4]; + unsigned char cu_version [2]; + unsigned char cu_abbrev_offset [4]; + unsigned char cu_pointer_size [1]; +} +DWARF2_External_CompUnit; + +typedef struct +{ + unsigned long cu_length; + unsigned short cu_version; + unsigned long cu_abbrev_offset; + unsigned char cu_pointer_size; +} +DWARF2_Internal_CompUnit; + +typedef struct +{ + unsigned char ar_length [4]; + unsigned char ar_version [2]; + unsigned char ar_info_offset [4]; + unsigned char ar_pointer_size [1]; + unsigned char ar_segment_size [1]; +} +DWARF2_External_ARange; + +typedef struct +{ + unsigned long ar_length; + unsigned short ar_version; + unsigned long ar_info_offset; + unsigned char ar_pointer_size; + unsigned char ar_segment_size; +} +DWARF2_Internal_ARange; + + +/* Tag names and codes. */ +enum dwarf_tag + { + DW_TAG_padding = 0x00, + DW_TAG_array_type = 0x01, + DW_TAG_class_type = 0x02, + DW_TAG_entry_point = 0x03, + DW_TAG_enumeration_type = 0x04, + DW_TAG_formal_parameter = 0x05, + DW_TAG_imported_declaration = 0x08, + DW_TAG_label = 0x0a, + DW_TAG_lexical_block = 0x0b, + DW_TAG_member = 0x0d, + DW_TAG_pointer_type = 0x0f, + DW_TAG_reference_type = 0x10, + DW_TAG_compile_unit = 0x11, + DW_TAG_string_type = 0x12, + DW_TAG_structure_type = 0x13, + DW_TAG_subroutine_type = 0x15, + DW_TAG_typedef = 0x16, + DW_TAG_union_type = 0x17, + DW_TAG_unspecified_parameters = 0x18, + DW_TAG_variant = 0x19, + DW_TAG_common_block = 0x1a, + DW_TAG_common_inclusion = 0x1b, + DW_TAG_inheritance = 0x1c, + DW_TAG_inlined_subroutine = 0x1d, + DW_TAG_module = 0x1e, + DW_TAG_ptr_to_member_type = 0x1f, + DW_TAG_set_type = 0x20, + DW_TAG_subrange_type = 0x21, + DW_TAG_with_stmt = 0x22, + DW_TAG_access_declaration = 0x23, + DW_TAG_base_type = 0x24, + DW_TAG_catch_block = 0x25, + DW_TAG_const_type = 0x26, + DW_TAG_constant = 0x27, + DW_TAG_enumerator = 0x28, + DW_TAG_file_type = 0x29, + DW_TAG_friend = 0x2a, + DW_TAG_namelist = 0x2b, + DW_TAG_namelist_item = 0x2c, + DW_TAG_packed_type = 0x2d, + DW_TAG_subprogram = 0x2e, + DW_TAG_template_type_param = 0x2f, + DW_TAG_template_value_param = 0x30, + DW_TAG_thrown_type = 0x31, + DW_TAG_try_block = 0x32, + DW_TAG_variant_part = 0x33, + DW_TAG_variable = 0x34, + DW_TAG_volatile_type = 0x35, + /* DWARF 3. */ + DW_TAG_dwarf_procedure = 0x36, + DW_TAG_restrict_type = 0x37, + DW_TAG_interface_type = 0x38, + DW_TAG_namespace = 0x39, + DW_TAG_imported_module = 0x3a, + DW_TAG_unspecified_type = 0x3b, + DW_TAG_partial_unit = 0x3c, + DW_TAG_imported_unit = 0x3d, + DW_TAG_condition = 0x3f, + DW_TAG_shared_type = 0x40, + /* DWARF 4. */ + DW_TAG_type_unit = 0x41, + DW_TAG_rvalue_reference_type = 0x42, + DW_TAG_template_alias = 0x43, + + DW_TAG_lo_user = 0x4080, + DW_TAG_hi_user = 0xffff, + + /* SGI/MIPS Extensions. */ + DW_TAG_MIPS_loop = 0x4081, + /* HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . */ + DW_TAG_HP_array_descriptor = 0x4090, + /* GNU extensions. */ + DW_TAG_format_label = 0x4101, /* For FORTRAN 77 and Fortran 90. */ + DW_TAG_function_template = 0x4102, /* For C++. */ + DW_TAG_class_template = 0x4103, /* For C++. */ + DW_TAG_GNU_BINCL = 0x4104, + DW_TAG_GNU_EINCL = 0x4105, + /* Template template parameter. + See http://gcc.gnu.org/wiki/TemplateParmsDwarf . */ + DW_TAG_GNU_template_template_param = 0x4106, + + /* Template parameter pack extension, specified at + http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates + The values of these two TAGS are in the DW_TAG_GNU_* space until the tags + are properly part of DWARF 5. */ + DW_TAG_GNU_template_parameter_pack = 0x4107, + DW_TAG_GNU_formal_parameter_pack = 0x4108, + /* Extensions for UPC. See: http://upc.gwu.edu/~upc. */ + DW_TAG_upc_shared_type = 0x8765, + DW_TAG_upc_strict_type = 0x8766, + DW_TAG_upc_relaxed_type = 0x8767, + /* PGI (STMicroelectronics) extensions. No documentation available. */ + DW_TAG_PGI_kanji_type = 0xA000, + DW_TAG_PGI_interface_block = 0xA020 + }; + +/* Flag that tells whether entry has a child or not. */ +#define DW_children_no 0 +#define DW_children_yes 1 + +/* Form names and codes. */ +enum dwarf_form + { + DW_FORM_addr = 0x01, + DW_FORM_block2 = 0x03, + DW_FORM_block4 = 0x04, + DW_FORM_data2 = 0x05, + DW_FORM_data4 = 0x06, + DW_FORM_data8 = 0x07, + DW_FORM_string = 0x08, + DW_FORM_block = 0x09, + DW_FORM_block1 = 0x0a, + DW_FORM_data1 = 0x0b, + DW_FORM_flag = 0x0c, + DW_FORM_sdata = 0x0d, + DW_FORM_strp = 0x0e, + DW_FORM_udata = 0x0f, + DW_FORM_ref_addr = 0x10, + DW_FORM_ref1 = 0x11, + DW_FORM_ref2 = 0x12, + DW_FORM_ref4 = 0x13, + DW_FORM_ref8 = 0x14, + DW_FORM_ref_udata = 0x15, + DW_FORM_indirect = 0x16, + /* DWARF 4. */ + DW_FORM_sec_offset = 0x17, + DW_FORM_exprloc = 0x18, + DW_FORM_flag_present = 0x19, + DW_FORM_ref_sig8 = 0x20 +#define DW_FORM_sig8 DW_FORM_ref_sig8 /* Note: The use of DW_FORM_sig8 is deprecated. */ + }; + +/* Attribute names and codes. */ +enum dwarf_attribute + { + DW_AT_sibling = 0x01, + DW_AT_location = 0x02, + DW_AT_name = 0x03, + DW_AT_ordering = 0x09, + DW_AT_subscr_data = 0x0a, + DW_AT_byte_size = 0x0b, + DW_AT_bit_offset = 0x0c, + DW_AT_bit_size = 0x0d, + DW_AT_element_list = 0x0f, + DW_AT_stmt_list = 0x10, + DW_AT_low_pc = 0x11, + DW_AT_high_pc = 0x12, + DW_AT_language = 0x13, + DW_AT_member = 0x14, + DW_AT_discr = 0x15, + DW_AT_discr_value = 0x16, + DW_AT_visibility = 0x17, + DW_AT_import = 0x18, + DW_AT_string_length = 0x19, + DW_AT_common_reference = 0x1a, + DW_AT_comp_dir = 0x1b, + DW_AT_const_value = 0x1c, + DW_AT_containing_type = 0x1d, + DW_AT_default_value = 0x1e, + DW_AT_inline = 0x20, + DW_AT_is_optional = 0x21, + DW_AT_lower_bound = 0x22, + DW_AT_producer = 0x25, + DW_AT_prototyped = 0x27, + DW_AT_return_addr = 0x2a, + DW_AT_start_scope = 0x2c, + DW_AT_bit_stride = 0x2e, +#define DW_AT_stride_size DW_AT_bit_stride /* Note: The use of DW_AT_stride_size is deprecated. */ + DW_AT_upper_bound = 0x2f, + DW_AT_abstract_origin = 0x31, + DW_AT_accessibility = 0x32, + DW_AT_address_class = 0x33, + DW_AT_artificial = 0x34, + DW_AT_base_types = 0x35, + DW_AT_calling_convention = 0x36, + DW_AT_count = 0x37, + DW_AT_data_member_location = 0x38, + DW_AT_decl_column = 0x39, + DW_AT_decl_file = 0x3a, + DW_AT_decl_line = 0x3b, + DW_AT_declaration = 0x3c, + DW_AT_discr_list = 0x3d, + DW_AT_encoding = 0x3e, + DW_AT_external = 0x3f, + DW_AT_frame_base = 0x40, + DW_AT_friend = 0x41, + DW_AT_identifier_case = 0x42, + DW_AT_macro_info = 0x43, + DW_AT_namelist_items = 0x44, + DW_AT_priority = 0x45, + DW_AT_segment = 0x46, + DW_AT_specification = 0x47, + DW_AT_static_link = 0x48, + DW_AT_type = 0x49, + DW_AT_use_location = 0x4a, + DW_AT_variable_parameter = 0x4b, + DW_AT_virtuality = 0x4c, + DW_AT_vtable_elem_location = 0x4d, + /* DWARF 3 values. */ + DW_AT_allocated = 0x4e, + DW_AT_associated = 0x4f, + DW_AT_data_location = 0x50, + DW_AT_byte_stride = 0x51, +#define DW_AT_stride DW_AT_byte_stride /* Note: The use of DW_AT_stride is deprecated. */ + DW_AT_entry_pc = 0x52, + DW_AT_use_UTF8 = 0x53, + DW_AT_extension = 0x54, + DW_AT_ranges = 0x55, + DW_AT_trampoline = 0x56, + DW_AT_call_column = 0x57, + DW_AT_call_file = 0x58, + DW_AT_call_line = 0x59, + DW_AT_description = 0x5a, + DW_AT_binary_scale = 0x5b, + DW_AT_decimal_scale = 0x5c, + DW_AT_small = 0x5d, + DW_AT_decimal_sign = 0x5e, + DW_AT_digit_count = 0x5f, + DW_AT_picture_string = 0x60, + DW_AT_mutable = 0x61, + DW_AT_threads_scaled = 0x62, + DW_AT_explicit = 0x63, + DW_AT_object_pointer = 0x64, + DW_AT_endianity = 0x65, + DW_AT_elemental = 0x66, + DW_AT_pure = 0x67, + DW_AT_recursive = 0x68, + /* DWARF 4. */ + DW_AT_signature = 0x69, + DW_AT_main_subprogram = 0x6a, + DW_AT_data_bit_offset = 0x6b, + DW_AT_const_expr = 0x6c, + DW_AT_enum_class = 0x6d, + DW_AT_linkage_name = 0x6e, + + DW_AT_lo_user = 0x2000, /* Implementation-defined range start. */ + DW_AT_hi_user = 0x3ff0, /* Implementation-defined range end. */ + + /* SGI/MIPS extensions. */ + DW_AT_MIPS_fde = 0x2001, + DW_AT_MIPS_loop_begin = 0x2002, + DW_AT_MIPS_tail_loop_begin = 0x2003, + DW_AT_MIPS_epilog_begin = 0x2004, + DW_AT_MIPS_loop_unroll_factor = 0x2005, + DW_AT_MIPS_software_pipeline_depth = 0x2006, + DW_AT_MIPS_linkage_name = 0x2007, + DW_AT_MIPS_stride = 0x2008, + DW_AT_MIPS_abstract_name = 0x2009, + DW_AT_MIPS_clone_origin = 0x200a, + DW_AT_MIPS_has_inlines = 0x200b, + /* HP extensions. */ + DW_AT_HP_block_index = 0x2000, + DW_AT_HP_unmodifiable = 0x2001, /* Same as DW_AT_MIPS_fde. */ + DW_AT_HP_actuals_stmt_list = 0x2010, + DW_AT_HP_proc_per_section = 0x2011, + DW_AT_HP_raw_data_ptr = 0x2012, + DW_AT_HP_pass_by_reference = 0x2013, + DW_AT_HP_opt_level = 0x2014, + DW_AT_HP_prof_version_id = 0x2015, + DW_AT_HP_opt_flags = 0x2016, + DW_AT_HP_cold_region_low_pc = 0x2017, + DW_AT_HP_cold_region_high_pc = 0x2018, + DW_AT_HP_all_variables_modifiable = 0x2019, + DW_AT_HP_linkage_name = 0x201a, + DW_AT_HP_prof_flags = 0x201b, /* In comp unit of procs_info for -g. */ + /* GNU extensions. */ + DW_AT_sf_names = 0x2101, + DW_AT_src_info = 0x2102, + DW_AT_mac_info = 0x2103, + DW_AT_src_coords = 0x2104, + DW_AT_body_begin = 0x2105, + DW_AT_body_end = 0x2106, + DW_AT_GNU_vector = 0x2107, + /* Thread-safety annotations. + See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation . */ + DW_AT_GNU_guarded_by = 0x2108, + DW_AT_GNU_pt_guarded_by = 0x2109, + DW_AT_GNU_guarded = 0x210a, + DW_AT_GNU_pt_guarded = 0x210b, + DW_AT_GNU_locks_excluded = 0x210c, + DW_AT_GNU_exclusive_locks_required = 0x210d, + DW_AT_GNU_shared_locks_required = 0x210e, + /* One-definition rule violation detection. + See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo . */ + DW_AT_GNU_odr_signature = 0x210f, + /* Template template argument name. + See http://gcc.gnu.org/wiki/TemplateParmsDwarf . */ + DW_AT_GNU_template_name = 0x2110, + /* VMS extensions. */ + DW_AT_VMS_rtnbeg_pd_address = 0x2201, + /* GNAT extensions. */ + /* GNAT descriptive type. + See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . */ + DW_AT_use_GNAT_descriptive_type = 0x2301, + DW_AT_GNAT_descriptive_type = 0x2302, + /* UPC extension. */ + DW_AT_upc_threads_scaled = 0x3210, + /* PGI (STMicroelectronics) extensions. */ + DW_AT_PGI_lbase = 0x3a00, + DW_AT_PGI_soffset = 0x3a01, + DW_AT_PGI_lstride = 0x3a02 + }; + +/* Location atom names and codes. */ +enum dwarf_location_atom + { + DW_OP_addr = 0x03, + DW_OP_deref = 0x06, + DW_OP_const1u = 0x08, + DW_OP_const1s = 0x09, + DW_OP_const2u = 0x0a, + DW_OP_const2s = 0x0b, + DW_OP_const4u = 0x0c, + DW_OP_const4s = 0x0d, + DW_OP_const8u = 0x0e, + DW_OP_const8s = 0x0f, + DW_OP_constu = 0x10, + DW_OP_consts = 0x11, + DW_OP_dup = 0x12, + DW_OP_drop = 0x13, + DW_OP_over = 0x14, + DW_OP_pick = 0x15, + DW_OP_swap = 0x16, + DW_OP_rot = 0x17, + DW_OP_xderef = 0x18, + DW_OP_abs = 0x19, + DW_OP_and = 0x1a, + DW_OP_div = 0x1b, + DW_OP_minus = 0x1c, + DW_OP_mod = 0x1d, + DW_OP_mul = 0x1e, + DW_OP_neg = 0x1f, + DW_OP_not = 0x20, + DW_OP_or = 0x21, + DW_OP_plus = 0x22, + DW_OP_plus_uconst = 0x23, + DW_OP_shl = 0x24, + DW_OP_shr = 0x25, + DW_OP_shra = 0x26, + DW_OP_xor = 0x27, + DW_OP_bra = 0x28, + DW_OP_eq = 0x29, + DW_OP_ge = 0x2a, + DW_OP_gt = 0x2b, + DW_OP_le = 0x2c, + DW_OP_lt = 0x2d, + DW_OP_ne = 0x2e, + DW_OP_skip = 0x2f, + DW_OP_lit0 = 0x30, + DW_OP_lit1 = 0x31, + DW_OP_lit2 = 0x32, + DW_OP_lit3 = 0x33, + DW_OP_lit4 = 0x34, + DW_OP_lit5 = 0x35, + DW_OP_lit6 = 0x36, + DW_OP_lit7 = 0x37, + DW_OP_lit8 = 0x38, + DW_OP_lit9 = 0x39, + DW_OP_lit10 = 0x3a, + DW_OP_lit11 = 0x3b, + DW_OP_lit12 = 0x3c, + DW_OP_lit13 = 0x3d, + DW_OP_lit14 = 0x3e, + DW_OP_lit15 = 0x3f, + DW_OP_lit16 = 0x40, + DW_OP_lit17 = 0x41, + DW_OP_lit18 = 0x42, + DW_OP_lit19 = 0x43, + DW_OP_lit20 = 0x44, + DW_OP_lit21 = 0x45, + DW_OP_lit22 = 0x46, + DW_OP_lit23 = 0x47, + DW_OP_lit24 = 0x48, + DW_OP_lit25 = 0x49, + DW_OP_lit26 = 0x4a, + DW_OP_lit27 = 0x4b, + DW_OP_lit28 = 0x4c, + DW_OP_lit29 = 0x4d, + DW_OP_lit30 = 0x4e, + DW_OP_lit31 = 0x4f, + DW_OP_reg0 = 0x50, + DW_OP_reg1 = 0x51, + DW_OP_reg2 = 0x52, + DW_OP_reg3 = 0x53, + DW_OP_reg4 = 0x54, + DW_OP_reg5 = 0x55, + DW_OP_reg6 = 0x56, + DW_OP_reg7 = 0x57, + DW_OP_reg8 = 0x58, + DW_OP_reg9 = 0x59, + DW_OP_reg10 = 0x5a, + DW_OP_reg11 = 0x5b, + DW_OP_reg12 = 0x5c, + DW_OP_reg13 = 0x5d, + DW_OP_reg14 = 0x5e, + DW_OP_reg15 = 0x5f, + DW_OP_reg16 = 0x60, + DW_OP_reg17 = 0x61, + DW_OP_reg18 = 0x62, + DW_OP_reg19 = 0x63, + DW_OP_reg20 = 0x64, + DW_OP_reg21 = 0x65, + DW_OP_reg22 = 0x66, + DW_OP_reg23 = 0x67, + DW_OP_reg24 = 0x68, + DW_OP_reg25 = 0x69, + DW_OP_reg26 = 0x6a, + DW_OP_reg27 = 0x6b, + DW_OP_reg28 = 0x6c, + DW_OP_reg29 = 0x6d, + DW_OP_reg30 = 0x6e, + DW_OP_reg31 = 0x6f, + DW_OP_breg0 = 0x70, + DW_OP_breg1 = 0x71, + DW_OP_breg2 = 0x72, + DW_OP_breg3 = 0x73, + DW_OP_breg4 = 0x74, + DW_OP_breg5 = 0x75, + DW_OP_breg6 = 0x76, + DW_OP_breg7 = 0x77, + DW_OP_breg8 = 0x78, + DW_OP_breg9 = 0x79, + DW_OP_breg10 = 0x7a, + DW_OP_breg11 = 0x7b, + DW_OP_breg12 = 0x7c, + DW_OP_breg13 = 0x7d, + DW_OP_breg14 = 0x7e, + DW_OP_breg15 = 0x7f, + DW_OP_breg16 = 0x80, + DW_OP_breg17 = 0x81, + DW_OP_breg18 = 0x82, + DW_OP_breg19 = 0x83, + DW_OP_breg20 = 0x84, + DW_OP_breg21 = 0x85, + DW_OP_breg22 = 0x86, + DW_OP_breg23 = 0x87, + DW_OP_breg24 = 0x88, + DW_OP_breg25 = 0x89, + DW_OP_breg26 = 0x8a, + DW_OP_breg27 = 0x8b, + DW_OP_breg28 = 0x8c, + DW_OP_breg29 = 0x8d, + DW_OP_breg30 = 0x8e, + DW_OP_breg31 = 0x8f, + DW_OP_regx = 0x90, + DW_OP_fbreg = 0x91, + DW_OP_bregx = 0x92, + DW_OP_piece = 0x93, + DW_OP_deref_size = 0x94, + DW_OP_xderef_size = 0x95, + DW_OP_nop = 0x96, + /* DWARF 3 extensions. */ + DW_OP_push_object_address = 0x97, + DW_OP_call2 = 0x98, + DW_OP_call4 = 0x99, + DW_OP_call_ref = 0x9a, + DW_OP_form_tls_address = 0x9b, + DW_OP_call_frame_cfa = 0x9c, + DW_OP_bit_piece = 0x9d, + + /* DWARF 4 extensions. */ + DW_OP_implicit_value = 0x9e, + DW_OP_stack_value = 0x9f, + + DW_OP_lo_user = 0xe0, /* Implementation-defined range start. */ + DW_OP_hi_user = 0xff, /* Implementation-defined range end. */ + + /* GNU extensions. */ + DW_OP_GNU_push_tls_address = 0xe0, + /* The following is for marking variables that are uninitialized. */ + DW_OP_GNU_uninit = 0xf0, + DW_OP_GNU_encoded_addr = 0xf1, + /* HP extensions. */ + DW_OP_HP_unknown = 0xe0, /* Ouch, the same as GNU_push_tls_address. */ + DW_OP_HP_is_value = 0xe1, + DW_OP_HP_fltconst4 = 0xe2, + DW_OP_HP_fltconst8 = 0xe3, + DW_OP_HP_mod_range = 0xe4, + DW_OP_HP_unmod_range = 0xe5, + DW_OP_HP_tls = 0xe6, + /* PGI (STMicroelectronics) extensions. */ + DW_OP_PGI_omp_thread_num = 0xf8 + }; + +/* Type encodings. */ +enum dwarf_type + { + DW_ATE_void = 0x0, + DW_ATE_address = 0x1, + DW_ATE_boolean = 0x2, + DW_ATE_complex_float = 0x3, + DW_ATE_float = 0x4, + DW_ATE_signed = 0x5, + DW_ATE_signed_char = 0x6, + DW_ATE_unsigned = 0x7, + DW_ATE_unsigned_char = 0x8, + /* DWARF 3. */ + DW_ATE_imaginary_float = 0x9, + DW_ATE_packed_decimal = 0xa, + DW_ATE_numeric_string = 0xb, + DW_ATE_edited = 0xc, + DW_ATE_signed_fixed = 0xd, + DW_ATE_unsigned_fixed = 0xe, + DW_ATE_decimal_float = 0xf, + + DW_ATE_lo_user = 0x80, + DW_ATE_hi_user = 0xff, + + /* HP extensions. */ + DW_ATE_HP_float80 = 0x80, /* Floating-point (80 bit). */ + DW_ATE_HP_complex_float80 = 0x81, /* Complex floating-point (80 bit). */ + DW_ATE_HP_float128 = 0x82, /* Floating-point (128 bit). */ + DW_ATE_HP_complex_float128 = 0x83, /* Complex floating-point (128 bit). */ + DW_ATE_HP_floathpintel = 0x84, /* Floating-point (82 bit IA64). */ + DW_ATE_HP_imaginary_float80 = 0x85, + DW_ATE_HP_imaginary_float128 = 0x86 + }; + +/* Decimal sign encodings. */ +enum dwarf_decimal_sign_encoding + { + /* DWARF 3. */ + DW_DS_unsigned = 0x01, + DW_DS_leading_overpunch = 0x02, + DW_DS_trailing_overpunch = 0x03, + DW_DS_leading_separate = 0x04, + DW_DS_trailing_separate = 0x05 + }; + +/* Endianity encodings. */ +enum dwarf_endianity_encoding + { + /* DWARF 3. */ + DW_END_default = 0x00, + DW_END_big = 0x01, + DW_END_little = 0x02, + + DW_END_lo_user = 0x40, + DW_END_hi_user = 0xff + }; + +/* Array ordering names and codes. */ +enum dwarf_array_dim_ordering + { + DW_ORD_row_major = 0, + DW_ORD_col_major = 1 + }; + +/* Access attribute. */ +enum dwarf_access_attribute + { + DW_ACCESS_public = 1, + DW_ACCESS_protected = 2, + DW_ACCESS_private = 3 + }; + +/* Visibility. */ +enum dwarf_visibility_attribute + { + DW_VIS_local = 1, + DW_VIS_exported = 2, + DW_VIS_qualified = 3 + }; + +/* Virtuality. */ +enum dwarf_virtuality_attribute + { + DW_VIRTUALITY_none = 0, + DW_VIRTUALITY_virtual = 1, + DW_VIRTUALITY_pure_virtual = 2 + }; + +/* Case sensitivity. */ +enum dwarf_id_case + { + DW_ID_case_sensitive = 0, + DW_ID_up_case = 1, + DW_ID_down_case = 2, + DW_ID_case_insensitive = 3 + }; + +/* Calling convention. */ +enum dwarf_calling_convention + { + DW_CC_normal = 0x1, + DW_CC_program = 0x2, + DW_CC_nocall = 0x3, + + DW_CC_lo_user = 0x40, + DW_CC_hi_user = 0xff, + + DW_CC_GNU_renesas_sh = 0x40, + DW_CC_GNU_borland_fastcall_i386 = 0x41 + }; + +/* Inline attribute. */ +enum dwarf_inline_attribute + { + DW_INL_not_inlined = 0, + DW_INL_inlined = 1, + DW_INL_declared_not_inlined = 2, + DW_INL_declared_inlined = 3 + }; + +/* Discriminant lists. */ +enum dwarf_discrim_list + { + DW_DSC_label = 0, + DW_DSC_range = 1 + }; + +/* Line number opcodes. */ +enum dwarf_line_number_ops + { + DW_LNS_extended_op = 0, + DW_LNS_copy = 1, + DW_LNS_advance_pc = 2, + DW_LNS_advance_line = 3, + DW_LNS_set_file = 4, + DW_LNS_set_column = 5, + DW_LNS_negate_stmt = 6, + DW_LNS_set_basic_block = 7, + DW_LNS_const_add_pc = 8, + DW_LNS_fixed_advance_pc = 9, + /* DWARF 3. */ + DW_LNS_set_prologue_end = 10, + DW_LNS_set_epilogue_begin = 11, + DW_LNS_set_isa = 12 + }; + +/* Line number extended opcodes. */ +enum dwarf_line_number_x_ops + { + DW_LNE_end_sequence = 1, + DW_LNE_set_address = 2, + DW_LNE_define_file = 3, + DW_LNE_set_discriminator = 4, + /* HP extensions. */ + DW_LNE_HP_negate_is_UV_update = 0x11, + DW_LNE_HP_push_context = 0x12, + DW_LNE_HP_pop_context = 0x13, + DW_LNE_HP_set_file_line_column = 0x14, + DW_LNE_HP_set_routine_name = 0x15, + DW_LNE_HP_set_sequence = 0x16, + DW_LNE_HP_negate_post_semantics = 0x17, + DW_LNE_HP_negate_function_exit = 0x18, + DW_LNE_HP_negate_front_end_logical = 0x19, + DW_LNE_HP_define_proc = 0x20, + + DW_LNE_lo_user = 0x80, + DW_LNE_hi_user = 0xff + }; + +/* Call frame information. */ +enum dwarf_call_frame_info + { + DW_CFA_advance_loc = 0x40, + DW_CFA_offset = 0x80, + DW_CFA_restore = 0xc0, + DW_CFA_nop = 0x00, + DW_CFA_set_loc = 0x01, + DW_CFA_advance_loc1 = 0x02, + DW_CFA_advance_loc2 = 0x03, + DW_CFA_advance_loc4 = 0x04, + DW_CFA_offset_extended = 0x05, + DW_CFA_restore_extended = 0x06, + DW_CFA_undefined = 0x07, + DW_CFA_same_value = 0x08, + DW_CFA_register = 0x09, + DW_CFA_remember_state = 0x0a, + DW_CFA_restore_state = 0x0b, + DW_CFA_def_cfa = 0x0c, + DW_CFA_def_cfa_register = 0x0d, + DW_CFA_def_cfa_offset = 0x0e, + /* DWARF 3. */ + DW_CFA_def_cfa_expression = 0x0f, + DW_CFA_expression = 0x10, + DW_CFA_offset_extended_sf = 0x11, + DW_CFA_def_cfa_sf = 0x12, + DW_CFA_def_cfa_offset_sf = 0x13, + DW_CFA_val_offset = 0x14, + DW_CFA_val_offset_sf = 0x15, + DW_CFA_val_expression = 0x16, + + DW_CFA_lo_user = 0x1c, + DW_CFA_hi_user = 0x3f, + + /* SGI/MIPS specific. */ + DW_CFA_MIPS_advance_loc8 = 0x1d, + /* GNU extensions. */ + DW_CFA_GNU_window_save = 0x2d, + DW_CFA_GNU_args_size = 0x2e, + DW_CFA_GNU_negative_offset_extended = 0x2f + }; + +#define DW_CIE_ID 0xffffffff +#define DW64_CIE_ID 0xffffffffffffffffULL +#define DW_CIE_VERSION 1 + +#define DW_CFA_extended 0 + +#define DW_CHILDREN_no 0x00 +#define DW_CHILDREN_yes 0x01 + +#define DW_ADDR_none 0 + +/* Source language names and codes. */ +enum dwarf_source_language + { + DW_LANG_C89 = 0x0001, + DW_LANG_C = 0x0002, + DW_LANG_Ada83 = 0x0003, + DW_LANG_C_plus_plus = 0x0004, + DW_LANG_Cobol74 = 0x0005, + DW_LANG_Cobol85 = 0x0006, + DW_LANG_Fortran77 = 0x0007, + DW_LANG_Fortran90 = 0x0008, + DW_LANG_Pascal83 = 0x0009, + DW_LANG_Modula2 = 0x000a, + /* DWARF 3. */ + DW_LANG_Java = 0x000b, + DW_LANG_C99 = 0x000c, + DW_LANG_Ada95 = 0x000d, + DW_LANG_Fortran95 = 0x000e, + DW_LANG_PLI = 0x000f, + DW_LANG_ObjC = 0x0010, + DW_LANG_ObjC_plus_plus = 0x0011, + DW_LANG_UPC = 0x0012, + DW_LANG_D = 0x0013, + /* DWARF 4. */ + DW_LANG_Python = 0x0014, + + DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */ + DW_LANG_hi_user = 0xffff, /* Implementation-defined range start. */ + + /* MIPS. */ + DW_LANG_Mips_Assembler = 0x8001, + /* UPC. */ + DW_LANG_Upc = 0x8765 + }; + +/* Names and codes for macro information. */ +enum dwarf_macinfo_record_type + { + DW_MACINFO_define = 1, + DW_MACINFO_undef = 2, + DW_MACINFO_start_file = 3, + DW_MACINFO_end_file = 4, + DW_MACINFO_vendor_ext = 255 + }; + +/* @@@ For use with GNU frame unwind information. */ + +#define DW_EH_PE_absptr 0x00 +#define DW_EH_PE_omit 0xff + +#define DW_EH_PE_uleb128 0x01 +#define DW_EH_PE_udata2 0x02 +#define DW_EH_PE_udata4 0x03 +#define DW_EH_PE_udata8 0x04 +#define DW_EH_PE_sleb128 0x09 +#define DW_EH_PE_sdata2 0x0A +#define DW_EH_PE_sdata4 0x0B +#define DW_EH_PE_sdata8 0x0C +#define DW_EH_PE_signed 0x08 + +#define DW_EH_PE_pcrel 0x10 +#define DW_EH_PE_textrel 0x20 +#define DW_EH_PE_datarel 0x30 +#define DW_EH_PE_funcrel 0x40 +#define DW_EH_PE_aligned 0x50 + +#define DW_EH_PE_indirect 0x80 + +#endif /* _ELF_DWARF2_H */ diff --git a/contrib/sdk/sources/gcc_eh/filenames.h b/contrib/sdk/sources/gcc_eh/filenames.h new file mode 100644 index 0000000000..0d411cc126 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/filenames.h @@ -0,0 +1,60 @@ +/* Macros for taking apart, interpreting and processing file names. + + These are here because some non-Posix (a.k.a. DOSish) systems have + drive letter brain-damage at the beginning of an absolute file name, + use forward- and back-slash in path names interchangeably, and + some of them have case-insensitive file names. + + Copyright 2000, 2001, 2007 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program 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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef FILENAMES_H +#define FILENAMES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) + +#ifndef HAVE_DOS_BASED_FILE_SYSTEM +#define HAVE_DOS_BASED_FILE_SYSTEM 1 +#endif + +#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') +/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is + only semi-absolute. This is because the users of IS_ABSOLUTE_PATH + want to know whether to prepend the current working directory to + a file name, which should not be done with a name like d:foo. */ +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) + +#else /* not DOSish */ + +#define IS_DIR_SEPARATOR(c) ((c) == '/') +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) + +#endif /* not DOSish */ + +extern int filename_cmp (const char *s1, const char *s2); +#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) + +#ifdef __cplusplus +} +#endif + +#endif /* FILENAMES_H */ diff --git a/contrib/sdk/sources/gcc_eh/gthr-single.h b/contrib/sdk/sources/gcc_eh/gthr-single.h new file mode 100644 index 0000000000..357528ad1f --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/gthr-single.h @@ -0,0 +1,292 @@ +/* Threads compatibility routines for libgcc2 and libobjc. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_GTHR_SINGLE_H +#define GCC_GTHR_SINGLE_H + +/* Just provide compatibility for mutex handling. */ + +typedef int __gthread_key_t; +typedef int __gthread_once_t; +typedef int __gthread_mutex_t; +typedef int __gthread_recursive_mutex_t; + +#define __GTHREAD_ONCE_INIT 0 +#define __GTHREAD_MUTEX_INIT 0 +#define __GTHREAD_RECURSIVE_MUTEX_INIT 0 + +#define UNUSED __attribute__((unused)) + +#ifdef _LIBOBJC + +/* Thread local storage for a single thread */ +static void *thread_local_storage = NULL; + +/* Backend initialization functions */ + +/* Initialize the threads subsystem. */ +static inline int +__gthread_objc_init_thread_system (void) +{ + /* No thread support available */ + return -1; +} + +/* Close the threads subsystem. */ +static inline int +__gthread_objc_close_thread_system (void) +{ + /* No thread support available */ + return -1; +} + +/* Backend thread functions */ + +/* Create a new thread of execution. */ +static inline objc_thread_t +__gthread_objc_thread_detach (void (* func)(void *), void * arg UNUSED) +{ + /* No thread support available */ + return NULL; +} + +/* Set the current thread's priority. */ +static inline int +__gthread_objc_thread_set_priority (int priority UNUSED) +{ + /* No thread support available */ + return -1; +} + +/* Return the current thread's priority. */ +static inline int +__gthread_objc_thread_get_priority (void) +{ + return OBJC_THREAD_INTERACTIVE_PRIORITY; +} + +/* Yield our process time to another thread. */ +static inline void +__gthread_objc_thread_yield (void) +{ + return; +} + +/* Terminate the current thread. */ +static inline int +__gthread_objc_thread_exit (void) +{ + /* No thread support available */ + /* Should we really exit the program */ + /* exit (&__objc_thread_exit_status); */ + return -1; +} + +/* Returns an integer value which uniquely describes a thread. */ +static inline objc_thread_t +__gthread_objc_thread_id (void) +{ + /* No thread support, use 1. */ + return (objc_thread_t) 1; +} + +/* Sets the thread's local storage pointer. */ +static inline int +__gthread_objc_thread_set_data (void *value) +{ + thread_local_storage = value; + return 0; +} + +/* Returns the thread's local storage pointer. */ +static inline void * +__gthread_objc_thread_get_data (void) +{ + return thread_local_storage; +} + +/* Backend mutex functions */ + +/* Allocate a mutex. */ +static inline int +__gthread_objc_mutex_allocate (objc_mutex_t mutex UNUSED) +{ + return 0; +} + +/* Deallocate a mutex. */ +static inline int +__gthread_objc_mutex_deallocate (objc_mutex_t mutex UNUSED) +{ + return 0; +} + +/* Grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_lock (objc_mutex_t mutex UNUSED) +{ + /* There can only be one thread, so we always get the lock */ + return 0; +} + +/* Try to grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_trylock (objc_mutex_t mutex UNUSED) +{ + /* There can only be one thread, so we always get the lock */ + return 0; +} + +/* Unlock the mutex */ +static inline int +__gthread_objc_mutex_unlock (objc_mutex_t mutex UNUSED) +{ + return 0; +} + +/* Backend condition mutex functions */ + +/* Allocate a condition. */ +static inline int +__gthread_objc_condition_allocate (objc_condition_t condition UNUSED) +{ + return 0; +} + +/* Deallocate a condition. */ +static inline int +__gthread_objc_condition_deallocate (objc_condition_t condition UNUSED) +{ + return 0; +} + +/* Wait on the condition */ +static inline int +__gthread_objc_condition_wait (objc_condition_t condition UNUSED, + objc_mutex_t mutex UNUSED) +{ + return 0; +} + +/* Wake up all threads waiting on this condition. */ +static inline int +__gthread_objc_condition_broadcast (objc_condition_t condition UNUSED) +{ + return 0; +} + +/* Wake up one thread waiting on this condition. */ +static inline int +__gthread_objc_condition_signal (objc_condition_t condition UNUSED) +{ + return 0; +} + +#else /* _LIBOBJC */ + +static inline int +__gthread_active_p (void) +{ + return 0; +} + +static inline int +__gthread_once (__gthread_once_t *__once UNUSED, void (*__func) (void) UNUSED) +{ + return 0; +} + +static inline int UNUSED +__gthread_key_create (__gthread_key_t *__key UNUSED, void (*__func) (void *) UNUSED) +{ + return 0; +} + +static int UNUSED +__gthread_key_delete (__gthread_key_t __key UNUSED) +{ + return 0; +} + +static inline void * +__gthread_getspecific (__gthread_key_t __key UNUSED) +{ + return 0; +} + +static inline int +__gthread_setspecific (__gthread_key_t __key UNUSED, const void *__v UNUSED) +{ + return 0; +} + +static inline int +__gthread_mutex_destroy (__gthread_mutex_t *__mutex UNUSED) +{ + return 0; +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *__mutex UNUSED) +{ + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *__mutex UNUSED) +{ + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *__mutex UNUSED) +{ + return 0; +} + +static inline int +__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_lock (__mutex); +} + +static inline int +__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_trylock (__mutex); +} + +static inline int +__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_unlock (__mutex); +} + +#endif /* _LIBOBJC */ + +#undef UNUSED + +#endif /* ! GCC_GTHR_SINGLE_H */ diff --git a/contrib/sdk/sources/gcc_eh/gthr.h b/contrib/sdk/sources/gcc_eh/gthr.h new file mode 100644 index 0000000000..6edfbcd69c --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/gthr.h @@ -0,0 +1,173 @@ +/* Threads compatibility routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_GTHR_H +#define GCC_GTHR_H + +#ifndef HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +/* If this file is compiled with threads support, it must + #define __GTHREADS 1 + to indicate that threads support is present. Also it has define + function + int __gthread_active_p () + that returns 1 if thread system is active, 0 if not. + + The threads interface must define the following types: + __gthread_key_t + __gthread_once_t + __gthread_mutex_t + __gthread_recursive_mutex_t + + The threads interface must define the following macros: + + __GTHREAD_ONCE_INIT + to initialize __gthread_once_t + __GTHREAD_MUTEX_INIT + to initialize __gthread_mutex_t to get a fast + non-recursive mutex. + __GTHREAD_MUTEX_INIT_FUNCTION + some systems can't initialize a mutex without a + function call. On such systems, define this to a + function which looks like this: + void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) + Don't define __GTHREAD_MUTEX_INIT in this case + __GTHREAD_RECURSIVE_MUTEX_INIT + __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION + as above, but for a recursive mutex. + + The threads interface must define the following static functions: + + int __gthread_once (__gthread_once_t *once, void (*func) ()) + + int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) + int __gthread_key_delete (__gthread_key_t key) + + void *__gthread_getspecific (__gthread_key_t key) + int __gthread_setspecific (__gthread_key_t key, const void *ptr) + + int __gthread_mutex_destroy (__gthread_mutex_t *mutex); + + int __gthread_mutex_lock (__gthread_mutex_t *mutex); + int __gthread_mutex_trylock (__gthread_mutex_t *mutex); + int __gthread_mutex_unlock (__gthread_mutex_t *mutex); + + int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); + int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); + int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); + + The following are supported in POSIX threads only. They are required to + fix a deadlock in static initialization inside libsupc++. The header file + gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra + features are supported. + + Types: + __gthread_cond_t + + Macros: + __GTHREAD_COND_INIT + __GTHREAD_COND_INIT_FUNCTION + + Interface: + int __gthread_cond_broadcast (__gthread_cond_t *cond); + int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); + int __gthread_cond_wait_recursive (__gthread_cond_t *cond, + __gthread_recursive_mutex_t *mutex); + + All functions returning int should return zero on success or the error + number. If the operation is not supported, -1 is returned. + + If the following are also defined, you should + #define __GTHREADS_CXX0X 1 + to enable the c++0x thread library. + + Types: + __gthread_t + __gthread_time_t + + Interface: + int __gthread_create (__gthread_t *thread, void *(*func) (void*), + void *args); + int __gthread_join (__gthread_t thread, void **value_ptr); + int __gthread_detach (__gthread_t thread); + int __gthread_equal (__gthread_t t1, __gthread_t t2); + __gthread_t __gthread_self (void); + int __gthread_yield (void); + + int __gthread_mutex_timedlock (__gthread_mutex_t *m, + const __gthread_time_t *abs_timeout); + int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, + const __gthread_time_t *abs_time); + + int __gthread_cond_signal (__gthread_cond_t *cond); + int __gthread_cond_timedwait (__gthread_cond_t *cond, + __gthread_mutex_t *mutex, + const __gthread_time_t *abs_timeout); + int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond, + __gthread_recursive_mutex_t *mutex, + const __gthread_time_t *abs_time) + + Currently supported threads packages are + TPF threads with -D__tpf__ + POSIX/Unix98 threads with -D_PTHREADS + POSIX/Unix95 threads with -D_PTHREADS95 + DCE threads with -D_DCE_THREADS + Solaris/UI threads with -D_SOLARIS_THREADS + +*/ + +/* Check first for thread specific defines. */ +#if defined (__tpf__) +#include "gthr-tpf.h" +#elif _PTHREADS +#include "gthr-posix.h" +#elif _PTHREADS95 +#include "gthr-posix95.h" +#elif _DCE_THREADS +#include "gthr-dce.h" +#elif _SOLARIS_THREADS +#include "gthr-solaris.h" + +/* Include GTHREAD_FILE if one is defined. */ +#elif defined(HAVE_GTHR_DEFAULT) +#if SUPPORTS_WEAK +#ifndef GTHREAD_USE_WEAK +#define GTHREAD_USE_WEAK 1 +#endif +#endif +#include "gthr-default.h" + +/* Fallback to single thread definitions. */ +#else +#include "gthr-single.h" +#endif + +#ifndef HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* ! GCC_GTHR_H */ diff --git a/contrib/sdk/sources/gcc_eh/options.h b/contrib/sdk/sources/gcc_eh/options.h new file mode 100644 index 0000000000..41a561be57 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/options.h @@ -0,0 +1,1608 @@ +/* This file is auto-generated by opth-gen.awk. */ + +#ifndef OPTIONS_H +#define OPTIONS_H + +extern int target_flags; +extern int target_flags_explicit; + +extern int extra_warnings; +extern int warn_abi; +extern int warn_address; +extern int warn_aggregate_return; +extern int warn_array_bounds; +extern int warn_assign_intercept; +extern int warn_attributes; +extern int warn_bad_function_cast; +extern int warn_cxx_compat; +extern int warn_cxx0x_compat; +extern int warn_cast_align; +extern int warn_cast_qual; +extern int warn_char_subscripts; +extern int warn_clobbered; +extern int warn_conversion; +extern int warn_conversion_null; +extern int warn_coverage_mismatch; +extern int warn_ctor_dtor_privacy; +extern int warn_declaration_after_statement; +extern int warn_deprecated; +extern int warn_deprecated_decl; +extern int warn_disabled_optimization; +extern int warn_div_by_zero; +extern int warn_ecpp; +extern int warn_empty_body; +extern int warn_enum_compare; +extern int warnings_are_errors; +extern int flag_extraneous_semicolon; +extern int flag_fatal_errors; +extern int warn_float_equal; +extern int warn_format_contains_nul; +extern int warn_format_extra_args; +extern int warn_format_nonliteral; +extern int warn_format_security; +extern int warn_format_y2k; +extern int warn_format_zero_length; +extern int warn_ignored_qualifiers; +extern int warn_implicit_function_declaration; +extern int warn_implicit_int; +extern int warn_init_self; +extern int warn_inline; +extern int warn_int_to_pointer_cast; +extern int warn_invalid_offsetof; +extern int warn_jump_misses_init; +extern int warn_logical_op; +extern int warn_long_long; +extern int warn_main; +extern int warn_missing_braces; +extern int warn_missing_declarations; +extern int warn_missing_field_initializers; +extern int warn_missing_format_attribute; +extern int warn_missing_noreturn; +extern int warn_missing_parameter_type; +extern int warn_missing_prototypes; +extern int warn_mudflap; +extern int warn_nested_externs; +extern int warn_nontemplate_friend; +extern int warn_nonvdtor; +extern int warn_nonnull; +extern int warn_old_style_cast; +extern int warn_old_style_declaration; +extern int warn_old_style_definition; +extern int flag_newer; +extern int warn_overflow; +extern int warn_overlength_strings; +extern int warn_overloaded_virtual; +extern int warn_override_init; +extern int warn_packed; +extern int warn_packed_bitfield_compat; +extern int warn_padded; +extern int warn_parentheses; +extern int warn_pedantic_ms_format; +extern int warn_pmf2ptr; +extern int warn_pointer_arith; +extern int warn_pointer_sign; +extern int warn_pointer_to_int_cast; +extern int warn_pragmas; +extern int warn_protocol; +extern int warn_psabi; +extern int warn_redundant_decls; +extern int flag_redundant; +extern int warn_reorder; +extern int warn_return_type; +extern int warn_selector; +extern int warn_sequence_point; +extern int warn_shadow; +extern int warn_sign_compare; +extern int warn_sign_conversion; +extern int warn_sign_promo; +extern int warn_stack_protect; +extern int warn_strict_aliasing; +extern int warn_strict_overflow; +extern int warn_strict_prototypes; +extern int warn_strict_selector_match; +extern int warn_switch; +extern int warn_switch_default; +extern int warn_switch_enum; +extern int warn_sync_nand; +extern int warn_synth; +extern int warn_system_headers; +extern int warn_traditional; +extern int warn_traditional_conversion; +extern int warn_type_limits; +extern int warn_undeclared_selector; +extern int warn_uninitialized; +extern int warn_unsafe_loop_optimizations; +extern int warn_unsuffixed_float_constants; +extern int warn_unused; +extern int warn_unused_function; +extern int warn_unused_label; +extern int warn_unused_parameter; +extern int warn_unused_result; +extern int warn_unused_value; +extern int warn_unused_variable; +extern int warn_vla; +extern int warn_volatile_register_var; +extern int warn_write_strings; +extern int flag_pic; +extern int flag_pie; +extern int flag_abi_version; +extern int align_functions; +extern int align_jumps; +extern int align_labels; +extern int align_loops; +extern int flag_argument_noalias; +extern int flag_assert; +extern int flag_associative_math; +extern int flag_asynchronous_unwind_tables; +extern int flag_auto_inc_dec; +extern int flag_bootstrap_classes; +extern int flag_bounds_check; +extern int flag_branch_on_count_reg; +extern int flag_branch_probabilities; +extern int flag_branch_target_load_optimize; +extern int flag_branch_target_load_optimize2; +extern int flag_btr_bb_exclusive; +extern int flag_caller_saves; +extern int flag_check_data_deps; +extern int flag_check_references; +extern int flag_no_common; +extern int flag_compare_debug; +extern const char *flag_compare_debug_opt; +extern int flag_conserve_stack; +extern int flag_cprop_registers; +extern int flag_crossjumping; +extern int flag_cse_follow_jumps; +extern int flag_cx_fortran_rules; +extern int flag_cx_limited_range; +extern int flag_data_sections; +extern int flag_dce; +extern int flag_deduce_init_list; +extern int flag_defer_pop; +extern int flag_delayed_branch; +extern int flag_delete_null_pointer_checks; +extern int flag_dse; +extern const char *flag_dump_final_insns; +extern int flag_dump_noaddr; +extern int flag_dump_unnumbered; +extern int flag_dump_unnumbered_links; +extern int flag_dwarf2_cfi_asm; +extern int flag_early_inlining; +extern int flag_eliminate_dwarf2_dups; +extern int flag_debug_only_used_symbols; +extern int flag_eliminate_unused_debug_types; +extern int flag_emit_class_debug_always; +extern int flag_emit_class_files; +extern int flag_enable_icf_debug; +extern int flag_exceptions; +extern int flag_expensive_optimizations; +extern int flag_filelist_file; +extern int flag_finite_math_only; +extern int flag_float_store; +extern int flag_force_classes_archive_check; +extern int flag_forward_propagate; +extern int flag_friend_injection; +extern int flag_no_function_cse; +extern int flag_function_sections; +extern int flag_gcse; +extern int flag_gcse_after_reload; +extern int flag_gcse_las; +extern int flag_gcse_lm; +extern int flag_gcse_sm; +extern int flag_gnu89_inline; +extern int flag_graphite; +extern int flag_graphite_identity; +extern int flag_guess_branch_prob; +extern int flag_hash_synchronization; +extern int help_flag; +extern int flag_no_ident; +extern int flag_if_conversion; +extern int flag_if_conversion2; +extern int flag_indirect_classes; +extern int flag_indirect_dispatch; +extern int flag_indirect_inlining; +extern int flag_inhibit_size_directive; +extern int flag_no_inline; +extern int flag_inline_functions; +extern int flag_inline_functions_called_once; +extern int flag_inline_small_functions; +extern int flag_instrument_function_entry_exit; +extern int flag_ipa_cp; +extern int flag_ipa_cp_clone; +extern int flag_ipa_matrix_reorg; +extern int flag_ipa_pta; +extern int flag_ipa_pure_const; +extern int flag_ipa_reference; +extern int flag_ipa_sra; +extern int flag_ipa_struct_reorg; +extern int flag_ipa_type_escape; +extern int flag_ira_coalesce; +extern int flag_ira_loop_pressure; +extern int flag_ira_share_save_slots; +extern int flag_ira_share_spill_slots; +extern int flag_ivopts; +extern int flag_jni; +extern int flag_jump_tables; +extern int flag_keep_inline_functions; +extern int flag_keep_static_consts; +extern int flag_leading_underscore; +extern int flag_loop_block; +extern int flag_loop_interchange; +extern int flag_loop_parallelize_all; +extern int flag_loop_strip_mine; +extern int flag_lto; +extern int flag_lto_compression_level; +extern int flag_lto_report; +extern int flag_ltrans; +extern const char *ltrans_output_list; +extern int flag_errno_math; +extern int mem_report; +extern int flag_merge_constants; +extern int flag_merge_debug_strings; +extern int flag_modulo_sched; +extern int flag_modulo_sched_allow_regmoves; +extern int flag_move_loop_invariants; +extern int flag_mudflap; +extern int flag_mudflap_ignore_reads; +extern int flag_non_call_exceptions; +extern int flag_objc_call_cxx_cdtors; +extern int flag_objc_direct_dispatch; +extern int flag_objc_exceptions; +extern int flag_objc_gc; +extern int flag_objc_sjlj_exceptions; +extern int flag_omit_frame_pointer; +extern int flag_openmp; +extern int flag_regmove; +extern int flag_optimize_sibling_calls; +extern int flag_optimize_sci; +extern int flag_pack_struct; +extern int flag_pcc_struct_return; +extern int flag_peel_loops; +extern int flag_no_peephole; +extern int flag_peephole2; +extern int post_ipa_mem_report; +extern int pre_ipa_mem_report; +extern int flag_predictive_commoning; +extern int flag_prefetch_loop_arrays; +extern int profile_flag; +extern int profile_arc_flag; +extern int flag_profile_correction; +extern int flag_profile_use; +extern int flag_profile_values; +extern int flag_reciprocal_math; +extern int flag_record_gcc_switches; +extern int flag_reduced_reflection; +extern int flag_rename_registers; +extern int flag_reorder_blocks; +extern int flag_reorder_blocks_and_partition; +extern int flag_reorder_functions; +extern int flag_rerun_cse_after_loop; +extern int flag_resched_modulo_sched; +extern int flag_rounding_math; +extern int flag_sched_critical_path_heuristic; +extern int flag_sched_dep_count_heuristic; +extern int flag_sched_group_heuristic; +extern int flag_schedule_interblock; +extern int flag_sched_last_insn_heuristic; +extern int flag_sched_pressure; +extern int flag_sched_rank_heuristic; +extern int flag_schedule_speculative; +extern int flag_sched_spec_insn_heuristic; +extern int flag_schedule_speculative_load; +extern int flag_schedule_speculative_load_dangerous; +extern int flag_sched_stalled_insns; +extern int flag_sched_stalled_insns_dep; +extern int flag_sched2_use_superblocks; +extern int flag_schedule_insns; +extern int flag_schedule_insns_after_reload; +extern int flag_section_anchors; +extern int flag_sel_sched_pipelining; +extern int flag_sel_sched_pipelining_outer_loops; +extern int flag_sel_sched_reschedule_pipelined; +extern int flag_selective_scheduling; +extern int flag_selective_scheduling2; +extern int flag_setstackexecutable; +extern int flag_show_column; +extern int flag_signaling_nans; +extern int flag_signed_zeros; +extern int flag_single_precision_constant; +extern int flag_split_ivs_in_unroller; +extern int flag_split_wide_types; +extern int flag_stack_protect; +extern int flag_store_check; +extern int flag_strict_aliasing; +extern int flag_strict_overflow; +extern int flag_syntax_only; +extern int flag_test_coverage; +extern int flag_thread_jumps; +extern int time_report; +extern int flag_toplevel_reorder; +extern int flag_tracer; +extern int flag_trapping_math; +extern int flag_trapv; +extern int flag_tree_builtin_call_dce; +extern int flag_tree_ccp; +extern int flag_tree_ch; +extern int flag_tree_copy_prop; +extern int flag_tree_copyrename; +extern int flag_tree_cselim; +extern int flag_tree_dce; +extern int flag_tree_dom; +extern int flag_tree_dse; +extern int flag_tree_forwprop; +extern int flag_tree_fre; +extern int flag_tree_loop_distribution; +extern int flag_tree_loop_im; +extern int flag_tree_loop_ivcanon; +extern int flag_tree_loop_linear; +extern int flag_tree_loop_optimize; +extern int flag_tree_live_range_split; +extern int flag_tree_parallelize_loops; +extern int flag_tree_phiprop; +extern int flag_tree_pre; +extern int flag_tree_pta; +extern int flag_tree_reassoc; +extern int flag_tree_scev_cprop; +extern int flag_tree_sink; +extern int flag_tree_slp_vectorize; +extern int flag_tree_sra; +extern int flag_tree_switch_conversion; +extern int flag_tree_ter; +extern int flag_tree_vect_loop_version; +extern int flag_tree_vectorize; +extern int flag_tree_vrp; +extern int flag_unit_at_a_time; +extern int flag_unroll_all_loops; +extern int flag_unroll_loops; +extern int flag_unsafe_loop_optimizations; +extern int flag_unsafe_math_optimizations; +extern int flag_unswitch_loops; +extern int flag_unwind_tables; +extern int flag_use_atomic_builtins; +extern int flag_use_boehm_gc; +extern int flag_use_divide_subroutine; +extern int flag_var_tracking; +extern int flag_var_tracking_assignments; +extern int flag_var_tracking_assignments_toggle; +extern int flag_var_tracking_uninit; +extern int flag_variable_expansion_in_unroller; +extern int flag_vect_cost_model; +extern int flag_verbose_asm; +extern int flag_visibility_ms_compat; +extern int flag_value_profile_transformations; +extern int flag_web; +extern int flag_whole_program; +extern int flag_whopr; +extern int flag_wpa; +extern int flag_wrapv; +extern int flag_zero_initialized_in_bss; +extern int dwarf_version; +extern int dwarf_strict; +extern int flag_gtoggle; +extern int ix86_isa_flags; +extern const char *ix86_abi_string; +extern const char *ix86_align_funcs_string; +extern const char *ix86_align_jumps_string; +extern const char *ix86_align_loops_string; +extern const char *ix86_arch_string; +extern const char *ix86_asm_string; +extern const char *ix86_branch_cost_string; +extern const char *ix86_cmodel_string; +extern int ix86_force_drap; +extern const char *ix86_fpmath_string; +extern const char *ix86_incoming_stack_boundary_string; +extern const char *ix86_section_threshold_string; +extern int TARGET_NOP_FUN_DLLIMPORT; +extern const char *ix87_precision_string; +extern int use_pe_aligned_common; +extern const char *ix86_preferred_stack_boundary_string; +extern const char *ix86_regparm_string; +extern int ix86_sse2avx; +extern int ix86_force_align_arg_pointer; +extern const char *ix86_stringop_string; +extern const char *ix86_tls_dialect_string; +extern const char *ix86_tune_string; +extern const char *ix86_veclibabi_string; +extern int pedantic; +extern int quiet_flag; +extern int version_flag; +extern int inhibit_warnings; + +#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) + +/* Structure to save/restore optimization and target specific options. */ +struct GTY(()) cl_optimization +{ + int align_functions; + int align_jumps; + int align_labels; + int align_loops; + int flag_sched_stalled_insns; + int flag_sched_stalled_insns_dep; + unsigned char optimize; + unsigned char optimize_size; + signed char flag_argument_noalias; + signed char flag_asynchronous_unwind_tables; + signed char flag_branch_on_count_reg; + signed char flag_branch_probabilities; + signed char flag_branch_target_load_optimize; + signed char flag_branch_target_load_optimize2; + signed char flag_btr_bb_exclusive; + signed char flag_caller_saves; + signed char flag_no_common; + signed char flag_conserve_stack; + signed char flag_cprop_registers; + signed char flag_crossjumping; + signed char flag_cse_follow_jumps; + signed char flag_cx_fortran_rules; + signed char flag_cx_limited_range; + signed char flag_data_sections; + signed char flag_dce; + signed char flag_defer_pop; + signed char flag_delayed_branch; + signed char flag_delete_null_pointer_checks; + signed char flag_dse; + signed char flag_early_inlining; + signed char flag_exceptions; + signed char flag_expensive_optimizations; + signed char flag_finite_math_only; + signed char flag_float_store; + signed char flag_forward_propagate; + signed char flag_gcse; + signed char flag_gcse_after_reload; + signed char flag_gcse_las; + signed char flag_gcse_lm; + signed char flag_gcse_sm; + signed char flag_graphite_identity; + signed char flag_guess_branch_prob; + signed char flag_if_conversion; + signed char flag_if_conversion2; + signed char flag_inline_functions; + signed char flag_inline_functions_called_once; + signed char flag_inline_small_functions; + signed char flag_ipa_cp; + signed char flag_ipa_cp_clone; + signed char flag_ipa_matrix_reorg; + signed char flag_ipa_pta; + signed char flag_ipa_pure_const; + signed char flag_ipa_reference; + signed char flag_ipa_sra; + signed char flag_ipa_type_escape; + signed char flag_ivopts; + signed char flag_jump_tables; + signed char flag_loop_block; + signed char flag_loop_interchange; + signed char flag_loop_parallelize_all; + signed char flag_loop_strip_mine; + signed char flag_lto_report; + signed char flag_ltrans; + signed char flag_errno_math; + signed char flag_merge_constants; + signed char flag_modulo_sched; + signed char flag_move_loop_invariants; + signed char flag_non_call_exceptions; + signed char flag_omit_frame_pointer; + signed char flag_regmove; + signed char flag_optimize_sibling_calls; + signed char flag_pack_struct; + signed char flag_peel_loops; + signed char flag_no_peephole; + signed char flag_peephole2; + signed char flag_predictive_commoning; + signed char flag_prefetch_loop_arrays; + signed char flag_pcc_struct_return; + signed char flag_rename_registers; + signed char flag_reorder_blocks; + signed char flag_reorder_blocks_and_partition; + signed char flag_reorder_functions; + signed char flag_rerun_cse_after_loop; + signed char flag_resched_modulo_sched; + signed char flag_rounding_math; + signed char flag_sched_critical_path_heuristic; + signed char flag_sched_dep_count_heuristic; + signed char flag_sched_group_heuristic; + signed char flag_schedule_interblock; + signed char flag_sched_last_insn_heuristic; + signed char flag_sched_pressure; + signed char flag_sched_rank_heuristic; + signed char flag_schedule_speculative; + signed char flag_sched_spec_insn_heuristic; + signed char flag_schedule_speculative_load; + signed char flag_schedule_speculative_load_dangerous; + signed char flag_sched2_use_superblocks; + signed char flag_schedule_insns; + signed char flag_schedule_insns_after_reload; + signed char flag_section_anchors; + signed char flag_sel_sched_pipelining; + signed char flag_sel_sched_pipelining_outer_loops; + signed char flag_sel_sched_reschedule_pipelined; + signed char flag_selective_scheduling; + signed char flag_selective_scheduling2; + signed char flag_setstackexecutable; + signed char flag_signaling_nans; + signed char flag_signed_zeros; + signed char flag_single_precision_constant; + signed char flag_split_ivs_in_unroller; + signed char flag_split_wide_types; + signed char flag_strict_aliasing; + signed char flag_thread_jumps; + signed char flag_toplevel_reorder; + signed char flag_trapping_math; + signed char flag_trapv; + signed char flag_tree_builtin_call_dce; + signed char flag_tree_ccp; + signed char flag_tree_ch; + signed char flag_tree_copy_prop; + signed char flag_tree_copyrename; + signed char flag_tree_cselim; + signed char flag_tree_dce; + signed char flag_tree_dom; + signed char flag_tree_dse; + signed char flag_tree_forwprop; + signed char flag_tree_fre; + signed char flag_tree_loop_distribution; + signed char flag_tree_loop_im; + signed char flag_tree_loop_ivcanon; + signed char flag_tree_loop_linear; + signed char flag_tree_loop_optimize; + signed char flag_tree_live_range_split; + signed char flag_tree_phiprop; + signed char flag_tree_pre; + signed char flag_tree_pta; + signed char flag_tree_reassoc; + signed char flag_tree_scev_cprop; + signed char flag_tree_sink; + signed char flag_tree_slp_vectorize; + signed char flag_tree_sra; + signed char flag_tree_switch_conversion; + signed char flag_tree_ter; + signed char flag_tree_vect_loop_version; + signed char flag_tree_vectorize; + signed char flag_tree_vrp; + signed char flag_unit_at_a_time; + signed char flag_unroll_all_loops; + signed char flag_unroll_loops; + signed char flag_unsafe_loop_optimizations; + signed char flag_unsafe_math_optimizations; + signed char flag_unswitch_loops; + signed char flag_unwind_tables; + signed char flag_var_tracking; + signed char flag_var_tracking_assignments; + signed char flag_var_tracking_assignments_toggle; + signed char flag_var_tracking_uninit; + signed char flag_variable_expansion_in_unroller; + signed char flag_vect_cost_model; + signed char flag_value_profile_transformations; + signed char flag_web; + signed char flag_whole_program; + signed char flag_wpa; + signed char flag_wrapv; +}; + +/* Structure to save/restore selected target specific options. */ +struct GTY(()) cl_target_option +{ + int ix86_isa_flags_explicit; + int target_flags_explicit; + int target_flags; + int ix86_isa_flags; + unsigned char arch; + unsigned char arch_specified; + unsigned char branch_cost; + unsigned char fpmath; + unsigned char schedule; + unsigned char tune; + unsigned char tune_defaulted; +}; + + +/* Save optimization variables into a structure. */ +extern void cl_optimization_save (struct cl_optimization *); + +/* Restore optimization variables from a structure. */ +extern void cl_optimization_restore (struct cl_optimization *); + +/* Print optimization variables from a structure. */ +extern void cl_optimization_print (FILE *, int, struct cl_optimization *); + +/* Save selected option variables into a structure. */ +extern void cl_target_option_save (struct cl_target_option *); + +/* Restore selected option variables from a structure. */ +extern void cl_target_option_restore (struct cl_target_option *); + +/* Print target option variables from a structure. */ +extern void cl_target_option_print (FILE *, int, struct cl_target_option *); +#endif + +#define MASK_128BIT_LONG_DOUBLE (1 << 0) +#define OPTION_MASK_ISA_3DNOW (1 << 0) +#define OPTION_MASK_ISA_3DNOW_A (1 << 1) +#define OPTION_MASK_ISA_64BIT (1 << 2) +#define MASK_80387 (1 << 1) +#define OPTION_MASK_ISA_ABM (1 << 3) +#define MASK_ACCUMULATE_OUTGOING_ARGS (1 << 2) +#define OPTION_MASK_ISA_AES (1 << 4) +#define MASK_ALIGN_DOUBLE (1 << 3) +#define OPTION_MASK_ISA_AVX (1 << 5) +#define MASK_CLD (1 << 4) +#define OPTION_MASK_ISA_CRC32 (1 << 6) +#define OPTION_MASK_ISA_CX16 (1 << 7) +#define OPTION_MASK_ISA_FMA (1 << 8) +#define OPTION_MASK_ISA_FMA4 (1 << 9) +#define MASK_FLOAT_RETURNS (1 << 5) +#define MASK_FUSED_MADD (1 << 6) +#define MASK_IEEE_FP (1 << 7) +#define MASK_INLINE_ALL_STRINGOPS (1 << 8) +#define MASK_INLINE_STRINGOPS_DYNAMICALLY (1 << 9) +#define OPTION_MASK_ISA_LWP (1 << 10) +#define OPTION_MASK_ISA_MMX (1 << 11) +#define OPTION_MASK_ISA_MOVBE (1 << 12) +#define MASK_MS_BITFIELD_LAYOUT (1 << 10) +#define MASK_NO_ALIGN_STRINGOPS (1 << 11) +#define MASK_NO_FANCY_MATH_387 (1 << 12) +#define MASK_NO_PUSH_ARGS (1 << 13) +#define MASK_NO_RED_ZONE (1 << 14) +#define MASK_OMIT_LEAF_FRAME_POINTER (1 << 15) +#define OPTION_MASK_ISA_PCLMUL (1 << 13) +#define OPTION_MASK_ISA_POPCNT (1 << 14) +#define MASK_RECIP (1 << 16) +#define MASK_RTD (1 << 17) +#define OPTION_MASK_ISA_SAHF (1 << 15) +#define OPTION_MASK_ISA_SSE (1 << 16) +#define OPTION_MASK_ISA_SSE2 (1 << 17) +#define OPTION_MASK_ISA_SSE3 (1 << 18) +#define OPTION_MASK_ISA_SSE4_1 (1 << 19) +#define OPTION_MASK_ISA_SSE4_2 (1 << 20) +#define OPTION_MASK_ISA_SSE4A (1 << 21) +#define MASK_SSEREGPARM (1 << 18) +#define OPTION_MASK_ISA_SSSE3 (1 << 22) +#define MASK_STACK_PROBE (1 << 19) +#define MASK_TLS_DIRECT_SEG_REFS (1 << 20) +#define OPTION_MASK_ISA_XOP (1 << 23) + +#define TARGET_128BIT_LONG_DOUBLE ((target_flags & MASK_128BIT_LONG_DOUBLE) != 0) +#define OPTION_ISA_3DNOW ((ix86_isa_flags & OPTION_MASK_ISA_3DNOW) != 0) +#define OPTION_ISA_3DNOW_A ((ix86_isa_flags & OPTION_MASK_ISA_3DNOW_A) != 0) +#define OPTION_ISA_64BIT ((ix86_isa_flags & OPTION_MASK_ISA_64BIT) != 0) +#define TARGET_80387 ((target_flags & MASK_80387) != 0) +#define OPTION_ISA_ABM ((ix86_isa_flags & OPTION_MASK_ISA_ABM) != 0) +#define TARGET_ACCUMULATE_OUTGOING_ARGS ((target_flags & MASK_ACCUMULATE_OUTGOING_ARGS) != 0) +#define OPTION_ISA_AES ((ix86_isa_flags & OPTION_MASK_ISA_AES) != 0) +#define TARGET_ALIGN_DOUBLE ((target_flags & MASK_ALIGN_DOUBLE) != 0) +#define OPTION_ISA_AVX ((ix86_isa_flags & OPTION_MASK_ISA_AVX) != 0) +#define TARGET_CLD ((target_flags & MASK_CLD) != 0) +#define OPTION_ISA_CRC32 ((ix86_isa_flags & OPTION_MASK_ISA_CRC32) != 0) +#define OPTION_ISA_CX16 ((ix86_isa_flags & OPTION_MASK_ISA_CX16) != 0) +#define OPTION_ISA_FMA ((ix86_isa_flags & OPTION_MASK_ISA_FMA) != 0) +#define OPTION_ISA_FMA4 ((ix86_isa_flags & OPTION_MASK_ISA_FMA4) != 0) +#define TARGET_FLOAT_RETURNS ((target_flags & MASK_FLOAT_RETURNS) != 0) +#define TARGET_FUSED_MADD ((target_flags & MASK_FUSED_MADD) != 0) +#define TARGET_IEEE_FP ((target_flags & MASK_IEEE_FP) != 0) +#define TARGET_INLINE_ALL_STRINGOPS ((target_flags & MASK_INLINE_ALL_STRINGOPS) != 0) +#define TARGET_INLINE_STRINGOPS_DYNAMICALLY ((target_flags & MASK_INLINE_STRINGOPS_DYNAMICALLY) != 0) +#define OPTION_ISA_LWP ((ix86_isa_flags & OPTION_MASK_ISA_LWP) != 0) +#define OPTION_ISA_MMX ((ix86_isa_flags & OPTION_MASK_ISA_MMX) != 0) +#define OPTION_ISA_MOVBE ((ix86_isa_flags & OPTION_MASK_ISA_MOVBE) != 0) +#define TARGET_MS_BITFIELD_LAYOUT ((target_flags & MASK_MS_BITFIELD_LAYOUT) != 0) +#define TARGET_NO_ALIGN_STRINGOPS ((target_flags & MASK_NO_ALIGN_STRINGOPS) != 0) +#define TARGET_NO_FANCY_MATH_387 ((target_flags & MASK_NO_FANCY_MATH_387) != 0) +#define TARGET_NO_PUSH_ARGS ((target_flags & MASK_NO_PUSH_ARGS) != 0) +#define TARGET_NO_RED_ZONE ((target_flags & MASK_NO_RED_ZONE) != 0) +#define TARGET_OMIT_LEAF_FRAME_POINTER ((target_flags & MASK_OMIT_LEAF_FRAME_POINTER) != 0) +#define OPTION_ISA_PCLMUL ((ix86_isa_flags & OPTION_MASK_ISA_PCLMUL) != 0) +#define OPTION_ISA_POPCNT ((ix86_isa_flags & OPTION_MASK_ISA_POPCNT) != 0) +#define TARGET_RECIP ((target_flags & MASK_RECIP) != 0) +#define TARGET_RTD ((target_flags & MASK_RTD) != 0) +#define OPTION_ISA_SAHF ((ix86_isa_flags & OPTION_MASK_ISA_SAHF) != 0) +#define OPTION_ISA_SSE ((ix86_isa_flags & OPTION_MASK_ISA_SSE) != 0) +#define OPTION_ISA_SSE2 ((ix86_isa_flags & OPTION_MASK_ISA_SSE2) != 0) +#define OPTION_ISA_SSE3 ((ix86_isa_flags & OPTION_MASK_ISA_SSE3) != 0) +#define OPTION_ISA_SSE4_1 ((ix86_isa_flags & OPTION_MASK_ISA_SSE4_1) != 0) +#define OPTION_ISA_SSE4_2 ((ix86_isa_flags & OPTION_MASK_ISA_SSE4_2) != 0) +#define OPTION_ISA_SSE4A ((ix86_isa_flags & OPTION_MASK_ISA_SSE4A) != 0) +#define TARGET_SSEREGPARM ((target_flags & MASK_SSEREGPARM) != 0) +#define OPTION_ISA_SSSE3 ((ix86_isa_flags & OPTION_MASK_ISA_SSSE3) != 0) +#define TARGET_STACK_PROBE ((target_flags & MASK_STACK_PROBE) != 0) +#define TARGET_TLS_DIRECT_SEG_REFS ((target_flags & MASK_TLS_DIRECT_SEG_REFS) != 0) +#define OPTION_ISA_XOP ((ix86_isa_flags & OPTION_MASK_ISA_XOP) != 0) + +#define TARGET_ALIGN_STRINGOPS ((target_flags & MASK_NO_ALIGN_STRINGOPS) == 0) +#define TARGET_USE_FANCY_MATH_387 ((target_flags & MASK_NO_FANCY_MATH_387) == 0) +#define TARGET_PUSH_ARGS ((target_flags & MASK_NO_PUSH_ARGS) == 0) +#define TARGET_RED_ZONE ((target_flags & MASK_NO_RED_ZONE) == 0) + +#define CL_Ada (1 << 0) +#define CL_C (1 << 1) +#define CL_CXX (1 << 2) +#define CL_Fortran (1 << 3) +#define CL_Java (1 << 4) +#define CL_LTO (1 << 5) +#define CL_ObjC (1 << 6) +#define CL_ObjCXX (1 << 7) +#define CL_LANG_ALL ((1 << 8) - 1) + +enum opt_code +{ + OPT__help, /* --help */ + OPT__help_, /* --help= */ + OPT__output_pch_, /* --output-pch= */ + OPT__param, /* --param */ + OPT__target_help, /* --target-help */ + OPT__version, /* --version */ + OPT_A, /* -A */ + OPT_C, /* -C */ + OPT_CC, /* -CC */ + OPT_D, /* -D */ + OPT_E, /* -E */ + OPT_F, /* -F */ + OPT_G, /* -G */ + OPT_H, /* -H */ + OPT_I, /* -I */ + OPT_J, /* -J */ + OPT_M, /* -M */ + OPT_MD, /* -MD */ + OPT_MD_, /* -MD_ */ + OPT_MF, /* -MF */ + OPT_MG, /* -MG */ + OPT_MM, /* -MM */ + OPT_MMD, /* -MMD */ + OPT_MMD_, /* -MMD_ */ + OPT_MP, /* -MP */ + OPT_MQ, /* -MQ */ + OPT_MT, /* -MT */ + OPT_O, /* -O */ + OPT_Os, /* -Os */ + OPT_P, /* -P */ + OPT_U, /* -U */ + OPT_W, /* -W */ + OPT_Wabi, /* -Wabi */ + OPT_Waddress, /* -Waddress */ + OPT_Waggregate_return, /* -Waggregate-return */ + OPT_Waliasing, /* -Waliasing */ + OPT_Walign_commons, /* -Walign-commons */ + OPT_Wall, /* -Wall */ + OPT_Wall_deprecation, /* -Wall-deprecation */ + OPT_Wall_javadoc, /* -Wall-javadoc */ + OPT_Wampersand, /* -Wampersand */ + OPT_Warray_bounds, /* -Warray-bounds */ + OPT_Warray_temporaries, /* -Warray-temporaries */ + OPT_Wassert_identifier, /* -Wassert-identifier */ + OPT_Wassign_intercept, /* -Wassign-intercept */ + OPT_Wattributes, /* -Wattributes */ + OPT_Wbad_function_cast, /* -Wbad-function-cast */ + OPT_Wboxing, /* -Wboxing */ + OPT_Wbuiltin_macro_redefined, /* -Wbuiltin-macro-redefined */ + OPT_Wc___compat, /* -Wc++-compat */ + OPT_Wc__0x_compat, /* -Wc++0x-compat */ + OPT_Wcast_align, /* -Wcast-align */ + OPT_Wcast_qual, /* -Wcast-qual */ + OPT_Wchar_concat, /* -Wchar-concat */ + OPT_Wchar_subscripts, /* -Wchar-subscripts */ + OPT_Wcharacter_truncation, /* -Wcharacter-truncation */ + OPT_Wclobbered, /* -Wclobbered */ + OPT_Wcomment, /* -Wcomment */ + OPT_Wcomments, /* -Wcomments */ + OPT_Wcondition_assign, /* -Wcondition-assign */ + OPT_Wconstructor_name, /* -Wconstructor-name */ + OPT_Wconversion, /* -Wconversion */ + OPT_Wconversion_null, /* -Wconversion-null */ + OPT_Wcoverage_mismatch, /* -Wcoverage-mismatch */ + OPT_Wctor_dtor_privacy, /* -Wctor-dtor-privacy */ + OPT_Wdeclaration_after_statement, /* -Wdeclaration-after-statement */ + OPT_Wdep_ann, /* -Wdep-ann */ + OPT_Wdeprecated, /* -Wdeprecated */ + OPT_Wdeprecated_declarations, /* -Wdeprecated-declarations */ + OPT_Wdisabled_optimization, /* -Wdisabled-optimization */ + OPT_Wdiscouraged, /* -Wdiscouraged */ + OPT_Wdiv_by_zero, /* -Wdiv-by-zero */ + OPT_Weffc__, /* -Weffc++ */ + OPT_Wempty_block, /* -Wempty-block */ + OPT_Wempty_body, /* -Wempty-body */ + OPT_Wendif_labels, /* -Wendif-labels */ + OPT_Wenum_compare, /* -Wenum-compare */ + OPT_Wenum_identifier, /* -Wenum-identifier */ + OPT_Wenum_switch, /* -Wenum-switch */ + OPT_Werror, /* -Werror */ + OPT_Werror_implicit_function_declaration, /* -Werror-implicit-function-declaration */ + OPT_Werror_, /* -Werror= */ + OPT_Wextra, /* -Wextra */ + OPT_Wextraneous_semicolon, /* -Wextraneous-semicolon */ + OPT_Wfallthrough, /* -Wfallthrough */ + OPT_Wfatal_errors, /* -Wfatal-errors */ + OPT_Wfield_hiding, /* -Wfield-hiding */ + OPT_Wfinal_bound, /* -Wfinal-bound */ + OPT_Wfinally, /* -Wfinally */ + OPT_Wfloat_equal, /* -Wfloat-equal */ + OPT_Wforbidden, /* -Wforbidden */ + OPT_Wformat, /* -Wformat */ + OPT_Wformat_contains_nul, /* -Wformat-contains-nul */ + OPT_Wformat_extra_args, /* -Wformat-extra-args */ + OPT_Wformat_nonliteral, /* -Wformat-nonliteral */ + OPT_Wformat_security, /* -Wformat-security */ + OPT_Wformat_y2k, /* -Wformat-y2k */ + OPT_Wformat_zero_length, /* -Wformat-zero-length */ + OPT_Wformat_, /* -Wformat= */ + OPT_Wframe_larger_than_, /* -Wframe-larger-than= */ + OPT_Whiding, /* -Whiding */ + OPT_Wignored_qualifiers, /* -Wignored-qualifiers */ + OPT_Wimplicit, /* -Wimplicit */ + OPT_Wimplicit_function_declaration, /* -Wimplicit-function-declaration */ + OPT_Wimplicit_int, /* -Wimplicit-int */ + OPT_Wimplicit_interface, /* -Wimplicit-interface */ + OPT_Wimplicit_procedure, /* -Wimplicit-procedure */ + OPT_Wimport, /* -Wimport */ + OPT_Windirect_static, /* -Windirect-static */ + OPT_Winit_self, /* -Winit-self */ + OPT_Winline, /* -Winline */ + OPT_Wint_to_pointer_cast, /* -Wint-to-pointer-cast */ + OPT_Wintf_annotation, /* -Wintf-annotation */ + OPT_Wintf_non_inherited, /* -Wintf-non-inherited */ + OPT_Wintrinsic_shadow, /* -Wintrinsic-shadow */ + OPT_Wintrinsics_std, /* -Wintrinsics-std */ + OPT_Winvalid_offsetof, /* -Winvalid-offsetof */ + OPT_Winvalid_pch, /* -Winvalid-pch */ + OPT_Wjavadoc, /* -Wjavadoc */ + OPT_Wjump_misses_init, /* -Wjump-misses-init */ + OPT_Wlarger_than_, /* -Wlarger-than- */ + OPT_Wlarger_than_eq, /* -Wlarger-than= */ + OPT_Wline_truncation, /* -Wline-truncation */ + OPT_Wlocal_hiding, /* -Wlocal-hiding */ + OPT_Wlogical_op, /* -Wlogical-op */ + OPT_Wlong_long, /* -Wlong-long */ + OPT_Wmain, /* -Wmain */ + OPT_Wmasked_catch_block, /* -Wmasked-catch-block */ + OPT_Wmissing_braces, /* -Wmissing-braces */ + OPT_Wmissing_declarations, /* -Wmissing-declarations */ + OPT_Wmissing_field_initializers, /* -Wmissing-field-initializers */ + OPT_Wmissing_format_attribute, /* -Wmissing-format-attribute */ + OPT_Wmissing_include_dirs, /* -Wmissing-include-dirs */ + OPT_Wmissing_noreturn, /* -Wmissing-noreturn */ + OPT_Wmissing_parameter_type, /* -Wmissing-parameter-type */ + OPT_Wmissing_prototypes, /* -Wmissing-prototypes */ + OPT_Wmudflap, /* -Wmudflap */ + OPT_Wmultichar, /* -Wmultichar */ + OPT_Wnested_externs, /* -Wnested-externs */ + OPT_Wnls, /* -Wnls */ + OPT_Wno_effect_assign, /* -Wno-effect-assign */ + OPT_Wnon_template_friend, /* -Wnon-template-friend */ + OPT_Wnon_virtual_dtor, /* -Wnon-virtual-dtor */ + OPT_Wnonnull, /* -Wnonnull */ + OPT_Wnormalized_, /* -Wnormalized= */ + OPT_Wnull, /* -Wnull */ + OPT_Wold_style_cast, /* -Wold-style-cast */ + OPT_Wold_style_declaration, /* -Wold-style-declaration */ + OPT_Wold_style_definition, /* -Wold-style-definition */ + OPT_Wout_of_date, /* -Wout-of-date */ + OPT_Wover_ann, /* -Wover-ann */ + OPT_Woverflow, /* -Woverflow */ + OPT_Woverlength_strings, /* -Woverlength-strings */ + OPT_Woverloaded_virtual, /* -Woverloaded-virtual */ + OPT_Woverride_init, /* -Woverride-init */ + OPT_Wpacked, /* -Wpacked */ + OPT_Wpacked_bitfield_compat, /* -Wpacked-bitfield-compat */ + OPT_Wpadded, /* -Wpadded */ + OPT_Wparam_assign, /* -Wparam-assign */ + OPT_Wparentheses, /* -Wparentheses */ + OPT_Wpedantic_ms_format, /* -Wpedantic-ms-format */ + OPT_Wpkg_default_method, /* -Wpkg-default-method */ + OPT_Wpmf_conversions, /* -Wpmf-conversions */ + OPT_Wpointer_arith, /* -Wpointer-arith */ + OPT_Wpointer_sign, /* -Wpointer-sign */ + OPT_Wpointer_to_int_cast, /* -Wpointer-to-int-cast */ + OPT_Wpragmas, /* -Wpragmas */ + OPT_Wprotocol, /* -Wprotocol */ + OPT_Wpsabi, /* -Wpsabi */ + OPT_Wraw, /* -Wraw */ + OPT_Wredundant_decls, /* -Wredundant-decls */ + OPT_Wredundant_modifiers, /* -Wredundant-modifiers */ + OPT_Wreorder, /* -Wreorder */ + OPT_Wreturn_type, /* -Wreturn-type */ + OPT_Wselector, /* -Wselector */ + OPT_Wsequence_point, /* -Wsequence-point */ + OPT_Wserial, /* -Wserial */ + OPT_Wshadow, /* -Wshadow */ + OPT_Wsign_compare, /* -Wsign-compare */ + OPT_Wsign_conversion, /* -Wsign-conversion */ + OPT_Wsign_promo, /* -Wsign-promo */ + OPT_Wspecial_param_hiding, /* -Wspecial-param-hiding */ + OPT_Wstack_protector, /* -Wstack-protector */ + OPT_Wstatic_access, /* -Wstatic-access */ + OPT_Wstatic_receiver, /* -Wstatic-receiver */ + OPT_Wstrict_aliasing, /* -Wstrict-aliasing */ + OPT_Wstrict_aliasing_, /* -Wstrict-aliasing= */ + OPT_Wstrict_null_sentinel, /* -Wstrict-null-sentinel */ + OPT_Wstrict_overflow, /* -Wstrict-overflow */ + OPT_Wstrict_overflow_, /* -Wstrict-overflow= */ + OPT_Wstrict_prototypes, /* -Wstrict-prototypes */ + OPT_Wstrict_selector_match, /* -Wstrict-selector-match */ + OPT_Wsuppress, /* -Wsuppress */ + OPT_Wsurprising, /* -Wsurprising */ + OPT_Wswitch, /* -Wswitch */ + OPT_Wswitch_default, /* -Wswitch-default */ + OPT_Wswitch_enum, /* -Wswitch-enum */ + OPT_Wsync_nand, /* -Wsync-nand */ + OPT_Wsynth, /* -Wsynth */ + OPT_Wsynthetic_access, /* -Wsynthetic-access */ + OPT_Wsystem_headers, /* -Wsystem-headers */ + OPT_Wtabs, /* -Wtabs */ + OPT_Wtasks, /* -Wtasks */ + OPT_Wtraditional, /* -Wtraditional */ + OPT_Wtraditional_conversion, /* -Wtraditional-conversion */ + OPT_Wtrigraphs, /* -Wtrigraphs */ + OPT_Wtype_hiding, /* -Wtype-hiding */ + OPT_Wtype_limits, /* -Wtype-limits */ + OPT_Wuncheck, /* -Wuncheck */ + OPT_Wundeclared_selector, /* -Wundeclared-selector */ + OPT_Wundef, /* -Wundef */ + OPT_Wunderflow, /* -Wunderflow */ + OPT_Wuninitialized, /* -Wuninitialized */ + OPT_Wunknown_pragmas, /* -Wunknown-pragmas */ + OPT_Wunnecessary_else, /* -Wunnecessary-else */ + OPT_Wunqualified_field, /* -Wunqualified-field */ + OPT_Wunreachable_code, /* -Wunreachable-code */ + OPT_Wunsafe_loop_optimizations, /* -Wunsafe-loop-optimizations */ + OPT_Wunsuffixed_float_constants, /* -Wunsuffixed-float-constants */ + OPT_Wunused, /* -Wunused */ + OPT_Wunused_argument, /* -Wunused-argument */ + OPT_Wunused_function, /* -Wunused-function */ + OPT_Wunused_import, /* -Wunused-import */ + OPT_Wunused_label, /* -Wunused-label */ + OPT_Wunused_local, /* -Wunused-local */ + OPT_Wunused_macros, /* -Wunused-macros */ + OPT_Wunused_parameter, /* -Wunused-parameter */ + OPT_Wunused_private, /* -Wunused-private */ + OPT_Wunused_result, /* -Wunused-result */ + OPT_Wunused_thrown, /* -Wunused-thrown */ + OPT_Wunused_value, /* -Wunused-value */ + OPT_Wunused_variable, /* -Wunused-variable */ + OPT_Wuseless_type_check, /* -Wuseless-type-check */ + OPT_Wvarargs_cast, /* -Wvarargs-cast */ + OPT_Wvariadic_macros, /* -Wvariadic-macros */ + OPT_Wvla, /* -Wvla */ + OPT_Wvolatile_register_var, /* -Wvolatile-register-var */ + OPT_Wwarning_token, /* -Wwarning-token */ + OPT_Wwrite_strings, /* -Wwrite-strings */ + OPT_ansi, /* -ansi */ + OPT_aux_info, /* -aux-info */ + OPT_aux_info_, /* -aux-info= */ + OPT_auxbase, /* -auxbase */ + OPT_auxbase_strip, /* -auxbase-strip */ + OPT_cpp, /* -cpp */ + OPT_d, /* -d */ + OPT_dumpbase, /* -dumpbase */ + OPT_dumpdir, /* -dumpdir */ + OPT_fCLASSPATH_, /* -fCLASSPATH= */ + OPT_fPIC, /* -fPIC */ + OPT_fPIE, /* -fPIE */ + OPT_fRTS_, /* -fRTS= */ + OPT_fabi_version_, /* -fabi-version= */ + OPT_faccess_control, /* -faccess-control */ + OPT_falign_commons, /* -falign-commons */ + OPT_falign_functions, /* -falign-functions */ + OPT_falign_functions_, /* -falign-functions= */ + OPT_falign_jumps, /* -falign-jumps */ + OPT_falign_jumps_, /* -falign-jumps= */ + OPT_falign_labels, /* -falign-labels */ + OPT_falign_labels_, /* -falign-labels= */ + OPT_falign_loops, /* -falign-loops */ + OPT_falign_loops_, /* -falign-loops= */ + OPT_fall_intrinsics, /* -fall-intrinsics */ + OPT_fall_virtual, /* -fall-virtual */ + OPT_fallow_leading_underscore, /* -fallow-leading-underscore */ + OPT_falt_external_templates, /* -falt-external-templates */ + OPT_fargument_alias, /* -fargument-alias */ + OPT_fargument_noalias, /* -fargument-noalias */ + OPT_fargument_noalias_anything, /* -fargument-noalias-anything */ + OPT_fargument_noalias_global, /* -fargument-noalias-global */ + OPT_fasm, /* -fasm */ + OPT_fassert, /* -fassert */ + OPT_fassociative_math, /* -fassociative-math */ + OPT_fassume_compiled, /* -fassume-compiled */ + OPT_fassume_compiled_, /* -fassume-compiled= */ + OPT_fasynchronous_unwind_tables, /* -fasynchronous-unwind-tables */ + OPT_fauto_inc_dec, /* -fauto-inc-dec */ + OPT_fautomatic, /* -fautomatic */ + OPT_faux_classpath, /* -faux-classpath */ + OPT_fbackslash, /* -fbackslash */ + OPT_fbacktrace, /* -fbacktrace */ + OPT_fblas_matmul_limit_, /* -fblas-matmul-limit= */ + OPT_fbootclasspath_, /* -fbootclasspath= */ + OPT_fbootstrap_classes, /* -fbootstrap-classes */ + OPT_fbounds_check, /* -fbounds-check */ + OPT_fbranch_count_reg, /* -fbranch-count-reg */ + OPT_fbranch_probabilities, /* -fbranch-probabilities */ + OPT_fbranch_target_load_optimize, /* -fbranch-target-load-optimize */ + OPT_fbranch_target_load_optimize2, /* -fbranch-target-load-optimize2 */ + OPT_fbtr_bb_exclusive, /* -fbtr-bb-exclusive */ + OPT_fbuiltin, /* -fbuiltin */ + OPT_fbuiltin_, /* -fbuiltin- */ + OPT_fcall_saved_, /* -fcall-saved- */ + OPT_fcall_used_, /* -fcall-used- */ + OPT_fcaller_saves, /* -fcaller-saves */ + OPT_fcheck_array_temporaries, /* -fcheck-array-temporaries */ + OPT_fcheck_data_deps, /* -fcheck-data-deps */ + OPT_fcheck_new, /* -fcheck-new */ + OPT_fcheck_references, /* -fcheck-references */ + OPT_fcheck_, /* -fcheck= */ + OPT_fclasspath_, /* -fclasspath= */ + OPT_fcommon, /* -fcommon */ + OPT_fcompare_debug_second, /* -fcompare-debug-second */ + OPT_fcompare_debug_, /* -fcompare-debug= */ + OPT_fcompile_resource_, /* -fcompile-resource= */ + OPT_fcond_mismatch, /* -fcond-mismatch */ + OPT_fconserve_space, /* -fconserve-space */ + OPT_fconserve_stack, /* -fconserve-stack */ + OPT_fconstant_string_class_, /* -fconstant-string-class= */ + OPT_fconvert_big_endian, /* -fconvert=big-endian */ + OPT_fconvert_little_endian, /* -fconvert=little-endian */ + OPT_fconvert_native, /* -fconvert=native */ + OPT_fconvert_swap, /* -fconvert=swap */ + OPT_fcprop_registers, /* -fcprop-registers */ + OPT_fcray_pointer, /* -fcray-pointer */ + OPT_fcrossjumping, /* -fcrossjumping */ + OPT_fcse_follow_jumps, /* -fcse-follow-jumps */ + OPT_fcse_skip_blocks, /* -fcse-skip-blocks */ + OPT_fcx_fortran_rules, /* -fcx-fortran-rules */ + OPT_fcx_limited_range, /* -fcx-limited-range */ + OPT_fd_lines_as_code, /* -fd-lines-as-code */ + OPT_fd_lines_as_comments, /* -fd-lines-as-comments */ + OPT_fdata_sections, /* -fdata-sections */ + OPT_fdbg_cnt_list, /* -fdbg-cnt-list */ + OPT_fdbg_cnt_, /* -fdbg-cnt= */ + OPT_fdce, /* -fdce */ + OPT_fdebug_prefix_map_, /* -fdebug-prefix-map= */ + OPT_fdeduce_init_list, /* -fdeduce-init-list */ + OPT_fdefault_double_8, /* -fdefault-double-8 */ + OPT_fdefault_inline, /* -fdefault-inline */ + OPT_fdefault_integer_8, /* -fdefault-integer-8 */ + OPT_fdefault_real_8, /* -fdefault-real-8 */ + OPT_fdefer_pop, /* -fdefer-pop */ + OPT_fdelayed_branch, /* -fdelayed-branch */ + OPT_fdelete_null_pointer_checks, /* -fdelete-null-pointer-checks */ + OPT_fdiagnostics_show_location_, /* -fdiagnostics-show-location= */ + OPT_fdiagnostics_show_option, /* -fdiagnostics-show-option */ + OPT_fdirectives_only, /* -fdirectives-only */ + OPT_fdisable_assertions, /* -fdisable-assertions */ + OPT_fdisable_assertions_, /* -fdisable-assertions= */ + OPT_fdollar_ok, /* -fdollar-ok */ + OPT_fdollars_in_identifiers, /* -fdollars-in-identifiers */ + OPT_fdse, /* -fdse */ + OPT_fdump_, /* -fdump- */ + OPT_fdump_core, /* -fdump-core */ + OPT_fdump_final_insns_, /* -fdump-final-insns= */ + OPT_fdump_noaddr, /* -fdump-noaddr */ + OPT_fdump_parse_tree, /* -fdump-parse-tree */ + OPT_fdump_unnumbered, /* -fdump-unnumbered */ + OPT_fdump_unnumbered_links, /* -fdump-unnumbered-links */ + OPT_fdwarf2_cfi_asm, /* -fdwarf2-cfi-asm */ + OPT_fearly_inlining, /* -fearly-inlining */ + OPT_felide_constructors, /* -felide-constructors */ + OPT_feliminate_dwarf2_dups, /* -feliminate-dwarf2-dups */ + OPT_feliminate_unused_debug_symbols, /* -feliminate-unused-debug-symbols */ + OPT_feliminate_unused_debug_types, /* -feliminate-unused-debug-types */ + OPT_femit_class_debug_always, /* -femit-class-debug-always */ + OPT_femit_class_file, /* -femit-class-file */ + OPT_femit_class_files, /* -femit-class-files */ + OPT_femit_struct_debug_baseonly, /* -femit-struct-debug-baseonly */ + OPT_femit_struct_debug_detailed_, /* -femit-struct-debug-detailed= */ + OPT_femit_struct_debug_reduced, /* -femit-struct-debug-reduced */ + OPT_fenable_assertions, /* -fenable-assertions */ + OPT_fenable_assertions_, /* -fenable-assertions= */ + OPT_fenable_icf_debug, /* -fenable-icf-debug */ + OPT_fencoding_, /* -fencoding= */ + OPT_fenforce_eh_specs, /* -fenforce-eh-specs */ + OPT_fenum_int_equiv, /* -fenum-int-equiv */ + OPT_fexceptions, /* -fexceptions */ + OPT_fexcess_precision_, /* -fexcess-precision= */ + OPT_fexec_charset_, /* -fexec-charset= */ + OPT_fexpensive_optimizations, /* -fexpensive-optimizations */ + OPT_fextdirs_, /* -fextdirs= */ + OPT_fextended_identifiers, /* -fextended-identifiers */ + OPT_fexternal_blas, /* -fexternal-blas */ + OPT_fexternal_templates, /* -fexternal-templates */ + OPT_ff2c, /* -ff2c */ + OPT_ffast_math, /* -ffast-math */ + OPT_ffilelist_file, /* -ffilelist-file */ + OPT_ffinite_math_only, /* -ffinite-math-only */ + OPT_ffixed_, /* -ffixed- */ + OPT_ffixed_form, /* -ffixed-form */ + OPT_ffixed_line_length_, /* -ffixed-line-length- */ + OPT_ffixed_line_length_none, /* -ffixed-line-length-none */ + OPT_ffloat_store, /* -ffloat-store */ + OPT_ffor_scope, /* -ffor-scope */ + OPT_fforce_addr, /* -fforce-addr */ + OPT_fforce_classes_archive_check, /* -fforce-classes-archive-check */ + OPT_fforward_propagate, /* -fforward-propagate */ + OPT_ffpe_trap_, /* -ffpe-trap= */ + OPT_ffree_form, /* -ffree-form */ + OPT_ffree_line_length_, /* -ffree-line-length- */ + OPT_ffree_line_length_none, /* -ffree-line-length-none */ + OPT_ffreestanding, /* -ffreestanding */ + OPT_ffriend_injection, /* -ffriend-injection */ + OPT_ffunction_cse, /* -ffunction-cse */ + OPT_ffunction_sections, /* -ffunction-sections */ + OPT_fgcse, /* -fgcse */ + OPT_fgcse_after_reload, /* -fgcse-after-reload */ + OPT_fgcse_las, /* -fgcse-las */ + OPT_fgcse_lm, /* -fgcse-lm */ + OPT_fgcse_sm, /* -fgcse-sm */ + OPT_fgnu_keywords, /* -fgnu-keywords */ + OPT_fgnu_runtime, /* -fgnu-runtime */ + OPT_fgnu89_inline, /* -fgnu89-inline */ + OPT_fgraphite, /* -fgraphite */ + OPT_fgraphite_identity, /* -fgraphite-identity */ + OPT_fguess_branch_probability, /* -fguess-branch-probability */ + OPT_fguiding_decls, /* -fguiding-decls */ + OPT_fhandle_exceptions, /* -fhandle-exceptions */ + OPT_fhash_synchronization, /* -fhash-synchronization */ + OPT_fhelp, /* -fhelp */ + OPT_fhelp_, /* -fhelp= */ + OPT_fhonor_std, /* -fhonor-std */ + OPT_fhosted, /* -fhosted */ + OPT_fhuge_objects, /* -fhuge-objects */ + OPT_fident, /* -fident */ + OPT_fif_conversion, /* -fif-conversion */ + OPT_fif_conversion2, /* -fif-conversion2 */ + OPT_fimplement_inlines, /* -fimplement-inlines */ + OPT_fimplicit_inline_templates, /* -fimplicit-inline-templates */ + OPT_fimplicit_none, /* -fimplicit-none */ + OPT_fimplicit_templates, /* -fimplicit-templates */ + OPT_findirect_classes, /* -findirect-classes */ + OPT_findirect_dispatch, /* -findirect-dispatch */ + OPT_findirect_inlining, /* -findirect-inlining */ + OPT_finhibit_size_directive, /* -finhibit-size-directive */ + OPT_finit_character_, /* -finit-character= */ + OPT_finit_integer_, /* -finit-integer= */ + OPT_finit_local_zero, /* -finit-local-zero */ + OPT_finit_logical_, /* -finit-logical= */ + OPT_finit_real_, /* -finit-real= */ + OPT_finline, /* -finline */ + OPT_finline_functions, /* -finline-functions */ + OPT_finline_functions_called_once, /* -finline-functions-called-once */ + OPT_finline_limit_, /* -finline-limit- */ + OPT_finline_limit_eq, /* -finline-limit= */ + OPT_finline_small_functions, /* -finline-small-functions */ + OPT_finput_charset_, /* -finput-charset= */ + OPT_finstrument_functions, /* -finstrument-functions */ + OPT_finstrument_functions_exclude_file_list_,/* -finstrument-functions-exclude-file-list= */ + OPT_finstrument_functions_exclude_function_list_,/* -finstrument-functions-exclude-function-list= */ + OPT_fintrinsic_modules_path, /* -fintrinsic-modules-path */ + OPT_fipa_cp, /* -fipa-cp */ + OPT_fipa_cp_clone, /* -fipa-cp-clone */ + OPT_fipa_matrix_reorg, /* -fipa-matrix-reorg */ + OPT_fipa_pta, /* -fipa-pta */ + OPT_fipa_pure_const, /* -fipa-pure-const */ + OPT_fipa_reference, /* -fipa-reference */ + OPT_fipa_sra, /* -fipa-sra */ + OPT_fipa_struct_reorg, /* -fipa-struct-reorg */ + OPT_fipa_type_escape, /* -fipa-type-escape */ + OPT_fira_algorithm_, /* -fira-algorithm= */ + OPT_fira_coalesce, /* -fira-coalesce */ + OPT_fira_loop_pressure, /* -fira-loop-pressure */ + OPT_fira_region_, /* -fira-region= */ + OPT_fira_share_save_slots, /* -fira-share-save-slots */ + OPT_fira_share_spill_slots, /* -fira-share-spill-slots */ + OPT_fira_verbose_, /* -fira-verbose= */ + OPT_fivopts, /* -fivopts */ + OPT_fjni, /* -fjni */ + OPT_fjump_tables, /* -fjump-tables */ + OPT_fkeep_inline_functions, /* -fkeep-inline-functions */ + OPT_fkeep_static_consts, /* -fkeep-static-consts */ + OPT_flabels_ok, /* -flabels-ok */ + OPT_flax_vector_conversions, /* -flax-vector-conversions */ + OPT_fleading_underscore, /* -fleading-underscore */ + OPT_floop_block, /* -floop-block */ + OPT_floop_interchange, /* -floop-interchange */ + OPT_floop_optimize, /* -floop-optimize */ + OPT_floop_parallelize_all, /* -floop-parallelize-all */ + OPT_floop_strip_mine, /* -floop-strip-mine */ + OPT_flto, /* -flto */ + OPT_flto_compression_level_, /* -flto-compression-level= */ + OPT_flto_report, /* -flto-report */ + OPT_fltrans, /* -fltrans */ + OPT_fltrans_output_list_, /* -fltrans-output-list= */ + OPT_fmath_errno, /* -fmath-errno */ + OPT_fmax_array_constructor_, /* -fmax-array-constructor= */ + OPT_fmax_errors_, /* -fmax-errors= */ + OPT_fmax_identifier_length_, /* -fmax-identifier-length= */ + OPT_fmax_stack_var_size_, /* -fmax-stack-var-size= */ + OPT_fmax_subrecord_length_, /* -fmax-subrecord-length= */ + OPT_fmem_report, /* -fmem-report */ + OPT_fmerge_all_constants, /* -fmerge-all-constants */ + OPT_fmerge_constants, /* -fmerge-constants */ + OPT_fmerge_debug_strings, /* -fmerge-debug-strings */ + OPT_fmessage_length_, /* -fmessage-length= */ + OPT_fmodule_private, /* -fmodule-private */ + OPT_fmodulo_sched, /* -fmodulo-sched */ + OPT_fmodulo_sched_allow_regmoves, /* -fmodulo-sched-allow-regmoves */ + OPT_fmove_loop_invariants, /* -fmove-loop-invariants */ + OPT_fms_extensions, /* -fms-extensions */ + OPT_fmudflap, /* -fmudflap */ + OPT_fmudflapir, /* -fmudflapir */ + OPT_fmudflapth, /* -fmudflapth */ + OPT_fname_mangling_version_, /* -fname-mangling-version- */ + OPT_fnew_abi, /* -fnew-abi */ + OPT_fnext_runtime, /* -fnext-runtime */ + OPT_fnil_receivers, /* -fnil-receivers */ + OPT_fnon_call_exceptions, /* -fnon-call-exceptions */ + OPT_fnonansi_builtins, /* -fnonansi-builtins */ + OPT_fnonnull_objects, /* -fnonnull-objects */ + OPT_fobjc_call_cxx_cdtors, /* -fobjc-call-cxx-cdtors */ + OPT_fobjc_direct_dispatch, /* -fobjc-direct-dispatch */ + OPT_fobjc_exceptions, /* -fobjc-exceptions */ + OPT_fobjc_gc, /* -fobjc-gc */ + OPT_fobjc_sjlj_exceptions, /* -fobjc-sjlj-exceptions */ + OPT_fomit_frame_pointer, /* -fomit-frame-pointer */ + OPT_fopenmp, /* -fopenmp */ + OPT_foperator_names, /* -foperator-names */ + OPT_foptimize_register_move, /* -foptimize-register-move */ + OPT_foptimize_sibling_calls, /* -foptimize-sibling-calls */ + OPT_foptimize_static_class_initialization, /* -foptimize-static-class-initialization */ + OPT_foptional_diags, /* -foptional-diags */ + OPT_foutput_class_dir_, /* -foutput-class-dir= */ + OPT_fpack_derived, /* -fpack-derived */ + OPT_fpack_struct, /* -fpack-struct */ + OPT_fpack_struct_, /* -fpack-struct= */ + OPT_fpcc_struct_return, /* -fpcc-struct-return */ + OPT_fpch_deps, /* -fpch-deps */ + OPT_fpch_preprocess, /* -fpch-preprocess */ + OPT_fpeel_loops, /* -fpeel-loops */ + OPT_fpeephole, /* -fpeephole */ + OPT_fpeephole2, /* -fpeephole2 */ + OPT_fpermissive, /* -fpermissive */ + OPT_fpic, /* -fpic */ + OPT_fpie, /* -fpie */ + OPT_fplugin_arg_, /* -fplugin-arg- */ + OPT_fplugin_, /* -fplugin= */ + OPT_fpost_ipa_mem_report, /* -fpost-ipa-mem-report */ + OPT_fpre_ipa_mem_report, /* -fpre-ipa-mem-report */ + OPT_fpredictive_commoning, /* -fpredictive-commoning */ + OPT_fprefetch_loop_arrays, /* -fprefetch-loop-arrays */ + OPT_fpreprocessed, /* -fpreprocessed */ + OPT_fpretty_templates, /* -fpretty-templates */ + OPT_fprofile, /* -fprofile */ + OPT_fprofile_arcs, /* -fprofile-arcs */ + OPT_fprofile_correction, /* -fprofile-correction */ + OPT_fprofile_dir_, /* -fprofile-dir= */ + OPT_fprofile_generate, /* -fprofile-generate */ + OPT_fprofile_generate_, /* -fprofile-generate= */ + OPT_fprofile_use, /* -fprofile-use */ + OPT_fprofile_use_, /* -fprofile-use= */ + OPT_fprofile_values, /* -fprofile-values */ + OPT_fprotect_parens, /* -fprotect-parens */ + OPT_frandom_seed, /* -frandom-seed */ + OPT_frandom_seed_, /* -frandom-seed= */ + OPT_frange_check, /* -frange-check */ + OPT_freciprocal_math, /* -freciprocal-math */ + OPT_frecord_gcc_switches, /* -frecord-gcc-switches */ + OPT_frecord_marker_4, /* -frecord-marker=4 */ + OPT_frecord_marker_8, /* -frecord-marker=8 */ + OPT_frecursive, /* -frecursive */ + OPT_freduced_reflection, /* -freduced-reflection */ + OPT_freg_struct_return, /* -freg-struct-return */ + OPT_fregmove, /* -fregmove */ + OPT_frename_registers, /* -frename-registers */ + OPT_freorder_blocks, /* -freorder-blocks */ + OPT_freorder_blocks_and_partition, /* -freorder-blocks-and-partition */ + OPT_freorder_functions, /* -freorder-functions */ + OPT_frepack_arrays, /* -frepack-arrays */ + OPT_freplace_objc_classes, /* -freplace-objc-classes */ + OPT_frepo, /* -frepo */ + OPT_frerun_cse_after_loop, /* -frerun-cse-after-loop */ + OPT_frerun_loop_opt, /* -frerun-loop-opt */ + OPT_freschedule_modulo_scheduled_loops, /* -freschedule-modulo-scheduled-loops */ + OPT_fresolution, /* -fresolution */ + OPT_frounding_math, /* -frounding-math */ + OPT_frtti, /* -frtti */ + OPT_fsaw_java_file, /* -fsaw-java-file */ + OPT_fsched_critical_path_heuristic, /* -fsched-critical-path-heuristic */ + OPT_fsched_dep_count_heuristic, /* -fsched-dep-count-heuristic */ + OPT_fsched_group_heuristic, /* -fsched-group-heuristic */ + OPT_fsched_interblock, /* -fsched-interblock */ + OPT_fsched_last_insn_heuristic, /* -fsched-last-insn-heuristic */ + OPT_fsched_pressure, /* -fsched-pressure */ + OPT_fsched_rank_heuristic, /* -fsched-rank-heuristic */ + OPT_fsched_spec, /* -fsched-spec */ + OPT_fsched_spec_insn_heuristic, /* -fsched-spec-insn-heuristic */ + OPT_fsched_spec_load, /* -fsched-spec-load */ + OPT_fsched_spec_load_dangerous, /* -fsched-spec-load-dangerous */ + OPT_fsched_stalled_insns, /* -fsched-stalled-insns */ + OPT_fsched_stalled_insns_dep, /* -fsched-stalled-insns-dep */ + OPT_fsched_stalled_insns_dep_, /* -fsched-stalled-insns-dep= */ + OPT_fsched_stalled_insns_, /* -fsched-stalled-insns= */ + OPT_fsched_verbose_, /* -fsched-verbose= */ + OPT_fsched2_use_superblocks, /* -fsched2-use-superblocks */ + OPT_fsched2_use_traces, /* -fsched2-use-traces */ + OPT_fschedule_insns, /* -fschedule-insns */ + OPT_fschedule_insns2, /* -fschedule-insns2 */ + OPT_fsecond_underscore, /* -fsecond-underscore */ + OPT_fsection_anchors, /* -fsection-anchors */ + OPT_fsee, /* -fsee */ + OPT_fsel_sched_pipelining, /* -fsel-sched-pipelining */ + OPT_fsel_sched_pipelining_outer_loops, /* -fsel-sched-pipelining-outer-loops */ + OPT_fsel_sched_reschedule_pipelined, /* -fsel-sched-reschedule-pipelined */ + OPT_fselective_scheduling, /* -fselective-scheduling */ + OPT_fselective_scheduling2, /* -fselective-scheduling2 */ + OPT_fset_stack_executable, /* -fset-stack-executable */ + OPT_fshort_double, /* -fshort-double */ + OPT_fshort_enums, /* -fshort-enums */ + OPT_fshort_wchar, /* -fshort-wchar */ + OPT_fshow_column, /* -fshow-column */ + OPT_fsign_zero, /* -fsign-zero */ + OPT_fsignaling_nans, /* -fsignaling-nans */ + OPT_fsigned_bitfields, /* -fsigned-bitfields */ + OPT_fsigned_char, /* -fsigned-char */ + OPT_fsigned_zeros, /* -fsigned-zeros */ + OPT_fsingle_precision_constant, /* -fsingle-precision-constant */ + OPT_fsource_filename_, /* -fsource-filename= */ + OPT_fsource_, /* -fsource= */ + OPT_fsplit_ivs_in_unroller, /* -fsplit-ivs-in-unroller */ + OPT_fsplit_wide_types, /* -fsplit-wide-types */ + OPT_fsquangle, /* -fsquangle */ + OPT_fstack_check, /* -fstack-check */ + OPT_fstack_check_, /* -fstack-check= */ + OPT_fstack_limit, /* -fstack-limit */ + OPT_fstack_limit_register_, /* -fstack-limit-register= */ + OPT_fstack_limit_symbol_, /* -fstack-limit-symbol= */ + OPT_fstack_protector, /* -fstack-protector */ + OPT_fstack_protector_all, /* -fstack-protector-all */ + OPT_fstats, /* -fstats */ + OPT_fstore_check, /* -fstore-check */ + OPT_fstrength_reduce, /* -fstrength-reduce */ + OPT_fstrict_aliasing, /* -fstrict-aliasing */ + OPT_fstrict_overflow, /* -fstrict-overflow */ + OPT_fstrict_prototype, /* -fstrict-prototype */ + OPT_fsyntax_only, /* -fsyntax-only */ + OPT_ftabstop_, /* -ftabstop= */ + OPT_ftarget_help, /* -ftarget-help */ + OPT_ftarget_, /* -ftarget= */ + OPT_ftemplate_depth_, /* -ftemplate-depth- */ + OPT_ftemplate_depth_eq, /* -ftemplate-depth= */ + OPT_ftest_coverage, /* -ftest-coverage */ + OPT_fthis_is_variable, /* -fthis-is-variable */ + OPT_fthread_jumps, /* -fthread-jumps */ + OPT_fthreadsafe_statics, /* -fthreadsafe-statics */ + OPT_ftime_report, /* -ftime-report */ + OPT_ftls_model_, /* -ftls-model= */ + OPT_ftoplevel_reorder, /* -ftoplevel-reorder */ + OPT_ftracer, /* -ftracer */ + OPT_ftrapping_math, /* -ftrapping-math */ + OPT_ftrapv, /* -ftrapv */ + OPT_ftree_builtin_call_dce, /* -ftree-builtin-call-dce */ + OPT_ftree_ccp, /* -ftree-ccp */ + OPT_ftree_ch, /* -ftree-ch */ + OPT_ftree_copy_prop, /* -ftree-copy-prop */ + OPT_ftree_copyrename, /* -ftree-copyrename */ + OPT_ftree_cselim, /* -ftree-cselim */ + OPT_ftree_dce, /* -ftree-dce */ + OPT_ftree_dominator_opts, /* -ftree-dominator-opts */ + OPT_ftree_dse, /* -ftree-dse */ + OPT_ftree_forwprop, /* -ftree-forwprop */ + OPT_ftree_fre, /* -ftree-fre */ + OPT_ftree_loop_distribution, /* -ftree-loop-distribution */ + OPT_ftree_loop_im, /* -ftree-loop-im */ + OPT_ftree_loop_ivcanon, /* -ftree-loop-ivcanon */ + OPT_ftree_loop_linear, /* -ftree-loop-linear */ + OPT_ftree_loop_optimize, /* -ftree-loop-optimize */ + OPT_ftree_lrs, /* -ftree-lrs */ + OPT_ftree_parallelize_loops_, /* -ftree-parallelize-loops= */ + OPT_ftree_phiprop, /* -ftree-phiprop */ + OPT_ftree_pre, /* -ftree-pre */ + OPT_ftree_pta, /* -ftree-pta */ + OPT_ftree_reassoc, /* -ftree-reassoc */ + OPT_ftree_salias, /* -ftree-salias */ + OPT_ftree_scev_cprop, /* -ftree-scev-cprop */ + OPT_ftree_sink, /* -ftree-sink */ + OPT_ftree_slp_vectorize, /* -ftree-slp-vectorize */ + OPT_ftree_sra, /* -ftree-sra */ + OPT_ftree_store_ccp, /* -ftree-store-ccp */ + OPT_ftree_store_copy_prop, /* -ftree-store-copy-prop */ + OPT_ftree_switch_conversion, /* -ftree-switch-conversion */ + OPT_ftree_ter, /* -ftree-ter */ + OPT_ftree_vect_loop_version, /* -ftree-vect-loop-version */ + OPT_ftree_vectorize, /* -ftree-vectorize */ + OPT_ftree_vectorizer_verbose_, /* -ftree-vectorizer-verbose= */ + OPT_ftree_vrp, /* -ftree-vrp */ + OPT_funderscoring, /* -funderscoring */ + OPT_funit_at_a_time, /* -funit-at-a-time */ + OPT_funroll_all_loops, /* -funroll-all-loops */ + OPT_funroll_loops, /* -funroll-loops */ + OPT_funsafe_loop_optimizations, /* -funsafe-loop-optimizations */ + OPT_funsafe_math_optimizations, /* -funsafe-math-optimizations */ + OPT_funsigned_bitfields, /* -funsigned-bitfields */ + OPT_funsigned_char, /* -funsigned-char */ + OPT_funswitch_loops, /* -funswitch-loops */ + OPT_funwind_tables, /* -funwind-tables */ + OPT_fuse_atomic_builtins, /* -fuse-atomic-builtins */ + OPT_fuse_boehm_gc, /* -fuse-boehm-gc */ + OPT_fuse_cxa_atexit, /* -fuse-cxa-atexit */ + OPT_fuse_cxa_get_exception_ptr, /* -fuse-cxa-get-exception-ptr */ + OPT_fuse_divide_subroutine, /* -fuse-divide-subroutine */ + OPT_fuse_linker_plugin, /* -fuse-linker-plugin */ + OPT_fvar_tracking, /* -fvar-tracking */ + OPT_fvar_tracking_assignments, /* -fvar-tracking-assignments */ + OPT_fvar_tracking_assignments_toggle, /* -fvar-tracking-assignments-toggle */ + OPT_fvar_tracking_uninit, /* -fvar-tracking-uninit */ + OPT_fvariable_expansion_in_unroller, /* -fvariable-expansion-in-unroller */ + OPT_fvect_cost_model, /* -fvect-cost-model */ + OPT_fverbose_asm, /* -fverbose-asm */ + OPT_fversion, /* -fversion */ + OPT_fvisibility_inlines_hidden, /* -fvisibility-inlines-hidden */ + OPT_fvisibility_ms_compat, /* -fvisibility-ms-compat */ + OPT_fvisibility_, /* -fvisibility= */ + OPT_fvpt, /* -fvpt */ + OPT_fvtable_gc, /* -fvtable-gc */ + OPT_fvtable_thunks, /* -fvtable-thunks */ + OPT_fweak, /* -fweak */ + OPT_fweb, /* -fweb */ + OPT_fwhole_file, /* -fwhole-file */ + OPT_fwhole_program, /* -fwhole-program */ + OPT_fwhopr, /* -fwhopr */ + OPT_fwide_exec_charset_, /* -fwide-exec-charset= */ + OPT_fworking_directory, /* -fworking-directory */ + OPT_fwpa, /* -fwpa */ + OPT_fwrapv, /* -fwrapv */ + OPT_fxref, /* -fxref */ + OPT_fzero_initialized_in_bss, /* -fzero-initialized-in-bss */ + OPT_fzero_link, /* -fzero-link */ + OPT_g, /* -g */ + OPT_gant, /* -gant */ + OPT_gcoff, /* -gcoff */ + OPT_gdwarfplus, /* -gdwarf+ */ + OPT_gdwarf_, /* -gdwarf- */ + OPT_gen_decls, /* -gen-decls */ + OPT_ggdb, /* -ggdb */ + OPT_gnat, /* -gnat */ + OPT_gnatO, /* -gnatO */ + OPT_gno_strict_dwarf, /* -gno-strict-dwarf */ + OPT_gstabs, /* -gstabs */ + OPT_gstabs_, /* -gstabs+ */ + OPT_gstrict_dwarf, /* -gstrict-dwarf */ + OPT_gtoggle, /* -gtoggle */ + OPT_gvms, /* -gvms */ + OPT_gxcoff, /* -gxcoff */ + OPT_gxcoff_, /* -gxcoff+ */ + OPT_idirafter, /* -idirafter */ + OPT_imacros, /* -imacros */ + OPT_imultilib, /* -imultilib */ + OPT_include, /* -include */ + OPT_iprefix, /* -iprefix */ + OPT_iquote, /* -iquote */ + OPT_isysroot, /* -isysroot */ + OPT_isystem, /* -isystem */ + OPT_iwithprefix, /* -iwithprefix */ + OPT_iwithprefixbefore, /* -iwithprefixbefore */ + OPT_lang_asm, /* -lang-asm */ + OPT_lang_objc, /* -lang-objc */ + OPT_m128bit_long_double, /* -m128bit-long-double */ + OPT_m32, /* -m32 */ + OPT_m3dnow, /* -m3dnow */ + OPT_m3dnowa, /* -m3dnowa */ + OPT_m64, /* -m64 */ + OPT_m80387, /* -m80387 */ + OPT_m96bit_long_double, /* -m96bit-long-double */ + OPT_mabi_, /* -mabi= */ + OPT_mabm, /* -mabm */ + OPT_maccumulate_outgoing_args, /* -maccumulate-outgoing-args */ + OPT_maes, /* -maes */ + OPT_malign_double, /* -malign-double */ + OPT_malign_functions_, /* -malign-functions= */ + OPT_malign_jumps_, /* -malign-jumps= */ + OPT_malign_loops_, /* -malign-loops= */ + OPT_malign_stringops, /* -malign-stringops */ + OPT_march_, /* -march= */ + OPT_masm_, /* -masm= */ + OPT_mavx, /* -mavx */ + OPT_mbranch_cost_, /* -mbranch-cost= */ + OPT_mcld, /* -mcld */ + OPT_mcmodel_, /* -mcmodel= */ + OPT_mconsole, /* -mconsole */ + OPT_mcrc32, /* -mcrc32 */ + OPT_mcx16, /* -mcx16 */ + OPT_mcygwin, /* -mcygwin */ + OPT_mdll, /* -mdll */ + OPT_mfancy_math_387, /* -mfancy-math-387 */ + OPT_mfma, /* -mfma */ + OPT_mfma4, /* -mfma4 */ + OPT_mforce_drap, /* -mforce-drap */ + OPT_mfp_ret_in_387, /* -mfp-ret-in-387 */ + OPT_mfpmath_, /* -mfpmath= */ + OPT_mfused_madd, /* -mfused-madd */ + OPT_mhard_float, /* -mhard-float */ + OPT_mieee_fp, /* -mieee-fp */ + OPT_mincoming_stack_boundary_, /* -mincoming-stack-boundary= */ + OPT_minline_all_stringops, /* -minline-all-stringops */ + OPT_minline_stringops_dynamically, /* -minline-stringops-dynamically */ + OPT_mintel_syntax, /* -mintel-syntax */ + OPT_mlarge_data_threshold_, /* -mlarge-data-threshold= */ + OPT_mlwp, /* -mlwp */ + OPT_mmmx, /* -mmmx */ + OPT_mmovbe, /* -mmovbe */ + OPT_mms_bitfields, /* -mms-bitfields */ + OPT_mno_align_stringops, /* -mno-align-stringops */ + OPT_mno_fancy_math_387, /* -mno-fancy-math-387 */ + OPT_mno_push_args, /* -mno-push-args */ + OPT_mno_red_zone, /* -mno-red-zone */ + OPT_mno_sse4, /* -mno-sse4 */ + OPT_mnop_fun_dllimport, /* -mnop-fun-dllimport */ + OPT_momit_leaf_frame_pointer, /* -momit-leaf-frame-pointer */ + OPT_mpc, /* -mpc */ + OPT_mpclmul, /* -mpclmul */ + OPT_mpe_aligned_commons, /* -mpe-aligned-commons */ + OPT_mpopcnt, /* -mpopcnt */ + OPT_mpreferred_stack_boundary_, /* -mpreferred-stack-boundary= */ + OPT_mpush_args, /* -mpush-args */ + OPT_mrecip, /* -mrecip */ + OPT_mred_zone, /* -mred-zone */ + OPT_mregparm_, /* -mregparm= */ + OPT_mrtd, /* -mrtd */ + OPT_msahf, /* -msahf */ + OPT_msoft_float, /* -msoft-float */ + OPT_msse, /* -msse */ + OPT_msse2, /* -msse2 */ + OPT_msse2avx, /* -msse2avx */ + OPT_msse3, /* -msse3 */ + OPT_msse4, /* -msse4 */ + OPT_msse4_1, /* -msse4.1 */ + OPT_msse4_2, /* -msse4.2 */ + OPT_msse4a, /* -msse4a */ + OPT_msseregparm, /* -msseregparm */ + OPT_mssse3, /* -mssse3 */ + OPT_mstack_arg_probe, /* -mstack-arg-probe */ + OPT_mstackrealign, /* -mstackrealign */ + OPT_mstringop_strategy_, /* -mstringop-strategy= */ + OPT_mthreads, /* -mthreads */ + OPT_mtls_dialect_, /* -mtls-dialect= */ + OPT_mtls_direct_seg_refs, /* -mtls-direct-seg-refs */ + OPT_mtune_, /* -mtune= */ + OPT_muse_libstdc_wrappers, /* -muse-libstdc-wrappers */ + OPT_mveclibabi_, /* -mveclibabi= */ + OPT_mwin32, /* -mwin32 */ + OPT_mwindows, /* -mwindows */ + OPT_mxop, /* -mxop */ + OPT_nocpp, /* -nocpp */ + OPT_nostdinc, /* -nostdinc */ + OPT_nostdinc__, /* -nostdinc++ */ + OPT_nostdlib, /* -nostdlib */ + OPT_o, /* -o */ + OPT_p, /* -p */ + OPT_pedantic, /* -pedantic */ + OPT_pedantic_errors, /* -pedantic-errors */ + OPT_pie, /* -pie */ + OPT_print_objc_runtime_info, /* -print-objc-runtime-info */ + OPT_print_pch_checksum, /* -print-pch-checksum */ + OPT_quiet, /* -quiet */ + OPT_remap, /* -remap */ + OPT_shared, /* -shared */ + OPT_static_libgfortran, /* -static-libgfortran */ + OPT_std_c__0x, /* -std=c++0x */ + OPT_std_c__98, /* -std=c++98 */ + OPT_std_c89, /* -std=c89 */ + OPT_std_c90, /* -std=c90 */ + OPT_std_c99, /* -std=c99 */ + OPT_std_c9x, /* -std=c9x */ + OPT_std_f2003, /* -std=f2003 */ + OPT_std_f2008, /* -std=f2008 */ + OPT_std_f95, /* -std=f95 */ + OPT_std_gnu, /* -std=gnu */ + OPT_std_gnu__0x, /* -std=gnu++0x */ + OPT_std_gnu__98, /* -std=gnu++98 */ + OPT_std_gnu89, /* -std=gnu89 */ + OPT_std_gnu90, /* -std=gnu90 */ + OPT_std_gnu99, /* -std=gnu99 */ + OPT_std_gnu9x, /* -std=gnu9x */ + OPT_std_iso9899_1990, /* -std=iso9899:1990 */ + OPT_std_iso9899_199409, /* -std=iso9899:199409 */ + OPT_std_iso9899_1999, /* -std=iso9899:1999 */ + OPT_std_iso9899_199x, /* -std=iso9899:199x */ + OPT_std_legacy, /* -std=legacy */ + OPT_traditional_cpp, /* -traditional-cpp */ + OPT_trigraphs, /* -trigraphs */ + OPT_undef, /* -undef */ + OPT_v, /* -v */ + OPT_version, /* -version */ + OPT_w, /* -w */ + N_OPTS +}; + +#endif /* OPTIONS_H */ diff --git a/contrib/sdk/sources/gcc_eh/tconfig.h b/contrib/sdk/sources/gcc_eh/tconfig.h new file mode 100644 index 0000000000..e5b203e9ab --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/tconfig.h @@ -0,0 +1,11 @@ +#ifndef GCC_TCONFIG_H +#define GCC_TCONFIG_H +#ifndef USED_FOR_TARGET +# define USED_FOR_TARGET +#endif +#include "auto-host.h" +#ifdef IN_GCC +# include "ansidecl.h" +# include "xm-mingw32.h" +#endif +#endif /* GCC_TCONFIG_H */ diff --git a/contrib/sdk/sources/gcc_eh/tm.h b/contrib/sdk/sources/gcc_eh/tm.h new file mode 100644 index 0000000000..4ad844bc7d --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/tm.h @@ -0,0 +1,21 @@ +#ifndef GCC_TM_H +#define GCC_TM_H +#ifdef IN_GCC +# include "options.h" +# include "config/vxworks-dummy.h" +# include "config/i386/i386.h" +# include "config/i386/unix.h" +# include "config/i386/bsd.h" +# include "config/i386/gas.h" +# include "config/dbxcoff.h" +# include "config/i386/cygming.h" +# include "config/i386/mingw32.h" +# include "config/i386/mingw-stdint.h" +# include "config/tm-dwarf2.h" +# include "defaults.h" +#endif +#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET +# include "insn-constants.h" +# include "insn-flags.h" +#endif +#endif /* GCC_TM_H */ diff --git a/contrib/sdk/sources/gcc_eh/tsystem.h b/contrib/sdk/sources/gcc_eh/tsystem.h new file mode 100644 index 0000000000..fc7713c9d1 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/tsystem.h @@ -0,0 +1,134 @@ +/* Get common system includes and various definitions and declarations + based on target macros. + Copyright (C) 2000, 2001, 2004, 2005, 2009 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_TSYSTEM_H +#define GCC_TSYSTEM_H + +/* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes + indirectly include getopt.h. Our -I flags will cause gcc's gnu + getopt.h to be included, not the platform's copy. In the default + case, gnu getopt.h will provide us with a no-argument prototype + which will generate -Wstrict-prototypes warnings. None of the + target files actually use getopt, so it is safe to tell gnu + getopt.h we never need this prototype. */ +#ifndef HAVE_DECL_GETOPT +#define HAVE_DECL_GETOPT 1 +#endif + +/* We want everything from the glibc headers. */ +#define _GNU_SOURCE 1 + +/* GCC supplies these headers. */ +#include +#include + +#ifdef inhibit_libc + +#ifndef malloc +extern void *malloc (size_t); +#endif + +#ifndef free +extern void free (void *); +#endif + +#ifndef atexit +extern int atexit (void (*)(void)); +#endif + +#ifndef abort +extern void abort (void) __attribute__ ((__noreturn__)); +#endif + +#ifndef strlen +extern size_t strlen (const char *); +#endif + +#ifndef memcpy +extern void *memcpy (void *, const void *, size_t); +#endif + +#ifndef memset +extern void *memset (void *, int, size_t); +#endif + +#else /* ! inhibit_libc */ +/* We disable this when inhibit_libc, so that gcc can still be built without + needing header files first. */ +/* ??? This is not a good solution, since prototypes may be required in + some cases for correct code. */ + +/* GCC supplies this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +#ifndef errno +extern int errno; +#endif + +/* If these system headers do not exist, fixincludes must create them. */ +#include +#include +#include + +/* GCC supplies this header. */ +#include + +/* If these system headers do not exist, fixincludes must create them. */ +#include + +#endif /* inhibit_libc */ + +/* Define a generic NULL if one hasn't already been defined. */ +#ifndef NULL +#define NULL 0 +#endif + +/* GCC always provides __builtin_alloca(x). */ +#undef alloca +#define alloca(x) __builtin_alloca(x) + +#ifdef ENABLE_RUNTIME_CHECKING +#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0)) +#else +/* Include EXPR, so that unused variable warnings do not occur. */ +#define gcc_assert(EXPR) ((void)(0 && (EXPR))) +#endif +/* Use gcc_unreachable() to mark unreachable locations (like an + unreachable default case of a switch. Do not use gcc_assert(0). */ +#define gcc_unreachable() (abort ()) + +/* Filename handling macros. */ +#include "filenames.h" + +#endif /* ! GCC_TSYSTEM_H */ diff --git a/contrib/sdk/sources/gcc_eh/unwind-c.c b/contrib/sdk/sources/gcc_eh/unwind-c.c new file mode 100644 index 0000000000..86b9f55704 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-c.c @@ -0,0 +1,229 @@ +/* Supporting functions for C exception handling. + Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc. + Contributed by Aldy Hernandez . + Shamelessly stolen from the Java front end. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#include "tconfig.h" +#include "tsystem.h" +#include "unwind.h" +#define NO_SIZE_OF_ENCODED_VALUE +#include "unwind-pe.h" + +typedef struct +{ + _Unwind_Ptr Start; + _Unwind_Ptr LPStart; + _Unwind_Ptr ttype_base; + const unsigned char *TType; + const unsigned char *action_table; + unsigned char ttype_encoding; + unsigned char call_site_encoding; +} lsda_header_info; + +static const unsigned char * +parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p, + lsda_header_info *info) +{ + _uleb128_t tmp; + unsigned char lpstart_encoding; + + info->Start = (context ? _Unwind_GetRegionStart (context) : 0); + + /* Find @LPStart, the base to which landing pad offsets are relative. */ + lpstart_encoding = *p++; + if (lpstart_encoding != DW_EH_PE_omit) + p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart); + else + info->LPStart = info->Start; + + /* Find @TType, the base of the handler and exception spec type data. */ + info->ttype_encoding = *p++; + if (info->ttype_encoding != DW_EH_PE_omit) + { + p = read_uleb128 (p, &tmp); + info->TType = p + tmp; + } + else + info->TType = 0; + + /* The encoding and length of the call-site table; the action table + immediately follows. */ + info->call_site_encoding = *p++; + p = read_uleb128 (p, &tmp); + info->action_table = p + tmp; + + return p; +} + +#ifdef __ARM_EABI_UNWINDER__ +/* ARM EABI personality routines must also unwind the stack. */ +#define CONTINUE_UNWINDING \ + do \ + { \ + if (__gnu_unwind_frame (ue_header, context) != _URC_OK) \ + return _URC_FAILURE; \ + return _URC_CONTINUE_UNWIND; \ + } \ + while (0) +#else +#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND +#endif + +#ifdef __USING_SJLJ_EXCEPTIONS__ +#define PERSONALITY_FUNCTION __gcc_personality_sj0 +#define __builtin_eh_return_data_regno(x) x +#else +#define PERSONALITY_FUNCTION __gcc_personality_v0 +#endif + +#ifdef __ARM_EABI_UNWINDER__ +_Unwind_Reason_Code +PERSONALITY_FUNCTION (_Unwind_State, struct _Unwind_Exception *, + struct _Unwind_Context *); + +_Unwind_Reason_Code +PERSONALITY_FUNCTION (_Unwind_State state, + struct _Unwind_Exception * ue_header, + struct _Unwind_Context * context) +#else +_Unwind_Reason_Code +PERSONALITY_FUNCTION (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +_Unwind_Reason_Code +PERSONALITY_FUNCTION (int version, + _Unwind_Action actions, + _Unwind_Exception_Class exception_class ATTRIBUTE_UNUSED, + struct _Unwind_Exception *ue_header, + struct _Unwind_Context *context) +#endif +{ + lsda_header_info info; + const unsigned char *language_specific_data, *p; + _Unwind_Ptr landing_pad, ip; + int ip_before_insn = 0; + +#ifdef __ARM_EABI_UNWINDER__ + if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING) + CONTINUE_UNWINDING; + + /* The dwarf unwinder assumes the context structure holds things like the + function and LSDA pointers. The ARM implementation caches these in + the exception header (UCB). To avoid rewriting everything we make the + virtual IP register point at the UCB. */ + ip = (_Unwind_Ptr) ue_header; + _Unwind_SetGR (context, 12, ip); +#else + if (version != 1) + return _URC_FATAL_PHASE1_ERROR; + + /* Currently we only support cleanups for C. */ + if ((actions & _UA_CLEANUP_PHASE) == 0) + CONTINUE_UNWINDING; +#endif + + language_specific_data = (const unsigned char *) + _Unwind_GetLanguageSpecificData (context); + + /* If no LSDA, then there are no handlers or cleanups. */ + if (! language_specific_data) + CONTINUE_UNWINDING; + + /* Parse the LSDA header. */ + p = parse_lsda_header (context, language_specific_data, &info); +#ifdef HAVE_GETIPINFO + ip = _Unwind_GetIPInfo (context, &ip_before_insn); +#else + ip = _Unwind_GetIP (context); +#endif + if (! ip_before_insn) + --ip; + landing_pad = 0; + +#ifdef __USING_SJLJ_EXCEPTIONS__ + /* The given "IP" is an index into the call-site table, with two + exceptions -- -1 means no-action, and 0 means terminate. But + since we're using uleb128 values, we've not got random access + to the array. */ + if ((int) ip <= 0) + return _URC_CONTINUE_UNWIND; + else + { + _uleb128_t cs_lp, cs_action; + do + { + p = read_uleb128 (p, &cs_lp); + p = read_uleb128 (p, &cs_action); + } + while (--ip); + + /* Can never have null landing pad for sjlj -- that would have + been indicated by a -1 call site index. */ + landing_pad = (_Unwind_Ptr)cs_lp + 1; + goto found_something; + } +#else + /* Search the call-site table for the action associated with this IP. */ + while (p < info.action_table) + { + _Unwind_Ptr cs_start, cs_len, cs_lp; + _uleb128_t cs_action; + + /* Note that all call-site encodings are "absolute" displacements. */ + p = read_encoded_value (0, info.call_site_encoding, p, &cs_start); + p = read_encoded_value (0, info.call_site_encoding, p, &cs_len); + p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp); + p = read_uleb128 (p, &cs_action); + + /* The table is sorted, so if we've passed the ip, stop. */ + if (ip < info.Start + cs_start) + p = info.action_table; + else if (ip < info.Start + cs_start + cs_len) + { + if (cs_lp) + landing_pad = info.LPStart + cs_lp; + goto found_something; + } + } +#endif + + /* IP is not in table. No associated cleanups. */ + /* ??? This is where C++ calls std::terminate to catch throw + from a destructor. */ + CONTINUE_UNWINDING; + + found_something: + if (landing_pad == 0) + { + /* IP is present, but has a null landing pad. + No handler to be run. */ + CONTINUE_UNWINDING; + } + + _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), + (_Unwind_Ptr) ue_header); + _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), 0); + _Unwind_SetIP (context, landing_pad); + return _URC_INSTALL_CONTEXT; +} diff --git a/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.c b/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.c new file mode 100644 index 0000000000..60535cfd78 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.c @@ -0,0 +1,1028 @@ +/* Subroutines needed for unwinding stack frames for exception handling. */ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008, + 2009 Free Software Foundation, Inc. + Contributed by Jason Merrill . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef _Unwind_Find_FDE +#include "tconfig.h" +#include "tsystem.h" +#include "coretypes.h" +#include "tm.h" +#include "dwarf2.h" +#include "unwind.h" +#define NO_BASE_OF_ENCODED_VALUE +#include "unwind-pe.h" +#include "unwind-dw2-fde.h" +#include "gthr.h" +#endif + +/* The unseen_objects list contains objects that have been registered + but not yet categorized in any way. The seen_objects list has had + its pc_begin and count fields initialized at minimum, and is sorted + by decreasing value of pc_begin. */ +static struct object *unseen_objects; +static struct object *seen_objects; + +#ifdef __GTHREAD_MUTEX_INIT +static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT; +#else +static __gthread_mutex_t object_mutex; +#endif + +#ifdef __GTHREAD_MUTEX_INIT_FUNCTION +static void +init_object_mutex (void) +{ + __GTHREAD_MUTEX_INIT_FUNCTION (&object_mutex); +} + +static void +init_object_mutex_once (void) +{ + static __gthread_once_t once = __GTHREAD_ONCE_INIT; + __gthread_once (&once, init_object_mutex); +} +#else +#define init_object_mutex_once() +#endif + +/* Called from crtbegin.o to register the unwind info for an object. */ + +void +__register_frame_info_bases (const void *begin, struct object *ob, + void *tbase, void *dbase) +{ + /* If .eh_frame is empty, don't register at all. */ + if ((const uword *) begin == 0 || *(const uword *) begin == 0) + return; + + ob->pc_begin = (void *)-1; + ob->tbase = tbase; + ob->dbase = dbase; + ob->u.single = begin; + ob->s.i = 0; + ob->s.b.encoding = DW_EH_PE_omit; +#ifdef DWARF2_OBJECT_END_PTR_EXTENSION + ob->fde_end = NULL; +#endif + + init_object_mutex_once (); + __gthread_mutex_lock (&object_mutex); + + ob->next = unseen_objects; + unseen_objects = ob; + + __gthread_mutex_unlock (&object_mutex); +} + +void +__register_frame_info (const void *begin, struct object *ob) +{ + __register_frame_info_bases (begin, ob, 0, 0); +} + +void +__register_frame (void *begin) +{ + struct object *ob; + + /* If .eh_frame is empty, don't register at all. */ + if (*(uword *) begin == 0) + return; + + ob = malloc (sizeof (struct object)); + __register_frame_info (begin, ob); +} + +/* Similar, but BEGIN is actually a pointer to a table of unwind entries + for different translation units. Called from the file generated by + collect2. */ + +void +__register_frame_info_table_bases (void *begin, struct object *ob, + void *tbase, void *dbase) +{ + ob->pc_begin = (void *)-1; + ob->tbase = tbase; + ob->dbase = dbase; + ob->u.array = begin; + ob->s.i = 0; + ob->s.b.from_array = 1; + ob->s.b.encoding = DW_EH_PE_omit; + + init_object_mutex_once (); + __gthread_mutex_lock (&object_mutex); + + ob->next = unseen_objects; + unseen_objects = ob; + + __gthread_mutex_unlock (&object_mutex); +} + +void +__register_frame_info_table (void *begin, struct object *ob) +{ + __register_frame_info_table_bases (begin, ob, 0, 0); +} + +void +__register_frame_table (void *begin) +{ + struct object *ob = malloc (sizeof (struct object)); + __register_frame_info_table (begin, ob); +} + +/* Called from crtbegin.o to deregister the unwind info for an object. */ +/* ??? Glibc has for a while now exported __register_frame_info and + __deregister_frame_info. If we call __register_frame_info_bases + from crtbegin (wherein it is declared weak), and this object does + not get pulled from libgcc.a for other reasons, then the + invocation of __deregister_frame_info will be resolved from glibc. + Since the registration did not happen there, we'll die. + + Therefore, declare a new deregistration entry point that does the + exact same thing, but will resolve to the same library as + implements __register_frame_info_bases. */ + +void * +__deregister_frame_info_bases (const void *begin) +{ + struct object **p; + struct object *ob = 0; + + /* If .eh_frame is empty, we haven't registered. */ + if ((const uword *) begin == 0 || *(const uword *) begin == 0) + return ob; + + init_object_mutex_once (); + __gthread_mutex_lock (&object_mutex); + + for (p = &unseen_objects; *p ; p = &(*p)->next) + if ((*p)->u.single == begin) + { + ob = *p; + *p = ob->next; + goto out; + } + + for (p = &seen_objects; *p ; p = &(*p)->next) + if ((*p)->s.b.sorted) + { + if ((*p)->u.sort->orig_data == begin) + { + ob = *p; + *p = ob->next; + free (ob->u.sort); + goto out; + } + } + else + { + if ((*p)->u.single == begin) + { + ob = *p; + *p = ob->next; + goto out; + } + } + + out: + __gthread_mutex_unlock (&object_mutex); + gcc_assert (ob); + return (void *) ob; +} + +void * +__deregister_frame_info (const void *begin) +{ + return __deregister_frame_info_bases (begin); +} + +void +__deregister_frame (void *begin) +{ + /* If .eh_frame is empty, we haven't registered. */ + if (*(uword *) begin != 0) + free (__deregister_frame_info (begin)); +} + + +/* Like base_of_encoded_value, but take the base from a struct object + instead of an _Unwind_Context. */ + +static _Unwind_Ptr +base_from_object (unsigned char encoding, struct object *ob) +{ + if (encoding == DW_EH_PE_omit) + return 0; + + switch (encoding & 0x70) + { + case DW_EH_PE_absptr: + case DW_EH_PE_pcrel: + case DW_EH_PE_aligned: + return 0; + + case DW_EH_PE_textrel: + return (_Unwind_Ptr) ob->tbase; + case DW_EH_PE_datarel: + return (_Unwind_Ptr) ob->dbase; + default: + gcc_unreachable (); + } +} + +/* Return the FDE pointer encoding from the CIE. */ +/* ??? This is a subset of extract_cie_info from unwind-dw2.c. */ + +static int +get_cie_encoding (const struct dwarf_cie *cie) +{ + const unsigned char *aug, *p; + _Unwind_Ptr dummy; + _uleb128_t utmp; + _sleb128_t stmp; + + aug = cie->augmentation; + if (aug[0] != 'z') + return DW_EH_PE_absptr; + + p = aug + strlen ((const char *)aug) + 1; /* Skip the augmentation string. */ + p = read_uleb128 (p, &utmp); /* Skip code alignment. */ + p = read_sleb128 (p, &stmp); /* Skip data alignment. */ + if (cie->version == 1) /* Skip return address column. */ + p++; + else + p = read_uleb128 (p, &utmp); + + aug++; /* Skip 'z' */ + p = read_uleb128 (p, &utmp); /* Skip augmentation length. */ + while (1) + { + /* This is what we're looking for. */ + if (*aug == 'R') + return *p; + /* Personality encoding and pointer. */ + else if (*aug == 'P') + { + /* ??? Avoid dereferencing indirect pointers, since we're + faking the base address. Gotta keep DW_EH_PE_aligned + intact, however. */ + p = read_encoded_value_with_base (*p & 0x7F, 0, p + 1, &dummy); + } + /* LSDA encoding. */ + else if (*aug == 'L') + p++; + /* Otherwise end of string, or unknown augmentation. */ + else + return DW_EH_PE_absptr; + aug++; + } +} + +static inline int +get_fde_encoding (const struct dwarf_fde *f) +{ + return get_cie_encoding (get_cie (f)); +} + + +/* Sorting an array of FDEs by address. + (Ideally we would have the linker sort the FDEs so we don't have to do + it at run time. But the linkers are not yet prepared for this.) */ + +/* Comparison routines. Three variants of increasing complexity. */ + +static int +fde_unencoded_compare (struct object *ob __attribute__((unused)), + const fde *x, const fde *y) +{ + _Unwind_Ptr x_ptr, y_ptr; + memcpy (&x_ptr, x->pc_begin, sizeof (_Unwind_Ptr)); + memcpy (&y_ptr, y->pc_begin, sizeof (_Unwind_Ptr)); + + if (x_ptr > y_ptr) + return 1; + if (x_ptr < y_ptr) + return -1; + return 0; +} + +static int +fde_single_encoding_compare (struct object *ob, const fde *x, const fde *y) +{ + _Unwind_Ptr base, x_ptr, y_ptr; + + base = base_from_object (ob->s.b.encoding, ob); + read_encoded_value_with_base (ob->s.b.encoding, base, x->pc_begin, &x_ptr); + read_encoded_value_with_base (ob->s.b.encoding, base, y->pc_begin, &y_ptr); + + if (x_ptr > y_ptr) + return 1; + if (x_ptr < y_ptr) + return -1; + return 0; +} + +static int +fde_mixed_encoding_compare (struct object *ob, const fde *x, const fde *y) +{ + int x_encoding, y_encoding; + _Unwind_Ptr x_ptr, y_ptr; + + x_encoding = get_fde_encoding (x); + read_encoded_value_with_base (x_encoding, base_from_object (x_encoding, ob), + x->pc_begin, &x_ptr); + + y_encoding = get_fde_encoding (y); + read_encoded_value_with_base (y_encoding, base_from_object (y_encoding, ob), + y->pc_begin, &y_ptr); + + if (x_ptr > y_ptr) + return 1; + if (x_ptr < y_ptr) + return -1; + return 0; +} + +typedef int (*fde_compare_t) (struct object *, const fde *, const fde *); + + +/* This is a special mix of insertion sort and heap sort, optimized for + the data sets that actually occur. They look like + 101 102 103 127 128 105 108 110 190 111 115 119 125 160 126 129 130. + I.e. a linearly increasing sequence (coming from functions in the text + section), with additionally a few unordered elements (coming from functions + in gnu_linkonce sections) whose values are higher than the values in the + surrounding linear sequence (but not necessarily higher than the values + at the end of the linear sequence!). + The worst-case total run time is O(N) + O(n log (n)), where N is the + total number of FDEs and n is the number of erratic ones. */ + +struct fde_accumulator +{ + struct fde_vector *linear; + struct fde_vector *erratic; +}; + +static inline int +start_fde_sort (struct fde_accumulator *accu, size_t count) +{ + size_t size; + if (! count) + return 0; + + size = sizeof (struct fde_vector) + sizeof (const fde *) * count; + if ((accu->linear = malloc (size))) + { + accu->linear->count = 0; + if ((accu->erratic = malloc (size))) + accu->erratic->count = 0; + return 1; + } + else + return 0; +} + +static inline void +fde_insert (struct fde_accumulator *accu, const fde *this_fde) +{ + if (accu->linear) + accu->linear->array[accu->linear->count++] = this_fde; +} + +/* Split LINEAR into a linear sequence with low values and an erratic + sequence with high values, put the linear one (of longest possible + length) into LINEAR and the erratic one into ERRATIC. This is O(N). + + Because the longest linear sequence we are trying to locate within the + incoming LINEAR array can be interspersed with (high valued) erratic + entries. We construct a chain indicating the sequenced entries. + To avoid having to allocate this chain, we overlay it onto the space of + the ERRATIC array during construction. A final pass iterates over the + chain to determine what should be placed in the ERRATIC array, and + what is the linear sequence. This overlay is safe from aliasing. */ + +static inline void +fde_split (struct object *ob, fde_compare_t fde_compare, + struct fde_vector *linear, struct fde_vector *erratic) +{ + static const fde *marker; + size_t count = linear->count; + const fde *const *chain_end = ▮ + size_t i, j, k; + + /* This should optimize out, but it is wise to make sure this assumption + is correct. Should these have different sizes, we cannot cast between + them and the overlaying onto ERRATIC will not work. */ + gcc_assert (sizeof (const fde *) == sizeof (const fde **)); + + for (i = 0; i < count; i++) + { + const fde *const *probe; + + for (probe = chain_end; + probe != &marker && fde_compare (ob, linear->array[i], *probe) < 0; + probe = chain_end) + { + chain_end = (const fde *const*) erratic->array[probe - linear->array]; + erratic->array[probe - linear->array] = NULL; + } + erratic->array[i] = (const fde *) chain_end; + chain_end = &linear->array[i]; + } + + /* Each entry in LINEAR which is part of the linear sequence we have + discovered will correspond to a non-NULL entry in the chain we built in + the ERRATIC array. */ + for (i = j = k = 0; i < count; i++) + if (erratic->array[i]) + linear->array[j++] = linear->array[i]; + else + erratic->array[k++] = linear->array[i]; + linear->count = j; + erratic->count = k; +} + +#define SWAP(x,y) do { const fde * tmp = x; x = y; y = tmp; } while (0) + +/* Convert a semi-heap to a heap. A semi-heap is a heap except possibly + for the first (root) node; push it down to its rightful place. */ + +static void +frame_downheap (struct object *ob, fde_compare_t fde_compare, const fde **a, + int lo, int hi) +{ + int i, j; + + for (i = lo, j = 2*i+1; + j < hi; + j = 2*i+1) + { + if (j+1 < hi && fde_compare (ob, a[j], a[j+1]) < 0) + ++j; + + if (fde_compare (ob, a[i], a[j]) < 0) + { + SWAP (a[i], a[j]); + i = j; + } + else + break; + } +} + +/* This is O(n log(n)). BSD/OS defines heapsort in stdlib.h, so we must + use a name that does not conflict. */ + +static void +frame_heapsort (struct object *ob, fde_compare_t fde_compare, + struct fde_vector *erratic) +{ + /* For a description of this algorithm, see: + Samuel P. Harbison, Guy L. Steele Jr.: C, a reference manual, 2nd ed., + p. 60-61. */ + const fde ** a = erratic->array; + /* A portion of the array is called a "heap" if for all i>=0: + If i and 2i+1 are valid indices, then a[i] >= a[2i+1]. + If i and 2i+2 are valid indices, then a[i] >= a[2i+2]. */ + size_t n = erratic->count; + int m; + + /* Expand our heap incrementally from the end of the array, heapifying + each resulting semi-heap as we go. After each step, a[m] is the top + of a heap. */ + for (m = n/2-1; m >= 0; --m) + frame_downheap (ob, fde_compare, a, m, n); + + /* Shrink our heap incrementally from the end of the array, first + swapping out the largest element a[0] and then re-heapifying the + resulting semi-heap. After each step, a[0..m) is a heap. */ + for (m = n-1; m >= 1; --m) + { + SWAP (a[0], a[m]); + frame_downheap (ob, fde_compare, a, 0, m); + } +#undef SWAP +} + +/* Merge V1 and V2, both sorted, and put the result into V1. */ +static inline void +fde_merge (struct object *ob, fde_compare_t fde_compare, + struct fde_vector *v1, struct fde_vector *v2) +{ + size_t i1, i2; + const fde * fde2; + + i2 = v2->count; + if (i2 > 0) + { + i1 = v1->count; + do + { + i2--; + fde2 = v2->array[i2]; + while (i1 > 0 && fde_compare (ob, v1->array[i1-1], fde2) > 0) + { + v1->array[i1+i2] = v1->array[i1-1]; + i1--; + } + v1->array[i1+i2] = fde2; + } + while (i2 > 0); + v1->count += v2->count; + } +} + +static inline void +end_fde_sort (struct object *ob, struct fde_accumulator *accu, size_t count) +{ + fde_compare_t fde_compare; + + gcc_assert (!accu->linear || accu->linear->count == count); + + if (ob->s.b.mixed_encoding) + fde_compare = fde_mixed_encoding_compare; + else if (ob->s.b.encoding == DW_EH_PE_absptr) + fde_compare = fde_unencoded_compare; + else + fde_compare = fde_single_encoding_compare; + + if (accu->erratic) + { + fde_split (ob, fde_compare, accu->linear, accu->erratic); + gcc_assert (accu->linear->count + accu->erratic->count == count); + frame_heapsort (ob, fde_compare, accu->erratic); + fde_merge (ob, fde_compare, accu->linear, accu->erratic); + free (accu->erratic); + } + else + { + /* We've not managed to malloc an erratic array, + so heap sort in the linear one. */ + frame_heapsort (ob, fde_compare, accu->linear); + } +} + + +/* Update encoding, mixed_encoding, and pc_begin for OB for the + fde array beginning at THIS_FDE. Return the number of fdes + encountered along the way. */ + +static size_t +classify_object_over_fdes (struct object *ob, const fde *this_fde) +{ + const struct dwarf_cie *last_cie = 0; + size_t count = 0; + int encoding = DW_EH_PE_absptr; + _Unwind_Ptr base = 0; + + for (; ! last_fde (ob, this_fde); this_fde = next_fde (this_fde)) + { + const struct dwarf_cie *this_cie; + _Unwind_Ptr mask, pc_begin; + + /* Skip CIEs. */ + if (this_fde->CIE_delta == 0) + continue; + + /* Determine the encoding for this FDE. Note mixed encoded + objects for later. */ + this_cie = get_cie (this_fde); + if (this_cie != last_cie) + { + last_cie = this_cie; + encoding = get_cie_encoding (this_cie); + base = base_from_object (encoding, ob); + if (ob->s.b.encoding == DW_EH_PE_omit) + ob->s.b.encoding = encoding; + else if (ob->s.b.encoding != encoding) + ob->s.b.mixed_encoding = 1; + } + + read_encoded_value_with_base (encoding, base, this_fde->pc_begin, + &pc_begin); + + /* Take care to ignore link-once functions that were removed. + In these cases, the function address will be NULL, but if + the encoding is smaller than a pointer a true NULL may not + be representable. Assume 0 in the representable bits is NULL. */ + mask = size_of_encoded_value (encoding); + if (mask < sizeof (void *)) + mask = (((_Unwind_Ptr) 1) << (mask << 3)) - 1; + else + mask = -1; + + if ((pc_begin & mask) == 0) + continue; + + count += 1; + if ((void *) pc_begin < ob->pc_begin) + ob->pc_begin = (void *) pc_begin; + } + + return count; +} + +static void +add_fdes (struct object *ob, struct fde_accumulator *accu, const fde *this_fde) +{ + const struct dwarf_cie *last_cie = 0; + int encoding = ob->s.b.encoding; + _Unwind_Ptr base = base_from_object (ob->s.b.encoding, ob); + + for (; ! last_fde (ob, this_fde); this_fde = next_fde (this_fde)) + { + const struct dwarf_cie *this_cie; + + /* Skip CIEs. */ + if (this_fde->CIE_delta == 0) + continue; + + if (ob->s.b.mixed_encoding) + { + /* Determine the encoding for this FDE. Note mixed encoded + objects for later. */ + this_cie = get_cie (this_fde); + if (this_cie != last_cie) + { + last_cie = this_cie; + encoding = get_cie_encoding (this_cie); + base = base_from_object (encoding, ob); + } + } + + if (encoding == DW_EH_PE_absptr) + { + _Unwind_Ptr ptr; + memcpy (&ptr, this_fde->pc_begin, sizeof (_Unwind_Ptr)); + if (ptr == 0) + continue; + } + else + { + _Unwind_Ptr pc_begin, mask; + + read_encoded_value_with_base (encoding, base, this_fde->pc_begin, + &pc_begin); + + /* Take care to ignore link-once functions that were removed. + In these cases, the function address will be NULL, but if + the encoding is smaller than a pointer a true NULL may not + be representable. Assume 0 in the representable bits is NULL. */ + mask = size_of_encoded_value (encoding); + if (mask < sizeof (void *)) + mask = (((_Unwind_Ptr) 1) << (mask << 3)) - 1; + else + mask = -1; + + if ((pc_begin & mask) == 0) + continue; + } + + fde_insert (accu, this_fde); + } +} + +/* Set up a sorted array of pointers to FDEs for a loaded object. We + count up the entries before allocating the array because it's likely to + be faster. We can be called multiple times, should we have failed to + allocate a sorted fde array on a previous occasion. */ + +static inline void +init_object (struct object* ob) +{ + struct fde_accumulator accu; + size_t count; + + count = ob->s.b.count; + if (count == 0) + { + if (ob->s.b.from_array) + { + fde **p = ob->u.array; + for (count = 0; *p; ++p) + count += classify_object_over_fdes (ob, *p); + } + else + count = classify_object_over_fdes (ob, ob->u.single); + + /* The count field we have in the main struct object is somewhat + limited, but should suffice for virtually all cases. If the + counted value doesn't fit, re-write a zero. The worst that + happens is that we re-count next time -- admittedly non-trivial + in that this implies some 2M fdes, but at least we function. */ + ob->s.b.count = count; + if (ob->s.b.count != count) + ob->s.b.count = 0; + } + + if (!start_fde_sort (&accu, count)) + return; + + if (ob->s.b.from_array) + { + fde **p; + for (p = ob->u.array; *p; ++p) + add_fdes (ob, &accu, *p); + } + else + add_fdes (ob, &accu, ob->u.single); + + end_fde_sort (ob, &accu, count); + + /* Save the original fde pointer, since this is the key by which the + DSO will deregister the object. */ + accu.linear->orig_data = ob->u.single; + ob->u.sort = accu.linear; + + ob->s.b.sorted = 1; +} + +/* A linear search through a set of FDEs for the given PC. This is + used when there was insufficient memory to allocate and sort an + array. */ + +static const fde * +linear_search_fdes (struct object *ob, const fde *this_fde, void *pc) +{ + const struct dwarf_cie *last_cie = 0; + int encoding = ob->s.b.encoding; + _Unwind_Ptr base = base_from_object (ob->s.b.encoding, ob); + + for (; ! last_fde (ob, this_fde); this_fde = next_fde (this_fde)) + { + const struct dwarf_cie *this_cie; + _Unwind_Ptr pc_begin, pc_range; + + /* Skip CIEs. */ + if (this_fde->CIE_delta == 0) + continue; + + if (ob->s.b.mixed_encoding) + { + /* Determine the encoding for this FDE. Note mixed encoded + objects for later. */ + this_cie = get_cie (this_fde); + if (this_cie != last_cie) + { + last_cie = this_cie; + encoding = get_cie_encoding (this_cie); + base = base_from_object (encoding, ob); + } + } + + if (encoding == DW_EH_PE_absptr) + { + const _Unwind_Ptr *pc_array = (const _Unwind_Ptr *) this_fde->pc_begin; + pc_begin = pc_array[0]; + pc_range = pc_array[1]; + if (pc_begin == 0) + continue; + } + else + { + _Unwind_Ptr mask; + const unsigned char *p; + + p = read_encoded_value_with_base (encoding, base, + this_fde->pc_begin, &pc_begin); + read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range); + + /* Take care to ignore link-once functions that were removed. + In these cases, the function address will be NULL, but if + the encoding is smaller than a pointer a true NULL may not + be representable. Assume 0 in the representable bits is NULL. */ + mask = size_of_encoded_value (encoding); + if (mask < sizeof (void *)) + mask = (((_Unwind_Ptr) 1) << (mask << 3)) - 1; + else + mask = -1; + + if ((pc_begin & mask) == 0) + continue; + } + + if ((_Unwind_Ptr) pc - pc_begin < pc_range) + return this_fde; + } + + return NULL; +} + +/* Binary search for an FDE containing the given PC. Here are three + implementations of increasing complexity. */ + +static inline const fde * +binary_search_unencoded_fdes (struct object *ob, void *pc) +{ + struct fde_vector *vec = ob->u.sort; + size_t lo, hi; + + for (lo = 0, hi = vec->count; lo < hi; ) + { + size_t i = (lo + hi) / 2; + const fde *const f = vec->array[i]; + void *pc_begin; + uaddr pc_range; + memcpy (&pc_begin, (const void * const *) f->pc_begin, sizeof (void *)); + memcpy (&pc_range, (const uaddr *) f->pc_begin + 1, sizeof (uaddr)); + + if (pc < pc_begin) + hi = i; + else if (pc >= pc_begin + pc_range) + lo = i + 1; + else + return f; + } + + return NULL; +} + +static inline const fde * +binary_search_single_encoding_fdes (struct object *ob, void *pc) +{ + struct fde_vector *vec = ob->u.sort; + int encoding = ob->s.b.encoding; + _Unwind_Ptr base = base_from_object (encoding, ob); + size_t lo, hi; + + for (lo = 0, hi = vec->count; lo < hi; ) + { + size_t i = (lo + hi) / 2; + const fde *f = vec->array[i]; + _Unwind_Ptr pc_begin, pc_range; + const unsigned char *p; + + p = read_encoded_value_with_base (encoding, base, f->pc_begin, + &pc_begin); + read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range); + + if ((_Unwind_Ptr) pc < pc_begin) + hi = i; + else if ((_Unwind_Ptr) pc >= pc_begin + pc_range) + lo = i + 1; + else + return f; + } + + return NULL; +} + +static inline const fde * +binary_search_mixed_encoding_fdes (struct object *ob, void *pc) +{ + struct fde_vector *vec = ob->u.sort; + size_t lo, hi; + + for (lo = 0, hi = vec->count; lo < hi; ) + { + size_t i = (lo + hi) / 2; + const fde *f = vec->array[i]; + _Unwind_Ptr pc_begin, pc_range; + const unsigned char *p; + int encoding; + + encoding = get_fde_encoding (f); + p = read_encoded_value_with_base (encoding, + base_from_object (encoding, ob), + f->pc_begin, &pc_begin); + read_encoded_value_with_base (encoding & 0x0F, 0, p, &pc_range); + + if ((_Unwind_Ptr) pc < pc_begin) + hi = i; + else if ((_Unwind_Ptr) pc >= pc_begin + pc_range) + lo = i + 1; + else + return f; + } + + return NULL; +} + +static const fde * +search_object (struct object* ob, void *pc) +{ + /* If the data hasn't been sorted, try to do this now. We may have + more memory available than last time we tried. */ + if (! ob->s.b.sorted) + { + init_object (ob); + + /* Despite the above comment, the normal reason to get here is + that we've not processed this object before. A quick range + check is in order. */ + if (pc < ob->pc_begin) + return NULL; + } + + if (ob->s.b.sorted) + { + if (ob->s.b.mixed_encoding) + return binary_search_mixed_encoding_fdes (ob, pc); + else if (ob->s.b.encoding == DW_EH_PE_absptr) + return binary_search_unencoded_fdes (ob, pc); + else + return binary_search_single_encoding_fdes (ob, pc); + } + else + { + /* Long slow laborious linear search, cos we've no memory. */ + if (ob->s.b.from_array) + { + fde **p; + for (p = ob->u.array; *p ; p++) + { + const fde *f = linear_search_fdes (ob, *p, pc); + if (f) + return f; + } + return NULL; + } + else + return linear_search_fdes (ob, ob->u.single, pc); + } +} + +const fde * +_Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases) +{ + struct object *ob; + const fde *f = NULL; + + init_object_mutex_once (); + __gthread_mutex_lock (&object_mutex); + + /* Linear search through the classified objects, to find the one + containing the pc. Note that pc_begin is sorted descending, and + we expect objects to be non-overlapping. */ + for (ob = seen_objects; ob; ob = ob->next) + if (pc >= ob->pc_begin) + { + f = search_object (ob, pc); + if (f) + goto fini; + break; + } + + /* Classify and search the objects we've not yet processed. */ + while ((ob = unseen_objects)) + { + struct object **p; + + unseen_objects = ob->next; + f = search_object (ob, pc); + + /* Insert the object into the classified list. */ + for (p = &seen_objects; *p ; p = &(*p)->next) + if ((*p)->pc_begin < ob->pc_begin) + break; + ob->next = *p; + *p = ob; + + if (f) + goto fini; + } + + fini: + __gthread_mutex_unlock (&object_mutex); + + if (f) + { + int encoding; + _Unwind_Ptr func; + + bases->tbase = ob->tbase; + bases->dbase = ob->dbase; + + encoding = ob->s.b.encoding; + if (ob->s.b.mixed_encoding) + encoding = get_fde_encoding (f); + read_encoded_value_with_base (encoding, base_from_object (encoding, ob), + f->pc_begin, &func); + bases->func = (void *) func; + } + + return f; +} diff --git a/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.h b/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.h new file mode 100644 index 0000000000..6d7a8dee2c --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-dw2-fde.h @@ -0,0 +1,183 @@ +/* Subroutines needed for unwinding stack frames for exception handling. */ +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2009 + Free Software Foundation, Inc. + Contributed by Jason Merrill . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_UNWIND_DW2_FDE_H +#define GCC_UNWIND_DW2_FDE_H + +#ifndef HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +struct fde_vector +{ + const void *orig_data; + size_t count; + const struct dwarf_fde *array[]; +}; + +struct object +{ + void *pc_begin; + void *tbase; + void *dbase; + union { + const struct dwarf_fde *single; + struct dwarf_fde **array; + struct fde_vector *sort; + } u; + + union { + struct { + unsigned long sorted : 1; + unsigned long from_array : 1; + unsigned long mixed_encoding : 1; + unsigned long encoding : 8; + /* ??? Wish there was an easy way to detect a 64-bit host here; + we've got 32 bits left to play with... */ + unsigned long count : 21; + } b; + size_t i; + } s; + +#ifdef DWARF2_OBJECT_END_PTR_EXTENSION + char *fde_end; +#endif + + struct object *next; +}; + +/* This is the original definition of struct object. While the struct + itself was opaque to users, they did know how large it was, and + allocate one statically in crtbegin for each DSO. Keep this around + so that we're aware of the static size limitations for the new struct. */ +struct old_object +{ + void *pc_begin; + void *pc_end; + struct dwarf_fde *fde_begin; + struct dwarf_fde **fde_array; + size_t count; + struct old_object *next; +}; + +struct dwarf_eh_bases +{ + void *tbase; + void *dbase; + void *func; +}; + + +extern void __register_frame_info_bases (const void *, struct object *, + void *, void *); +extern void __register_frame_info (const void *, struct object *); +extern void __register_frame (void *); +extern void __register_frame_info_table_bases (void *, struct object *, + void *, void *); +extern void __register_frame_info_table (void *, struct object *); +extern void __register_frame_table (void *); +extern void *__deregister_frame_info (const void *); +extern void *__deregister_frame_info_bases (const void *); +extern void __deregister_frame (void *); + + +typedef int sword __attribute__ ((mode (SI))); +typedef unsigned int uword __attribute__ ((mode (SI))); +typedef unsigned int uaddr __attribute__ ((mode (pointer))); +typedef int saddr __attribute__ ((mode (pointer))); +typedef unsigned char ubyte; + +/* Terminology: + CIE - Common Information Element + FDE - Frame Descriptor Element + + There is one per function, and it describes where the function code + is located, and what the register lifetimes and stack layout are + within the function. + + The data structures are defined in the DWARF specification, although + not in a very readable way (see LITERATURE). + + Every time an exception is thrown, the code needs to locate the FDE + for the current function, and starts to look for exception regions + from that FDE. This works in a two-level search: + a) in a linear search, find the shared image (i.e. DLL) containing + the PC + b) using the FDE table for that shared object, locate the FDE using + binary search (which requires the sorting). */ + +/* The first few fields of a CIE. The CIE_id field is 0 for a CIE, + to distinguish it from a valid FDE. FDEs are aligned to an addressing + unit boundary, but the fields within are unaligned. */ +struct dwarf_cie +{ + uword length; + sword CIE_id; + ubyte version; + unsigned char augmentation[]; +} __attribute__ ((packed, aligned (__alignof__ (void *)))); + +/* The first few fields of an FDE. */ +struct dwarf_fde +{ + uword length; + sword CIE_delta; + unsigned char pc_begin[]; +} __attribute__ ((packed, aligned (__alignof__ (void *)))); + +typedef struct dwarf_fde fde; + +/* Locate the CIE for a given FDE. */ + +static inline const struct dwarf_cie * +get_cie (const struct dwarf_fde *f) +{ + return (const void *)&f->CIE_delta - f->CIE_delta; +} + +static inline const fde * +next_fde (const fde *f) +{ + return (const fde *) ((const char *) f + f->length + sizeof (f->length)); +} + +extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *); + +static inline int +last_fde (struct object *obj __attribute__ ((__unused__)), const fde *f) +{ +#ifdef DWARF2_OBJECT_END_PTR_EXTENSION + return (char *)f == obj->fde_end || f->length == 0; +#else + return f->length == 0; +#endif +} + +#ifndef HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* unwind-dw2-fde.h */ diff --git a/contrib/sdk/sources/gcc_eh/unwind-dw2.c b/contrib/sdk/sources/gcc_eh/unwind-dw2.c new file mode 100644 index 0000000000..2b2836f9e0 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-dw2.c @@ -0,0 +1,1594 @@ +/* DWARF2 exception handling and frame unwind runtime interface routines. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2008, 2009, 2010 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + 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. + + 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 + . */ + +#include "tconfig.h" +#include "tsystem.h" +#include "coretypes.h" +#include "tm.h" +#include "dwarf2.h" +#include "unwind.h" +#ifdef __USING_SJLJ_EXCEPTIONS__ +# define NO_SIZE_OF_ENCODED_VALUE +#endif +#include "unwind-pe.h" +#include "unwind-dw2-fde.h" +#include "gthr.h" +#include "unwind-dw2.h" + +#ifndef __USING_SJLJ_EXCEPTIONS__ + +#ifndef STACK_GROWS_DOWNWARD +#define STACK_GROWS_DOWNWARD 0 +#else +#undef STACK_GROWS_DOWNWARD +#define STACK_GROWS_DOWNWARD 1 +#endif + +/* Dwarf frame registers used for pre gcc 3.0 compiled glibc. */ +#ifndef PRE_GCC3_DWARF_FRAME_REGISTERS +#define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS +#endif + +#ifndef DWARF_REG_TO_UNWIND_COLUMN +#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO) +#endif + +/* This is the register and unwind state for a particular frame. This + provides the information necessary to unwind up past a frame and return + to its caller. */ +struct _Unwind_Context +{ + void *reg[DWARF_FRAME_REGISTERS+1]; + void *cfa; + void *ra; + void *lsda; + struct dwarf_eh_bases bases; + /* Signal frame context. */ +#define SIGNAL_FRAME_BIT ((~(_Unwind_Word) 0 >> 1) + 1) + /* Context which has version/args_size/by_value fields. */ +#define EXTENDED_CONTEXT_BIT ((~(_Unwind_Word) 0 >> 2) + 1) + _Unwind_Word flags; + /* 0 for now, can be increased when further fields are added to + struct _Unwind_Context. */ + _Unwind_Word version; + _Unwind_Word args_size; + char by_value[DWARF_FRAME_REGISTERS+1]; +}; + +/* Byte size of every register managed by these routines. */ +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1]; + + +/* Read unaligned data from the instruction buffer. */ + +union unaligned +{ + void *p; + unsigned u2 __attribute__ ((mode (HI))); + unsigned u4 __attribute__ ((mode (SI))); + unsigned u8 __attribute__ ((mode (DI))); + signed s2 __attribute__ ((mode (HI))); + signed s4 __attribute__ ((mode (SI))); + signed s8 __attribute__ ((mode (DI))); +} __attribute__ ((packed)); + +static void uw_update_context (struct _Unwind_Context *, _Unwind_FrameState *); +static _Unwind_Reason_Code uw_frame_state_for (struct _Unwind_Context *, + _Unwind_FrameState *); + +static inline void * +read_pointer (const void *p) { const union unaligned *up = p; return up->p; } + +static inline int +read_1u (const void *p) { return *(const unsigned char *) p; } + +static inline int +read_1s (const void *p) { return *(const signed char *) p; } + +static inline int +read_2u (const void *p) { const union unaligned *up = p; return up->u2; } + +static inline int +read_2s (const void *p) { const union unaligned *up = p; return up->s2; } + +static inline unsigned int +read_4u (const void *p) { const union unaligned *up = p; return up->u4; } + +static inline int +read_4s (const void *p) { const union unaligned *up = p; return up->s4; } + +static inline unsigned long +read_8u (const void *p) { const union unaligned *up = p; return up->u8; } + +static inline unsigned long +read_8s (const void *p) { const union unaligned *up = p; return up->s8; } + +static inline _Unwind_Word +_Unwind_IsSignalFrame (struct _Unwind_Context *context) +{ + return (context->flags & SIGNAL_FRAME_BIT) ? 1 : 0; +} + +static inline void +_Unwind_SetSignalFrame (struct _Unwind_Context *context, int val) +{ + if (val) + context->flags |= SIGNAL_FRAME_BIT; + else + context->flags &= ~SIGNAL_FRAME_BIT; +} + +static inline _Unwind_Word +_Unwind_IsExtendedContext (struct _Unwind_Context *context) +{ + return context->flags & EXTENDED_CONTEXT_BIT; +} + +/* Get the value of register INDEX as saved in CONTEXT. */ + +inline _Unwind_Word +_Unwind_GetGR (struct _Unwind_Context *context, int index) +{ + int size; + void *ptr; + +#ifdef DWARF_ZERO_REG + if (index == DWARF_ZERO_REG) + return 0; +#endif + + index = DWARF_REG_TO_UNWIND_COLUMN (index); + gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); + size = dwarf_reg_size_table[index]; + ptr = context->reg[index]; + + if (_Unwind_IsExtendedContext (context) && context->by_value[index]) + return (_Unwind_Word) (_Unwind_Internal_Ptr) ptr; + + /* This will segfault if the register hasn't been saved. */ + if (size == sizeof(_Unwind_Ptr)) + return * (_Unwind_Ptr *) ptr; + else + { + gcc_assert (size == sizeof(_Unwind_Word)); + return * (_Unwind_Word *) ptr; + } +} + +static inline void * +_Unwind_GetPtr (struct _Unwind_Context *context, int index) +{ + return (void *)(_Unwind_Ptr) _Unwind_GetGR (context, index); +} + +/* Get the value of the CFA as saved in CONTEXT. */ + +_Unwind_Word +_Unwind_GetCFA (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->cfa; +} + +/* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ + +inline void +_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val) +{ + int size; + void *ptr; + + index = DWARF_REG_TO_UNWIND_COLUMN (index); + gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); + size = dwarf_reg_size_table[index]; + + if (_Unwind_IsExtendedContext (context) && context->by_value[index]) + { + context->reg[index] = (void *) (_Unwind_Internal_Ptr) val; + return; + } + + ptr = context->reg[index]; + + if (size == sizeof(_Unwind_Ptr)) + * (_Unwind_Ptr *) ptr = val; + else + { + gcc_assert (size == sizeof(_Unwind_Word)); + * (_Unwind_Word *) ptr = val; + } +} + +/* Get the pointer to a register INDEX as saved in CONTEXT. */ + +static inline void * +_Unwind_GetGRPtr (struct _Unwind_Context *context, int index) +{ + index = DWARF_REG_TO_UNWIND_COLUMN (index); + if (_Unwind_IsExtendedContext (context) && context->by_value[index]) + return &context->reg[index]; + return context->reg[index]; +} + +/* Set the pointer to a register INDEX as saved in CONTEXT. */ + +static inline void +_Unwind_SetGRPtr (struct _Unwind_Context *context, int index, void *p) +{ + index = DWARF_REG_TO_UNWIND_COLUMN (index); + if (_Unwind_IsExtendedContext (context)) + context->by_value[index] = 0; + context->reg[index] = p; +} + +/* Overwrite the saved value for register INDEX in CONTEXT with VAL. */ + +static inline void +_Unwind_SetGRValue (struct _Unwind_Context *context, int index, + _Unwind_Word val) +{ + index = DWARF_REG_TO_UNWIND_COLUMN (index); + gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); + gcc_assert (dwarf_reg_size_table[index] == sizeof (_Unwind_Ptr)); + + context->by_value[index] = 1; + context->reg[index] = (void *) (_Unwind_Internal_Ptr) val; +} + +/* Return nonzero if register INDEX is stored by value rather than + by reference. */ + +static inline int +_Unwind_GRByValue (struct _Unwind_Context *context, int index) +{ + index = DWARF_REG_TO_UNWIND_COLUMN (index); + return context->by_value[index]; +} + +/* Retrieve the return address for CONTEXT. */ + +inline _Unwind_Ptr +_Unwind_GetIP (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->ra; +} + +/* Retrieve the return address and flag whether that IP is before + or after first not yet fully executed instruction. */ + +inline _Unwind_Ptr +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) +{ + *ip_before_insn = _Unwind_IsSignalFrame (context); + return (_Unwind_Ptr) context->ra; +} + +/* Overwrite the return address for CONTEXT with VAL. */ + +inline void +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) +{ + context->ra = (void *) val; +} + +void * +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) +{ + return context->lsda; +} + +_Unwind_Ptr +_Unwind_GetRegionStart (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->bases.func; +} + +void * +_Unwind_FindEnclosingFunction (void *pc) +{ + struct dwarf_eh_bases bases; + const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases); + if (fde) + return bases.func; + else + return NULL; +} + +#ifndef __ia64__ +_Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->bases.dbase; +} + +_Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->bases.tbase; +} +#endif + +#ifdef MD_UNWIND_SUPPORT +#include MD_UNWIND_SUPPORT +#endif + +/* Extract any interesting information from the CIE for the translation + unit F belongs to. Return a pointer to the byte after the augmentation, + or NULL if we encountered an undecipherable augmentation. */ + +static const unsigned char * +extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context, + _Unwind_FrameState *fs) +{ + const unsigned char *aug = cie->augmentation; + const unsigned char *p = aug + strlen ((const char *)aug) + 1; + const unsigned char *ret = NULL; + _uleb128_t utmp; + _sleb128_t stmp; + + /* g++ v2 "eh" has pointer immediately following augmentation string, + so it must be handled first. */ + if (aug[0] == 'e' && aug[1] == 'h') + { + fs->eh_ptr = read_pointer (p); + p += sizeof (void *); + aug += 2; + } + + /* Immediately following the augmentation are the code and + data alignment and return address column. */ + p = read_uleb128 (p, &utmp); + fs->code_align = (_Unwind_Word)utmp; + p = read_sleb128 (p, &stmp); + fs->data_align = (_Unwind_Sword)stmp; + if (cie->version == 1) + fs->retaddr_column = *p++; + else + { + p = read_uleb128 (p, &utmp); + fs->retaddr_column = (_Unwind_Word)utmp; + } + fs->lsda_encoding = DW_EH_PE_omit; + + /* If the augmentation starts with 'z', then a uleb128 immediately + follows containing the length of the augmentation field following + the size. */ + if (*aug == 'z') + { + p = read_uleb128 (p, &utmp); + ret = p + utmp; + + fs->saw_z = 1; + ++aug; + } + + /* Iterate over recognized augmentation subsequences. */ + while (*aug != '\0') + { + /* "L" indicates a byte showing how the LSDA pointer is encoded. */ + if (aug[0] == 'L') + { + fs->lsda_encoding = *p++; + aug += 1; + } + + /* "R" indicates a byte indicating how FDE addresses are encoded. */ + else if (aug[0] == 'R') + { + fs->fde_encoding = *p++; + aug += 1; + } + + /* "P" indicates a personality routine in the CIE augmentation. */ + else if (aug[0] == 'P') + { + _Unwind_Ptr personality; + + p = read_encoded_value (context, *p, p + 1, &personality); + fs->personality = (_Unwind_Personality_Fn) personality; + aug += 1; + } + + /* "S" indicates a signal frame. */ + else if (aug[0] == 'S') + { + fs->signal_frame = 1; + aug += 1; + } + + /* Otherwise we have an unknown augmentation string. + Bail unless we saw a 'z' prefix. */ + else + return ret; + } + + return ret ? ret : p; +} + + +/* Decode a DW_OP stack program. Return the top of stack. Push INITIAL + onto the stack to start. */ + +static _Unwind_Word +execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end, + struct _Unwind_Context *context, _Unwind_Word initial) +{ + _Unwind_Word stack[64]; /* ??? Assume this is enough. */ + int stack_elt; + + stack[0] = initial; + stack_elt = 1; + + while (op_ptr < op_end) + { + enum dwarf_location_atom op = *op_ptr++; + _Unwind_Word result; + _uleb128_t reg, utmp; + _sleb128_t offset, stmp; + + switch (op) + { + case DW_OP_lit0: + case DW_OP_lit1: + case DW_OP_lit2: + case DW_OP_lit3: + case DW_OP_lit4: + case DW_OP_lit5: + case DW_OP_lit6: + case DW_OP_lit7: + case DW_OP_lit8: + case DW_OP_lit9: + case DW_OP_lit10: + case DW_OP_lit11: + case DW_OP_lit12: + case DW_OP_lit13: + case DW_OP_lit14: + case DW_OP_lit15: + case DW_OP_lit16: + case DW_OP_lit17: + case DW_OP_lit18: + case DW_OP_lit19: + case DW_OP_lit20: + case DW_OP_lit21: + case DW_OP_lit22: + case DW_OP_lit23: + case DW_OP_lit24: + case DW_OP_lit25: + case DW_OP_lit26: + case DW_OP_lit27: + case DW_OP_lit28: + case DW_OP_lit29: + case DW_OP_lit30: + case DW_OP_lit31: + result = op - DW_OP_lit0; + break; + + case DW_OP_addr: + result = (_Unwind_Word) (_Unwind_Ptr) read_pointer (op_ptr); + op_ptr += sizeof (void *); + break; + + case DW_OP_GNU_encoded_addr: + { + _Unwind_Ptr presult; + op_ptr = read_encoded_value (context, *op_ptr, op_ptr+1, &presult); + result = presult; + } + break; + + case DW_OP_const1u: + result = read_1u (op_ptr); + op_ptr += 1; + break; + case DW_OP_const1s: + result = read_1s (op_ptr); + op_ptr += 1; + break; + case DW_OP_const2u: + result = read_2u (op_ptr); + op_ptr += 2; + break; + case DW_OP_const2s: + result = read_2s (op_ptr); + op_ptr += 2; + break; + case DW_OP_const4u: + result = read_4u (op_ptr); + op_ptr += 4; + break; + case DW_OP_const4s: + result = read_4s (op_ptr); + op_ptr += 4; + break; + case DW_OP_const8u: + result = read_8u (op_ptr); + op_ptr += 8; + break; + case DW_OP_const8s: + result = read_8s (op_ptr); + op_ptr += 8; + break; + case DW_OP_constu: + op_ptr = read_uleb128 (op_ptr, &utmp); + result = (_Unwind_Word)utmp; + break; + case DW_OP_consts: + op_ptr = read_sleb128 (op_ptr, &stmp); + result = (_Unwind_Sword)stmp; + break; + + case DW_OP_reg0: + case DW_OP_reg1: + case DW_OP_reg2: + case DW_OP_reg3: + case DW_OP_reg4: + case DW_OP_reg5: + case DW_OP_reg6: + case DW_OP_reg7: + case DW_OP_reg8: + case DW_OP_reg9: + case DW_OP_reg10: + case DW_OP_reg11: + case DW_OP_reg12: + case DW_OP_reg13: + case DW_OP_reg14: + case DW_OP_reg15: + case DW_OP_reg16: + case DW_OP_reg17: + case DW_OP_reg18: + case DW_OP_reg19: + case DW_OP_reg20: + case DW_OP_reg21: + case DW_OP_reg22: + case DW_OP_reg23: + case DW_OP_reg24: + case DW_OP_reg25: + case DW_OP_reg26: + case DW_OP_reg27: + case DW_OP_reg28: + case DW_OP_reg29: + case DW_OP_reg30: + case DW_OP_reg31: + result = _Unwind_GetGR (context, op - DW_OP_reg0); + break; + case DW_OP_regx: + op_ptr = read_uleb128 (op_ptr, ®); + result = _Unwind_GetGR (context, reg); + break; + + case DW_OP_breg0: + case DW_OP_breg1: + case DW_OP_breg2: + case DW_OP_breg3: + case DW_OP_breg4: + case DW_OP_breg5: + case DW_OP_breg6: + case DW_OP_breg7: + case DW_OP_breg8: + case DW_OP_breg9: + case DW_OP_breg10: + case DW_OP_breg11: + case DW_OP_breg12: + case DW_OP_breg13: + case DW_OP_breg14: + case DW_OP_breg15: + case DW_OP_breg16: + case DW_OP_breg17: + case DW_OP_breg18: + case DW_OP_breg19: + case DW_OP_breg20: + case DW_OP_breg21: + case DW_OP_breg22: + case DW_OP_breg23: + case DW_OP_breg24: + case DW_OP_breg25: + case DW_OP_breg26: + case DW_OP_breg27: + case DW_OP_breg28: + case DW_OP_breg29: + case DW_OP_breg30: + case DW_OP_breg31: + op_ptr = read_sleb128 (op_ptr, &offset); + result = _Unwind_GetGR (context, op - DW_OP_breg0) + offset; + break; + case DW_OP_bregx: + op_ptr = read_uleb128 (op_ptr, ®); + op_ptr = read_sleb128 (op_ptr, &offset); + result = _Unwind_GetGR (context, reg) + (_Unwind_Word)offset; + break; + + case DW_OP_dup: + gcc_assert (stack_elt); + result = stack[stack_elt - 1]; + break; + + case DW_OP_drop: + gcc_assert (stack_elt); + stack_elt -= 1; + goto no_push; + + case DW_OP_pick: + offset = *op_ptr++; + gcc_assert (offset < stack_elt - 1); + result = stack[stack_elt - 1 - offset]; + break; + + case DW_OP_over: + gcc_assert (stack_elt >= 2); + result = stack[stack_elt - 2]; + break; + + case DW_OP_swap: + { + _Unwind_Word t; + gcc_assert (stack_elt >= 2); + t = stack[stack_elt - 1]; + stack[stack_elt - 1] = stack[stack_elt - 2]; + stack[stack_elt - 2] = t; + goto no_push; + } + + case DW_OP_rot: + { + _Unwind_Word t1, t2, t3; + + gcc_assert (stack_elt >= 3); + t1 = stack[stack_elt - 1]; + t2 = stack[stack_elt - 2]; + t3 = stack[stack_elt - 3]; + stack[stack_elt - 1] = t2; + stack[stack_elt - 2] = t3; + stack[stack_elt - 3] = t1; + goto no_push; + } + + case DW_OP_deref: + case DW_OP_deref_size: + case DW_OP_abs: + case DW_OP_neg: + case DW_OP_not: + case DW_OP_plus_uconst: + /* Unary operations. */ + gcc_assert (stack_elt); + stack_elt -= 1; + + result = stack[stack_elt]; + + switch (op) + { + case DW_OP_deref: + { + void *ptr = (void *) (_Unwind_Ptr) result; + result = (_Unwind_Ptr) read_pointer (ptr); + } + break; + + case DW_OP_deref_size: + { + void *ptr = (void *) (_Unwind_Ptr) result; + switch (*op_ptr++) + { + case 1: + result = read_1u (ptr); + break; + case 2: + result = read_2u (ptr); + break; + case 4: + result = read_4u (ptr); + break; + case 8: + result = read_8u (ptr); + break; + default: + gcc_unreachable (); + } + } + break; + + case DW_OP_abs: + if ((_Unwind_Sword) result < 0) + result = -result; + break; + case DW_OP_neg: + result = -result; + break; + case DW_OP_not: + result = ~result; + break; + case DW_OP_plus_uconst: + op_ptr = read_uleb128 (op_ptr, &utmp); + result += (_Unwind_Word)utmp; + break; + + default: + gcc_unreachable (); + } + break; + + case DW_OP_and: + case DW_OP_div: + case DW_OP_minus: + case DW_OP_mod: + case DW_OP_mul: + case DW_OP_or: + case DW_OP_plus: + case DW_OP_shl: + case DW_OP_shr: + case DW_OP_shra: + case DW_OP_xor: + case DW_OP_le: + case DW_OP_ge: + case DW_OP_eq: + case DW_OP_lt: + case DW_OP_gt: + case DW_OP_ne: + { + /* Binary operations. */ + _Unwind_Word first, second; + gcc_assert (stack_elt >= 2); + stack_elt -= 2; + + second = stack[stack_elt]; + first = stack[stack_elt + 1]; + + switch (op) + { + case DW_OP_and: + result = second & first; + break; + case DW_OP_div: + result = (_Unwind_Sword) second / (_Unwind_Sword) first; + break; + case DW_OP_minus: + result = second - first; + break; + case DW_OP_mod: + result = second % first; + break; + case DW_OP_mul: + result = second * first; + break; + case DW_OP_or: + result = second | first; + break; + case DW_OP_plus: + result = second + first; + break; + case DW_OP_shl: + result = second << first; + break; + case DW_OP_shr: + result = second >> first; + break; + case DW_OP_shra: + result = (_Unwind_Sword) second >> first; + break; + case DW_OP_xor: + result = second ^ first; + break; + case DW_OP_le: + result = (_Unwind_Sword) second <= (_Unwind_Sword) first; + break; + case DW_OP_ge: + result = (_Unwind_Sword) second >= (_Unwind_Sword) first; + break; + case DW_OP_eq: + result = (_Unwind_Sword) second == (_Unwind_Sword) first; + break; + case DW_OP_lt: + result = (_Unwind_Sword) second < (_Unwind_Sword) first; + break; + case DW_OP_gt: + result = (_Unwind_Sword) second > (_Unwind_Sword) first; + break; + case DW_OP_ne: + result = (_Unwind_Sword) second != (_Unwind_Sword) first; + break; + + default: + gcc_unreachable (); + } + } + break; + + case DW_OP_skip: + offset = read_2s (op_ptr); + op_ptr += 2; + op_ptr += offset; + goto no_push; + + case DW_OP_bra: + gcc_assert (stack_elt); + stack_elt -= 1; + + offset = read_2s (op_ptr); + op_ptr += 2; + if (stack[stack_elt] != 0) + op_ptr += offset; + goto no_push; + + case DW_OP_nop: + goto no_push; + + default: + gcc_unreachable (); + } + + /* Most things push a result value. */ + gcc_assert ((size_t) stack_elt < sizeof(stack)/sizeof(*stack)); + stack[stack_elt++] = result; + no_push:; + } + + /* We were executing this program to get a value. It should be + at top of stack. */ + gcc_assert (stack_elt); + stack_elt -= 1; + return stack[stack_elt]; +} + + +/* Decode DWARF 2 call frame information. Takes pointers the + instruction sequence to decode, current register information and + CIE info, and the PC range to evaluate. */ + +static void +execute_cfa_program (const unsigned char *insn_ptr, + const unsigned char *insn_end, + struct _Unwind_Context *context, + _Unwind_FrameState *fs) +{ + struct frame_state_reg_info *unused_rs = NULL; + + /* Don't allow remember/restore between CIE and FDE programs. */ + fs->regs.prev = NULL; + + /* The comparison with the return address uses < rather than <= because + we are only interested in the effects of code before the call; for a + noreturn function, the return address may point to unrelated code with + a different stack configuration that we are not interested in. We + assume that the call itself is unwind info-neutral; if not, or if + there are delay instructions that adjust the stack, these must be + reflected at the point immediately before the call insn. + In signal frames, return address is after last completed instruction, + so we add 1 to return address to make the comparison <=. */ + while (insn_ptr < insn_end + && fs->pc < context->ra + _Unwind_IsSignalFrame (context)) + { + unsigned char insn = *insn_ptr++; + _uleb128_t reg, utmp; + _sleb128_t offset, stmp; + + if ((insn & 0xc0) == DW_CFA_advance_loc) + fs->pc += (insn & 0x3f) * fs->code_align; + else if ((insn & 0xc0) == DW_CFA_offset) + { + reg = insn & 0x3f; + insn_ptr = read_uleb128 (insn_ptr, &utmp); + offset = (_Unwind_Sword) utmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; + } + else if ((insn & 0xc0) == DW_CFA_restore) + { + reg = insn & 0x3f; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_UNSAVED; + } + else switch (insn) + { + case DW_CFA_set_loc: + { + _Unwind_Ptr pc; + + insn_ptr = read_encoded_value (context, fs->fde_encoding, + insn_ptr, &pc); + fs->pc = (void *) pc; + } + break; + + case DW_CFA_advance_loc1: + fs->pc += read_1u (insn_ptr) * fs->code_align; + insn_ptr += 1; + break; + case DW_CFA_advance_loc2: + fs->pc += read_2u (insn_ptr) * fs->code_align; + insn_ptr += 2; + break; + case DW_CFA_advance_loc4: + fs->pc += read_4u (insn_ptr) * fs->code_align; + insn_ptr += 4; + break; + + case DW_CFA_offset_extended: + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_uleb128 (insn_ptr, &utmp); + offset = (_Unwind_Sword) utmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; + break; + + case DW_CFA_restore_extended: + insn_ptr = read_uleb128 (insn_ptr, ®); + /* FIXME, this is wrong; the CIE might have said that the + register was saved somewhere. */ + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; + break; + + case DW_CFA_same_value: + insn_ptr = read_uleb128 (insn_ptr, ®); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNSAVED; + break; + + case DW_CFA_undefined: + insn_ptr = read_uleb128 (insn_ptr, ®); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN(reg)].how = REG_UNDEFINED; + break; + + case DW_CFA_nop: + break; + + case DW_CFA_register: + { + _uleb128_t reg2; + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_uleb128 (insn_ptr, ®2); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_SAVED_REG; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.reg = + (_Unwind_Word)reg2; + } + break; + + case DW_CFA_remember_state: + { + struct frame_state_reg_info *new_rs; + if (unused_rs) + { + new_rs = unused_rs; + unused_rs = unused_rs->prev; + } + else + new_rs = alloca (sizeof (struct frame_state_reg_info)); + + *new_rs = fs->regs; + fs->regs.prev = new_rs; + } + break; + + case DW_CFA_restore_state: + { + struct frame_state_reg_info *old_rs = fs->regs.prev; + fs->regs = *old_rs; + old_rs->prev = unused_rs; + unused_rs = old_rs; + } + break; + + case DW_CFA_def_cfa: + insn_ptr = read_uleb128 (insn_ptr, &utmp); + fs->regs.cfa_reg = (_Unwind_Word)utmp; + insn_ptr = read_uleb128 (insn_ptr, &utmp); + fs->regs.cfa_offset = (_Unwind_Word)utmp; + fs->regs.cfa_how = CFA_REG_OFFSET; + break; + + case DW_CFA_def_cfa_register: + insn_ptr = read_uleb128 (insn_ptr, &utmp); + fs->regs.cfa_reg = (_Unwind_Word)utmp; + fs->regs.cfa_how = CFA_REG_OFFSET; + break; + + case DW_CFA_def_cfa_offset: + insn_ptr = read_uleb128 (insn_ptr, &utmp); + fs->regs.cfa_offset = utmp; + /* cfa_how deliberately not set. */ + break; + + case DW_CFA_def_cfa_expression: + fs->regs.cfa_exp = insn_ptr; + fs->regs.cfa_how = CFA_EXP; + insn_ptr = read_uleb128 (insn_ptr, &utmp); + insn_ptr += utmp; + break; + + case DW_CFA_expression: + insn_ptr = read_uleb128 (insn_ptr, ®); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how = REG_SAVED_EXP; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.exp = insn_ptr; + insn_ptr = read_uleb128 (insn_ptr, &utmp); + insn_ptr += utmp; + break; + + /* Dwarf3. */ + case DW_CFA_offset_extended_sf: + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_sleb128 (insn_ptr, &stmp); + offset = stmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; + break; + + case DW_CFA_def_cfa_sf: + insn_ptr = read_uleb128 (insn_ptr, &utmp); + fs->regs.cfa_reg = (_Unwind_Word)utmp; + insn_ptr = read_sleb128 (insn_ptr, &stmp); + fs->regs.cfa_offset = (_Unwind_Sword)stmp; + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_offset *= fs->data_align; + break; + + case DW_CFA_def_cfa_offset_sf: + insn_ptr = read_sleb128 (insn_ptr, &stmp); + fs->regs.cfa_offset = (_Unwind_Sword)stmp; + fs->regs.cfa_offset *= fs->data_align; + /* cfa_how deliberately not set. */ + break; + + case DW_CFA_val_offset: + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_uleb128 (insn_ptr, &utmp); + offset = (_Unwind_Sword) utmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_VAL_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; + break; + + case DW_CFA_val_offset_sf: + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_sleb128 (insn_ptr, &stmp); + offset = stmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_VAL_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = offset; + break; + + case DW_CFA_val_expression: + insn_ptr = read_uleb128 (insn_ptr, ®); + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_VAL_EXP; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.exp = insn_ptr; + insn_ptr = read_uleb128 (insn_ptr, &utmp); + insn_ptr += utmp; + break; + + case DW_CFA_GNU_window_save: + /* ??? Hardcoded for SPARC register window configuration. */ + for (reg = 16; reg < 32; ++reg) + { + fs->regs.reg[reg].how = REG_SAVED_OFFSET; + fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *); + } + break; + + case DW_CFA_GNU_args_size: + insn_ptr = read_uleb128 (insn_ptr, &utmp); + context->args_size = (_Unwind_Word)utmp; + break; + + case DW_CFA_GNU_negative_offset_extended: + /* Obsoleted by DW_CFA_offset_extended_sf, but used by + older PowerPC code. */ + insn_ptr = read_uleb128 (insn_ptr, ®); + insn_ptr = read_uleb128 (insn_ptr, &utmp); + offset = (_Unwind_Word) utmp * fs->data_align; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].how + = REG_SAVED_OFFSET; + fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (reg)].loc.offset = -offset; + break; + + default: + gcc_unreachable (); + } + } +} + +/* Given the _Unwind_Context CONTEXT for a stack frame, look up the FDE for + its caller and decode it into FS. This function also sets the + args_size and lsda members of CONTEXT, as they are really information + about the caller's frame. */ + +static _Unwind_Reason_Code +uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + const struct dwarf_fde *fde; + const struct dwarf_cie *cie; + const unsigned char *aug, *insn, *end; + + memset (fs, 0, sizeof (*fs)); + context->args_size = 0; + context->lsda = 0; + + if (context->ra == 0) + return _URC_END_OF_STACK; + + fde = _Unwind_Find_FDE (context->ra + _Unwind_IsSignalFrame (context) - 1, + &context->bases); + if (fde == NULL) + { +#ifdef MD_FALLBACK_FRAME_STATE_FOR + /* Couldn't find frame unwind info for this function. Try a + target-specific fallback mechanism. This will necessarily + not provide a personality routine or LSDA. */ + return MD_FALLBACK_FRAME_STATE_FOR (context, fs); +#else + return _URC_END_OF_STACK; +#endif + } + + fs->pc = context->bases.func; + + cie = get_cie (fde); + insn = extract_cie_info (cie, context, fs); + if (insn == NULL) + /* CIE contained unknown augmentation. */ + return _URC_FATAL_PHASE1_ERROR; + + /* First decode all the insns in the CIE. */ + end = (const unsigned char *) next_fde ((const struct dwarf_fde *) cie); + execute_cfa_program (insn, end, context, fs); + + /* Locate augmentation for the fde. */ + aug = (const unsigned char *) fde + sizeof (*fde); + aug += 2 * size_of_encoded_value (fs->fde_encoding); + insn = NULL; + if (fs->saw_z) + { + _uleb128_t i; + aug = read_uleb128 (aug, &i); + insn = aug + i; + } + if (fs->lsda_encoding != DW_EH_PE_omit) + { + _Unwind_Ptr lsda; + + aug = read_encoded_value (context, fs->lsda_encoding, aug, &lsda); + context->lsda = (void *) lsda; + } + + /* Then the insns in the FDE up to our target PC. */ + if (insn == NULL) + insn = aug; + end = (const unsigned char *) next_fde (fde); + execute_cfa_program (insn, end, context, fs); + + return _URC_NO_REASON; +} + +typedef struct frame_state +{ + void *cfa; + void *eh_ptr; + long cfa_offset; + long args_size; + long reg_or_offset[PRE_GCC3_DWARF_FRAME_REGISTERS+1]; + unsigned short cfa_reg; + unsigned short retaddr_column; + char saved[PRE_GCC3_DWARF_FRAME_REGISTERS+1]; +} frame_state; + +struct frame_state * __frame_state_for (void *, struct frame_state *); + +/* Called from pre-G++ 3.0 __throw to find the registers to restore for + a given PC_TARGET. The caller should allocate a local variable of + `struct frame_state' and pass its address to STATE_IN. */ + +struct frame_state * +__frame_state_for (void *pc_target, struct frame_state *state_in) +{ + struct _Unwind_Context context; + _Unwind_FrameState fs; + int reg; + + memset (&context, 0, sizeof (struct _Unwind_Context)); + context.flags = EXTENDED_CONTEXT_BIT; + context.ra = pc_target + 1; + + if (uw_frame_state_for (&context, &fs) != _URC_NO_REASON) + return 0; + + /* We have no way to pass a location expression for the CFA to our + caller. It wouldn't understand it anyway. */ + if (fs.regs.cfa_how == CFA_EXP) + return 0; + + for (reg = 0; reg < PRE_GCC3_DWARF_FRAME_REGISTERS + 1; reg++) + { + state_in->saved[reg] = fs.regs.reg[reg].how; + switch (state_in->saved[reg]) + { + case REG_SAVED_REG: + state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.reg; + break; + case REG_SAVED_OFFSET: + state_in->reg_or_offset[reg] = fs.regs.reg[reg].loc.offset; + break; + default: + state_in->reg_or_offset[reg] = 0; + break; + } + } + + state_in->cfa_offset = fs.regs.cfa_offset; + state_in->cfa_reg = fs.regs.cfa_reg; + state_in->retaddr_column = fs.retaddr_column; + state_in->args_size = context.args_size; + state_in->eh_ptr = fs.eh_ptr; + + return state_in; +} + +typedef union { _Unwind_Ptr ptr; _Unwind_Word word; } _Unwind_SpTmp; + +static inline void +_Unwind_SetSpColumn (struct _Unwind_Context *context, void *cfa, + _Unwind_SpTmp *tmp_sp) +{ + int size = dwarf_reg_size_table[__builtin_dwarf_sp_column ()]; + + if (size == sizeof(_Unwind_Ptr)) + tmp_sp->ptr = (_Unwind_Ptr) cfa; + else + { + gcc_assert (size == sizeof(_Unwind_Word)); + tmp_sp->word = (_Unwind_Ptr) cfa; + } + _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), tmp_sp); +} + +static void +uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + struct _Unwind_Context orig_context = *context; + void *cfa; + long i; + +#ifdef EH_RETURN_STACKADJ_RTX + /* Special handling here: Many machines do not use a frame pointer, + and track the CFA only through offsets from the stack pointer from + one frame to the next. In this case, the stack pointer is never + stored, so it has no saved address in the context. What we do + have is the CFA from the previous stack frame. + + In very special situations (such as unwind info for signal return), + there may be location expressions that use the stack pointer as well. + + Do this conditionally for one frame. This allows the unwind info + for one frame to save a copy of the stack pointer from the previous + frame, and be able to use much easier CFA mechanisms to do it. + Always zap the saved stack pointer value for the next frame; carrying + the value over from one frame to another doesn't make sense. */ + + _Unwind_SpTmp tmp_sp; + + if (!_Unwind_GetGRPtr (&orig_context, __builtin_dwarf_sp_column ())) + _Unwind_SetSpColumn (&orig_context, context->cfa, &tmp_sp); + _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), NULL); +#endif + + /* Compute this frame's CFA. */ + switch (fs->regs.cfa_how) + { + case CFA_REG_OFFSET: + cfa = _Unwind_GetPtr (&orig_context, fs->regs.cfa_reg); + cfa += fs->regs.cfa_offset; + break; + + case CFA_EXP: + { + const unsigned char *exp = fs->regs.cfa_exp; + _uleb128_t len; + + exp = read_uleb128 (exp, &len); + cfa = (void *) (_Unwind_Ptr) + execute_stack_op (exp, exp + len, &orig_context, 0); + break; + } + + default: + gcc_unreachable (); + } + context->cfa = cfa; + + /* Compute the addresses of all registers saved in this frame. */ + for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i) + switch (fs->regs.reg[i].how) + { + case REG_UNSAVED: + case REG_UNDEFINED: + break; + + case REG_SAVED_OFFSET: + _Unwind_SetGRPtr (context, i, + (void *) (cfa + fs->regs.reg[i].loc.offset)); + break; + + case REG_SAVED_REG: + if (_Unwind_GRByValue (&orig_context, fs->regs.reg[i].loc.reg)) + _Unwind_SetGRValue (context, i, + _Unwind_GetGR (&orig_context, + fs->regs.reg[i].loc.reg)); + else + _Unwind_SetGRPtr (context, i, + _Unwind_GetGRPtr (&orig_context, + fs->regs.reg[i].loc.reg)); + break; + + case REG_SAVED_EXP: + { + const unsigned char *exp = fs->regs.reg[i].loc.exp; + _uleb128_t len; + _Unwind_Ptr val; + + exp = read_uleb128 (exp, &len); + val = execute_stack_op (exp, exp + len, &orig_context, + (_Unwind_Ptr) cfa); + _Unwind_SetGRPtr (context, i, (void *) val); + } + break; + + case REG_SAVED_VAL_OFFSET: + _Unwind_SetGRValue (context, i, + (_Unwind_Internal_Ptr) + (cfa + fs->regs.reg[i].loc.offset)); + break; + + case REG_SAVED_VAL_EXP: + { + const unsigned char *exp = fs->regs.reg[i].loc.exp; + _uleb128_t len; + _Unwind_Ptr val; + + exp = read_uleb128 (exp, &len); + val = execute_stack_op (exp, exp + len, &orig_context, + (_Unwind_Ptr) cfa); + _Unwind_SetGRValue (context, i, val); + } + break; + } + + _Unwind_SetSignalFrame (context, fs->signal_frame); + +#ifdef MD_FROB_UPDATE_CONTEXT + MD_FROB_UPDATE_CONTEXT (context, fs); +#endif +} + +/* CONTEXT describes the unwind state for a frame, and FS describes the FDE + of its caller. Update CONTEXT to refer to the caller as well. Note + that the args_size and lsda members are not updated here, but later in + uw_frame_state_for. */ + +static void +uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + uw_update_context_1 (context, fs); + + /* In general this unwinder doesn't make any distinction between + undefined and same_value rule. Call-saved registers are assumed + to have same_value rule by default and explicit undefined + rule is handled like same_value. The only exception is + DW_CFA_undefined on retaddr_column which is supposed to + mark outermost frame in DWARF 3. */ + if (fs->regs.reg[DWARF_REG_TO_UNWIND_COLUMN (fs->retaddr_column)].how + == REG_UNDEFINED) + /* uw_frame_state_for uses context->ra == 0 check to find outermost + stack frame. */ + context->ra = 0; + else + /* Compute the return address now, since the return address column + can change from frame to frame. */ + context->ra = __builtin_extract_return_addr + (_Unwind_GetPtr (context, fs->retaddr_column)); +} + +static void +uw_advance_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + uw_update_context (context, fs); +} + +/* Fill in CONTEXT for top-of-stack. The only valid registers at this + level will be the return address and the CFA. */ + +#define uw_init_context(CONTEXT) \ + do \ + { \ + /* Do any necessary initialization to access arbitrary stack frames. \ + On the SPARC, this means flushing the register windows. */ \ + __builtin_unwind_init (); \ + uw_init_context_1 (CONTEXT, __builtin_dwarf_cfa (), \ + __builtin_return_address (0)); \ + } \ + while (0) + +static inline void +init_dwarf_reg_size_table (void) +{ + __builtin_init_dwarf_reg_size_table (dwarf_reg_size_table); +} + +static void __attribute__((noinline)) +uw_init_context_1 (struct _Unwind_Context *context, + void *outer_cfa, void *outer_ra) +{ + void *ra = __builtin_extract_return_addr (__builtin_return_address (0)); + _Unwind_FrameState fs; + _Unwind_SpTmp sp_slot; + _Unwind_Reason_Code code; + + memset (context, 0, sizeof (struct _Unwind_Context)); + context->ra = ra; + context->flags = EXTENDED_CONTEXT_BIT; + + code = uw_frame_state_for (context, &fs); + gcc_assert (code == _URC_NO_REASON); + +#if __GTHREADS + { + static __gthread_once_t once_regsizes = __GTHREAD_ONCE_INIT; + if (__gthread_once (&once_regsizes, init_dwarf_reg_size_table) != 0 + && dwarf_reg_size_table[0] == 0) + init_dwarf_reg_size_table (); + } +#else + if (dwarf_reg_size_table[0] == 0) + init_dwarf_reg_size_table (); +#endif + + /* Force the frame state to use the known cfa value. */ + _Unwind_SetSpColumn (context, outer_cfa, &sp_slot); + fs.regs.cfa_how = CFA_REG_OFFSET; + fs.regs.cfa_reg = __builtin_dwarf_sp_column (); + fs.regs.cfa_offset = 0; + + uw_update_context_1 (context, &fs); + + /* If the return address column was saved in a register in the + initialization context, then we can't see it in the given + call frame data. So have the initialization context tell us. */ + context->ra = __builtin_extract_return_addr (outer_ra); +} + +static void _Unwind_DebugHook (void *, void *) + __attribute__ ((__noinline__, __used__, __noclone__)); + +/* This function is called during unwinding. It is intended as a hook + for a debugger to intercept exceptions. CFA is the CFA of the + target frame. HANDLER is the PC to which control will be + transferred. */ +static void +_Unwind_DebugHook (void *cfa __attribute__ ((__unused__)), + void *handler __attribute__ ((__unused__))) +{ + asm (""); +} + +/* Install TARGET into CURRENT so that we can return to it. This is a + macro because __builtin_eh_return must be invoked in the context of + our caller. */ + +#define uw_install_context(CURRENT, TARGET) \ + do \ + { \ + long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ + void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ + _Unwind_DebugHook ((TARGET)->cfa, handler); \ + __builtin_eh_return (offset, handler); \ + } \ + while (0) + +static long +uw_install_context_1 (struct _Unwind_Context *current, + struct _Unwind_Context *target) +{ + long i; + _Unwind_SpTmp sp_slot; + + /* If the target frame does not have a saved stack pointer, + then set up the target's CFA. */ + if (!_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ())) + _Unwind_SetSpColumn (target, target->cfa, &sp_slot); + + for (i = 0; i < DWARF_FRAME_REGISTERS; ++i) + { + void *c = current->reg[i]; + void *t = target->reg[i]; + + gcc_assert (current->by_value[i] == 0); + if (target->by_value[i] && c) + { + _Unwind_Word w; + _Unwind_Ptr p; + if (dwarf_reg_size_table[i] == sizeof (_Unwind_Word)) + { + w = (_Unwind_Internal_Ptr) t; + memcpy (c, &w, sizeof (_Unwind_Word)); + } + else + { + gcc_assert (dwarf_reg_size_table[i] == sizeof (_Unwind_Ptr)); + p = (_Unwind_Internal_Ptr) t; + memcpy (c, &p, sizeof (_Unwind_Ptr)); + } + } + else if (t && c && t != c) + memcpy (c, t, dwarf_reg_size_table[i]); + } + + /* If the current frame doesn't have a saved stack pointer, then we + need to rely on EH_RETURN_STACKADJ_RTX to get our target stack + pointer value reloaded. */ + if (!_Unwind_GetGRPtr (current, __builtin_dwarf_sp_column ())) + { + void *target_cfa; + + target_cfa = _Unwind_GetPtr (target, __builtin_dwarf_sp_column ()); + + /* We adjust SP by the difference between CURRENT and TARGET's CFA. */ + if (STACK_GROWS_DOWNWARD) + return target_cfa - current->cfa + target->args_size; + else + return current->cfa - target_cfa - target->args_size; + } + return 0; +} + +static inline _Unwind_Ptr +uw_identify_context (struct _Unwind_Context *context) +{ + /* The CFA is not sufficient to disambiguate the context of a function + interrupted by a signal before establishing its frame and the context + of the signal itself. */ + if (STACK_GROWS_DOWNWARD) + return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context); + else + return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context); +} + + +#include "unwind.inc" + +#if defined (USE_GAS_SYMVER) && defined (SHARED) && defined (USE_LIBUNWIND_EXCEPTIONS) +alias (_Unwind_Backtrace); +alias (_Unwind_DeleteException); +alias (_Unwind_FindEnclosingFunction); +alias (_Unwind_ForcedUnwind); +alias (_Unwind_GetDataRelBase); +alias (_Unwind_GetTextRelBase); +alias (_Unwind_GetCFA); +alias (_Unwind_GetGR); +alias (_Unwind_GetIP); +alias (_Unwind_GetLanguageSpecificData); +alias (_Unwind_GetRegionStart); +alias (_Unwind_RaiseException); +alias (_Unwind_Resume); +alias (_Unwind_Resume_or_Rethrow); +alias (_Unwind_SetGR); +alias (_Unwind_SetIP); +#endif + +#endif /* !USING_SJLJ_EXCEPTIONS */ diff --git a/contrib/sdk/sources/gcc_eh/unwind-dw2.h b/contrib/sdk/sources/gcc_eh/unwind-dw2.h new file mode 100644 index 0000000000..2c558b4962 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-dw2.h @@ -0,0 +1,87 @@ +/* DWARF2 frame unwind data structure. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2009 + Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + 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. + + 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 + . */ + +/* A target can override (perhaps for backward compatibility) how + many dwarf2 columns are unwound. */ +#ifndef DWARF_FRAME_REGISTERS +#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER +#endif + +/* The result of interpreting the frame unwind info for a frame. + This is all symbolic at this point, as none of the values can + be resolved until the target pc is located. */ +typedef struct +{ + /* Each register save state can be described in terms of a CFA slot, + another register, or a location expression. */ + struct frame_state_reg_info + { + struct { + union { + _Unwind_Word reg; + _Unwind_Sword offset; + const unsigned char *exp; + } loc; + enum { + REG_UNSAVED, + REG_SAVED_OFFSET, + REG_SAVED_REG, + REG_SAVED_EXP, + REG_SAVED_VAL_OFFSET, + REG_SAVED_VAL_EXP, + REG_UNDEFINED + } how; + } reg[DWARF_FRAME_REGISTERS+1]; + + /* Used to implement DW_CFA_remember_state. */ + struct frame_state_reg_info *prev; + + /* The CFA can be described in terms of a reg+offset or a + location expression. */ + _Unwind_Sword cfa_offset; + _Unwind_Word cfa_reg; + const unsigned char *cfa_exp; + enum { + CFA_UNSET, + CFA_REG_OFFSET, + CFA_EXP + } cfa_how; + } regs; + + /* The PC described by the current frame state. */ + void *pc; + + /* The information we care about from the CIE/FDE. */ + _Unwind_Personality_Fn personality; + _Unwind_Sword data_align; + _Unwind_Word code_align; + _Unwind_Word retaddr_column; + unsigned char fde_encoding; + unsigned char lsda_encoding; + unsigned char saw_z; + unsigned char signal_frame; + void *eh_ptr; +} _Unwind_FrameState; + diff --git a/contrib/sdk/sources/gcc_eh/unwind-pe.h b/contrib/sdk/sources/gcc_eh/unwind-pe.h new file mode 100644 index 0000000000..121f877672 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind-pe.h @@ -0,0 +1,289 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + 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. + + 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 + . */ + +/* @@@ Really this should be out of line, but this also causes link + compatibility problems with the base ABI. This is slightly better + than duplicating code, however. */ + +#ifndef GCC_UNWIND_PE_H +#define GCC_UNWIND_PE_H + +/* If using C++, references to abort have to be qualified with std::. */ +#if __cplusplus +#define __gxx_abort std::abort +#else +#define __gxx_abort abort +#endif + +/* Pointer encodings, from dwarf2.h. */ +#define DW_EH_PE_absptr 0x00 +#define DW_EH_PE_omit 0xff + +#define DW_EH_PE_uleb128 0x01 +#define DW_EH_PE_udata2 0x02 +#define DW_EH_PE_udata4 0x03 +#define DW_EH_PE_udata8 0x04 +#define DW_EH_PE_sleb128 0x09 +#define DW_EH_PE_sdata2 0x0A +#define DW_EH_PE_sdata4 0x0B +#define DW_EH_PE_sdata8 0x0C +#define DW_EH_PE_signed 0x08 + +#define DW_EH_PE_pcrel 0x10 +#define DW_EH_PE_textrel 0x20 +#define DW_EH_PE_datarel 0x30 +#define DW_EH_PE_funcrel 0x40 +#define DW_EH_PE_aligned 0x50 + +#define DW_EH_PE_indirect 0x80 + + +#ifndef NO_SIZE_OF_ENCODED_VALUE + +/* Given an encoding, return the number of bytes the format occupies. + This is only defined for fixed-size encodings, and so does not + include leb128. */ + +static unsigned int +size_of_encoded_value (unsigned char encoding) __attribute__ ((unused)); + +static unsigned int +size_of_encoded_value (unsigned char encoding) +{ + if (encoding == DW_EH_PE_omit) + return 0; + + switch (encoding & 0x07) + { + case DW_EH_PE_absptr: + return sizeof (void *); + case DW_EH_PE_udata2: + return 2; + case DW_EH_PE_udata4: + return 4; + case DW_EH_PE_udata8: + return 8; + } + __gxx_abort (); +} + +#endif + +#ifndef NO_BASE_OF_ENCODED_VALUE + +/* Given an encoding and an _Unwind_Context, return the base to which + the encoding is relative. This base may then be passed to + read_encoded_value_with_base for use when the _Unwind_Context is + not available. */ + +static _Unwind_Ptr +base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context) +{ + if (encoding == DW_EH_PE_omit) + return 0; + + switch (encoding & 0x70) + { + case DW_EH_PE_absptr: + case DW_EH_PE_pcrel: + case DW_EH_PE_aligned: + return 0; + + case DW_EH_PE_textrel: + return _Unwind_GetTextRelBase (context); + case DW_EH_PE_datarel: + return _Unwind_GetDataRelBase (context); + case DW_EH_PE_funcrel: + return _Unwind_GetRegionStart (context); + } + __gxx_abort (); +} + +#endif + +/* Read an unsigned leb128 value from P, store the value in VAL, return + P incremented past the value. We assume that a word is large enough to + hold any value so encoded; if it is smaller than a pointer on some target, + pointers should not be leb128 encoded on that target. */ + +static const unsigned char * +read_uleb128 (const unsigned char *p, _uleb128_t *val) +{ + unsigned int shift = 0; + unsigned char byte; + _uleb128_t result; + + result = 0; + do + { + byte = *p++; + result |= ((_uleb128_t)byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + *val = result; + return p; +} + +/* Similar, but read a signed leb128 value. */ + +static const unsigned char * +read_sleb128 (const unsigned char *p, _sleb128_t *val) +{ + unsigned int shift = 0; + unsigned char byte; + _uleb128_t result; + + result = 0; + do + { + byte = *p++; + result |= ((_uleb128_t)byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + /* Sign-extend a negative value. */ + if (shift < 8 * sizeof(result) && (byte & 0x40) != 0) + result |= -(((_uleb128_t)1L) << shift); + + *val = (_sleb128_t) result; + return p; +} + +/* Load an encoded value from memory at P. The value is returned in VAL; + The function returns P incremented past the value. BASE is as given + by base_of_encoded_value for this encoding in the appropriate context. */ + +static const unsigned char * +read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base, + const unsigned char *p, _Unwind_Ptr *val) +{ + union unaligned + { + void *ptr; + unsigned u2 __attribute__ ((mode (HI))); + unsigned u4 __attribute__ ((mode (SI))); + unsigned u8 __attribute__ ((mode (DI))); + signed s2 __attribute__ ((mode (HI))); + signed s4 __attribute__ ((mode (SI))); + signed s8 __attribute__ ((mode (DI))); + } __attribute__((__packed__)); + + const union unaligned *u = (const union unaligned *) p; + _Unwind_Internal_Ptr result; + + if (encoding == DW_EH_PE_aligned) + { + _Unwind_Internal_Ptr a = (_Unwind_Internal_Ptr) p; + a = (a + sizeof (void *) - 1) & - sizeof(void *); + result = *(_Unwind_Internal_Ptr *) a; + p = (const unsigned char *) (_Unwind_Internal_Ptr) (a + sizeof (void *)); + } + else + { + switch (encoding & 0x0f) + { + case DW_EH_PE_absptr: + result = (_Unwind_Internal_Ptr) u->ptr; + p += sizeof (void *); + break; + + case DW_EH_PE_uleb128: + { + _uleb128_t tmp; + p = read_uleb128 (p, &tmp); + result = (_Unwind_Internal_Ptr) tmp; + } + break; + + case DW_EH_PE_sleb128: + { + _sleb128_t tmp; + p = read_sleb128 (p, &tmp); + result = (_Unwind_Internal_Ptr) tmp; + } + break; + + case DW_EH_PE_udata2: + result = u->u2; + p += 2; + break; + case DW_EH_PE_udata4: + result = u->u4; + p += 4; + break; + case DW_EH_PE_udata8: + result = u->u8; + p += 8; + break; + + case DW_EH_PE_sdata2: + result = u->s2; + p += 2; + break; + case DW_EH_PE_sdata4: + result = u->s4; + p += 4; + break; + case DW_EH_PE_sdata8: + result = u->s8; + p += 8; + break; + + default: + __gxx_abort (); + } + + if (result != 0) + { + result += ((encoding & 0x70) == DW_EH_PE_pcrel + ? (_Unwind_Internal_Ptr) u : base); + if (encoding & DW_EH_PE_indirect) + result = *(_Unwind_Internal_Ptr *) result; + } + } + + *val = result; + return p; +} + +#ifndef NO_BASE_OF_ENCODED_VALUE + +/* Like read_encoded_value_with_base, but get the base from the context + rather than providing it directly. */ + +static inline const unsigned char * +read_encoded_value (struct _Unwind_Context *context, unsigned char encoding, + const unsigned char *p, _Unwind_Ptr *val) +{ + return read_encoded_value_with_base (encoding, + base_of_encoded_value (encoding, context), + p, val); +} + +#endif + +#endif /* unwind-pe.h */ diff --git a/contrib/sdk/sources/gcc_eh/unwind.inc b/contrib/sdk/sources/gcc_eh/unwind.inc new file mode 100644 index 0000000000..5e2ec29c79 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/unwind.inc @@ -0,0 +1,307 @@ +/* Exception handling and frame unwind runtime interface routines. -*- C -*- + Copyright (C) 2001, 2003, 2008, 2009 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + 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. + + 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 + . */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". + This file is included from unwind-dw2.c, unwind-sjlj.c or + unwind-ia64.c. */ + +/* Subroutine of _Unwind_RaiseException also invoked from _Unwind_Resume. + + Unwind the stack calling the personality routine to find both the + exception handler and intermediary cleanup code. We'll only locate + the first such frame here. Cleanup code will call back into + _Unwind_Resume and we'll continue Phase 2 there. */ + +static _Unwind_Reason_Code +_Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc, + struct _Unwind_Context *context) +{ + _Unwind_Reason_Code code; + + while (1) + { + _Unwind_FrameState fs; + int match_handler; + + code = uw_frame_state_for (context, &fs); + + /* Identify when we've reached the designated handler context. */ + match_handler = (uw_identify_context (context) == exc->private_2 + ? _UA_HANDLER_FRAME : 0); + + if (code != _URC_NO_REASON) + /* Some error encountered. Usually the unwinder doesn't + diagnose these and merely crashes. */ + return _URC_FATAL_PHASE2_ERROR; + + /* Unwind successful. Run the personality routine, if any. */ + if (fs.personality) + { + code = (*fs.personality) (1, _UA_CLEANUP_PHASE | match_handler, + exc->exception_class, exc, context); + if (code == _URC_INSTALL_CONTEXT) + break; + if (code != _URC_CONTINUE_UNWIND) + return _URC_FATAL_PHASE2_ERROR; + } + + /* Don't let us unwind past the handler context. */ + gcc_assert (!match_handler); + + uw_update_context (context, &fs); + } + + return code; +} + +/* Raise an exception, passing along the given exception object. */ + +_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_RaiseException(struct _Unwind_Exception *exc) +{ + struct _Unwind_Context this_context, cur_context; + _Unwind_Reason_Code code; + + /* Set up this_context to describe the current stack frame. */ + uw_init_context (&this_context); + cur_context = this_context; + + /* Phase 1: Search. Unwind the stack, calling the personality routine + with the _UA_SEARCH_PHASE flag set. Do not modify the stack yet. */ + while (1) + { + _Unwind_FrameState fs; + + /* Set up fs to describe the FDE for the caller of cur_context. The + first time through the loop, that means __cxa_throw. */ + code = uw_frame_state_for (&cur_context, &fs); + + if (code == _URC_END_OF_STACK) + /* Hit end of stack with no handler found. */ + return _URC_END_OF_STACK; + + if (code != _URC_NO_REASON) + /* Some error encountered. Usually the unwinder doesn't + diagnose these and merely crashes. */ + return _URC_FATAL_PHASE1_ERROR; + + /* Unwind successful. Run the personality routine, if any. */ + if (fs.personality) + { + code = (*fs.personality) (1, _UA_SEARCH_PHASE, exc->exception_class, + exc, &cur_context); + if (code == _URC_HANDLER_FOUND) + break; + else if (code != _URC_CONTINUE_UNWIND) + return _URC_FATAL_PHASE1_ERROR; + } + + /* Update cur_context to describe the same frame as fs. */ + uw_update_context (&cur_context, &fs); + } + + /* Indicate to _Unwind_Resume and associated subroutines that this + is not a forced unwind. Further, note where we found a handler. */ + exc->private_1 = 0; + exc->private_2 = uw_identify_context (&cur_context); + + cur_context = this_context; + code = _Unwind_RaiseException_Phase2 (exc, &cur_context); + if (code != _URC_INSTALL_CONTEXT) + return code; + + uw_install_context (&this_context, &cur_context); +} + + +/* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume. */ + +static _Unwind_Reason_Code +_Unwind_ForcedUnwind_Phase2 (struct _Unwind_Exception *exc, + struct _Unwind_Context *context) +{ + _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1; + void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2; + _Unwind_Reason_Code code, stop_code; + + while (1) + { + _Unwind_FrameState fs; + int action; + + /* Set up fs to describe the FDE for the caller of cur_context. */ + code = uw_frame_state_for (context, &fs); + if (code != _URC_NO_REASON && code != _URC_END_OF_STACK) + return _URC_FATAL_PHASE2_ERROR; + + /* Unwind successful. */ + action = _UA_FORCE_UNWIND | _UA_CLEANUP_PHASE; + if (code == _URC_END_OF_STACK) + action |= _UA_END_OF_STACK; + stop_code = (*stop) (1, action, exc->exception_class, exc, + context, stop_argument); + if (stop_code != _URC_NO_REASON) + return _URC_FATAL_PHASE2_ERROR; + + /* Stop didn't want to do anything. Invoke the personality + handler, if applicable, to run cleanups. */ + if (code == _URC_END_OF_STACK) + break; + + if (fs.personality) + { + code = (*fs.personality) (1, _UA_FORCE_UNWIND | _UA_CLEANUP_PHASE, + exc->exception_class, exc, context); + if (code == _URC_INSTALL_CONTEXT) + break; + if (code != _URC_CONTINUE_UNWIND) + return _URC_FATAL_PHASE2_ERROR; + } + + /* Update cur_context to describe the same frame as fs, and discard + the previous context if necessary. */ + uw_advance_context (context, &fs); + } + + return code; +} + + +/* Raise an exception for forced unwinding. */ + +_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_ForcedUnwind (struct _Unwind_Exception *exc, + _Unwind_Stop_Fn stop, void * stop_argument) +{ + struct _Unwind_Context this_context, cur_context; + _Unwind_Reason_Code code; + + uw_init_context (&this_context); + cur_context = this_context; + + exc->private_1 = (_Unwind_Ptr) stop; + exc->private_2 = (_Unwind_Ptr) stop_argument; + + code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context); + if (code != _URC_INSTALL_CONTEXT) + return code; + + uw_install_context (&this_context, &cur_context); +} + + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ + +void LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Resume (struct _Unwind_Exception *exc) +{ + struct _Unwind_Context this_context, cur_context; + _Unwind_Reason_Code code; + + uw_init_context (&this_context); + cur_context = this_context; + + /* Choose between continuing to process _Unwind_RaiseException + or _Unwind_ForcedUnwind. */ + if (exc->private_1 == 0) + code = _Unwind_RaiseException_Phase2 (exc, &cur_context); + else + code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context); + + gcc_assert (code == _URC_INSTALL_CONTEXT); + + uw_install_context (&this_context, &cur_context); +} + + +/* Resume propagation of an FORCE_UNWIND exception, or to rethrow + a normal exception that was handled. */ + +_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc) +{ + struct _Unwind_Context this_context, cur_context; + _Unwind_Reason_Code code; + + /* Choose between continuing to process _Unwind_RaiseException + or _Unwind_ForcedUnwind. */ + if (exc->private_1 == 0) + return _Unwind_RaiseException (exc); + + uw_init_context (&this_context); + cur_context = this_context; + + code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context); + + gcc_assert (code == _URC_INSTALL_CONTEXT); + + uw_install_context (&this_context, &cur_context); +} + + +/* A convenience function that calls the exception_cleanup field. */ + +void +_Unwind_DeleteException (struct _Unwind_Exception *exc) +{ + if (exc->exception_cleanup) + (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc); +} + + +/* Perform stack backtrace through unwind data. */ + +_Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument) +{ + struct _Unwind_Context context; + _Unwind_Reason_Code code; + + uw_init_context (&context); + + while (1) + { + _Unwind_FrameState fs; + + /* Set up fs to describe the FDE for the caller of context. */ + code = uw_frame_state_for (&context, &fs); + if (code != _URC_NO_REASON && code != _URC_END_OF_STACK) + return _URC_FATAL_PHASE1_ERROR; + + /* Call trace function. */ + if ((*trace) (&context, trace_argument) != _URC_NO_REASON) + return _URC_FATAL_PHASE1_ERROR; + + /* We're done at end of stack. */ + if (code == _URC_END_OF_STACK) + break; + + /* Update context to describe the same frame as fs. */ + uw_update_context (&context, &fs); + } + + return code; +} diff --git a/contrib/sdk/sources/gcc_eh/xm-mingw32.h b/contrib/sdk/sources/gcc_eh/xm-mingw32.h new file mode 100644 index 0000000000..e0dd3f3721 --- /dev/null +++ b/contrib/sdk/sources/gcc_eh/xm-mingw32.h @@ -0,0 +1,35 @@ +/* Configuration for GCC for hosting on Windows32. + using GNU tools and the Windows32 API Library. + Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define HOST_EXECUTABLE_SUFFIX ".exe" + +#undef PATH_SEPARATOR +#define PATH_SEPARATOR ';' + +/* This is the name of the null device on windows. */ +#define HOST_BIT_BUCKET "nul" + +/* The st_ino field of struct stat is always 0. */ +#define HOST_LACKS_INODE_NUMBERS + +/* MSVCRT does not support the "ll" format specifier for printing + "long long" values. Instead, we use "I64". */ +#define HOST_LONG_LONG_FORMAT "I64" diff --git a/contrib/sdk/sources/libsupc++/Makefile b/contrib/sdk/sources/libsupc++/Makefile new file mode 100644 index 0000000000..dccf32f128 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/Makefile @@ -0,0 +1,81 @@ + +LIBRARY= libsup++ + +CC=gcc +CPP=g++ +CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -c -O2 -fomit-frame-pointer + +LD = ld + +AR= ar + +STRIP = $(PREFIX)strip + +INCLUDES= -I. -I../newlib/include + + +LIBS:= -ldll -lc.dll + + +DEFINES= -DIN_GCC -DUSE_EMUTLS=1 + + +SOURCES = gthr_mutex.c \ + bad_alloc.cc \ + class_type_info.cc \ + del_op.cc \ + del_opv.cc \ + eh_alloc.cc \ + eh_aux_runtime.cc \ + eh_call.cc \ + eh_catch.cc \ + eh_exception.cc \ + eh_globals.cc \ + eh_personality.cc \ + eh_term_handler.cc \ + eh_terminate.cc \ + eh_throw.cc \ + eh_type.c \ + eh_unex_handler.cc \ + guard.cc \ + guard_error.cc \ + new_handler.cc \ + new_op.cc \ + new_opnt.cc \ + new_opv.cc \ + pbase_type_info.cc \ + pure.cc \ + si_class_type_info.cc \ + tinfo.cc \ + vmi_class_type_info.cc \ + vterminate.cc + + +OBJECTS = $(patsubst %.cc, %.o, $(patsubst %.c, %.o, $(SOURCES))) + + + +# targets + + +all:$(LIBRARY).a + + +$(LIBRARY).a: $(OBJECTS) Makefile + ar cvrs $(LIBRARY).a $(OBJECTS) + mv -f $(LIBRARY).a ../../lib + + +%.o : %.c Makefile + $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + +%.o : %.cc Makefile + $(CPP) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + + +clean: + -rm -f *.o + + + + diff --git a/contrib/sdk/sources/libsupc++/bad_alloc.cc b/contrib/sdk/sources/libsupc++/bad_alloc.cc new file mode 100644 index 0000000000..b5ed6da490 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/bad_alloc.cc @@ -0,0 +1,34 @@ +// Implementation file for the -*- C++ -*- dynamic memory management header. + +// Copyright (C) 2010, 2011 Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "new" + +std::bad_alloc::~bad_alloc() _GLIBCXX_USE_NOEXCEPT { } + +const char* +std::bad_alloc::what() const _GLIBCXX_USE_NOEXCEPT +{ + return "std::bad_alloc"; +} diff --git a/contrib/sdk/sources/libsupc++/class_type_info.cc b/contrib/sdk/sources/libsupc++/class_type_info.cc new file mode 100644 index 0000000000..9d40d0c6b1 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/class_type_info.cc @@ -0,0 +1,111 @@ +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, +// 2009 Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include "tinfo.h" + +namespace __cxxabiv1 { + +__class_type_info:: +~__class_type_info () +{} + +bool __class_type_info:: +__do_catch (const type_info *thr_type, + void **thr_obj, + unsigned outer) const +{ + if (*this == *thr_type) + return true; + if (outer >= 4) + // Neither `A' nor `A *'. + return false; + return thr_type->__do_upcast (this, thr_obj); +} + +bool __class_type_info:: +__do_upcast (const __class_type_info *dst_type, + void **obj_ptr) const +{ + __upcast_result result (__vmi_class_type_info::__flags_unknown_mask); + + __do_upcast (dst_type, *obj_ptr, result); + if (!contained_public_p (result.part2dst)) + return false; + *obj_ptr = const_cast (result.dst_ptr); + return true; +} + +__class_type_info::__sub_kind __class_type_info:: +__do_find_public_src (ptrdiff_t, + const void *obj_ptr, + const __class_type_info *, + const void *src_ptr) const +{ + if (src_ptr == obj_ptr) + // Must be our type, as the pointers match. + return __contained_public; + return __not_contained; +} + +bool __class_type_info:: +__do_dyncast (ptrdiff_t, + __sub_kind access_path, + const __class_type_info *dst_type, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr, + __dyncast_result &__restrict result) const +{ + if (obj_ptr == src_ptr && *this == *src_type) + { + // The src object we started from. Indicate how we are accessible from + // the most derived object. + result.whole2src = access_path; + return false; + } + if (*this == *dst_type) + { + result.dst_ptr = obj_ptr; + result.whole2dst = access_path; + result.dst2src = __not_contained; + return false; + } + return false; +} + +bool __class_type_info:: +__do_upcast (const __class_type_info *dst, const void *obj, + __upcast_result &__restrict result) const +{ + if (*this == *dst) + { + result.dst_ptr = obj; + result.base_type = nonvirtual_base_type; + result.part2dst = __contained_public; + return true; + } + return false; +} + +} diff --git a/contrib/sdk/sources/libsupc++/del_op.cc b/contrib/sdk/sources/libsupc++/del_op.cc new file mode 100644 index 0000000000..0d69aa3aa3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/del_op.cc @@ -0,0 +1,49 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997, 1998, 1999, 2000, 2004, 2007, 2009, 2010, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include + +#if !_GLIBCXX_HOSTED +// A freestanding C runtime may not provide "free" -- but there is no +// other reasonable way to implement "operator delete". +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + extern "C" void free(void*); +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#else +# include +#endif + +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete(void* ptr) _GLIBCXX_USE_NOEXCEPT +{ + if (ptr) + std::free(ptr); +} diff --git a/contrib/sdk/sources/libsupc++/del_opv.cc b/contrib/sdk/sources/libsupc++/del_opv.cc new file mode 100644 index 0000000000..594f86262d --- /dev/null +++ b/contrib/sdk/sources/libsupc++/del_opv.cc @@ -0,0 +1,34 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997, 1998, 1999, 2000, 2004, 2009, 2010, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include "new" + +_GLIBCXX_WEAK_DEFINITION void +operator delete[] (void *ptr) _GLIBCXX_USE_NOEXCEPT +{ + ::operator delete (ptr); +} diff --git a/contrib/sdk/sources/libsupc++/eh_alloc.cc b/contrib/sdk/sources/libsupc++/eh_alloc.cc new file mode 100644 index 0000000000..74474d82ec --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_alloc.cc @@ -0,0 +1,220 @@ +// -*- C++ -*- Allocate exception objects. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011 +// Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +// This is derived from the C++ ABI for IA-64. Where we diverge +// for cross-architecture compatibility are noted with "@@@". + +#include +#include +#if _GLIBCXX_HOSTED +#include +#endif +#include +#include +#include "unwind-cxx.h" +#include + +#if _GLIBCXX_HOSTED +using std::free; +using std::malloc; +using std::memset; +#else +// In a freestanding environment, these functions may not be available +// -- but for now, we assume that they are. +extern "C" void *malloc (std::size_t); +extern "C" void free(void *); +extern "C" void *memset (void *, int, std::size_t); +#endif + +using namespace __cxxabiv1; + +// ??? How to control these parameters. + +// Guess from the size of basic types how large a buffer is reasonable. +// Note that the basic c++ exception header has 13 pointers and 2 ints, +// so on a system with PSImode pointers we're talking about 56 bytes +// just for overhead. + +#if INT_MAX == 32767 +# define EMERGENCY_OBJ_SIZE 128 +# define EMERGENCY_OBJ_COUNT 16 +#elif LONG_MAX == 2147483647 +# define EMERGENCY_OBJ_SIZE 512 +# define EMERGENCY_OBJ_COUNT 32 +#else +# define EMERGENCY_OBJ_SIZE 1024 +# define EMERGENCY_OBJ_COUNT 64 +#endif + +#ifndef __GTHREADS +# undef EMERGENCY_OBJ_COUNT +# define EMERGENCY_OBJ_COUNT 4 +#endif + +#if INT_MAX == 32767 || EMERGENCY_OBJ_COUNT <= 32 +typedef unsigned int bitmask_type; +#else +typedef unsigned long bitmask_type; +#endif + + +typedef char one_buffer[EMERGENCY_OBJ_SIZE] __attribute__((aligned)); +static one_buffer emergency_buffer[EMERGENCY_OBJ_COUNT]; +static bitmask_type emergency_used; + +static __cxa_dependent_exception dependents_buffer[EMERGENCY_OBJ_COUNT]; +static bitmask_type dependents_used; + +namespace +{ + // A single mutex controlling emergency allocations. + __gnu_cxx::__mutex emergency_mutex; +} + +extern "C" void * +__cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) _GLIBCXX_NOTHROW +{ + void *ret; + + thrown_size += sizeof (__cxa_refcounted_exception); + ret = malloc (thrown_size); + + if (! ret) + { + __gnu_cxx::__scoped_lock sentry(emergency_mutex); + + bitmask_type used = emergency_used; + unsigned int which = 0; + + if (thrown_size > EMERGENCY_OBJ_SIZE) + goto failed; + while (used & 1) + { + used >>= 1; + if (++which >= EMERGENCY_OBJ_COUNT) + goto failed; + } + + emergency_used |= (bitmask_type)1 << which; + ret = &emergency_buffer[which][0]; + + failed:; + + if (!ret) + std::terminate (); + } + + // We have an uncaught exception as soon as we allocate memory. This + // yields uncaught_exception() true during the copy-constructor that + // initializes the exception object. See Issue 475. + __cxa_eh_globals *globals = __cxa_get_globals (); + globals->uncaughtExceptions += 1; + + memset (ret, 0, sizeof (__cxa_refcounted_exception)); + + return (void *)((char *)ret + sizeof (__cxa_refcounted_exception)); +} + + +extern "C" void +__cxxabiv1::__cxa_free_exception(void *vptr) _GLIBCXX_NOTHROW +{ + char *base = (char *) emergency_buffer; + char *ptr = (char *) vptr; + if (ptr >= base + && ptr < base + sizeof (emergency_buffer)) + { + const unsigned int which + = (unsigned) (ptr - base) / EMERGENCY_OBJ_SIZE; + + __gnu_cxx::__scoped_lock sentry(emergency_mutex); + emergency_used &= ~((bitmask_type)1 << which); + } + else + free (ptr - sizeof (__cxa_refcounted_exception)); +} + + +extern "C" __cxa_dependent_exception* +__cxxabiv1::__cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW +{ + __cxa_dependent_exception *ret; + + ret = static_cast<__cxa_dependent_exception*> + (malloc (sizeof (__cxa_dependent_exception))); + + if (!ret) + { + __gnu_cxx::__scoped_lock sentry(emergency_mutex); + + bitmask_type used = dependents_used; + unsigned int which = 0; + + while (used & 1) + { + used >>= 1; + if (++which >= EMERGENCY_OBJ_COUNT) + goto failed; + } + + dependents_used |= (bitmask_type)1 << which; + ret = &dependents_buffer[which]; + + failed:; + + if (!ret) + std::terminate (); + } + + // We have an uncaught exception as soon as we allocate memory. This + // yields uncaught_exception() true during the copy-constructor that + // initializes the exception object. See Issue 475. + __cxa_eh_globals *globals = __cxa_get_globals (); + globals->uncaughtExceptions += 1; + + memset (ret, 0, sizeof (__cxa_dependent_exception)); + + return ret; +} + + +extern "C" void +__cxxabiv1::__cxa_free_dependent_exception + (__cxa_dependent_exception *vptr) _GLIBCXX_NOTHROW +{ + char *base = (char *) dependents_buffer; + char *ptr = (char *) vptr; + if (ptr >= base + && ptr < base + sizeof (dependents_buffer)) + { + const unsigned int which + = (unsigned) (ptr - base) / sizeof (__cxa_dependent_exception); + + __gnu_cxx::__scoped_lock sentry(emergency_mutex); + dependents_used &= ~((bitmask_type)1 << which); + } + else + free (vptr); +} diff --git a/contrib/sdk/sources/libsupc++/eh_aux_runtime.cc b/contrib/sdk/sources/libsupc++/eh_aux_runtime.cc new file mode 100644 index 0000000000..c6abe35464 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_aux_runtime.cc @@ -0,0 +1,51 @@ +// -*- C++ -*- Common throw conditions. +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2009, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "typeinfo" +#include "exception" +#include +#include "unwind-cxx.h" +#include + +extern "C" void +__cxxabiv1::__cxa_bad_cast () +{ +#ifdef __EXCEPTIONS + throw std::bad_cast(); +#else + std::abort(); +#endif +} + +extern "C" void +__cxxabiv1::__cxa_bad_typeid () +{ +#ifdef __EXCEPTIONS + throw std::bad_typeid(); +#else + std::abort(); +#endif +} + diff --git a/contrib/sdk/sources/libsupc++/eh_call.cc b/contrib/sdk/sources/libsupc++/eh_call.cc new file mode 100644 index 0000000000..a6a55a4d9d --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_call.cc @@ -0,0 +1,159 @@ +// -*- C++ -*- Helpers for calling unextected and terminate +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +// 2011 +// Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include +#include "unwind-cxx.h" + +using namespace __cxxabiv1; + +#include "unwind-pe.h" + + +// Helper routine for when the exception handling code needs to call +// terminate. + +extern "C" void +__cxa_call_terminate(_Unwind_Exception* ue_header) throw () +{ + + if (ue_header) + { + // terminate is classed as a catch handler. + __cxa_begin_catch(ue_header); + + // Call the terminate handler that was in effect when we threw this + // exception. */ + if (__is_gxx_exception_class(ue_header->exception_class)) + { + __cxa_exception* xh; + + xh = __get_exception_header_from_ue(ue_header); + __terminate(xh->terminateHandler); + } + } + /* Call the global routine if we don't have anything better. */ + std::terminate(); +} + + +#ifdef __ARM_EABI_UNWINDER__ +// The ARM EABI __cxa_call_unexpected has the same semantics as the generic +// routine, but the exception specification has a different format. +extern "C" void +__cxa_call_unexpected(void* exc_obj_in) +{ + _Unwind_Exception* exc_obj + = reinterpret_cast<_Unwind_Exception*>(exc_obj_in); + + int rtti_count = 0; + _Unwind_Word rtti_stride = 0; + _Unwind_Word* rtti_list = NULL; + _Unwind_Ptr rtti_base = 0; + bool foreign_exception; + std::unexpected_handler unexpectedHandler = NULL; + std::terminate_handler terminateHandler = NULL; + __cxa_exception* xh; + if (__is_gxx_exception_class(exc_obj->exception_class)) + { + // Save data from the EO, which may be clobbered by _cxa_begin_catch. + xh = __get_exception_header_from_ue(exc_obj); + unexpectedHandler = xh->unexpectedHandler; + terminateHandler = xh->terminateHandler; + rtti_count = exc_obj->barrier_cache.bitpattern[1]; + rtti_base = (_Unwind_Ptr) exc_obj->barrier_cache.bitpattern[2]; + rtti_stride = exc_obj->barrier_cache.bitpattern[3]; + rtti_list = (_Unwind_Word*) exc_obj->barrier_cache.bitpattern[4]; + foreign_exception = false; + } + else + foreign_exception = true; + + /* This must be called after extracting data from the EO, but before + calling unexpected(). */ + __cxa_begin_catch(exc_obj); + + // This function is a handler for our exception argument. If we exit + // by throwing a different exception, we'll need the original cleaned up. + struct end_catch_protect + { + end_catch_protect() { } + ~end_catch_protect() { __cxa_end_catch(); } + } end_catch_protect_obj; + + + __try + { + if (foreign_exception) + std::unexpected(); + else + __unexpected(unexpectedHandler); + } + __catch(...) + { + /* See if the new exception matches the rtti list. */ + if (foreign_exception) + std::terminate(); + + // Get the exception thrown from unexpected. + + __cxa_eh_globals* globals = __cxa_get_globals_fast(); + __cxa_exception* new_xh = globals->caughtExceptions; + void* new_ptr = __get_object_from_ambiguous_exception (new_xh); + const std::type_info* catch_type; + int n; + bool bad_exception_allowed = false; + const std::type_info& bad_exc = typeid(std::bad_exception); + + // Check the new exception against the rtti list + for (n = 0; n < rtti_count; n++) + { + _Unwind_Word offset; + + offset = (_Unwind_Word) &rtti_list[n * (rtti_stride >> 2)]; + offset = _Unwind_decode_typeinfo_ptr(rtti_base, offset); + catch_type = (const std::type_info*) (offset); + + if (__cxa_type_match(&new_xh->unwindHeader, catch_type, false, + &new_ptr) != ctm_failed) + __throw_exception_again; + + if (catch_type->__do_catch(&bad_exc, 0, 1)) + bad_exception_allowed = true; + } + + // If the exception spec allows std::bad_exception, throw that. +#ifdef __EXCEPTIONS + if (bad_exception_allowed) + throw std::bad_exception(); +#endif + + // Otherwise, die. + __terminate(terminateHandler); + } +} +#endif // __ARM_EABI_UNWINDER__ diff --git a/contrib/sdk/sources/libsupc++/eh_catch.cc b/contrib/sdk/sources/libsupc++/eh_catch.cc new file mode 100644 index 0000000000..b111497688 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_catch.cc @@ -0,0 +1,138 @@ +// -*- C++ -*- Exception handling routines for catching. +// Copyright (C) 2001, 2003, 2004, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include "unwind-cxx.h" + +using namespace __cxxabiv1; + +extern "C" void * +__cxxabiv1::__cxa_get_exception_ptr(void *exc_obj_in) _GLIBCXX_NOTHROW +{ + _Unwind_Exception *exceptionObject + = reinterpret_cast <_Unwind_Exception *>(exc_obj_in); + + return __gxx_caught_object(exceptionObject); +} + +extern "C" void * +__cxxabiv1::__cxa_begin_catch (void *exc_obj_in) _GLIBCXX_NOTHROW +{ + _Unwind_Exception *exceptionObject + = reinterpret_cast <_Unwind_Exception *>(exc_obj_in); + __cxa_eh_globals *globals = __cxa_get_globals (); + __cxa_exception *prev = globals->caughtExceptions; + __cxa_exception *header = __get_exception_header_from_ue (exceptionObject); + void* objectp; + + // Foreign exceptions can't be stacked here. If the exception stack is + // empty, then fine. Otherwise we really have no choice but to terminate. + // Note that this use of "header" is a lie. It's fine so long as we only + // examine header->unwindHeader though. + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) + { + if (prev != 0) + std::terminate (); + + // Remember for end_catch and rethrow. + globals->caughtExceptions = header; + + // ??? No sensible value to return; we don't know what the + // object is, much less where it is in relation to the header. + return 0; + } + + int count = header->handlerCount; + // Count is less than zero if this exception was rethrown from an + // immediately enclosing region. + if (count < 0) + count = -count + 1; + else + count += 1; + header->handlerCount = count; + globals->uncaughtExceptions -= 1; + + if (header != prev) + { + header->nextException = prev; + globals->caughtExceptions = header; + } + + objectp = __gxx_caught_object(exceptionObject); +#ifdef __ARM_EABI_UNWINDER__ + _Unwind_Complete(exceptionObject); +#endif + return objectp; +} + + +extern "C" void +__cxxabiv1::__cxa_end_catch () +{ + __cxa_eh_globals *globals = __cxa_get_globals_fast (); + __cxa_exception *header = globals->caughtExceptions; + + // A rethrow of a foreign exception will be removed from the + // the exception stack immediately by __cxa_rethrow. + if (!header) + return; + + // A foreign exception couldn't have been stacked (see above), + // so by definition processing must be complete. + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) + { + globals->caughtExceptions = 0; + _Unwind_DeleteException (&header->unwindHeader); + return; + } + + int count = header->handlerCount; + if (count < 0) + { + // This exception was rethrown. Decrement the (inverted) catch + // count and remove it from the chain when it reaches zero. + if (++count == 0) + globals->caughtExceptions = header->nextException; + } + else if (--count == 0) + { + // Handling for this exception is complete. Destroy the object. + globals->caughtExceptions = header->nextException; + _Unwind_DeleteException (&header->unwindHeader); + return; + } + else if (count < 0) + // A bug in the exception handling library or compiler. + std::terminate (); + + header->handlerCount = count; +} + + +bool +std::uncaught_exception() throw() +{ + __cxa_eh_globals *globals = __cxa_get_globals (); + return globals->uncaughtExceptions != 0; +} diff --git a/contrib/sdk/sources/libsupc++/eh_exception.cc b/contrib/sdk/sources/libsupc++/eh_exception.cc new file mode 100644 index 0000000000..cbdca199ba --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_exception.cc @@ -0,0 +1,52 @@ +// -*- C++ -*- std::exception implementation. +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +// 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "typeinfo" +#include "exception" +#include + +std::exception::~exception() _GLIBCXX_USE_NOEXCEPT { } + +std::bad_exception::~bad_exception() _GLIBCXX_USE_NOEXCEPT { } + +abi::__forced_unwind::~__forced_unwind() throw() { } + +abi::__foreign_exception::~__foreign_exception() throw() { } + +const char* +std::exception::what() const _GLIBCXX_USE_NOEXCEPT +{ + // NB: Another elegant option would be returning typeid(*this).name() + // and not overriding what() in bad_exception, bad_alloc, etc. In + // that case, however, mangled names would be returned, PR 14493. + return "std::exception"; +} + +const char* +std::bad_exception::what() const _GLIBCXX_USE_NOEXCEPT +{ + return "std::bad_exception"; +} diff --git a/contrib/sdk/sources/libsupc++/eh_globals.cc b/contrib/sdk/sources/libsupc++/eh_globals.cc new file mode 100644 index 0000000000..e49640d1f7 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_globals.cc @@ -0,0 +1,160 @@ +// -*- C++ -*- Manage the thread-local exception globals. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 +// Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include +#include "cxxabi.h" +#include "unwind-cxx.h" +#include "bits/gthr.h" + +#if _GLIBCXX_HOSTED +using std::free; +using std::malloc; +#else +// In a freestanding environment, these functions may not be +// available -- but for now, we assume that they are. +extern "C" void *malloc (std::size_t); +extern "C" void free(void *); +#endif + +using namespace __cxxabiv1; + +#if _GLIBCXX_HAVE_TLS + +namespace +{ + abi::__cxa_eh_globals* + get_global() _GLIBCXX_NOTHROW + { + static __thread abi::__cxa_eh_globals global; + return &global; + } +} // anonymous namespace + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW +{ return get_global(); } + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW +{ return get_global(); } + + +#else + +// Single-threaded fallback buffer. +static __cxa_eh_globals eh_globals; + +#if __GTHREADS + +static void +eh_globals_dtor(void* ptr) +{ + if (ptr) + { + __cxa_eh_globals* g = reinterpret_cast<__cxa_eh_globals*>(ptr); + __cxa_exception* exn = g->caughtExceptions; + __cxa_exception* next; + while (exn) + { + next = exn->nextException; + _Unwind_DeleteException(&exn->unwindHeader); + exn = next; + } + free(ptr); + } +} + +struct __eh_globals_init +{ + __gthread_key_t _M_key; + bool _M_init; + + __eh_globals_init() : _M_init(false) + { + if (__gthread_active_p()) + _M_init = __gthread_key_create(&_M_key, eh_globals_dtor) == 0; + } + + ~__eh_globals_init() + { + if (_M_init) + __gthread_key_delete(_M_key); + _M_init = false; + } +}; + +static __eh_globals_init init; + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW +{ + __cxa_eh_globals* g; + if (init._M_init) + g = static_cast<__cxa_eh_globals*>(__gthread_getspecific(init._M_key)); + else + g = &eh_globals; + return g; +} + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW +{ + __cxa_eh_globals* g; + if (init._M_init) + { + g = static_cast<__cxa_eh_globals*>(__gthread_getspecific(init._M_key)); + if (!g) + { + void* v = malloc(sizeof(__cxa_eh_globals)); + if (v == 0 || __gthread_setspecific(init._M_key, v) != 0) + std::terminate(); + g = static_cast<__cxa_eh_globals*>(v); + g->caughtExceptions = 0; + g->uncaughtExceptions = 0; +#ifdef __ARM_EABI_UNWINDER__ + g->propagatingExceptions = 0; +#endif + } + } + else + g = &eh_globals; + return g; +} + +#else + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals_fast() _GLIBCXX_NOTHROW +{ return &eh_globals; } + +extern "C" __cxa_eh_globals* +__cxxabiv1::__cxa_get_globals() _GLIBCXX_NOTHROW +{ return &eh_globals; } + +#endif + +#endif diff --git a/contrib/sdk/sources/libsupc++/eh_personality.cc b/contrib/sdk/sources/libsupc++/eh_personality.cc new file mode 100644 index 0000000000..43c6452cc9 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_personality.cc @@ -0,0 +1,781 @@ +// -*- C++ -*- The GNU C++ exception personality routine. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +// 2011 +// Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include +#include +#include "unwind-cxx.h" + + +using namespace __cxxabiv1; + +#include "unwind-pe.h" + + +struct lsda_header_info +{ + _Unwind_Ptr Start; + _Unwind_Ptr LPStart; + _Unwind_Ptr ttype_base; + const unsigned char *TType; + const unsigned char *action_table; + unsigned char ttype_encoding; + unsigned char call_site_encoding; +}; + +static const unsigned char * +parse_lsda_header (_Unwind_Context *context, const unsigned char *p, + lsda_header_info *info) +{ + _uleb128_t tmp; + unsigned char lpstart_encoding; + + info->Start = (context ? _Unwind_GetRegionStart (context) : 0); + + // Find @LPStart, the base to which landing pad offsets are relative. + lpstart_encoding = *p++; + if (lpstart_encoding != DW_EH_PE_omit) + p = read_encoded_value (context, lpstart_encoding, p, &info->LPStart); + else + info->LPStart = info->Start; + + // Find @TType, the base of the handler and exception spec type data. + info->ttype_encoding = *p++; + if (info->ttype_encoding != DW_EH_PE_omit) + { +#if _GLIBCXX_OVERRIDE_TTYPE_ENCODING + /* Older ARM EABI toolchains set this value incorrectly, so use a + hardcoded OS-specific format. */ + info->ttype_encoding = _GLIBCXX_OVERRIDE_TTYPE_ENCODING; +#endif + p = read_uleb128 (p, &tmp); + info->TType = p + tmp; + } + else + info->TType = 0; + + // The encoding and length of the call-site table; the action table + // immediately follows. + info->call_site_encoding = *p++; + p = read_uleb128 (p, &tmp); + info->action_table = p + tmp; + + return p; +} + +// Return an element from a type table. + +static const std::type_info* +get_ttype_entry(lsda_header_info* info, _uleb128_t i) +{ + _Unwind_Ptr ptr; + + i *= size_of_encoded_value (info->ttype_encoding); + read_encoded_value_with_base (info->ttype_encoding, info->ttype_base, + info->TType - i, &ptr); + + return reinterpret_cast(ptr); +} + +#ifdef __ARM_EABI_UNWINDER__ + +// The ABI provides a routine for matching exception object types. +typedef _Unwind_Control_Block _throw_typet; +#define get_adjusted_ptr(catch_type, throw_type, thrown_ptr_p) \ + (__cxa_type_match (throw_type, catch_type, false, thrown_ptr_p) \ + != ctm_failed) + +// Return true if THROW_TYPE matches one if the filter types. + +static bool +check_exception_spec(lsda_header_info* info, _throw_typet* throw_type, + void* thrown_ptr, _sleb128_t filter_value) +{ + const _uleb128_t* e = ((const _uleb128_t*) info->TType) + - filter_value - 1; + + while (1) + { + const std::type_info* catch_type; + _uleb128_t tmp; + + tmp = *e; + + // Zero signals the end of the list. If we've not found + // a match by now, then we've failed the specification. + if (tmp == 0) + return false; + + tmp = _Unwind_decode_typeinfo_ptr(info->ttype_base, (_Unwind_Word) e); + + // Match a ttype entry. + catch_type = reinterpret_cast(tmp); + + // ??? There is currently no way to ask the RTTI code about the + // relationship between two types without reference to a specific + // object. There should be; then we wouldn't need to mess with + // thrown_ptr here. + if (get_adjusted_ptr(catch_type, throw_type, &thrown_ptr)) + return true; + + // Advance to the next entry. + e++; + } +} + + +// Save stage1 handler information in the exception object + +static inline void +save_caught_exception(struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context, + void* thrown_ptr, + int handler_switch_value, + const unsigned char* language_specific_data, + _Unwind_Ptr landing_pad, + const unsigned char* action_record + __attribute__((__unused__))) +{ + ue_header->barrier_cache.sp = _Unwind_GetGR(context, UNWIND_STACK_REG); + ue_header->barrier_cache.bitpattern[0] = (_uw) thrown_ptr; + ue_header->barrier_cache.bitpattern[1] + = (_uw) handler_switch_value; + ue_header->barrier_cache.bitpattern[2] + = (_uw) language_specific_data; + ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad; +} + + +// Restore the catch handler data saved during phase1. + +static inline void +restore_caught_exception(struct _Unwind_Exception* ue_header, + int& handler_switch_value, + const unsigned char*& language_specific_data, + _Unwind_Ptr& landing_pad) +{ + handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1]; + language_specific_data = + (const unsigned char*) ue_header->barrier_cache.bitpattern[2]; + landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3]; +} + +#define CONTINUE_UNWINDING \ + do \ + { \ + if (__gnu_unwind_frame(ue_header, context) != _URC_OK) \ + return _URC_FAILURE; \ + return _URC_CONTINUE_UNWIND; \ + } \ + while (0) + +// Return true if the filter spec is empty, ie throw(). + +static bool +empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value) +{ + const _Unwind_Word* e = ((const _Unwind_Word*) info->TType) + - filter_value - 1; + + return *e == 0; +} + +#else +typedef const std::type_info _throw_typet; + + +// Given the thrown type THROW_TYPE, pointer to a variable containing a +// pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to +// compare against, return whether or not there is a match and if so, +// update *THROWN_PTR_P. + +static bool +get_adjusted_ptr (const std::type_info *catch_type, + const std::type_info *throw_type, + void **thrown_ptr_p) +{ + void *thrown_ptr = *thrown_ptr_p; + + // Pointer types need to adjust the actual pointer, not + // the pointer to pointer that is the exception object. + // This also has the effect of passing pointer types + // "by value" through the __cxa_begin_catch return value. + if (throw_type->__is_pointer_p ()) + thrown_ptr = *(void **) thrown_ptr; + + if (catch_type->__do_catch (throw_type, &thrown_ptr, 1)) + { + *thrown_ptr_p = thrown_ptr; + return true; + } + + return false; +} + +// Return true if THROW_TYPE matches one if the filter types. + +static bool +check_exception_spec(lsda_header_info* info, _throw_typet* throw_type, + void* thrown_ptr, _sleb128_t filter_value) +{ + const unsigned char *e = info->TType - filter_value - 1; + + while (1) + { + const std::type_info *catch_type; + _uleb128_t tmp; + + e = read_uleb128 (e, &tmp); + + // Zero signals the end of the list. If we've not found + // a match by now, then we've failed the specification. + if (tmp == 0) + return false; + + // Match a ttype entry. + catch_type = get_ttype_entry (info, tmp); + + // ??? There is currently no way to ask the RTTI code about the + // relationship between two types without reference to a specific + // object. There should be; then we wouldn't need to mess with + // thrown_ptr here. + if (get_adjusted_ptr (catch_type, throw_type, &thrown_ptr)) + return true; + } +} + + +// Save stage1 handler information in the exception object + +static inline void +save_caught_exception(struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context + __attribute__((__unused__)), + void* thrown_ptr, + int handler_switch_value, + const unsigned char* language_specific_data, + _Unwind_Ptr landing_pad __attribute__((__unused__)), + const unsigned char* action_record) +{ + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + + xh->handlerSwitchValue = handler_switch_value; + xh->actionRecord = action_record; + xh->languageSpecificData = language_specific_data; + xh->adjustedPtr = thrown_ptr; + + // ??? Completely unknown what this field is supposed to be for. + // ??? Need to cache TType encoding base for call_unexpected. + xh->catchTemp = landing_pad; +} + + +// Restore the catch handler information saved during phase1. + +static inline void +restore_caught_exception(struct _Unwind_Exception* ue_header, + int& handler_switch_value, + const unsigned char*& language_specific_data, + _Unwind_Ptr& landing_pad) +{ + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + handler_switch_value = xh->handlerSwitchValue; + language_specific_data = xh->languageSpecificData; + landing_pad = (_Unwind_Ptr) xh->catchTemp; +} + +#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND + +// Return true if the filter spec is empty, ie throw(). + +static bool +empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value) +{ + const unsigned char *e = info->TType - filter_value - 1; + _uleb128_t tmp; + + e = read_uleb128 (e, &tmp); + return tmp == 0; +} + +#endif // !__ARM_EABI_UNWINDER__ + +namespace __cxxabiv1 +{ + +// Using a different personality function name causes link failures +// when trying to mix code using different exception handling models. +#ifdef _GLIBCXX_SJLJ_EXCEPTIONS +#define PERSONALITY_FUNCTION __gxx_personality_sj0 +#define __builtin_eh_return_data_regno(x) x +#else +#define PERSONALITY_FUNCTION __gxx_personality_v0 +#endif + +extern "C" _Unwind_Reason_Code +#ifdef __ARM_EABI_UNWINDER__ +PERSONALITY_FUNCTION (_Unwind_State state, + struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context) +#else +PERSONALITY_FUNCTION (int version, + _Unwind_Action actions, + _Unwind_Exception_Class exception_class, + struct _Unwind_Exception *ue_header, + struct _Unwind_Context *context) +#endif +{ + enum found_handler_type + { + found_nothing, + found_terminate, + found_cleanup, + found_handler + } found_type; + + lsda_header_info info; + const unsigned char *language_specific_data; + const unsigned char *action_record; + const unsigned char *p; + _Unwind_Ptr landing_pad, ip; + int handler_switch_value; + void* thrown_ptr = 0; + bool foreign_exception; + int ip_before_insn = 0; + +#ifdef __ARM_EABI_UNWINDER__ + _Unwind_Action actions; + + switch (state & _US_ACTION_MASK) + { + case _US_VIRTUAL_UNWIND_FRAME: + actions = _UA_SEARCH_PHASE; + break; + + case _US_UNWIND_FRAME_STARTING: + actions = _UA_CLEANUP_PHASE; + if (!(state & _US_FORCE_UNWIND) + && ue_header->barrier_cache.sp == _Unwind_GetGR(context, + UNWIND_STACK_REG)) + actions |= _UA_HANDLER_FRAME; + break; + + case _US_UNWIND_FRAME_RESUME: + CONTINUE_UNWINDING; + break; + + default: + std::abort(); + } + actions |= state & _US_FORCE_UNWIND; + + // We don't know which runtime we're working with, so can't check this. + // However the ABI routines hide this from us, and we don't actually need + // to know. + foreign_exception = false; + + // The dwarf unwinder assumes the context structure holds things like the + // function and LSDA pointers. The ARM implementation caches these in + // the exception header (UCB). To avoid rewriting everything we make a + // virtual scratch register point at the UCB. + ip = (_Unwind_Ptr) ue_header; + _Unwind_SetGR(context, UNWIND_POINTER_REG, ip); +#else + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + + // Interface version check. + if (version != 1) + return _URC_FATAL_PHASE1_ERROR; + foreign_exception = !__is_gxx_exception_class(exception_class); +#endif + + // Shortcut for phase 2 found handler for domestic exception. + if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) + && !foreign_exception) + { + restore_caught_exception(ue_header, handler_switch_value, + language_specific_data, landing_pad); + found_type = (landing_pad == 0 ? found_terminate : found_handler); + goto install_context; + } + + language_specific_data = (const unsigned char *) + _Unwind_GetLanguageSpecificData (context); + + // If no LSDA, then there are no handlers or cleanups. + if (! language_specific_data) + CONTINUE_UNWINDING; + + // Parse the LSDA header. + p = parse_lsda_header (context, language_specific_data, &info); + info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); +#ifdef _GLIBCXX_HAVE_GETIPINFO + ip = _Unwind_GetIPInfo (context, &ip_before_insn); +#else + ip = _Unwind_GetIP (context); +#endif + if (! ip_before_insn) + --ip; + landing_pad = 0; + action_record = 0; + handler_switch_value = 0; + +#ifdef _GLIBCXX_SJLJ_EXCEPTIONS + // The given "IP" is an index into the call-site table, with two + // exceptions -- -1 means no-action, and 0 means terminate. But + // since we're using uleb128 values, we've not got random access + // to the array. + if ((int) ip < 0) + return _URC_CONTINUE_UNWIND; + else if (ip == 0) + { + // Fall through to set found_terminate. + } + else + { + _uleb128_t cs_lp, cs_action; + do + { + p = read_uleb128 (p, &cs_lp); + p = read_uleb128 (p, &cs_action); + } + while (--ip); + + // Can never have null landing pad for sjlj -- that would have + // been indicated by a -1 call site index. + landing_pad = cs_lp + 1; + if (cs_action) + action_record = info.action_table + cs_action - 1; + goto found_something; + } +#else + // Search the call-site table for the action associated with this IP. + while (p < info.action_table) + { + _Unwind_Ptr cs_start, cs_len, cs_lp; + _uleb128_t cs_action; + + // Note that all call-site encodings are "absolute" displacements. + p = read_encoded_value (0, info.call_site_encoding, p, &cs_start); + p = read_encoded_value (0, info.call_site_encoding, p, &cs_len); + p = read_encoded_value (0, info.call_site_encoding, p, &cs_lp); + p = read_uleb128 (p, &cs_action); + + // The table is sorted, so if we've passed the ip, stop. + if (ip < info.Start + cs_start) + p = info.action_table; + else if (ip < info.Start + cs_start + cs_len) + { + if (cs_lp) + landing_pad = info.LPStart + cs_lp; + if (cs_action) + action_record = info.action_table + cs_action - 1; + goto found_something; + } + } +#endif // _GLIBCXX_SJLJ_EXCEPTIONS + + // If ip is not present in the table, call terminate. This is for + // a destructor inside a cleanup, or a library routine the compiler + // was not expecting to throw. + found_type = found_terminate; + goto do_something; + + found_something: + if (landing_pad == 0) + { + // If ip is present, and has a null landing pad, there are + // no cleanups or handlers to be run. + found_type = found_nothing; + } + else if (action_record == 0) + { + // If ip is present, has a non-null landing pad, and a null + // action table offset, then there are only cleanups present. + // Cleanups use a zero switch value, as set above. + found_type = found_cleanup; + } + else + { + // Otherwise we have a catch handler or exception specification. + + _sleb128_t ar_filter, ar_disp; + const std::type_info* catch_type; + _throw_typet* throw_type; + bool saw_cleanup = false; + bool saw_handler = false; + +#ifdef __ARM_EABI_UNWINDER__ + // ??? How does this work - more importantly, how does it interact with + // dependent exceptions? + throw_type = ue_header; + if (actions & _UA_FORCE_UNWIND) + { + __GXX_INIT_FORCED_UNWIND_CLASS(ue_header->exception_class); + } + else if (!foreign_exception) + thrown_ptr = __get_object_from_ue (ue_header); +#else +#ifdef __GXX_RTTI + // During forced unwinding, match a magic exception type. + if (actions & _UA_FORCE_UNWIND) + { + throw_type = &typeid(abi::__forced_unwind); + } + // With a foreign exception class, there's no exception type. + // ??? What to do about GNU Java and GNU Ada exceptions? + else if (foreign_exception) + { + throw_type = &typeid(abi::__foreign_exception); + } + else +#endif + { + thrown_ptr = __get_object_from_ue (ue_header); + throw_type = __get_exception_header_from_obj + (thrown_ptr)->exceptionType; + } +#endif + + while (1) + { + p = action_record; + p = read_sleb128 (p, &ar_filter); + read_sleb128 (p, &ar_disp); + + if (ar_filter == 0) + { + // Zero filter values are cleanups. + saw_cleanup = true; + } + else if (ar_filter > 0) + { + // Positive filter values are handlers. + catch_type = get_ttype_entry (&info, ar_filter); + + // Null catch type is a catch-all handler; we can catch foreign + // exceptions with this. Otherwise we must match types. + if (! catch_type + || (throw_type + && get_adjusted_ptr (catch_type, throw_type, + &thrown_ptr))) + { + saw_handler = true; + break; + } + } + else + { + // Negative filter values are exception specifications. + // ??? How do foreign exceptions fit in? As far as I can + // see we can't match because there's no __cxa_exception + // object to stuff bits in for __cxa_call_unexpected to use. + // Allow them iff the exception spec is non-empty. I.e. + // a throw() specification results in __unexpected. + if ((throw_type + && !(actions & _UA_FORCE_UNWIND) + && !foreign_exception) + ? ! check_exception_spec (&info, throw_type, thrown_ptr, + ar_filter) + : empty_exception_spec (&info, ar_filter)) + { + saw_handler = true; + break; + } + } + + if (ar_disp == 0) + break; + action_record = p + ar_disp; + } + + if (saw_handler) + { + handler_switch_value = ar_filter; + found_type = found_handler; + } + else + found_type = (saw_cleanup ? found_cleanup : found_nothing); + } + + do_something: + if (found_type == found_nothing) + CONTINUE_UNWINDING; + + if (actions & _UA_SEARCH_PHASE) + { + if (found_type == found_cleanup) + CONTINUE_UNWINDING; + + // For domestic exceptions, we cache data from phase 1 for phase 2. + if (!foreign_exception) + { + save_caught_exception(ue_header, context, thrown_ptr, + handler_switch_value, language_specific_data, + landing_pad, action_record); + } + return _URC_HANDLER_FOUND; + } + + install_context: + + // We can't use any of the cxa routines with foreign exceptions, + // because they all expect ue_header to be a struct __cxa_exception. + // So in that case, call terminate or unexpected directly. + if ((actions & _UA_FORCE_UNWIND) + || foreign_exception) + { + if (found_type == found_terminate) + std::terminate (); + else if (handler_switch_value < 0) + { + __try + { std::unexpected (); } + __catch(...) + { std::terminate (); } + } + } + else + { + if (found_type == found_terminate) + __cxa_call_terminate(ue_header); + + // Cache the TType base value for __cxa_call_unexpected, as we won't + // have an _Unwind_Context then. + if (handler_switch_value < 0) + { + parse_lsda_header (context, language_specific_data, &info); + info.ttype_base = base_of_encoded_value (info.ttype_encoding, + context); + +#ifdef __ARM_EABI_UNWINDER__ + const _Unwind_Word* e; + _Unwind_Word n; + + e = ((const _Unwind_Word*) info.TType) - handler_switch_value - 1; + // Count the number of rtti objects. + n = 0; + while (e[n] != 0) + n++; + + // Count. + ue_header->barrier_cache.bitpattern[1] = n; + // Base + ue_header->barrier_cache.bitpattern[2] = info.ttype_base; + // Stride. + ue_header->barrier_cache.bitpattern[3] = 4; + // List head. + ue_header->barrier_cache.bitpattern[4] = (_Unwind_Word) e; +#else + xh->catchTemp = base_of_encoded_value (info.ttype_encoding, context); +#endif + } + } + + /* For targets with pointers smaller than the word size, we must extend the + pointer, and this extension is target dependent. */ + _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), + __builtin_extend_pointer (ue_header)); + _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), + handler_switch_value); + _Unwind_SetIP (context, landing_pad); +#ifdef __ARM_EABI_UNWINDER__ + if (found_type == found_cleanup) + __cxa_begin_cleanup(ue_header); +#endif + return _URC_INSTALL_CONTEXT; +} + +/* The ARM EABI implementation of __cxa_call_unexpected is in a + different file so that the personality routine (PR) can be used + standalone. The generic routine shared datastructures with the PR + so it is most convenient to implement it here. */ +#ifndef __ARM_EABI_UNWINDER__ +extern "C" void +__cxa_call_unexpected (void *exc_obj_in) +{ + _Unwind_Exception *exc_obj + = reinterpret_cast <_Unwind_Exception *>(exc_obj_in); + + __cxa_begin_catch (exc_obj); + + // This function is a handler for our exception argument. If we exit + // by throwing a different exception, we'll need the original cleaned up. + struct end_catch_protect + { + end_catch_protect() { } + ~end_catch_protect() { __cxa_end_catch(); } + } end_catch_protect_obj; + + lsda_header_info info; + __cxa_exception *xh = __get_exception_header_from_ue (exc_obj); + const unsigned char *xh_lsda; + _Unwind_Sword xh_switch_value; + std::terminate_handler xh_terminate_handler; + + // If the unexpectedHandler rethrows the exception (e.g. to categorize it), + // it will clobber data about the current handler. So copy the data out now. + xh_lsda = xh->languageSpecificData; + xh_switch_value = xh->handlerSwitchValue; + xh_terminate_handler = xh->terminateHandler; + info.ttype_base = (_Unwind_Ptr) xh->catchTemp; + + __try + { __unexpected (xh->unexpectedHandler); } + __catch(...) + { + // Get the exception thrown from unexpected. + + __cxa_eh_globals *globals = __cxa_get_globals_fast (); + __cxa_exception *new_xh = globals->caughtExceptions; + void *new_ptr = __get_object_from_ambiguous_exception (new_xh); + + // We don't quite have enough stuff cached; re-parse the LSDA. + parse_lsda_header (0, xh_lsda, &info); + + // If this new exception meets the exception spec, allow it. + if (check_exception_spec (&info, __get_exception_header_from_obj + (new_ptr)->exceptionType, + new_ptr, xh_switch_value)) + __throw_exception_again; + + // If the exception spec allows std::bad_exception, throw that. + // We don't have a thrown object to compare against, but since + // bad_exception doesn't have virtual bases, that's OK; just pass 0. +#if defined(__EXCEPTIONS) && defined(__GXX_RTTI) + const std::type_info &bad_exc = typeid (std::bad_exception); + if (check_exception_spec (&info, &bad_exc, 0, xh_switch_value)) + throw std::bad_exception(); +#endif + + // Otherwise, die. + __terminate (xh_terminate_handler); + } +} +#endif + +} // namespace __cxxabiv1 diff --git a/contrib/sdk/sources/libsupc++/eh_term_handler.cc b/contrib/sdk/sources/libsupc++/eh_term_handler.cc new file mode 100644 index 0000000000..52a074596f --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_term_handler.cc @@ -0,0 +1,46 @@ +// -*- C++ -*- std::terminate handler +// Copyright (C) 2002, 2003, 2009 Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include "unwind-cxx.h" + +/* We default to the talkative, informative handler in a normal hosted + library. This pulls in the demangler, the dyn-string utilities, and + elements of the I/O library. For a low-memory environment, you can return + to the earlier "silent death" handler by including , initializing + to "std::abort", and rebuilding the library. In a freestanding mode, we + default to this latter approach. */ + +#if ! _GLIBCXX_HOSTED +# include +#endif + +/* The current installed user handler. */ +std::terminate_handler __cxxabiv1::__terminate_handler = +#if _GLIBCXX_HOSTED + __gnu_cxx::__verbose_terminate_handler; +#else + std::abort; +#endif + diff --git a/contrib/sdk/sources/libsupc++/eh_terminate.cc b/contrib/sdk/sources/libsupc++/eh_terminate.cc new file mode 100644 index 0000000000..87359d09fd --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_terminate.cc @@ -0,0 +1,80 @@ +// -*- C++ -*- std::terminate, std::unexpected and friends. +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2009, +// 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "typeinfo" +#include "exception" +#include +#include "unwind-cxx.h" +#include + +using namespace __cxxabiv1; + +void +__cxxabiv1::__terminate (std::terminate_handler handler) throw () +{ + __try + { + handler (); + std::abort (); + } + __catch(...) + { std::abort (); } +} + +void +std::terminate () throw() +{ + __terminate (__terminate_handler); +} + +void +__cxxabiv1::__unexpected (std::unexpected_handler handler) +{ + handler(); + std::terminate (); +} + +void +std::unexpected () +{ + __unexpected (__unexpected_handler); +} + +std::terminate_handler +std::set_terminate (std::terminate_handler func) throw() +{ + std::terminate_handler old = __terminate_handler; + __terminate_handler = func; + return old; +} + +std::unexpected_handler +std::set_unexpected (std::unexpected_handler func) throw() +{ + std::unexpected_handler old = __unexpected_handler; + __unexpected_handler = func; + return old; +} diff --git a/contrib/sdk/sources/libsupc++/eh_throw.cc b/contrib/sdk/sources/libsupc++/eh_throw.cc new file mode 100644 index 0000000000..e78f8e7542 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_throw.cc @@ -0,0 +1,117 @@ +// -*- C++ -*- Exception handling routines for throwing. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +// 2011, 2012 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include "unwind-cxx.h" + +using namespace __cxxabiv1; + + +static void +__gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc) +{ + // This cleanup is set only for primaries. + __cxa_refcounted_exception *header + = __get_refcounted_exception_header_from_ue (exc); + + // We only want to be called through _Unwind_DeleteException. + // _Unwind_DeleteException in the HP-UX IA64 libunwind library + // returns _URC_NO_REASON and not _URC_FOREIGN_EXCEPTION_CAUGHT + // like the GCC _Unwind_DeleteException function does. + if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON) + __terminate (header->exc.terminateHandler); + +#if ATOMIC_INT_LOCK_FREE > 1 + if (__atomic_sub_fetch (&header->referenceCount, 1, __ATOMIC_ACQ_REL) == 0) + { +#endif + if (header->exc.exceptionDestructor) + header->exc.exceptionDestructor (header + 1); + + __cxa_free_exception (header + 1); +#if ATOMIC_INT_LOCK_FREE > 1 + } +#endif +} + + +extern "C" void +__cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo, + void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) +{ + // Definitely a primary. + __cxa_refcounted_exception *header + = __get_refcounted_exception_header_from_obj (obj); + header->referenceCount = 1; + header->exc.exceptionType = tinfo; + header->exc.exceptionDestructor = dest; + header->exc.unexpectedHandler = __unexpected_handler; + header->exc.terminateHandler = __terminate_handler; + __GXX_INIT_PRIMARY_EXCEPTION_CLASS(header->exc.unwindHeader.exception_class); + header->exc.unwindHeader.exception_cleanup = __gxx_exception_cleanup; + +#ifdef _GLIBCXX_SJLJ_EXCEPTIONS + _Unwind_SjLj_RaiseException (&header->exc.unwindHeader); +#else + _Unwind_RaiseException (&header->exc.unwindHeader); +#endif + + // Some sort of unwinding error. Note that terminate is a handler. + __cxa_begin_catch (&header->exc.unwindHeader); + std::terminate (); +} + +extern "C" void +__cxxabiv1::__cxa_rethrow () +{ + __cxa_eh_globals *globals = __cxa_get_globals (); + __cxa_exception *header = globals->caughtExceptions; + + globals->uncaughtExceptions += 1; + + // Watch for luser rethrowing with no active exception. + if (header) + { + // Tell __cxa_end_catch this is a rethrow. + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) + globals->caughtExceptions = 0; + else + header->handlerCount = -header->handlerCount; + +#ifdef _GLIBCXX_SJLJ_EXCEPTIONS + _Unwind_SjLj_Resume_or_Rethrow (&header->unwindHeader); +#else +#if defined(_LIBUNWIND_STD_ABI) + _Unwind_RaiseException (&header->unwindHeader); +#else + _Unwind_Resume_or_Rethrow (&header->unwindHeader); +#endif +#endif + + // Some sort of unwinding error. Note that terminate is a handler. + __cxa_begin_catch (&header->unwindHeader); + } + std::terminate (); +} diff --git a/contrib/sdk/sources/libsupc++/eh_type.cc b/contrib/sdk/sources/libsupc++/eh_type.cc new file mode 100644 index 0000000000..245e0eaab9 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_type.cc @@ -0,0 +1,54 @@ +// -*- C++ -*- Exception handling routines for catching. +// Copyright (C) 2001, 2008, 2009, 2011 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + + +#include +#include +#include "unwind-cxx.h" + +namespace __cxxabiv1 +{ + +// Returns the type_info for the currently handled exception [15.3/8], or +// null if there is none. +extern "C" +std::type_info *__cxa_current_exception_type () _GLIBCXX_NOTHROW +{ + __cxa_eh_globals *globals = __cxa_get_globals (); + __cxa_exception *header = globals->caughtExceptions; + if (header) + { + if (__is_dependent_exception (header->unwindHeader.exception_class)) + { + __cxa_dependent_exception *de = + __get_dependent_exception_from_ue (&header->unwindHeader); + header = __get_exception_header_from_obj (de->primaryException); + } + return header->exceptionType; + } + else + return 0; +} + +} // namespace __cxxabiv1 diff --git a/contrib/sdk/sources/libsupc++/eh_unex_handler.cc b/contrib/sdk/sources/libsupc++/eh_unex_handler.cc new file mode 100644 index 0000000000..e4f3906204 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/eh_unex_handler.cc @@ -0,0 +1,29 @@ +// -*- C++ -*- std::unexpected handler +// Copyright (C) 2002, 2009 Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "unwind-cxx.h" + +/* The current installed user handler. */ +std::unexpected_handler __cxxabiv1::__unexpected_handler = std::terminate; + diff --git a/contrib/sdk/sources/libsupc++/exception b/contrib/sdk/sources/libsupc++/exception new file mode 100644 index 0000000000..94a0bcbc66 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/exception @@ -0,0 +1,158 @@ +// Exception Handling support header for -*- C++ -*- + +// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +// 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +/** @file exception + * This is a Standard C++ Library header. + */ + +#ifndef __EXCEPTION__ +#define __EXCEPTION__ + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#include +#include + +extern "C++" { + +namespace std +{ + /** + * @defgroup exceptions Exceptions + * @ingroup diagnostics + * + * Classes and functions for reporting errors via exception classes. + * @{ + */ + + /** + * @brief Base class for all library exceptions. + * + * This is the base class for all exceptions thrown by the standard + * library, and by certain language expressions. You are free to derive + * your own %exception classes, or use a different hierarchy, or to + * throw non-class data (e.g., fundamental types). + */ + class exception + { + public: + exception() _GLIBCXX_USE_NOEXCEPT { } + virtual ~exception() _GLIBCXX_USE_NOEXCEPT; + + /** Returns a C-style character string describing the general cause + * of the current error. */ + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; + + /** If an %exception is thrown which is not listed in a function's + * %exception specification, one of these may be thrown. */ + class bad_exception : public exception + { + public: + bad_exception() _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_exception() _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; + + /// If you write a replacement %terminate handler, it must be of this type. + typedef void (*terminate_handler) (); + + /// If you write a replacement %unexpected handler, it must be of this type. + typedef void (*unexpected_handler) (); + + /// Takes a new handler function as an argument, returns the old function. + terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT; + + /** The runtime will call this function if %exception handling must be + * abandoned for any reason. It can also be called by the user. */ + void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__)); + + /// Takes a new handler function as an argument, returns the old function. + unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT; + + /** The runtime will call this function if an %exception is thrown which + * violates the function's %exception specification. */ + void unexpected() __attribute__ ((__noreturn__)); + + /** [18.6.4]/1: 'Returns true after completing evaluation of a + * throw-expression until either completing initialization of the + * exception-declaration in the matching handler or entering @c unexpected() + * due to the throw; or after entering @c terminate() for any reason + * other than an explicit call to @c terminate(). [Note: This includes + * stack unwinding [15.2]. end note]' + * + * 2: 'When @c uncaught_exception() is true, throwing an + * %exception can result in a call of @c terminate() + * (15.5.1).' + */ + bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); + + // @} group exceptions +} // namespace std + +namespace __gnu_cxx +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief A replacement for the standard terminate_handler which + * prints more information about the terminating exception (if any) + * on stderr. + * + * @ingroup exceptions + * + * Call + * @code + * std::set_terminate(__gnu_cxx::__verbose_terminate_handler) + * @endcode + * to use. For more info, see + * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html + * + * In 3.4 and later, this is on by default. + */ + void __verbose_terminate_handler(); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +} // extern "C++" + +#pragma GCC visibility pop + +#if defined(__GXX_EXPERIMENTAL_CXX0X__) && (ATOMIC_INT_LOCK_FREE > 1) +#include +#include +#endif + +#endif diff --git a/contrib/sdk/sources/libsupc++/exception_defines.h b/contrib/sdk/sources/libsupc++/exception_defines.h new file mode 100644 index 0000000000..269937cff9 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/exception_defines.h @@ -0,0 +1,47 @@ +// -fno-exceptions Support -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2006, 2007, 2008, 2009, +// 2011 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library 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. + +// 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 +// . + +/** @file bits/exception_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _EXCEPTION_DEFINES_H +#define _EXCEPTION_DEFINES_H 1 + +#ifndef __EXCEPTIONS +// Iff -fno-exceptions, transform error handling code to work without it. +# define __try if (true) +# define __catch(X) if (false) +# define __throw_exception_again +#else +// Else proceed normally. +# define __try try +# define __catch(X) catch(X) +# define __throw_exception_again throw +#endif + +#endif diff --git a/contrib/sdk/sources/libsupc++/gthr-default.h b/contrib/sdk/sources/libsupc++/gthr-default.h new file mode 100644 index 0000000000..bc09371e3c --- /dev/null +++ b/contrib/sdk/sources/libsupc++/gthr-default.h @@ -0,0 +1,772 @@ +/* Threads compatibility routines for libgcc2 and libobjc. */ +/* Compile this one with gcc. */ + +/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2008, 2009 + Free Software Foundation, Inc. + Contributed by Mumit Khan . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +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. + +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 +. */ + +#ifndef GCC_GTHR_WIN32_H +#define GCC_GTHR_WIN32_H + +/* Make sure CONST_CAST2 (origin in system.h) is declared. */ +#ifndef CONST_CAST2 +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq) +#endif + +/* Windows32 threads specific definitions. The windows32 threading model + does not map well into pthread-inspired gcc's threading model, and so + there are caveats one needs to be aware of. + + 1. The destructor supplied to __gthread_key_create is ignored for + generic x86-win32 ports. This will certainly cause memory leaks + due to unreclaimed eh contexts (sizeof (eh_context) is at least + 24 bytes for x86 currently). + + This memory leak may be significant for long-running applications + that make heavy use of C++ EH. + + However, Mingw runtime (version 0.3 or newer) provides a mechanism + to emulate pthreads key dtors; the runtime provides a special DLL, + linked in if -mthreads option is specified, that runs the dtors in + the reverse order of registration when each thread exits. If + -mthreads option is not given, a stub is linked in instead of the + DLL, which results in memory leak. Other x86-win32 ports can use + the same technique of course to avoid the leak. + + 2. The error codes returned are non-POSIX like, and cast into ints. + This may cause incorrect error return due to truncation values on + hw where sizeof (DWORD) > sizeof (int). + + 3. We are currently using a special mutex instead of the Critical + Sections, since Win9x does not support TryEnterCriticalSection + (while NT does). + + The basic framework should work well enough. In the long term, GCC + needs to use Structured Exception Handling on Windows32. */ + +#define __GTHREADS 1 + +#include +#ifdef __MINGW32__ +#include <_mingw.h> +#endif + +#ifndef ___GLIBCXX_UNUSED_PARAM +#define ___GLIBCXX_UNUSED_PARAM(x) x +#endif + +#ifdef _LIBOBJC + +/* This is necessary to prevent windef.h (included from windows.h) from + defining its own BOOL as a typedef. */ +#ifndef __OBJC__ +#define __OBJC__ +#endif +#include +/* Now undef the windows BOOL. */ +#undef BOOL + +/* Key structure for maintaining thread specific storage */ +static DWORD __gthread_objc_data_tls = (DWORD) -1; + +/* Backend initialization functions */ + +/* Initialize the threads subsystem. */ +int +__gthread_objc_init_thread_system (void) +{ + /* Initialize the thread storage key. */ + if ((__gthread_objc_data_tls = TlsAlloc ()) != (DWORD) -1) + return 0; + else + return -1; +} + +/* Close the threads subsystem. */ +int +__gthread_objc_close_thread_system (void) +{ + if (__gthread_objc_data_tls != (DWORD) -1) + TlsFree (__gthread_objc_data_tls); + return 0; +} + +/* Backend thread functions */ + +/* Create a new thread of execution. */ +objc_thread_t +__gthread_objc_thread_detach (void (*func)(void *arg), void *arg) +{ + DWORD thread_id = 0; + HANDLE win32_handle; + + if (!(win32_handle = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) func, + arg, 0, &thread_id))) + thread_id = 0; + + return (objc_thread_t) (INT_PTR) thread_id; +} + +/* Set the current thread's priority. */ +int +__gthread_objc_thread_set_priority (int priority) +{ + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = THREAD_PRIORITY_NORMAL; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = THREAD_PRIORITY_BELOW_NORMAL; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = THREAD_PRIORITY_LOWEST; + break; + } + + /* Change priority */ + if (SetThreadPriority (GetCurrentThread (), sys_priority)) + return 0; + else + return -1; +} + +/* Return the current thread's priority. */ +int +__gthread_objc_thread_get_priority (void) +{ + int sys_priority; + + sys_priority = GetThreadPriority (GetCurrentThread ()); + + switch (sys_priority) + { + case THREAD_PRIORITY_HIGHEST: + case THREAD_PRIORITY_TIME_CRITICAL: + case THREAD_PRIORITY_ABOVE_NORMAL: + case THREAD_PRIORITY_NORMAL: + return OBJC_THREAD_INTERACTIVE_PRIORITY; + + default: + case THREAD_PRIORITY_BELOW_NORMAL: + return OBJC_THREAD_BACKGROUND_PRIORITY; + + case THREAD_PRIORITY_IDLE: + case THREAD_PRIORITY_LOWEST: + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Couldn't get priority. */ + return -1; +} + +/* Yield our process time to another thread. */ +void +__gthread_objc_thread_yield (void) +{ + Sleep (0); +} + +/* Terminate the current thread. */ +int +__gthread_objc_thread_exit (void) +{ + /* exit the thread */ + ExitThread (__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; +} + +/* Returns an integer value which uniquely describes a thread. */ +objc_thread_t +__gthread_objc_thread_id (void) +{ + return (objc_thread_t) (INT_PTR) GetCurrentThreadId (); +} + +/* Sets the thread's local storage pointer. */ +int +__gthread_objc_thread_set_data (void *value) +{ + if (TlsSetValue (__gthread_objc_data_tls, value)) + return 0; + else + return -1; +} + +/* Returns the thread's local storage pointer. */ +void * +__gthread_objc_thread_get_data (void) +{ + DWORD lasterror; + void *ptr; + + lasterror = GetLastError (); + + ptr = TlsGetValue (__gthread_objc_data_tls); /* Return thread data. */ + + SetLastError (lasterror); + + return ptr; +} + +/* Backend mutex functions */ + +/* Allocate a mutex. */ +int +__gthread_objc_mutex_allocate (objc_mutex_t mutex) +{ + if ((mutex->backend = (void *) CreateMutex (NULL, 0, NULL)) == NULL) + return -1; + else + return 0; +} + +/* Deallocate a mutex. */ +int +__gthread_objc_mutex_deallocate (objc_mutex_t mutex) +{ + CloseHandle ((HANDLE) (mutex->backend)); + return 0; +} + +/* Grab a lock on a mutex. */ +int +__gthread_objc_mutex_lock (objc_mutex_t mutex) +{ + int status; + + status = WaitForSingleObject ((HANDLE) (mutex->backend), INFINITE); + if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) + return -1; + else + return 0; +} + +/* Try to grab a lock on a mutex. */ +int +__gthread_objc_mutex_trylock (objc_mutex_t mutex) +{ + int status; + + status = WaitForSingleObject ((HANDLE) (mutex->backend), 0); + if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED) + return -1; + else + return 0; +} + +/* Unlock the mutex */ +int +__gthread_objc_mutex_unlock (objc_mutex_t mutex) +{ + if (ReleaseMutex ((HANDLE) (mutex->backend)) == 0) + return -1; + else + return 0; +} + +/* Backend condition mutex functions */ + +/* Allocate a condition. */ +int +__gthread_objc_condition_allocate (objc_condition_t ___GLIBCXX_UNUSED_PARAM(condition)) +{ + /* Unimplemented. */ + return -1; +} + +/* Deallocate a condition. */ +int +__gthread_objc_condition_deallocate (objc_condition_t ___GLIBCXX_UNUSED_PARAM(condition)) +{ + /* Unimplemented. */ + return -1; +} + +/* Wait on the condition */ +int +__gthread_objc_condition_wait (objc_condition_t ___GLIBCXX_UNUSED_PARAM(condition), + objc_mutex_t ___GLIBCXX_UNUSED_PARAM(mutex)) +{ + /* Unimplemented. */ + return -1; +} + +/* Wake up all threads waiting on this condition. */ +int +__gthread_objc_condition_broadcast (objc_condition_t ___GLIBCXX_UNUSED_PARAM(condition)) +{ + /* Unimplemented. */ + return -1; +} + +/* Wake up one thread waiting on this condition. */ +int +__gthread_objc_condition_signal (objc_condition_t ___GLIBCXX_UNUSED_PARAM(condition)) +{ + /* Unimplemented. */ + return -1; +} + +#else /* _LIBOBJC */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef unsigned long __gthread_key_t; + +typedef struct { + int done; + long started; +} __gthread_once_t; + +typedef struct { + long counter; + void *sema; +} __gthread_mutex_t; + +typedef struct { + long counter; + long depth; + unsigned long owner; + void *sema; +} __gthread_recursive_mutex_t; + +#define __GTHREAD_ONCE_INIT {0, -1} +#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function +#define __GTHREAD_MUTEX_INIT_DEFAULT {-1, 0} +#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION \ + __gthread_recursive_mutex_init_function +#define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0} + +#if defined (_WIN32) && !defined(__CYGWIN__) +#define MINGW32_SUPPORTS_MT_EH 1 +/* Mingw runtime >= v0.3 provides a magic variable that is set to nonzero + if -mthreads option was specified, or 0 otherwise. This is to get around + the lack of weak symbols in PE-COFF. */ +extern int _CRT_MT; +extern int __mingwthr_key_dtor (unsigned long, void (*) (void *)); +#endif /* _WIN32 && !__CYGWIN__ */ + +/* The Windows95 kernel does not export InterlockedCompareExchange. + This provides a substitute. When building apps that reference + gthread_mutex_try_lock, the __GTHREAD_I486_INLINE_LOCK_PRIMITIVES + macro must be defined if Windows95 is a target. Currently + gthread_mutex_try_lock is not referenced by libgcc or libstdc++. */ +#ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES +static inline long +__gthr_i486_lock_cmp_xchg(long *__dest, long __xchg, long __comperand) +{ + long result; + __asm__ __volatile__ ("\n\ + lock\n\ + cmpxchg{l} {%4, %1|%1, %4}\n" + : "=a" (result), "=m" (*__dest) + : "0" (__comperand), "m" (*__dest), "r" (__xchg) + : "cc"); + return result; +} +#define __GTHR_W32_InterlockedCompareExchange __gthr_i486_lock_cmp_xchg +#else /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ +#define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange +#endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */ + +static inline int +__gthread_active_p (void) +{ +#ifdef MINGW32_SUPPORTS_MT_EH + return _CRT_MT; +#else + return 1; +#endif +} + +#if __GTHREAD_HIDE_WIN32API + +/* The implementations are in config/i386/gthr-win32.c in libgcc.a. + Only stubs are exposed to avoid polluting the C++ namespace with + windows api definitions. */ + +extern int __gthr_win32_once (__gthread_once_t *, void (*) (void)); +extern int __gthr_win32_key_create (__gthread_key_t *, void (*) (void*)); +extern int __gthr_win32_key_delete (__gthread_key_t); +extern void * __gthr_win32_getspecific (__gthread_key_t); +extern int __gthr_win32_setspecific (__gthread_key_t, const void *); +extern void __gthr_win32_mutex_init_function (__gthread_mutex_t *); +extern int __gthr_win32_mutex_lock (__gthread_mutex_t *); +extern int __gthr_win32_mutex_trylock (__gthread_mutex_t *); +extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *); +extern void + __gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *); +extern int __gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *); +extern int + __gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *); +extern int __gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *); +extern void __gthr_win32_mutex_destroy (__gthread_mutex_t *); + +static inline int +__gthread_once (__gthread_once_t *__once, void (*__func) (void)) +{ + if (__gthread_active_p ()) + return __gthr_win32_once (__once, __func); + else + return -1; +} + +static inline int +__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) +{ + return __gthr_win32_key_create (__key, __dtor); +} + +static inline int +__gthread_key_delete (__gthread_key_t __key) +{ + return __gthr_win32_key_delete (__key); +} + +static inline void * +__gthread_getspecific (__gthread_key_t __key) +{ + return __gthr_win32_getspecific (__key); +} + +static inline int +__gthread_setspecific (__gthread_key_t __key, const void *__ptr) +{ + return __gthr_win32_setspecific (__key, __ptr); +} + +static inline void +__gthread_mutex_init_function (__gthread_mutex_t *__mutex) +{ + __gthr_win32_mutex_init_function (__mutex); +} + +static inline void +__gthread_mutex_destroy (__gthread_mutex_t *__mutex) +{ + __gthr_win32_mutex_destroy (__mutex); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_mutex_lock (__mutex); + else + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_mutex_trylock (__mutex); + else + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_mutex_unlock (__mutex); + else + return 0; +} + +static inline void +__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) +{ + __gthr_win32_recursive_mutex_init_function (__mutex); +} + +static inline int +__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_recursive_mutex_lock (__mutex); + else + return 0; +} + +static inline int +__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_recursive_mutex_trylock (__mutex); + else + return 0; +} + +static inline int +__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthr_win32_recursive_mutex_unlock (__mutex); + else + return 0; +} + +#else /* ! __GTHREAD_HIDE_WIN32API */ + +#include +#include + +static inline int +__gthread_once (__gthread_once_t *__once, void (*__func) (void)) +{ + if (! __gthread_active_p ()) + return -1; + else if (__once == NULL || __func == NULL) + return EINVAL; + + if (! __once->done) + { + if (InterlockedIncrement (&(__once->started)) == 0) + { + (*__func) (); + __once->done = TRUE; + } + else + { + /* Another thread is currently executing the code, so wait for it + to finish; yield the CPU in the meantime. If performance + does become an issue, the solution is to use an Event that + we wait on here (and set above), but that implies a place to + create the event before this routine is called. */ + while (! __once->done) + Sleep (0); + } + } + + return 0; +} + +/* Windows32 thread local keys don't support destructors; this leads to + leaks, especially in threaded applications making extensive use of + C++ EH. Mingw uses a thread-support DLL to work-around this problem. */ +static inline int +__gthread_key_create (__gthread_key_t *__key, + void (*__dtor) (void *) __attribute__((unused))) +{ + int __status = 0; + DWORD __tls_index = TlsAlloc (); + if (__tls_index != 0xFFFFFFFF) + { + *__key = __tls_index; +#ifdef MINGW32_SUPPORTS_MT_EH + /* Mingw runtime will run the dtors in reverse order for each thread + when the thread exits. */ + __status = __mingwthr_key_dtor (*__key, __dtor); +#endif + } + else + __status = (int) GetLastError (); + return __status; +} + +static inline int +__gthread_key_delete (__gthread_key_t __key) +{ + return (TlsFree (__key) != 0) ? 0 : (int) GetLastError (); +} + +static inline void * +__gthread_getspecific (__gthread_key_t __key) +{ + DWORD __lasterror; + void *__ptr; + + __lasterror = GetLastError (); + + __ptr = TlsGetValue (__key); + + SetLastError (__lasterror); + + return __ptr; +} + +static inline int +__gthread_setspecific (__gthread_key_t __key, const void *__ptr) +{ + if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr)) != 0) + return 0; + else + return GetLastError (); +} + +static inline void +__gthread_mutex_init_function (__gthread_mutex_t *__mutex) +{ + __mutex->counter = -1; + __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL); +} + +static inline void +__gthread_mutex_destroy (__gthread_mutex_t *__mutex) +{ + CloseHandle ((HANDLE) __mutex->sema); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *__mutex) +{ + int __status = 0; + + if (__gthread_active_p ()) + { + if (InterlockedIncrement (&__mutex->counter) == 0 || + WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0) + __status = 0; + else + { + /* WaitForSingleObject returns WAIT_FAILED, and we can only do + some best-effort cleanup here. */ + InterlockedDecrement (&__mutex->counter); + __status = 1; + } + } + return __status; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *__mutex) +{ + int __status = 0; + + if (__gthread_active_p ()) + { + if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0) + __status = 0; + else + __status = 1; + } + return __status; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + { + if (InterlockedDecrement (&__mutex->counter) >= 0) + return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1; + } + return 0; +} + +static inline void +__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) +{ + __mutex->counter = -1; + __mutex->depth = 0; + __mutex->owner = 0; + __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL); +} + +static inline int +__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + { + DWORD __me = GetCurrentThreadId(); + if (InterlockedIncrement (&__mutex->counter) == 0) + { + __mutex->depth = 1; + __mutex->owner = __me; + } + else if (__mutex->owner == __me) + { + InterlockedDecrement (&__mutex->counter); + ++(__mutex->depth); + } + else if (WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0) + { + __mutex->depth = 1; + __mutex->owner = __me; + } + else + { + /* WaitForSingleObject returns WAIT_FAILED, and we can only do + some best-effort cleanup here. */ + InterlockedDecrement (&__mutex->counter); + return 1; + } + } + return 0; +} + +static inline int +__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + { + DWORD __me = GetCurrentThreadId(); + if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0) + { + __mutex->depth = 1; + __mutex->owner = __me; + } + else if (__mutex->owner == __me) + ++(__mutex->depth); + else + return 1; + } + return 0; +} + +static inline int +__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + { + --(__mutex->depth); + if (__mutex->depth == 0) + { + __mutex->owner = 0; + + if (InterlockedDecrement (&__mutex->counter) >= 0) + return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1; + } + } + return 0; +} + +#endif /* __GTHREAD_HIDE_WIN32API */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBOBJC */ + +#endif /* ! GCC_GTHR_WIN32_H */ diff --git a/contrib/sdk/sources/libsupc++/gthr_mutex.c b/contrib/sdk/sources/libsupc++/gthr_mutex.c new file mode 100644 index 0000000000..d750279ec3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/gthr_mutex.c @@ -0,0 +1,27 @@ + +void __mutex_lock(volatile int *val); + +typedef struct { + int counter; + void *sema; +} __gthread_mutex_t; + +void __gthr_win32_mutex_init_function (__gthread_mutex_t *mutex) +{ + mutex->counter = 0; + mutex->sema = 0; +} + +int __gthr_win32_mutex_lock (__gthread_mutex_t *mutex) +{ + __mutex_lock(&mutex->counter); + return 0; +} + +int +__gthr_win32_mutex_unlock (__gthread_mutex_t *mutex) +{ + mutex->counter = 0; + return 0; +} + diff --git a/contrib/sdk/sources/libsupc++/guard.cc b/contrib/sdk/sources/libsupc++/guard.cc new file mode 100644 index 0000000000..f8550c03fa --- /dev/null +++ b/contrib/sdk/sources/libsupc++/guard.cc @@ -0,0 +1,416 @@ +// Copyright (C) 2002, 2004, 2006, 2008, 2009, 2010, 2011, 2012 +// Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +// Written by Mark Mitchell, CodeSourcery LLC, +// Thread support written by Jason Merrill, Red Hat Inc. + +#include +#include +#include +#include +#include +#include +#if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \ + && (ATOMIC_INT_LOCK_FREE > 1) && defined(_GLIBCXX_HAVE_LINUX_FUTEX) +# include +# include +# include +# define _GLIBCXX_USE_FUTEX +# define _GLIBCXX_FUTEX_WAIT 0 +# define _GLIBCXX_FUTEX_WAKE 1 +#endif + +// The IA64/generic ABI uses the first byte of the guard variable. +// The ARM EABI uses the least significant bit. + +// Thread-safe static local initialization support. +#ifdef __GTHREADS +# ifndef _GLIBCXX_USE_FUTEX +namespace +{ + // A single mutex controlling all static initializations. + static __gnu_cxx::__recursive_mutex* static_mutex; + + typedef char fake_recursive_mutex[sizeof(__gnu_cxx::__recursive_mutex)] + __attribute__ ((aligned(__alignof__(__gnu_cxx::__recursive_mutex)))); + fake_recursive_mutex fake_mutex; + + static void init() + { static_mutex = new (&fake_mutex) __gnu_cxx::__recursive_mutex(); } + + __gnu_cxx::__recursive_mutex& + get_static_mutex() + { + static __gthread_once_t once = __GTHREAD_ONCE_INIT; + __gthread_once(&once, init); + return *static_mutex; + } + + // Simple wrapper for exception safety. + struct mutex_wrapper + { + bool unlock; + mutex_wrapper() : unlock(true) + { get_static_mutex().lock(); } + + ~mutex_wrapper() + { + if (unlock) + static_mutex->unlock(); + } + }; +} +# endif + +# if defined(__GTHREAD_HAS_COND) && !defined(_GLIBCXX_USE_FUTEX) +namespace +{ + // A single condition variable controlling all static initializations. + static __gnu_cxx::__cond* static_cond; + + // using a fake type to avoid initializing a static class. + typedef char fake_cond_t[sizeof(__gnu_cxx::__cond)] + __attribute__ ((aligned(__alignof__(__gnu_cxx::__cond)))); + fake_cond_t fake_cond; + + static void init_static_cond() + { static_cond = new (&fake_cond) __gnu_cxx::__cond(); } + + __gnu_cxx::__cond& + get_static_cond() + { + static __gthread_once_t once = __GTHREAD_ONCE_INIT; + __gthread_once(&once, init_static_cond); + return *static_cond; + } +} +# endif + +# ifndef _GLIBCXX_GUARD_TEST_AND_ACQUIRE +inline bool +__test_and_acquire (__cxxabiv1::__guard *g) +{ + bool b = _GLIBCXX_GUARD_TEST (g); + _GLIBCXX_READ_MEM_BARRIER; + return b; +} +# define _GLIBCXX_GUARD_TEST_AND_ACQUIRE(G) __test_and_acquire (G) +# endif + +# ifndef _GLIBCXX_GUARD_SET_AND_RELEASE +inline void +__set_and_release (__cxxabiv1::__guard *g) +{ + _GLIBCXX_WRITE_MEM_BARRIER; + _GLIBCXX_GUARD_SET (g); +} +# define _GLIBCXX_GUARD_SET_AND_RELEASE(G) __set_and_release (G) +# endif + +#else /* !__GTHREADS */ + +# undef _GLIBCXX_GUARD_TEST_AND_ACQUIRE +# undef _GLIBCXX_GUARD_SET_AND_RELEASE +# define _GLIBCXX_GUARD_SET_AND_RELEASE(G) _GLIBCXX_GUARD_SET (G) + +#endif /* __GTHREADS */ + +// +// Here are C++ run-time routines for guarded initialization of static +// variables. There are 4 scenarios under which these routines are called: +// +// 1. Threads not supported (__GTHREADS not defined) +// 2. Threads are supported but not enabled at run-time. +// 3. Threads enabled at run-time but __gthreads_* are not fully POSIX. +// 4. Threads enabled at run-time and __gthreads_* support all POSIX threads +// primitives we need here. +// +// The old code supported scenarios 1-3 but was broken since it used a global +// mutex for all threads and had the mutex locked during the whole duration of +// initialization of a guarded static variable. The following created a +// dead-lock with the old code. +// +// Thread 1 acquires the global mutex. +// Thread 1 starts initializing static variable. +// Thread 1 creates thread 2 during initialization. +// Thread 2 attempts to acquire mutex to initialize another variable. +// Thread 2 blocks since thread 1 is locking the mutex. +// Thread 1 waits for result from thread 2 and also blocks. A deadlock. +// +// The new code here can handle this situation and thus is more robust. However, +// we need to use the POSIX thread condition variable, which is not supported +// in all platforms, notably older versions of Microsoft Windows. The gthr*.h +// headers define a symbol __GTHREAD_HAS_COND for platforms that support POSIX +// like condition variables. For platforms that do not support condition +// variables, we need to fall back to the old code. + +// If _GLIBCXX_USE_FUTEX, no global mutex or condition variable is used, +// only atomic operations are used together with futex syscall. +// Valid values of the first integer in guard are: +// 0 No thread encountered the guarded init +// yet or it has been aborted. +// _GLIBCXX_GUARD_BIT The guarded static var has been successfully +// initialized. +// _GLIBCXX_GUARD_PENDING_BIT The guarded static var is being initialized +// and no other thread is waiting for its +// initialization. +// (_GLIBCXX_GUARD_PENDING_BIT The guarded static var is being initialized +// | _GLIBCXX_GUARD_WAITING_BIT) and some other threads are waiting until +// it is initialized. + +namespace __cxxabiv1 +{ +#ifdef _GLIBCXX_USE_FUTEX + namespace + { + static inline int __guard_test_bit (const int __byte, const int __val) + { + union { int __i; char __c[sizeof (int)]; } __u = { 0 }; + __u.__c[__byte] = __val; + return __u.__i; + } + } +#endif + + static inline int + init_in_progress_flag(__guard* g) + { return ((char *)g)[1]; } + + static inline void + set_init_in_progress_flag(__guard* g, int v) + { ((char *)g)[1] = v; } + + static inline void + throw_recursive_init_exception() + { +#ifdef __EXCEPTIONS + throw __gnu_cxx::recursive_init_error(); +#else + // Use __builtin_trap so we don't require abort(). + __builtin_trap(); +#endif + } + + // acquire() is a helper function used to acquire guard if thread support is + // not compiled in or is compiled in but not enabled at run-time. + static int + acquire(__guard *g) + { + // Quit if the object is already initialized. + if (_GLIBCXX_GUARD_TEST(g)) + return 0; + + if (init_in_progress_flag(g)) + throw_recursive_init_exception(); + + set_init_in_progress_flag(g, 1); + return 1; + } + + extern "C" + int __cxa_guard_acquire (__guard *g) + { +#ifdef __GTHREADS + // If the target can reorder loads, we need to insert a read memory + // barrier so that accesses to the guarded variable happen after the + // guard test. + if (_GLIBCXX_GUARD_TEST_AND_ACQUIRE (g)) + return 0; + +# ifdef _GLIBCXX_USE_FUTEX + // If __atomic_* and futex syscall are supported, don't use any global + // mutex. + if (__gthread_active_p ()) + { + int *gi = (int *) (void *) g; + const int guard_bit = _GLIBCXX_GUARD_BIT; + const int pending_bit = _GLIBCXX_GUARD_PENDING_BIT; + const int waiting_bit = _GLIBCXX_GUARD_WAITING_BIT; + + while (1) + { + int expected(0); + if (__atomic_compare_exchange_n(gi, &expected, pending_bit, false, + __ATOMIC_ACQ_REL, + __ATOMIC_ACQUIRE)) + { + // This thread should do the initialization. + return 1; + } + + if (expected == guard_bit) + { + // Already initialized. + return 0; + } + + if (expected == pending_bit) + { + // Use acquire here. + int newv = expected | waiting_bit; + if (!__atomic_compare_exchange_n(gi, &expected, newv, false, + __ATOMIC_ACQ_REL, + __ATOMIC_ACQUIRE)) + { + if (expected == guard_bit) + { + // Make a thread that failed to set the + // waiting bit exit the function earlier, + // if it detects that another thread has + // successfully finished initialising. + return 0; + } + if (expected == 0) + continue; + } + + expected = newv; + } + + syscall (SYS_futex, gi, _GLIBCXX_FUTEX_WAIT, expected, 0); + } + } +# else + if (__gthread_active_p ()) + { + mutex_wrapper mw; + + while (1) // When this loop is executing, mutex is locked. + { +# ifdef __GTHREAD_HAS_COND + // The static is already initialized. + if (_GLIBCXX_GUARD_TEST(g)) + return 0; // The mutex will be unlocked via wrapper + + if (init_in_progress_flag(g)) + { + // The guarded static is currently being initialized by + // another thread, so we release mutex and wait for the + // condition variable. We will lock the mutex again after + // this. + get_static_cond().wait_recursive(&get_static_mutex()); + } + else + { + set_init_in_progress_flag(g, 1); + return 1; // The mutex will be unlocked via wrapper. + } +# else + // This provides compatibility with older systems not supporting + // POSIX like condition variables. + if (acquire(g)) + { + mw.unlock = false; + return 1; // The mutex still locked. + } + return 0; // The mutex will be unlocked via wrapper. +# endif + } + } +# endif +#endif + + return acquire (g); + } + + extern "C" + void __cxa_guard_abort (__guard *g) throw () + { +#ifdef _GLIBCXX_USE_FUTEX + // If __atomic_* and futex syscall are supported, don't use any global + // mutex. + if (__gthread_active_p ()) + { + int *gi = (int *) (void *) g; + const int waiting_bit = _GLIBCXX_GUARD_WAITING_BIT; + int old = __atomic_exchange_n (gi, 0, __ATOMIC_ACQ_REL); + + if ((old & waiting_bit) != 0) + syscall (SYS_futex, gi, _GLIBCXX_FUTEX_WAKE, INT_MAX); + return; + } +#elif defined(__GTHREAD_HAS_COND) + if (__gthread_active_p()) + { + mutex_wrapper mw; + + set_init_in_progress_flag(g, 0); + + // If we abort, we still need to wake up all other threads waiting for + // the condition variable. + get_static_cond().broadcast(); + return; + } +#endif + + set_init_in_progress_flag(g, 0); +#if defined(__GTHREADS) && !defined(__GTHREAD_HAS_COND) + // This provides compatibility with older systems not supporting POSIX like + // condition variables. + if (__gthread_active_p ()) + static_mutex->unlock(); +#endif + } + + extern "C" + void __cxa_guard_release (__guard *g) throw () + { +#ifdef _GLIBCXX_USE_FUTEX + // If __atomic_* and futex syscall are supported, don't use any global + // mutex. + if (__gthread_active_p ()) + { + int *gi = (int *) (void *) g; + const int guard_bit = _GLIBCXX_GUARD_BIT; + const int waiting_bit = _GLIBCXX_GUARD_WAITING_BIT; + int old = __atomic_exchange_n (gi, guard_bit, __ATOMIC_ACQ_REL); + + if ((old & waiting_bit) != 0) + syscall (SYS_futex, gi, _GLIBCXX_FUTEX_WAKE, INT_MAX); + return; + } +#elif defined(__GTHREAD_HAS_COND) + if (__gthread_active_p()) + { + mutex_wrapper mw; + + set_init_in_progress_flag(g, 0); + _GLIBCXX_GUARD_SET_AND_RELEASE(g); + + get_static_cond().broadcast(); + return; + } +#endif + + set_init_in_progress_flag(g, 0); + _GLIBCXX_GUARD_SET_AND_RELEASE (g); + +#if defined(__GTHREADS) && !defined(__GTHREAD_HAS_COND) + // This provides compatibility with older systems not supporting POSIX like + // condition variables. + if (__gthread_active_p()) + static_mutex->unlock(); +#endif + } +} diff --git a/contrib/sdk/sources/libsupc++/guard_error.cc b/contrib/sdk/sources/libsupc++/guard_error.cc new file mode 100644 index 0000000000..7c06bcd0d3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/guard_error.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include +#include + +namespace __gnu_cxx +{ + recursive_init_error::~recursive_init_error() throw() { } +} + diff --git a/contrib/sdk/sources/libsupc++/initializer_list b/contrib/sdk/sources/libsupc++/initializer_list new file mode 100644 index 0000000000..6b991b7d66 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/initializer_list @@ -0,0 +1,107 @@ +// std::initializer_list support -*- C++ -*- + +// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +/** @file initializer_list + * This is a Standard C++ Library header. + */ + +#ifndef _INITIALIZER_LIST +#define _INITIALIZER_LIST + +#pragma GCC system_header + +#ifndef __GXX_EXPERIMENTAL_CXX0X__ +# include +#else // C++0x + +#pragma GCC visibility push(default) + +#include + +namespace std +{ + /// initializer_list + template + class initializer_list + { + public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + typedef const _E* iterator; + typedef const _E* const_iterator; + + private: + iterator _M_array; + size_type _M_len; + + // The compiler can call a private constructor. + constexpr initializer_list(const_iterator __a, size_type __l) + : _M_array(__a), _M_len(__l) { } + + public: + constexpr initializer_list() noexcept + : _M_array(0), _M_len(0) { } + + // Number of elements. + constexpr size_type + size() const noexcept { return _M_len; } + + // First element. + constexpr const_iterator + begin() const noexcept { return _M_array; } + + // One past the last element. + constexpr const_iterator + end() const noexcept { return begin() + size(); } + }; + + /** + * @brief Return an iterator pointing to the first element of + * the initilizer_list. + * @param __ils Initializer list. + */ + template + constexpr const _Tp* + begin(initializer_list<_Tp> __ils) noexcept + { return __ils.begin(); } + + /** + * @brief Return an iterator pointing to one past the last element + * of the initilizer_list. + * @param __ils Initializer list. + */ + template + constexpr const _Tp* + end(initializer_list<_Tp> __ils) noexcept + { return __ils.end(); } +} + +#pragma GCC visibility pop + +#endif // __GXX_EXPERIMENTAL_CXX0X__ + +#endif // _INITIALIZER_LIST diff --git a/contrib/sdk/sources/libsupc++/new b/contrib/sdk/sources/libsupc++/new new file mode 100644 index 0000000000..1c258002e6 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/new @@ -0,0 +1,124 @@ +// The -*- C++ -*- dynamic memory management header. + +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +// 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 +// Free Software Foundation + +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +/** @file new + * This is a Standard C++ Library header. + * + * The header @c new defines several functions to manage dynamic memory and + * handling memory allocation errors; see + * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more. + */ + +#ifndef _NEW +#define _NEW + +#pragma GCC system_header + +#include +#include + +#pragma GCC visibility push(default) + +extern "C++" { + +namespace std +{ + /** + * @brief Exception possibly thrown by @c new. + * @ingroup exceptions + * + * @c bad_alloc (or classes derived from it) is used to report allocation + * errors from the throwing forms of @c new. */ + class bad_alloc : public exception + { + public: + bad_alloc() throw() { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_alloc() throw(); + + // See comment in eh_exception.cc. + virtual const char* what() const throw(); + }; + + struct nothrow_t { }; + + extern const nothrow_t nothrow; + + /** If you write your own error handler to be called by @c new, it must + * be of this type. */ + typedef void (*new_handler)(); + + /// Takes a replacement handler as the argument, returns the + /// previous handler. + new_handler set_new_handler(new_handler) throw(); +} // namespace std + +//@{ +/** These are replaceable signatures: + * - normal single new and delete (no arguments, throw @c bad_alloc on error) + * - normal array new and delete (same) + * - @c nothrow single new and delete (take a @c nothrow argument, return + * @c NULL on error) + * - @c nothrow array new and delete (same) + * + * Placement new and delete signatures (take a memory address argument, + * does nothing) may not be replaced by a user's program. +*/ +void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) + __attribute__((__externally_visible__)); +void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) + __attribute__((__externally_visible__)); +void operator delete(void*) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete(void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); + +// Default placement versions of operator new. +inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT +{ return __p; } +inline void* operator new[](std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT +{ return __p; } + +// Default placement versions of operator delete. +inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } +inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { } +//@} +} // extern "C++" + +#pragma GCC visibility pop + +#endif diff --git a/contrib/sdk/sources/libsupc++/new_handler.cc b/contrib/sdk/sources/libsupc++/new_handler.cc new file mode 100644 index 0000000000..4e3c93545a --- /dev/null +++ b/contrib/sdk/sources/libsupc++/new_handler.cc @@ -0,0 +1,41 @@ +// Implementation file for the -*- C++ -*- dynamic memory management header. + +// Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +// 2005, 2006, 2007, 2008, 2009, 2010 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include "new" + +const std::nothrow_t std::nothrow = { }; + +using std::new_handler; +new_handler __new_handler; + +new_handler +std::set_new_handler (new_handler handler) throw() +{ + new_handler prev_handler = __new_handler; + __new_handler = handler; + return prev_handler; +} diff --git a/contrib/sdk/sources/libsupc++/new_op.cc b/contrib/sdk/sources/libsupc++/new_op.cc new file mode 100644 index 0000000000..bb0199e969 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/new_op.cc @@ -0,0 +1,67 @@ +// Support routines for the -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2009, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include +#include "new" + +using std::new_handler; +using std::bad_alloc; +#if _GLIBCXX_HOSTED +using std::malloc; +#else +// A freestanding C runtime may not provide "malloc" -- but there is no +// other reasonable way to implement "operator new". +extern "C" void *malloc (std::size_t); +#endif + +extern new_handler __new_handler; + +_GLIBCXX_WEAK_DEFINITION void * +operator new (std::size_t sz) _GLIBCXX_THROW (std::bad_alloc) +{ + void *p; + + /* malloc (0) is unpredictable; avoid it. */ + if (sz == 0) + sz = 1; + p = (void *) malloc (sz); + while (p == 0) + { + new_handler handler = __new_handler; + if (! handler) +#ifdef __EXCEPTIONS + throw bad_alloc(); +#else + std::abort(); +#endif + handler (); + p = (void *) malloc (sz); + } + + return p; +} diff --git a/contrib/sdk/sources/libsupc++/new_opnt.cc b/contrib/sdk/sources/libsupc++/new_opnt.cc new file mode 100644 index 0000000000..71600a63c3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/new_opnt.cc @@ -0,0 +1,63 @@ +// Support routines for the -*- C++ -*- dynamic memory management. +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2009, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include "new" + +using std::new_handler; +using std::bad_alloc; + +extern "C" void *malloc (std::size_t); +extern new_handler __new_handler; + +_GLIBCXX_WEAK_DEFINITION void * +operator new (std::size_t sz, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT +{ + void *p; + + /* malloc (0) is unpredictable; avoid it. */ + if (sz == 0) + sz = 1; + p = (void *) malloc (sz); + while (p == 0) + { + new_handler handler = __new_handler; + if (! handler) + return 0; + __try + { + handler (); + } + __catch(const bad_alloc&) + { + return 0; + } + + p = (void *) malloc (sz); + } + + return p; +} diff --git a/contrib/sdk/sources/libsupc++/new_opv.cc b/contrib/sdk/sources/libsupc++/new_opv.cc new file mode 100644 index 0000000000..4080bd25b4 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/new_opv.cc @@ -0,0 +1,34 @@ +// Boilerplate support routines for -*- C++ -*- dynamic memory management. + +// Copyright (C) 1997, 1998, 1999, 2000, 2004, 2009, 2010, 2011 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include "new" + +_GLIBCXX_WEAK_DEFINITION void* +operator new[] (std::size_t sz) _GLIBCXX_THROW (std::bad_alloc) +{ + return ::operator new(sz); +} diff --git a/contrib/sdk/sources/libsupc++/pbase_type_info.cc b/contrib/sdk/sources/libsupc++/pbase_type_info.cc new file mode 100644 index 0000000000..f79d9e9686 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/pbase_type_info.cc @@ -0,0 +1,66 @@ +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, +// 2009, 2010 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include "tinfo.h" + +namespace __cxxabiv1 { + +__pbase_type_info:: +~__pbase_type_info () +{} + +bool __pbase_type_info:: +__do_catch (const type_info *thr_type, + void **thr_obj, + unsigned outer) const +{ + if (*this == *thr_type) + return true; // same type + +#ifdef __GXX_RTTI + if (typeid (*this) != typeid (*thr_type)) + return false; // not both same kind of pointers +#endif + + if (!(outer & 1)) + // We're not the same and our outer pointers are not all const qualified + // Therefore there must at least be a qualification conversion involved + // But for that to be valid, our outer pointers must be const qualified. + return false; + + const __pbase_type_info *thrown_type = + static_cast (thr_type); + + if (thrown_type->__flags & ~__flags) + // We're less qualified. + return false; + + if (!(__flags & __const_mask)) + outer &= ~1; + + return __pointer_catch (thrown_type, thr_obj, outer); +} + +} diff --git a/contrib/sdk/sources/libsupc++/pure.cc b/contrib/sdk/sources/libsupc++/pure.cc new file mode 100644 index 0000000000..4879e59de3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/pure.cc @@ -0,0 +1,58 @@ +// -*- C++ -*- +// Copyright (C) 2000, 2001, 2009, 2011 Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +#include +#include +#include "unwind-cxx.h" + +#if _GLIBCXX_HOSTED +#ifdef _GLIBCXX_HAVE_UNISTD_H +# include +# define writestr(str) write(2, str, sizeof(str) - 1) +# ifdef __GNU_LIBRARY__ + /* Avoid forcing the library's meaning of `write' on the user program + by using the "internal" name (for use within the library). */ +/*# define write(fd, buf, n) __write((fd), (buf), (n))*/ +# endif +#else +# include +# define writestr(str) std::fputs(str, stderr) +#endif +#else +# define writestr(str) /* Empty */ +#endif + +extern "C" void +__cxxabiv1::__cxa_pure_virtual (void) +{ + writestr ("pure virtual method called\n"); + std::terminate (); +} + +extern "C" void +__cxxabiv1::__cxa_deleted_virtual (void) +{ + writestr ("deleted virtual method called\n"); + std::terminate (); +} diff --git a/contrib/sdk/sources/libsupc++/si_class_type_info.cc b/contrib/sdk/sources/libsupc++/si_class_type_info.cc new file mode 100644 index 0000000000..829e71fad3 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/si_class_type_info.cc @@ -0,0 +1,85 @@ +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2009 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include "tinfo.h" + +namespace __cxxabiv1 { + +__si_class_type_info:: +~__si_class_type_info () +{} + +__class_type_info::__sub_kind __si_class_type_info:: +__do_find_public_src (ptrdiff_t src2dst, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr) const +{ + if (src_ptr == obj_ptr && *this == *src_type) + return __contained_public; + return __base_type->__do_find_public_src (src2dst, obj_ptr, src_type, src_ptr); +} + +bool __si_class_type_info:: +__do_dyncast (ptrdiff_t src2dst, + __sub_kind access_path, + const __class_type_info *dst_type, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr, + __dyncast_result &__restrict result) const +{ + if (*this == *dst_type) + { + result.dst_ptr = obj_ptr; + result.whole2dst = access_path; + if (src2dst >= 0) + result.dst2src = adjust_pointer (obj_ptr, src2dst) == src_ptr + ? __contained_public : __not_contained; + else if (src2dst == -2) + result.dst2src = __not_contained; + return false; + } + if (obj_ptr == src_ptr && *this == *src_type) + { + // The src object we started from. Indicate how we are accessible from + // the most derived object. + result.whole2src = access_path; + return false; + } + return __base_type->__do_dyncast (src2dst, access_path, dst_type, obj_ptr, + src_type, src_ptr, result); +} + +bool __si_class_type_info:: +__do_upcast (const __class_type_info *dst, const void *obj_ptr, + __upcast_result &__restrict result) const +{ + if (__class_type_info::__do_upcast (dst, obj_ptr, result)) + return true; + + return __base_type->__do_upcast (dst, obj_ptr, result); +} + +} diff --git a/contrib/sdk/sources/libsupc++/tinfo.cc b/contrib/sdk/sources/libsupc++/tinfo.cc new file mode 100644 index 0000000000..eba74dbdad --- /dev/null +++ b/contrib/sdk/sources/libsupc++/tinfo.cc @@ -0,0 +1,84 @@ +// Methods for type_info for -*- C++ -*- Run Time Type Identification. +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +// 2003, 2004, 2005, 2006, 2007, 2009 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include +#include +#include "tinfo.h" + +std::type_info:: +~type_info () +{ } + +#if !__GXX_TYPEINFO_EQUALITY_INLINE + +// We can't rely on common symbols being shared between shared objects. +bool std::type_info:: +operator== (const std::type_info& arg) const +{ +#if __GXX_MERGED_TYPEINFO_NAMES + return name () == arg.name (); +#else + /* The name() method will strip any leading '*' prefix. Therefore + take care to look at __name rather than name() when looking for + the "pointer" prefix. */ + return (&arg == this) + || (__name[0] != '*' && (__builtin_strcmp (name (), arg.name ()) == 0)); +#endif +} + +#endif + +namespace std { + +// return true if this is a type_info for a pointer type +bool type_info:: +__is_pointer_p () const +{ + return false; +} + +// return true if this is a type_info for a function type +bool type_info:: +__is_function_p () const +{ + return false; +} + +// try and catch a thrown object. +bool type_info:: +__do_catch (const type_info *thr_type, void **, unsigned) const +{ + return *this == *thr_type; +} + +// upcast from this type to the target. __class_type_info will override +bool type_info:: +__do_upcast (const abi::__class_type_info *, void **) const +{ + return false; +} + +} diff --git a/contrib/sdk/sources/libsupc++/tinfo.h b/contrib/sdk/sources/libsupc++/tinfo.h new file mode 100644 index 0000000000..b3e22232f1 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/tinfo.h @@ -0,0 +1,183 @@ +// RTTI support internals for -*- C++ -*- +// Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2009 +// Free Software Foundation + +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include "typeinfo" +#include + +// Class declarations shared between the typeinfo implementation files. + +#include + +namespace __cxxabiv1 { + +inline bool __pbase_type_info:: +__pointer_catch (const __pbase_type_info *thrown_type, + void **thr_obj, + unsigned outer) const +{ + return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2); +} + +namespace { + +using namespace std; +using namespace abi; + +// Initial part of a vtable, this structure is used with offsetof, so we don't +// have to keep alignments consistent manually. +struct vtable_prefix +{ + // Offset to most derived object. + ptrdiff_t whole_object; + + // Additional padding if necessary. +#ifdef _GLIBCXX_VTABLE_PADDING + ptrdiff_t padding1; +#endif + + // Pointer to most derived type_info. + const __class_type_info *whole_type; + + // Additional padding if necessary. +#ifdef _GLIBCXX_VTABLE_PADDING + ptrdiff_t padding2; +#endif + + // What a class's vptr points to. + const void *origin; +}; + +template +inline const T * +adjust_pointer (const void *base, ptrdiff_t offset) +{ + return reinterpret_cast + (reinterpret_cast (base) + offset); +} + +// ADDR is a pointer to an object. Convert it to a pointer to a base, +// using OFFSET. IS_VIRTUAL is true, if we are getting a virtual base. +inline void const * +convert_to_base (void const *addr, bool is_virtual, ptrdiff_t offset) +{ + if (is_virtual) + { + const void *vtable = *static_cast (addr); + + offset = *adjust_pointer (vtable, offset); + } + + return adjust_pointer (addr, offset); +} + +// some predicate functions for __class_type_info::__sub_kind +inline bool contained_p (__class_type_info::__sub_kind access_path) +{ + return access_path >= __class_type_info::__contained_mask; +} +inline bool public_p (__class_type_info::__sub_kind access_path) +{ + return access_path & __class_type_info::__contained_public_mask; +} +inline bool virtual_p (__class_type_info::__sub_kind access_path) +{ + return (access_path & __class_type_info::__contained_virtual_mask); +} +inline bool contained_public_p (__class_type_info::__sub_kind access_path) +{ + return ((access_path & __class_type_info::__contained_public) + == __class_type_info::__contained_public); +} +inline bool contained_nonpublic_p (__class_type_info::__sub_kind access_path) +{ + return ((access_path & __class_type_info::__contained_public) + == __class_type_info::__contained_mask); +} +inline bool contained_nonvirtual_p (__class_type_info::__sub_kind access_path) +{ + return ((access_path & (__class_type_info::__contained_mask + | __class_type_info::__contained_virtual_mask)) + == __class_type_info::__contained_mask); +} + +static const __class_type_info *const nonvirtual_base_type = + static_cast (0) + 1; + +} // namespace + +// __upcast_result is used to hold information during traversal of a class +// hierarchy when catch matching. +struct __class_type_info::__upcast_result +{ + const void *dst_ptr; // pointer to caught object + __sub_kind part2dst; // path from current base to target + int src_details; // hints about the source type hierarchy + const __class_type_info *base_type; // where we found the target, + // if in vbase the __class_type_info of vbase + // if a non-virtual base then 1 + // else NULL + __upcast_result (int d) + :dst_ptr (NULL), part2dst (__unknown), src_details (d), base_type (NULL) + {} +}; + +// __dyncast_result is used to hold information during traversal of a class +// hierarchy when dynamic casting. +struct __class_type_info::__dyncast_result +{ + const void *dst_ptr; // pointer to target object or NULL + __sub_kind whole2dst; // path from most derived object to target + __sub_kind whole2src; // path from most derived object to sub object + __sub_kind dst2src; // path from target to sub object + int whole_details; // details of the whole class hierarchy + + __dyncast_result (int details_ = __vmi_class_type_info::__flags_unknown_mask) + :dst_ptr (NULL), whole2dst (__unknown), + whole2src (__unknown), dst2src (__unknown), + whole_details (details_) + {} + +protected: + __dyncast_result(const __dyncast_result&); + + __dyncast_result& + operator=(const __dyncast_result&); +}; + +inline __class_type_info::__sub_kind __class_type_info:: +__find_public_src (ptrdiff_t src2dst, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr) const +{ + if (src2dst >= 0) + return adjust_pointer (obj_ptr, src2dst) == src_ptr + ? __contained_public : __not_contained; + if (src2dst == -2) + return __not_contained; + return __do_find_public_src (src2dst, obj_ptr, src_type, src_ptr); +} + +} diff --git a/contrib/sdk/sources/libsupc++/typeinfo b/contrib/sdk/sources/libsupc++/typeinfo new file mode 100644 index 0000000000..be5991af7e --- /dev/null +++ b/contrib/sdk/sources/libsupc++/typeinfo @@ -0,0 +1,224 @@ +// RTTI support for -*- C++ -*- +// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +// 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +/** @file typeinfo + * This is a Standard C++ Library header. + */ + +#ifndef _TYPEINFO +#define _TYPEINFO + +#pragma GCC system_header + +#include +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include +#endif + +#pragma GCC visibility push(default) + +extern "C++" { + +namespace __cxxabiv1 +{ + class __class_type_info; +} // namespace __cxxabiv1 + +// Determine whether typeinfo names for the same type are merged (in which +// case comparison can just compare pointers) or not (in which case strings +// must be compared), and whether comparison is to be implemented inline or +// not. We used to do inline pointer comparison by default if weak symbols +// are available, but even with weak symbols sometimes names are not merged +// when objects are loaded with RTLD_LOCAL, so now we always use strcmp by +// default. For ABI compatibility, we do the strcmp inline if weak symbols +// are available, and out-of-line if not. Out-of-line pointer comparison +// is used where the object files are to be portable to multiple systems, +// some of which may not be able to use pointer comparison, but the +// particular system for which libstdc++ is being built can use pointer +// comparison; in particular for most ARM EABI systems, where the ABI +// specifies out-of-line comparison. The compiler's target configuration +// can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to +// 1 or 0 to indicate whether or not comparison is inline, and +// __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer +// comparison can be used. + +#ifndef __GXX_MERGED_TYPEINFO_NAMES +// By default, typeinfo names are not merged. +#define __GXX_MERGED_TYPEINFO_NAMES 0 +#endif + +// By default follow the old inline rules to avoid ABI changes. +#ifndef __GXX_TYPEINFO_EQUALITY_INLINE + #if !__GXX_WEAK__ + #define __GXX_TYPEINFO_EQUALITY_INLINE 0 + #else + #define __GXX_TYPEINFO_EQUALITY_INLINE 1 + #endif +#endif + +namespace std +{ + /** + * @brief Part of RTTI. + * + * The @c type_info class describes type information generated by + * an implementation. + */ + class type_info + { + public: + /** Destructor first. Being the first non-inline virtual function, this + * controls in which translation unit the vtable is emitted. The + * compiler makes use of that information to know where to emit + * the runtime-mandated type_info structures in the new-abi. */ + virtual ~type_info(); + + /** Returns an @e implementation-defined byte string; this is not + * portable between compilers! */ + const char* name() const + { return __name[0] == '*' ? __name + 1 : __name; } + +#if !__GXX_TYPEINFO_EQUALITY_INLINE + // In old abi, or when weak symbols are not supported, there can + // be multiple instances of a type_info object for one + // type. Uniqueness must use the _name value, not object address. + bool before(const type_info& __arg) const; + bool operator==(const type_info& __arg) const; +#else + #if !__GXX_MERGED_TYPEINFO_NAMES + /** Returns true if @c *this precedes @c __arg in the implementation's + * collation order. */ + // Even with the new abi, on systems that support dlopen + // we can run into cases where type_info names aren't merged, + // so we still need to do string comparison. + bool before(const type_info& __arg) const + { return (__name[0] == '*' && __arg.__name[0] == '*') + ? __name < __arg.__name + : __builtin_strcmp (__name, __arg.__name) < 0; } + + bool operator==(const type_info& __arg) const + { + return ((__name == __arg.__name) + || (__name[0] != '*' && + __builtin_strcmp (__name, __arg.__name) == 0)); + } + #else + // On some targets we can rely on type_info's NTBS being unique, + // and therefore address comparisons are sufficient. + bool before(const type_info& __arg) const + { return __name < __arg.__name; } + + bool operator==(const type_info& __arg) const + { return __name == __arg.__name; } + #endif +#endif + bool operator!=(const type_info& __arg) const + { return !operator==(__arg); } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + size_t hash_code() const noexcept + { +# if !__GXX_MERGED_TYPEINFO_NAMES + return _Hash_bytes(name(), __builtin_strlen(name()), + static_cast(0xc70f6907UL)); +# else + return reinterpret_cast(__name); +# endif + } +#endif // __GXX_EXPERIMENTAL_CXX0X__ + + // Return true if this is a pointer type of some kind + virtual bool __is_pointer_p() const; + + // Return true if this is a function type + virtual bool __is_function_p() const; + + // Try and catch a thrown type. Store an adjusted pointer to the + // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then + // THR_OBJ points to the thrown object. If THR_TYPE is a pointer + // type, then THR_OBJ is the pointer itself. OUTER indicates the + // number of outer pointers, and whether they were const + // qualified. + virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, + unsigned __outer) const; + + // Internally used during catch matching + virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, + void **__obj_ptr) const; + + protected: + const char *__name; + + explicit type_info(const char *__n): __name(__n) { } + + private: + /// Assigning type_info is not supported. + type_info& operator=(const type_info&); + type_info(const type_info&); + }; + + /** + * @brief Thrown during incorrect typecasting. + * @ingroup exceptions + * + * If you attempt an invalid @c dynamic_cast expression, an instance of + * this class (or something derived from this class) is thrown. */ + class bad_cast : public exception + { + public: + bad_cast() _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; + + /** + * @brief Thrown when a NULL pointer in a @c typeid expression is used. + * @ingroup exceptions + */ + class bad_typeid : public exception + { + public: + bad_typeid () _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; +} // namespace std + +} // extern "C++" + +#pragma GCC visibility pop + +#endif diff --git a/contrib/sdk/sources/libsupc++/unwind-cxx.h b/contrib/sdk/sources/libsupc++/unwind-cxx.h new file mode 100644 index 0000000000..a4a2b9de4c --- /dev/null +++ b/contrib/sdk/sources/libsupc++/unwind-cxx.h @@ -0,0 +1,382 @@ +// -*- C++ -*- Exception handling and frame unwind runtime interface routines. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +// 2011 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// 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. +// +// 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 +// . + +// This is derived from the C++ ABI for IA-64. Where we diverge +// for cross-architecture compatibility are noted with "@@@". + +#ifndef _UNWIND_CXX_H +#define _UNWIND_CXX_H 1 + +// Level 2: C++ ABI + +#include +#include +#include +#include "unwind.h" +#include +#include + +#pragma GCC visibility push(default) + +namespace __cxxabiv1 +{ + +// A primary C++ exception object consists of a header, which is a wrapper +// around an unwind object header with additional C++ specific information, +// followed by the exception object itself. + +struct __cxa_exception +{ + // Manage the exception object itself. + std::type_info *exceptionType; + void (_GLIBCXX_CDTOR_CALLABI *exceptionDestructor)(void *); + + // The C++ standard has entertaining rules wrt calling set_terminate + // and set_unexpected in the middle of the exception cleanup process. + std::unexpected_handler unexpectedHandler; + std::terminate_handler terminateHandler; + + // The caught exception stack threads through here. + __cxa_exception *nextException; + + // How many nested handlers have caught this exception. A negated + // value is a signal that this object has been rethrown. + int handlerCount; + +#ifdef __ARM_EABI_UNWINDER__ + // Stack of exceptions in cleanups. + __cxa_exception* nextPropagatingException; + + // The nuber of active cleanup handlers for this exception. + int propagationCount; +#else + // Cache parsed handler data from the personality routine Phase 1 + // for Phase 2 and __cxa_call_unexpected. + int handlerSwitchValue; + const unsigned char *actionRecord; + const unsigned char *languageSpecificData; + _Unwind_Ptr catchTemp; + void *adjustedPtr; +#endif + + // The generic exception header. Must be last. + _Unwind_Exception unwindHeader; +}; + +struct __cxa_refcounted_exception +{ + // Manage this header. + _Atomic_word referenceCount; + // __cxa_exception must be last, and no padding can be after it. + __cxa_exception exc; +}; + +// A dependent C++ exception object consists of a wrapper around an unwind +// object header with additional C++ specific information, containing a pointer +// to a primary exception object. + +struct __cxa_dependent_exception +{ + // The primary exception this thing depends on. + void *primaryException; + + // The C++ standard has entertaining rules wrt calling set_terminate + // and set_unexpected in the middle of the exception cleanup process. + std::unexpected_handler unexpectedHandler; + std::terminate_handler terminateHandler; + + // The caught exception stack threads through here. + __cxa_exception *nextException; + + // How many nested handlers have caught this exception. A negated + // value is a signal that this object has been rethrown. + int handlerCount; + +#ifdef __ARM_EABI_UNWINDER__ + // Stack of exceptions in cleanups. + __cxa_exception* nextPropagatingException; + + // The nuber of active cleanup handlers for this exception. + int propagationCount; +#else + // Cache parsed handler data from the personality routine Phase 1 + // for Phase 2 and __cxa_call_unexpected. + int handlerSwitchValue; + const unsigned char *actionRecord; + const unsigned char *languageSpecificData; + _Unwind_Ptr catchTemp; + void *adjustedPtr; +#endif + + // The generic exception header. Must be last. + _Unwind_Exception unwindHeader; +}; + +// Each thread in a C++ program has access to a __cxa_eh_globals object. +struct __cxa_eh_globals +{ + __cxa_exception *caughtExceptions; + unsigned int uncaughtExceptions; +#ifdef __ARM_EABI_UNWINDER__ + __cxa_exception* propagatingExceptions; +#endif +}; + +// @@@ These are not directly specified by the IA-64 C++ ABI. + +// Handles re-checking the exception specification if unexpectedHandler +// throws, and if bad_exception needs to be thrown. Called from the +// compiler. +extern "C" void __cxa_call_unexpected (void *) __attribute__((__noreturn__)); +extern "C" void __cxa_call_terminate (_Unwind_Exception*) throw () + __attribute__((__noreturn__)); + +#ifdef __ARM_EABI_UNWINDER__ +// Arm EABI specified routines. +typedef enum { + ctm_failed = 0, + ctm_succeeded = 1, + ctm_succeeded_with_ptr_to_base = 2 +} __cxa_type_match_result; +extern "C" __cxa_type_match_result __cxa_type_match(_Unwind_Exception*, + const std::type_info*, + bool, void**); +extern "C" bool __cxa_begin_cleanup (_Unwind_Exception*); +extern "C" void __cxa_end_cleanup (void); +#endif + +// Handles cleanup from transactional memory restart. +extern "C" void __cxa_tm_cleanup (void *, void *, unsigned int) throw(); + +// Invokes given handler, dying appropriately if the user handler was +// so inconsiderate as to return. +extern void __terminate(std::terminate_handler) throw () + __attribute__((__noreturn__)); +extern void __unexpected(std::unexpected_handler) + __attribute__((__noreturn__)); + +// The current installed user handlers. +extern std::terminate_handler __terminate_handler; +extern std::unexpected_handler __unexpected_handler; + +// These are explicitly GNU C++ specific. + +// Acquire the C++ exception header from the C++ object. +static inline __cxa_exception * +__get_exception_header_from_obj (void *ptr) +{ + return reinterpret_cast<__cxa_exception *>(ptr) - 1; +} + +// Acquire the C++ exception header from the generic exception header. +static inline __cxa_exception * +__get_exception_header_from_ue (_Unwind_Exception *exc) +{ + return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; +} + +// Acquire the C++ refcounted exception header from the C++ object. +static inline __cxa_refcounted_exception * +__get_refcounted_exception_header_from_obj (void *ptr) +{ + return reinterpret_cast<__cxa_refcounted_exception *>(ptr) - 1; +} + +// Acquire the C++ refcounted exception header from the generic exception +// header. +static inline __cxa_refcounted_exception * +__get_refcounted_exception_header_from_ue (_Unwind_Exception *exc) +{ + return reinterpret_cast<__cxa_refcounted_exception *>(exc + 1) - 1; +} + +static inline __cxa_dependent_exception * +__get_dependent_exception_from_ue (_Unwind_Exception *exc) +{ + return reinterpret_cast<__cxa_dependent_exception *>(exc + 1) - 1; +} + +#ifdef __ARM_EABI_UNWINDER__ +static inline bool +__is_gxx_exception_class(_Unwind_Exception_Class c) +{ + // TODO: Take advantage of the fact that c will always be word aligned. + return c[0] == 'G' + && c[1] == 'N' + && c[2] == 'U' + && c[3] == 'C' + && c[4] == 'C' + && c[5] == '+' + && c[6] == '+' + && (c[7] == '\0' || c[7] == '\x01'); +} + +// Only checks for primary or dependent, but not that it is a C++ exception at +// all. +static inline bool +__is_dependent_exception(_Unwind_Exception_Class c) +{ + return c[7] == '\x01'; +} + +static inline void +__GXX_INIT_PRIMARY_EXCEPTION_CLASS(_Unwind_Exception_Class c) +{ + c[0] = 'G'; + c[1] = 'N'; + c[2] = 'U'; + c[3] = 'C'; + c[4] = 'C'; + c[5] = '+'; + c[6] = '+'; + c[7] = '\0'; +} + +static inline void +__GXX_INIT_DEPENDENT_EXCEPTION_CLASS(_Unwind_Exception_Class c) +{ + c[0] = 'G'; + c[1] = 'N'; + c[2] = 'U'; + c[3] = 'C'; + c[4] = 'C'; + c[5] = '+'; + c[6] = '+'; + c[7] = '\x01'; +} + +static inline bool +__is_gxx_forced_unwind_class(_Unwind_Exception_Class c) +{ + return c[0] == 'G' + && c[1] == 'N' + && c[2] == 'U' + && c[3] == 'C' + && c[4] == 'F' + && c[5] == 'O' + && c[6] == 'R' + && c[7] == '\0'; +} + +static inline void +__GXX_INIT_FORCED_UNWIND_CLASS(_Unwind_Exception_Class c) +{ + c[0] = 'G'; + c[1] = 'N'; + c[2] = 'U'; + c[3] = 'C'; + c[4] = 'F'; + c[5] = 'O'; + c[6] = 'R'; + c[7] = '\0'; +} + +static inline void* +__gxx_caught_object(_Unwind_Exception* eo) +{ + return (void*)eo->barrier_cache.bitpattern[0]; +} +#else // !__ARM_EABI_UNWINDER__ +// This is the primary exception class we report -- "GNUCC++\0". +const _Unwind_Exception_Class __gxx_primary_exception_class += ((((((((_Unwind_Exception_Class) 'G' + << 8 | (_Unwind_Exception_Class) 'N') + << 8 | (_Unwind_Exception_Class) 'U') + << 8 | (_Unwind_Exception_Class) 'C') + << 8 | (_Unwind_Exception_Class) 'C') + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '\0'); + +// This is the dependent (from std::rethrow_exception) exception class we report +// "GNUCC++\x01" +const _Unwind_Exception_Class __gxx_dependent_exception_class += ((((((((_Unwind_Exception_Class) 'G' + << 8 | (_Unwind_Exception_Class) 'N') + << 8 | (_Unwind_Exception_Class) 'U') + << 8 | (_Unwind_Exception_Class) 'C') + << 8 | (_Unwind_Exception_Class) 'C') + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '+') + << 8 | (_Unwind_Exception_Class) '\x01'); + +static inline bool +__is_gxx_exception_class(_Unwind_Exception_Class c) +{ + return c == __gxx_primary_exception_class + || c == __gxx_dependent_exception_class; +} + +// Only checks for primary or dependent, but not that it is a C++ exception at +// all. +static inline bool +__is_dependent_exception(_Unwind_Exception_Class c) +{ + return (c & 1); +} + +#define __GXX_INIT_PRIMARY_EXCEPTION_CLASS(c) c = __gxx_primary_exception_class +#define __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(c) \ + c = __gxx_dependent_exception_class + +// GNU C++ personality routine, Version 0. +extern "C" _Unwind_Reason_Code __gxx_personality_v0 + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +// GNU C++ sjlj personality routine, Version 0. +extern "C" _Unwind_Reason_Code __gxx_personality_sj0 + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +static inline void* +__gxx_caught_object(_Unwind_Exception* eo) +{ + // Bad as it looks, this actually works for dependent exceptions too. + __cxa_exception* header = __get_exception_header_from_ue (eo); + return header->adjustedPtr; +} +#endif // !__ARM_EABI_UNWINDER__ + +static inline void* +__get_object_from_ue(_Unwind_Exception* eo) throw() +{ + return __is_dependent_exception (eo->exception_class) ? + __get_dependent_exception_from_ue (eo)->primaryException : + eo + 1; +} + +static inline void * +__get_object_from_ambiguous_exception(__cxa_exception *p_or_d) throw() +{ + return __get_object_from_ue (&p_or_d->unwindHeader); +} + + +} /* namespace __cxxabiv1 */ + +#pragma GCC visibility pop + +#endif // _UNWIND_CXX_H diff --git a/contrib/sdk/sources/libsupc++/unwind-pe.h b/contrib/sdk/sources/libsupc++/unwind-pe.h new file mode 100644 index 0000000000..121f877672 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/unwind-pe.h @@ -0,0 +1,289 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + 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. + + 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 + . */ + +/* @@@ Really this should be out of line, but this also causes link + compatibility problems with the base ABI. This is slightly better + than duplicating code, however. */ + +#ifndef GCC_UNWIND_PE_H +#define GCC_UNWIND_PE_H + +/* If using C++, references to abort have to be qualified with std::. */ +#if __cplusplus +#define __gxx_abort std::abort +#else +#define __gxx_abort abort +#endif + +/* Pointer encodings, from dwarf2.h. */ +#define DW_EH_PE_absptr 0x00 +#define DW_EH_PE_omit 0xff + +#define DW_EH_PE_uleb128 0x01 +#define DW_EH_PE_udata2 0x02 +#define DW_EH_PE_udata4 0x03 +#define DW_EH_PE_udata8 0x04 +#define DW_EH_PE_sleb128 0x09 +#define DW_EH_PE_sdata2 0x0A +#define DW_EH_PE_sdata4 0x0B +#define DW_EH_PE_sdata8 0x0C +#define DW_EH_PE_signed 0x08 + +#define DW_EH_PE_pcrel 0x10 +#define DW_EH_PE_textrel 0x20 +#define DW_EH_PE_datarel 0x30 +#define DW_EH_PE_funcrel 0x40 +#define DW_EH_PE_aligned 0x50 + +#define DW_EH_PE_indirect 0x80 + + +#ifndef NO_SIZE_OF_ENCODED_VALUE + +/* Given an encoding, return the number of bytes the format occupies. + This is only defined for fixed-size encodings, and so does not + include leb128. */ + +static unsigned int +size_of_encoded_value (unsigned char encoding) __attribute__ ((unused)); + +static unsigned int +size_of_encoded_value (unsigned char encoding) +{ + if (encoding == DW_EH_PE_omit) + return 0; + + switch (encoding & 0x07) + { + case DW_EH_PE_absptr: + return sizeof (void *); + case DW_EH_PE_udata2: + return 2; + case DW_EH_PE_udata4: + return 4; + case DW_EH_PE_udata8: + return 8; + } + __gxx_abort (); +} + +#endif + +#ifndef NO_BASE_OF_ENCODED_VALUE + +/* Given an encoding and an _Unwind_Context, return the base to which + the encoding is relative. This base may then be passed to + read_encoded_value_with_base for use when the _Unwind_Context is + not available. */ + +static _Unwind_Ptr +base_of_encoded_value (unsigned char encoding, struct _Unwind_Context *context) +{ + if (encoding == DW_EH_PE_omit) + return 0; + + switch (encoding & 0x70) + { + case DW_EH_PE_absptr: + case DW_EH_PE_pcrel: + case DW_EH_PE_aligned: + return 0; + + case DW_EH_PE_textrel: + return _Unwind_GetTextRelBase (context); + case DW_EH_PE_datarel: + return _Unwind_GetDataRelBase (context); + case DW_EH_PE_funcrel: + return _Unwind_GetRegionStart (context); + } + __gxx_abort (); +} + +#endif + +/* Read an unsigned leb128 value from P, store the value in VAL, return + P incremented past the value. We assume that a word is large enough to + hold any value so encoded; if it is smaller than a pointer on some target, + pointers should not be leb128 encoded on that target. */ + +static const unsigned char * +read_uleb128 (const unsigned char *p, _uleb128_t *val) +{ + unsigned int shift = 0; + unsigned char byte; + _uleb128_t result; + + result = 0; + do + { + byte = *p++; + result |= ((_uleb128_t)byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + *val = result; + return p; +} + +/* Similar, but read a signed leb128 value. */ + +static const unsigned char * +read_sleb128 (const unsigned char *p, _sleb128_t *val) +{ + unsigned int shift = 0; + unsigned char byte; + _uleb128_t result; + + result = 0; + do + { + byte = *p++; + result |= ((_uleb128_t)byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + + /* Sign-extend a negative value. */ + if (shift < 8 * sizeof(result) && (byte & 0x40) != 0) + result |= -(((_uleb128_t)1L) << shift); + + *val = (_sleb128_t) result; + return p; +} + +/* Load an encoded value from memory at P. The value is returned in VAL; + The function returns P incremented past the value. BASE is as given + by base_of_encoded_value for this encoding in the appropriate context. */ + +static const unsigned char * +read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base, + const unsigned char *p, _Unwind_Ptr *val) +{ + union unaligned + { + void *ptr; + unsigned u2 __attribute__ ((mode (HI))); + unsigned u4 __attribute__ ((mode (SI))); + unsigned u8 __attribute__ ((mode (DI))); + signed s2 __attribute__ ((mode (HI))); + signed s4 __attribute__ ((mode (SI))); + signed s8 __attribute__ ((mode (DI))); + } __attribute__((__packed__)); + + const union unaligned *u = (const union unaligned *) p; + _Unwind_Internal_Ptr result; + + if (encoding == DW_EH_PE_aligned) + { + _Unwind_Internal_Ptr a = (_Unwind_Internal_Ptr) p; + a = (a + sizeof (void *) - 1) & - sizeof(void *); + result = *(_Unwind_Internal_Ptr *) a; + p = (const unsigned char *) (_Unwind_Internal_Ptr) (a + sizeof (void *)); + } + else + { + switch (encoding & 0x0f) + { + case DW_EH_PE_absptr: + result = (_Unwind_Internal_Ptr) u->ptr; + p += sizeof (void *); + break; + + case DW_EH_PE_uleb128: + { + _uleb128_t tmp; + p = read_uleb128 (p, &tmp); + result = (_Unwind_Internal_Ptr) tmp; + } + break; + + case DW_EH_PE_sleb128: + { + _sleb128_t tmp; + p = read_sleb128 (p, &tmp); + result = (_Unwind_Internal_Ptr) tmp; + } + break; + + case DW_EH_PE_udata2: + result = u->u2; + p += 2; + break; + case DW_EH_PE_udata4: + result = u->u4; + p += 4; + break; + case DW_EH_PE_udata8: + result = u->u8; + p += 8; + break; + + case DW_EH_PE_sdata2: + result = u->s2; + p += 2; + break; + case DW_EH_PE_sdata4: + result = u->s4; + p += 4; + break; + case DW_EH_PE_sdata8: + result = u->s8; + p += 8; + break; + + default: + __gxx_abort (); + } + + if (result != 0) + { + result += ((encoding & 0x70) == DW_EH_PE_pcrel + ? (_Unwind_Internal_Ptr) u : base); + if (encoding & DW_EH_PE_indirect) + result = *(_Unwind_Internal_Ptr *) result; + } + } + + *val = result; + return p; +} + +#ifndef NO_BASE_OF_ENCODED_VALUE + +/* Like read_encoded_value_with_base, but get the base from the context + rather than providing it directly. */ + +static inline const unsigned char * +read_encoded_value (struct _Unwind_Context *context, unsigned char encoding, + const unsigned char *p, _Unwind_Ptr *val) +{ + return read_encoded_value_with_base (encoding, + base_of_encoded_value (encoding, context), + p, val); +} + +#endif + +#endif /* unwind-pe.h */ diff --git a/contrib/sdk/sources/libsupc++/vmi_class_type_info.cc b/contrib/sdk/sources/libsupc++/vmi_class_type_info.cc new file mode 100644 index 0000000000..195061d72e --- /dev/null +++ b/contrib/sdk/sources/libsupc++/vmi_class_type_info.cc @@ -0,0 +1,391 @@ +// Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2009 +// Free Software Foundation +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. + +// 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. + +// 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 +// . + +#include "tinfo.h" + +namespace __cxxabiv1 { + +__vmi_class_type_info:: +~__vmi_class_type_info () +{} + +__class_type_info::__sub_kind __vmi_class_type_info:: +__do_find_public_src (ptrdiff_t src2dst, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr) const +{ + if (obj_ptr == src_ptr && *this == *src_type) + return __contained_public; + + for (std::size_t i = __base_count; i--;) + { + if (!__base_info[i].__is_public_p ()) + continue; // Not public, can't be here. + + const void *base = obj_ptr; + ptrdiff_t offset = __base_info[i].__offset (); + bool is_virtual = __base_info[i].__is_virtual_p (); + + if (is_virtual) + { + if (src2dst == -3) + continue; // Not a virtual base, so can't be here. + } + base = convert_to_base (base, is_virtual, offset); + + __sub_kind base_kind = __base_info[i].__base_type->__do_find_public_src + (src2dst, base, src_type, src_ptr); + if (contained_p (base_kind)) + { + if (is_virtual) + base_kind = __sub_kind (base_kind | __contained_virtual_mask); + return base_kind; + } + } + + return __not_contained; +} + +// This is a big hairy function. Although the run-time behaviour of +// dynamic_cast is simple to describe, it gives rise to some non-obvious +// behaviour. We also desire to determine as early as possible any definite +// answer we can get. Because it is unknown what the run-time ratio of +// succeeding to failing dynamic casts is, we do not know in which direction +// to bias any optimizations. To that end we make no particular effort towards +// early fail answers or early success answers. Instead we try to minimize +// work by filling in things lazily (when we know we need the information), +// and opportunisticly take early success or failure results. +bool __vmi_class_type_info:: +__do_dyncast (ptrdiff_t src2dst, + __sub_kind access_path, + const __class_type_info *dst_type, + const void *obj_ptr, + const __class_type_info *src_type, + const void *src_ptr, + __dyncast_result &__restrict result) const +{ + if (result.whole_details & __flags_unknown_mask) + result.whole_details = __flags; + + if (obj_ptr == src_ptr && *this == *src_type) + { + // The src object we started from. Indicate how we are accessible from + // the most derived object. + result.whole2src = access_path; + return false; + } + if (*this == *dst_type) + { + result.dst_ptr = obj_ptr; + result.whole2dst = access_path; + if (src2dst >= 0) + result.dst2src = adjust_pointer (obj_ptr, src2dst) == src_ptr + ? __contained_public : __not_contained; + else if (src2dst == -2) + result.dst2src = __not_contained; + return false; + } + + // If src_type is a unique non-virtual base of dst_type, we have a good + // guess at the address we want, so in the first pass try skipping any + // bases which don't contain that address. + const void *dst_cand = NULL; + if (src2dst >= 0) + dst_cand = adjust_pointer(src_ptr, -src2dst); + bool first_pass = true; + bool skipped = false; + + bool result_ambig = false; + again: + for (std::size_t i = __base_count; i--;) + { + __dyncast_result result2 (result.whole_details); + void const *base = obj_ptr; + __sub_kind base_access = access_path; + ptrdiff_t offset = __base_info[i].__offset (); + bool is_virtual = __base_info[i].__is_virtual_p (); + + if (is_virtual) + base_access = __sub_kind (base_access | __contained_virtual_mask); + base = convert_to_base (base, is_virtual, offset); + + if (dst_cand) + { + bool skip_on_first_pass = base > dst_cand; + if (skip_on_first_pass == first_pass) + { + // We aren't interested in this base on this pass: either + // we're on the first pass and this base doesn't contain the + // likely address, or we're on the second pass and we checked + // this base on the first pass. + skipped = true; + continue; + } + } + + if (!__base_info[i].__is_public_p ()) + { + if (src2dst == -2 && + !(result.whole_details + & (__non_diamond_repeat_mask | __diamond_shaped_mask))) + // The hierarchy has no duplicate bases (which might ambiguate + // things) and where we started is not a public base of what we + // want (so it cannot be a downcast). There is nothing of interest + // hiding in a non-public base. + continue; + base_access = __sub_kind (base_access & ~__contained_public_mask); + } + + bool result2_ambig + = __base_info[i].__base_type->__do_dyncast (src2dst, base_access, + dst_type, base, + src_type, src_ptr, result2); + result.whole2src = __sub_kind (result.whole2src | result2.whole2src); + if (result2.dst2src == __contained_public + || result2.dst2src == __contained_ambig) + { + result.dst_ptr = result2.dst_ptr; + result.whole2dst = result2.whole2dst; + result.dst2src = result2.dst2src; + // Found a downcast which can't be bettered or an ambiguous downcast + // which can't be disambiguated + return result2_ambig; + } + + if (!result_ambig && !result.dst_ptr) + { + // Not found anything yet. + result.dst_ptr = result2.dst_ptr; + result.whole2dst = result2.whole2dst; + result_ambig = result2_ambig; + if (result.dst_ptr && result.whole2src != __unknown + && !(__flags & __non_diamond_repeat_mask)) + // Found dst and src and we don't have repeated bases. + return result_ambig; + } + else if (result.dst_ptr && result.dst_ptr == result2.dst_ptr) + { + // Found at same address, must be via virtual. Pick the most + // accessible path. + result.whole2dst = + __sub_kind (result.whole2dst | result2.whole2dst); + } + else if ((result.dst_ptr != 0 && result2.dst_ptr != 0) + || (result.dst_ptr != 0 && result2_ambig) + || (result2.dst_ptr != 0 && result_ambig)) + { + // Found two different DST_TYPE bases, or a valid one and a set of + // ambiguous ones, must disambiguate. See whether SRC_PTR is + // contained publicly within one of the non-ambiguous choices. If it + // is in only one, then that's the choice. If it is in both, then + // we're ambiguous and fail. If it is in neither, we're ambiguous, + // but don't yet fail as we might later find a third base which does + // contain SRC_PTR. + + __sub_kind new_sub_kind = result2.dst2src; + __sub_kind old_sub_kind = result.dst2src; + + if (contained_p (result.whole2src) + && (!virtual_p (result.whole2src) + || !(result.whole_details & __diamond_shaped_mask))) + { + // We already found SRC_PTR as a base of most derived, and + // either it was non-virtual, or the whole hierarchy is + // not-diamond shaped. Therefore if it is in either choice, it + // can only be in one of them, and we will already know. + if (old_sub_kind == __unknown) + old_sub_kind = __not_contained; + if (new_sub_kind == __unknown) + new_sub_kind = __not_contained; + } + else + { + if (old_sub_kind >= __not_contained) + ;// already calculated + else if (contained_p (new_sub_kind) + && (!virtual_p (new_sub_kind) + || !(__flags & __diamond_shaped_mask))) + // Already found inside the other choice, and it was + // non-virtual or we are not diamond shaped. + old_sub_kind = __not_contained; + else + old_sub_kind = dst_type->__find_public_src + (src2dst, result.dst_ptr, src_type, src_ptr); + + if (new_sub_kind >= __not_contained) + ;// already calculated + else if (contained_p (old_sub_kind) + && (!virtual_p (old_sub_kind) + || !(__flags & __diamond_shaped_mask))) + // Already found inside the other choice, and it was + // non-virtual or we are not diamond shaped. + new_sub_kind = __not_contained; + else + new_sub_kind = dst_type->__find_public_src + (src2dst, result2.dst_ptr, src_type, src_ptr); + } + + // Neither sub_kind can be contained_ambig -- we bail out early + // when we find those. + if (contained_p (__sub_kind (new_sub_kind ^ old_sub_kind))) + { + // Only on one choice, not ambiguous. + if (contained_p (new_sub_kind)) + { + // Only in new. + result.dst_ptr = result2.dst_ptr; + result.whole2dst = result2.whole2dst; + result_ambig = false; + old_sub_kind = new_sub_kind; + } + result.dst2src = old_sub_kind; + if (public_p (result.dst2src)) + return false; // Can't be an ambiguating downcast for later discovery. + if (!virtual_p (result.dst2src)) + return false; // Found non-virtually can't be bettered + } + else if (contained_p (__sub_kind (new_sub_kind & old_sub_kind))) + { + // In both. + result.dst_ptr = NULL; + result.dst2src = __contained_ambig; + return true; // Fail. + } + else + { + // In neither publicly, ambiguous for the moment, but keep + // looking. It is possible that it was private in one or + // both and therefore we should fail, but that's just tough. + result.dst_ptr = NULL; + result.dst2src = __not_contained; + result_ambig = true; + } + } + + if (result.whole2src == __contained_private) + // We found SRC_PTR as a private non-virtual base, therefore all + // cross casts will fail. We have already found a down cast, if + // there is one. + return result_ambig; + } + + if (skipped && first_pass) + { + // We didn't find dst where we expected it, so let's go back and try + // the bases we skipped (if any). + first_pass = false; + goto again; + } + + return result_ambig; +} + +bool __vmi_class_type_info:: +__do_upcast (const __class_type_info *dst, const void *obj_ptr, + __upcast_result &__restrict result) const +{ + if (__class_type_info::__do_upcast (dst, obj_ptr, result)) + return true; + + int src_details = result.src_details; + if (src_details & __flags_unknown_mask) + src_details = __flags; + + for (std::size_t i = __base_count; i--;) + { + __upcast_result result2 (src_details); + const void *base = obj_ptr; + ptrdiff_t offset = __base_info[i].__offset (); + bool is_virtual = __base_info[i].__is_virtual_p (); + bool is_public = __base_info[i].__is_public_p (); + + if (!is_public && !(src_details & __non_diamond_repeat_mask)) + // original cannot have an ambiguous base, so skip private bases + continue; + + if (base) + base = convert_to_base (base, is_virtual, offset); + + if (__base_info[i].__base_type->__do_upcast (dst, base, result2)) + { + if (result2.base_type == nonvirtual_base_type && is_virtual) + result2.base_type = __base_info[i].__base_type; + if (contained_p (result2.part2dst) && !is_public) + result2.part2dst = __sub_kind (result2.part2dst & ~__contained_public_mask); + + if (!result.base_type) + { + result = result2; + if (!contained_p (result.part2dst)) + return true; // found ambiguously + + if (result.part2dst & __contained_public_mask) + { + if (!(__flags & __non_diamond_repeat_mask)) + return true; // cannot have an ambiguous other base + } + else + { + if (!virtual_p (result.part2dst)) + return true; // cannot have another path + if (!(__flags & __diamond_shaped_mask)) + return true; // cannot have a more accessible path + } + } + else if (result.dst_ptr != result2.dst_ptr) + { + // Found an ambiguity. + result.dst_ptr = NULL; + result.part2dst = __contained_ambig; + return true; + } + else if (result.dst_ptr) + { + // Ok, found real object via a virtual path. + result.part2dst + = __sub_kind (result.part2dst | result2.part2dst); + } + else + { + // Dealing with a null pointer, need to check vbase + // containing each of the two choices. + if (result2.base_type == nonvirtual_base_type + || result.base_type == nonvirtual_base_type + || !(*result2.base_type == *result.base_type)) + { + // Already ambiguous, not virtual or via different virtuals. + // Cannot match. + result.part2dst = __contained_ambig; + return true; + } + result.part2dst + = __sub_kind (result.part2dst | result2.part2dst); + } + } + } + return result.part2dst != __unknown; +} + +} diff --git a/contrib/sdk/sources/libsupc++/vterminate.cc b/contrib/sdk/sources/libsupc++/vterminate.cc new file mode 100644 index 0000000000..00c86e54c7 --- /dev/null +++ b/contrib/sdk/sources/libsupc++/vterminate.cc @@ -0,0 +1,101 @@ +// Verbose terminate_handler -*- C++ -*- + +// Copyright (C) 2001, 2002, 2004, 2005, 2009, 2011 Free Software Foundation +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library 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. + +// 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 +// . + +#include + +#if _GLIBCXX_HOSTED +#include +#include +#include +#include +# include + +using namespace std; +using namespace abi; + +namespace __gnu_cxx +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // A replacement for the standard terminate_handler which prints + // more information about the terminating exception (if any) on + // stderr. + void __verbose_terminate_handler() + { + static bool terminating; + if (terminating) + { + //fputs("terminate called recursively\n", stderr); + abort (); + } + terminating = true; + + // Make sure there was an exception; terminate is also called for an + // attempt to rethrow when there is no suitable exception. + type_info *t = __cxa_current_exception_type(); + if (t) + { + // Note that "name" is the mangled name. + char const *name = t->name(); + { + int status = -1; + char *dem = 0; + +// dem = __cxa_demangle(name, 0, 0, &status); + +// fputs("terminate called after throwing an instance of '", stderr); +// if (status == 0) +// fputs(dem, stderr); +// else +// fputs(name, stderr); +// fputs("'\n", stderr); + +// if (status == 0) +// free(dem); + } + + // If the exception is derived from std::exception, we can + // give more information. + __try { __throw_exception_again; } +#ifdef __EXCEPTIONS + __catch(const exception& exc) + { + char const *w = exc.what(); +// fputs(" what(): ", stderr); +// fputs(w, stderr); +// fputs("\n", stderr); + } +#endif + __catch(...) { } + } + else; +// fputs("terminate called without an active exception\n", stderr); + + abort(); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif