[llvm-commits] [125637] arm EABI patch (from Lauro Ramos Venancio)

johannes at apple.com johannes at apple.com
Mon Apr 2 17:10:48 PDT 2007


Revision: 125637
Author:   johannes
Date:     2007-04-02 17:10:47 -0700 (Mon, 02 Apr 2007)

Log Message:
-----------
arm EABI patch (from Lauro Ramos Venancio)

Modified Paths:
--------------
    apple-local/branches/llvm/libstdc++-v3/Makefile.in
    apple-local/branches/llvm/libstdc++-v3/acinclude.m4
    apple-local/branches/llvm/libstdc++-v3/aclocal.m4
    apple-local/branches/llvm/libstdc++-v3/configure
    apple-local/branches/llvm/libstdc++-v3/include/Makefile.in
    apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in
    apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am
    apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in
    apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc
    apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc
    apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc
    apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h
    apple-local/branches/llvm/libstdc++-v3/po/Makefile.in
    apple-local/branches/llvm/libstdc++-v3/src/Makefile.in

Modified: apple-local/branches/llvm/libstdc++-v3/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -408,7 +408,13 @@
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	target=`echo $@ | sed s/-recursive//`; \
 	list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -420,7 +426,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done; \
 	if test "$$dot_seen" = "no"; then \
 	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -428,7 +434,13 @@
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-	@set fnord $$MAKEFLAGS; amf=$$2; \
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
 	dot_seen=no; \
 	case "$@" in \
 	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -449,7 +461,7 @@
 	    local_target="$$target"; \
 	  fi; \
 	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	  || eval $$failcom; \
 	done && test -z "$$fail"
 tags-recursive:
 	list='$(SUBDIRS)'; for subdir in $$list; do \

Modified: apple-local/branches/llvm/libstdc++-v3/acinclude.m4
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/acinclude.m4	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/acinclude.m4	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1675,6 +1675,10 @@
         enable_sjlj_exceptions=yes
       elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
         enable_sjlj_exceptions=no
+      #APPLE LOCAL begin LLVM
+      elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
+        enable_sjlj_exceptions=no
+      #APPLE LOCAL end LLVM
       fi
     fi
     # APPLE LOCAL LLVM HACK!

Modified: apple-local/branches/llvm/libstdc++-v3/aclocal.m4
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/aclocal.m4	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/aclocal.m4	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,24 +11,12 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-#                                                        -*- Autoconf -*-
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
-# Generated from amversion.in; do not edit by hand.
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -40,27 +28,16 @@
 # Call AM_AUTOMAKE_VERSION so it can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-	 [AM_AUTOMAKE_VERSION([1.9.3])])
+	 [AM_AUTOMAKE_VERSION([1.9.5])])
 
-# AM_AUX_DIR_EXPAND
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -106,27 +83,17 @@
 am_aux_dir=`cd $ac_aux_dir && pwd`
 ])
 
-# AM_CONDITIONAL                                              -*- Autoconf -*-
+# AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 7
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 6
-
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
@@ -149,31 +116,20 @@
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Do all the work for Automake.                            -*- Autoconf -*-
+# Do all the work for Automake.                             -*- Autoconf -*-
 
-# This macro actually does too much some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 12
 
-# 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.
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 11
-
 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
 # -----------------------------------------------
@@ -333,29 +289,18 @@
 rmdir .tst 2>/dev/null
 AC_SUBST([am__leading_dot])])
 
-# Add --enable-maintainer-mode option to configure.
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 4
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 3
-
 AC_DEFUN([AM_MAINTAINER_MODE],
 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode is disabled by default
@@ -373,28 +318,17 @@
 
 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
 
-#  -*- Autoconf -*-
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+# serial 4
 
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 3
-
 # AM_MISSING_PROG(NAME, PROGRAM)
 # ------------------------------
 AC_DEFUN([AM_MISSING_PROG],
@@ -419,27 +353,16 @@
 fi
 ])
 
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+#
 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
 # created by `make install' are always world readable, even if the
 # installer happens to have an overly restrictive umask (e.g. 077).
@@ -493,26 +416,15 @@
 fi
 AC_SUBST([mkdir_p])])
 
-# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004
+# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
 # Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 5
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 4
-
 # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
 # ---------------------------------------------------
 # Add --enable-multilib to configure.
@@ -562,27 +474,16 @@
 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
 CC="$CC"])])dnl
 
-# Helper functions for option handling.                    -*- Autoconf -*-
+# Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 3
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 2
-
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
 AC_DEFUN([_AM_MANGLE_OPTION],
@@ -606,29 +507,17 @@
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
 #
-# Check to make sure that the build environment is sane.
-#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
+# serial 4
 
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 3
-
 # AM_SANITY_CHECK
 # ---------------
 AC_DEFUN([AM_SANITY_CHECK],
@@ -670,25 +559,14 @@
 fi
 AC_MSG_RESULT(yes)])
 
-# AM_PROG_INSTALL_STRIP
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
-
-# 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, 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
+# AM_PROG_INSTALL_STRIP
+# ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
 # specify the program used to strip binaries.  This is especially
 # annoying in cross-compiling environments, where the build's strip
@@ -711,26 +589,14 @@
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-# 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, or (at your option)
-# any later version.
+# serial 2
 
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 1
-
-
 # _AM_PROG_TAR(FORMAT)
 # --------------------
 # Check how to create a tarball in format FORMAT.

Modified: apple-local/branches/llvm/libstdc++-v3/configure
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/configure	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/configure	2007-04-03 00:10:47 UTC (rev 125637)
@@ -5031,6 +5031,8 @@
         enable_sjlj_exceptions=yes
       elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
         enable_sjlj_exceptions=no
+      elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
+        enable_sjlj_exceptions=no
       fi
     fi
     # APPLE LOCAL LLVM HACK!

Modified: apple-local/branches/llvm/libstdc++-v3/include/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/include/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/include/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Modified: apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am	2007-04-03 00:10:47 UTC (rev 125637)
@@ -45,7 +45,13 @@
 	del_opv.cc \
 	del_opvnt.cc \
 	eh_alloc.cc \
+#APPLE LOCAL begin LLVM \
+	eh_arm.cc \
+#APPLE LOCAL end LLVM \
 	eh_aux_runtime.cc \
+#APPLE LOCAL begin LLVM \
+	eh_call.cc \
+#APPLE LOCAL end LLVM \
 	eh_catch.cc \
 	eh_exception.cc \
 	eh_globals.cc \

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -65,29 +65,31 @@
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 libsupc___la_LIBADD =
 am__libsupc___la_SOURCES_DIST = del_op.cc del_opnt.cc del_opv.cc \
-	del_opvnt.cc eh_alloc.cc eh_aux_runtime.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.cc \
-	eh_unex_handler.cc guard.cc new_handler.cc new_op.cc \
-	new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc \
-	vec.cc vterminate.cc cp-demangle.c
+	del_opvnt.cc eh_alloc.cc eh_arm.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.cc eh_unex_handler.cc guard.cc \
+	new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc \
+	pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc cp-demangle.c
 am__objects_1 = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \
-	eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo \
-	eh_globals.lo eh_personality.lo eh_term_handler.lo \
-	eh_terminate.lo eh_throw.lo eh_type.lo eh_unex_handler.lo \
-	guard.lo new_handler.lo new_op.lo new_opnt.lo new_opv.lo \
-	new_opvnt.lo pure.lo tinfo.lo tinfo2.lo vec.lo vterminate.lo
+	eh_alloc.lo eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \
+	eh_exception.lo eh_globals.lo eh_personality.lo \
+	eh_term_handler.lo eh_terminate.lo eh_throw.lo eh_type.lo \
+	eh_unex_handler.lo guard.lo new_handler.lo new_op.lo \
+	new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo tinfo2.lo \
+	vec.lo vterminate.lo
 @GLIBCXX_HOSTED_TRUE at am__objects_2 = cp-demangle.lo
 am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS)
 libsupc__convenience_la_LIBADD =
 am__libsupc__convenience_la_SOURCES_DIST = del_op.cc del_opnt.cc \
-	del_opv.cc del_opvnt.cc eh_alloc.cc eh_aux_runtime.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.cc \
-	eh_unex_handler.cc guard.cc new_handler.cc new_op.cc \
-	new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc \
-	vec.cc vterminate.cc cp-demangle.c
+	del_opv.cc del_opvnt.cc eh_alloc.cc eh_arm.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.cc eh_unex_handler.cc \
+	guard.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc \
+	new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc \
+	cp-demangle.c
 am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libsupc__convenience_la_OBJECTS =  \
 	$(am_libsupc__convenience_la_OBJECTS)
@@ -310,7 +312,13 @@
 	del_opv.cc \
 	del_opvnt.cc \
 	eh_alloc.cc \
+#APPLE LOCAL begin LLVM \
+	eh_arm.cc \
+#APPLE LOCAL end LLVM \
 	eh_aux_runtime.cc \
+#APPLE LOCAL begin LLVM \
+	eh_call.cc \
+#APPLE LOCAL end LLVM \
 	eh_catch.cc \
 	eh_exception.cc \
 	eh_globals.cc \

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc	2007-04-03 00:10:47 UTC (rev 125637)
@@ -38,9 +38,10 @@
 {
   _Unwind_Exception *exceptionObject
     = reinterpret_cast <_Unwind_Exception *>(exc_obj_in);
-  __cxa_exception *header = __get_exception_header_from_ue (exceptionObject);
 
-  return header->adjustedPtr;
+// APPLE LOCAL begin LLVM
+  return __gxx_caught_object(exceptionObject);
+// APPLE LOCAL end LLVM
 }
 
 extern "C" void *
@@ -51,12 +52,17 @@
   __cxa_eh_globals *globals = __cxa_get_globals ();
   __cxa_exception *prev = globals->caughtExceptions;
   __cxa_exception *header = __get_exception_header_from_ue (exceptionObject);
+// APPLE LOCAL begin LLVM
+  void* objectp;
+// APPLE LOCAL end LLVM
 
   // 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 (header->unwindHeader.exception_class != __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+  if (!__is_gxx_exception_class(header->unwindHeader.exception_class))
+// APPLE LOCAL end LLVM
     {
       if (prev != 0)
 	std::terminate ();
@@ -85,7 +91,13 @@
       globals->caughtExceptions = header;
     }
 
-  return header->adjustedPtr;
+// APPLE LOCAL begin LLVM
+  objectp = __gxx_caught_object(exceptionObject);
+#ifdef __ARM_EABI_UNWINDER__
+  _Unwind_Complete(exceptionObject);
+#endif
+  return objectp;
+// APPLE LOCAL end LLVM
 }
 
 
@@ -102,7 +114,9 @@
 
   // A foreign exception couldn't have been stacked (see above),
   // so by definition processing must be complete.
-  if (header->unwindHeader.exception_class != __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+  if (!__is_gxx_exception_class(header->unwindHeader.exception_class))
+// APPLE LOCAL end LLVM
     {
       globals->caughtExceptions = 0;
       _Unwind_DeleteException (&header->unwindHeader);

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc	2007-04-03 00:10:47 UTC (rev 125637)
@@ -35,6 +35,12 @@
 
 using namespace __cxxabiv1;
 
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+#define NO_SIZE_OF_ENCODED_VALUE
+#endif
+// APPLE LOCAL end LLVM
+
 #include "unwind-pe.h"
 
 
@@ -84,6 +90,119 @@
   return p;
 }
 
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+
+// Return an element from a type table.
+
+static const std::type_info*
+get_ttype_entry(lsda_header_info* info, _Unwind_Word i)
+{
+  _Unwind_Ptr ptr;
+
+  ptr = (_Unwind_Ptr) (info->TType - (i * 4));
+  ptr = _Unwind_decode_target2(ptr);
+  
+  return reinterpret_cast<const std::type_info *>(ptr);
+}
+
+// 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, _Unwind_Sword filter_value)
+{
+  const _Unwind_Word* e = ((const _Unwind_Word*) info->TType)
+			  - filter_value - 1;
+
+  while (1)
+    {
+      const std::type_info* catch_type;
+      _Unwind_Word 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_target2((_Unwind_Word) e);
+
+      // Match a ttype entry.
+      catch_type = reinterpret_cast<const std::type_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;
+
+      // 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, 13);
+    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)
+
+#else
+// APPLE LOCAL end LLVM
+typedef const std::type_info _throw_typet;
+
+
+// Return an element from a type table.
+
 static const std::type_info *
 get_ttype_entry (lsda_header_info *info, _Unwind_Word i)
 {
@@ -127,8 +246,10 @@
 // Return true if THROW_TYPE matches one if the filter types.
 
 static bool
-check_exception_spec (lsda_header_info *info, const std::type_info *throw_type,
-		      void *thrown_ptr, _Unwind_Sword filter_value)
+// APPLE LOCAL begin LLVM
+check_exception_spec(lsda_header_info* info, _throw_typet* throw_type,
+		      void* thrown_ptr, _Unwind_Sword filter_value)
+// APPLE LOCAL end LLVM
 {
   const unsigned char *e = info->TType - filter_value - 1;
 
@@ -156,6 +277,52 @@
     }
 }
 
+
+// APPLE LOCAL begin LLVM
+// 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
+
+#endif // !__ARM_EABI_UNWINDER__
+// APPLE LOCAL end LLVM
+
 // Return true if the filter spec is empty, ie throw().
 
 static bool
@@ -178,14 +345,20 @@
 #endif
 
 extern "C" _Unwind_Reason_Code
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+PERSONALITY_FUNCTION (_Unwind_State state,
+		      struct _Unwind_Exception* ue_header,
+		      struct _Unwind_Context* context)
+#else
+// APPLE LOCAL end LLVM
 PERSONALITY_FUNCTION (int version,
 		      _Unwind_Action actions,
 		      _Unwind_Exception_Class exception_class,
 		      struct _Unwind_Exception *ue_header,
 		      struct _Unwind_Context *context)
+#endif
 {
-  __cxa_exception *xh = __get_exception_header_from_ue (ue_header);
-
   enum found_handler_type
   {
     found_nothing,
@@ -200,19 +373,66 @@
   const unsigned char *p;
   _Unwind_Ptr landing_pad, ip;
   int handler_switch_value;
-  void *thrown_ptr = xh + 1;
+// APPLE LOCAL begin LLVM
+  void* thrown_ptr = ue_header + 1;
+  bool foreign_exception;
 
+#ifdef __ARM_EABI_UNWINDER__
+  _Unwind_Action actions;
+
+  switch (state)
+    {
+    case _US_VIRTUAL_UNWIND_FRAME:
+      actions = _UA_SEARCH_PHASE;
+      break;
+
+    case _US_UNWIND_FRAME_STARTING:
+      actions = _UA_CLEANUP_PHASE;
+      if (ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13))
+	actions |= _UA_HANDLER_FRAME;
+      break;
+
+    case _US_UNWIND_FRAME_RESUME:
+      CONTINUE_UNWINDING;
+      break;
+
+    default:
+      abort();
+    }
+
+  // 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 the
+  // virtual IP register point at the UCB.
+  ip = (_Unwind_Ptr) ue_header;
+  _Unwind_SetGR(context, 12, ip);
+#else
+  __cxa_exception* xh = __get_exception_header_from_ue(ue_header);
+// APPLE LOCAL end LLVM
+
   // Interface version check.
   if (version != 1)
     return _URC_FATAL_PHASE1_ERROR;
+// APPLE LOCAL begin LLVM
+  foreign_exception = !__is_gxx_exception_class(exception_class);
+#endif
+// APPLE LOCAL end LLVM
 
   // Shortcut for phase 2 found handler for domestic exception.
+// APPLE LOCAL begin LLVM
   if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME)
-      && exception_class == __gxx_exception_class)
+      && !foreign_exception)
+// APPLE LOCAL end LLVM
     {
-      handler_switch_value = xh->handlerSwitchValue;
-      language_specific_data = xh->languageSpecificData;
-      landing_pad = (_Unwind_Ptr) xh->catchTemp;
+// APPLE LOCAL begin LLVM
+      restore_caught_exception(ue_header, handler_switch_value,
+			       language_specific_data, landing_pad);
+// APPLE LOCAL end LLVM
       found_type = (landing_pad == 0 ? found_terminate : found_handler);
       goto install_context;
     }
@@ -222,11 +442,15 @@
 
   // If no LSDA, then there are no handlers or cleanups.
   if (! language_specific_data)
-    return _URC_CONTINUE_UNWIND;
+// APPLE LOCAL begin LLVM
+    CONTINUE_UNWINDING;
+// APPLE LOCAL end LLVM
 
   // Parse the LSDA header.
   p = parse_lsda_header (context, language_specific_data, &info);
-  info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
+// APPLE LOCAL begin LLVM
+  info.ttype_base = 0;
+// APPLE LOCAL end LLVM
   ip = _Unwind_GetIP (context) - 1;
   landing_pad = 0;
   action_record = 0;
@@ -312,7 +536,10 @@
       // Otherwise we have a catch handler or exception specification.
 
       _Unwind_Sword ar_filter, ar_disp;
-      const std::type_info *throw_type, *catch_type;
+// APPLE LOCAL begin LLVM
+      const std::type_info* catch_type;
+      _throw_typet* throw_type;
+// APPLE LOCAL end LLVM
       bool saw_cleanup = false;
       bool saw_handler = false;
 
@@ -320,11 +547,21 @@
       // exception class, there's no exception type.
       // ??? What to do about GNU Java and GNU Ada exceptions.
 
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+      throw_type = ue_header;
+#else
+// APPLE LOCAL end LLVM
       if ((actions & _UA_FORCE_UNWIND)
-	  || exception_class != __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+	  || foreign_exception)
+// APPLE LOCAL end LLVM
 	throw_type = 0;
       else
 	throw_type = xh->exceptionType;
+// APPLE LOCAL begin LLVM
+#endif
+// APPLE LOCAL end LLVM
 
       while (1)
 	{
@@ -387,34 +624,41 @@
 
  do_something:
    if (found_type == found_nothing)
-     return _URC_CONTINUE_UNWIND;
+// APPLE LOCAL begin LLVM
+     CONTINUE_UNWINDING;
+// APPLE LOCAL end LLVM
 
   if (actions & _UA_SEARCH_PHASE)
     {
       if (found_type == found_cleanup)
-	return _URC_CONTINUE_UNWIND;
+// APPLE LOCAL begin LLVM
+	CONTINUE_UNWINDING;
+// APPLE LOCAL end LLVM
 
       // For domestic exceptions, we cache data from phase 1 for phase 2.
-      if (exception_class == __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+      if (!foreign_exception)
         {
-          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;
+	  save_caught_exception(ue_header, context, thrown_ptr,
+				handler_switch_value, language_specific_data,
+				landing_pad, action_record);
 	}
+//APPLE LOCAL end LLVM
       return _URC_HANDLER_FOUND;
     }
 
  install_context:
+  
+// APPLE LOCAL begin LLVM
+#ifndef __ARM_EABI_UNWINDER__
+// APPLE LOCAL end LLVM
   // 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)
-      || exception_class != __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+      || foreign_exception)
+// APPLE LOCAL end LLVM
     {
       if (found_type == found_terminate)
 	std::terminate ();
@@ -427,32 +671,74 @@
 	}
     }
   else
+// APPLE LOCAL begin LLVM
+#endif
+// APPLE LOCAL end LLVM
     {
       if (found_type == found_terminate)
-	{
-	  __cxa_begin_catch (&xh->unwindHeader);
-	  __terminate (xh->terminateHandler);
-	}
+// APPLE LOCAL begin LLVM
+	__cxa_call_terminate(ue_header);
+// APPLE LOCAL end LLVM
 
       // 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);
+
+// APPLE LOCAL begin LLVM
+#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 (obsolete)
+	  ue_header->barrier_cache.bitpattern[2] = 0;
+	  // Stride.
+	  ue_header->barrier_cache.bitpattern[3] = 4;
+	  // List head.
+	  ue_header->barrier_cache.bitpattern[4] = (_Unwind_Word) e;
+#else
+// APPLE LOCAL end LLVM
 	  xh->catchTemp = base_of_encoded_value (info.ttype_encoding, context);
+// APPLE LOCAL begin LLVM
+#endif
+// APPLE LOCAL end LLVM
 	}
     }
 
   /* 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 (&xh->unwindHeader));
+// APPLE LOCAL begin LLVM
+		 __builtin_extend_pointer (ue_header));
+// APPLE LOCAL end LLVM
   _Unwind_SetGR (context, __builtin_eh_return_data_regno (1),
 		 handler_switch_value);
   _Unwind_SetIP (context, landing_pad);
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+  if (found_type == found_cleanup)
+    __cxa_begin_cleanup(ue_header);
+#endif
+// APPLE LOCAL end LLVM
   return _URC_INSTALL_CONTEXT;
 }
 
+// APPLE LOCAL begin LLVM
+/* The ARM EABI implementation of __cxa_call_unexpected is in a different
+   file so that the personality routine san be used standalone.  The generic
+   routine sahred datastructures with the PR so it is most convenient to
+   implement it here.  */
+#ifndef __ARM_EABI_UNWINDER__
+// APPLE LOCAL end LLVM
 extern "C" void
 __cxa_call_unexpected (void *exc_obj_in)
 {
@@ -507,9 +793,12 @@
       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();
+// APPLE LOCAL begin LLVM
 #endif   
+// APPLE LOCAL end LLVM
 
       // Otherwise, die.
       __terminate (xh_terminate_handler);
     }
 }
+#endif

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc	2007-04-03 00:10:47 UTC (rev 125637)
@@ -63,7 +63,9 @@
   header->exceptionDestructor = dest;
   header->unexpectedHandler = __unexpected_handler;
   header->terminateHandler = __terminate_handler;
-  header->unwindHeader.exception_class = __gxx_exception_class;
+// APPLE LOCAL begin LLVM
+  __GXX_INIT_EXCEPTION_CLASS(header->unwindHeader.exception_class);
+// APPLE LOCAL end LLVM
   header->unwindHeader.exception_cleanup = __gxx_exception_cleanup;
 
 #ifdef _GLIBCXX_SJLJ_EXCEPTIONS
@@ -89,7 +91,9 @@
   if (header)
     {
       // Tell __cxa_end_catch this is a rethrow.
-      if (header->unwindHeader.exception_class != __gxx_exception_class)
+// APPLE LOCAL begin LLVM
+      if (!__is_gxx_exception_class(header->unwindHeader.exception_class))
+// APPLE LOCAL end LLVM
 	globals->caughtExceptions = 0;
       else
 	header->handlerCount = -header->handlerCount;
@@ -97,7 +101,9 @@
 #ifdef _GLIBCXX_SJLJ_EXCEPTIONS
       _Unwind_SjLj_Resume_or_Rethrow (&header->unwindHeader);
 #else
-#ifdef _LIBUNWIND_STD_ABI
+// APPLE LOCAL begin LLVM
+#if defined(_LIBUNWIND_STD_ABI) || defined (__ARM_EABI_UNWINDER__)
+// APPLE LOCAL end LLVM
       _Unwind_RaiseException (&header->unwindHeader);
 #else
       _Unwind_Resume_or_Rethrow (&header->unwindHeader);

Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h	2007-04-03 00:10:47 UTC (rev 125637)
@@ -67,6 +67,15 @@
   // value is a signal that this object has been rethrown.
   int handlerCount;
 
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+  // Stack of exceptions in cleanups.
+  __cxa_exception* nextPropagatingException;
+
+  // The nuber of active cleanup handlers for this exception.
+  int propagationCount;
+#else
+// APPLE LOCAL end LLVM
   // Cache parsed handler data from the personality routine Phase 1
   // for Phase 2 and __cxa_call_unexpected.
   int handlerSwitchValue;
@@ -74,6 +83,9 @@
   const unsigned char *languageSpecificData;
   _Unwind_Ptr catchTemp;
   void *adjustedPtr;
+// APPLE LOCAL begin LLVM
+#endif
+// APPLE LOCAL end LLVM
 
   // The generic exception header.  Must be last.
   _Unwind_Exception unwindHeader;
@@ -84,6 +96,11 @@
 {
   __cxa_exception *caughtExceptions;
   unsigned int uncaughtExceptions;
+// APPLE LOCAL begin LLVM
+#ifdef __ARM_EABI_UNWINDER__
+  __cxa_exception* propagatingExceptions;
+#endif
+// APPLE LOCAL end LLVM
 };
 
 
@@ -122,7 +139,25 @@
 // throws, and if bad_exception needs to be thrown.  Called from the
 // compiler.
 extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
+// APPLE LOCAL begin LLVM
+extern "C" void __cxa_call_terminate (void*) __attribute__((noreturn));
+// APPLE LOCAL end LLVM
 
+// APPLE LOCAL begin LLVM
+#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" bool __cxa_type_match(_Unwind_Exception*, const std::type_info*,
+				 bool, void**);
+extern "C" void __cxa_begin_cleanup (_Unwind_Exception*);
+extern "C" void __cxa_end_cleanup (void);
+#endif
+// APPLE LOCAL end LLVM
+
 // Invokes given handler, dying appropriately if the user handler was
 // so inconsiderate as to return.
 extern void __terminate(std::terminate_handler) __attribute__((noreturn));
@@ -134,6 +169,56 @@
 
 // These are explicitly GNU C++ specific.
 
+// APPLE LOCAL begin LLVM
+// 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;
+}
+
+#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';
+}
+
+static inline void
+__GXX_INIT_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_caught_object(_Unwind_Exception* eo)
+{
+  return (void*)eo->barrier_cache.bitpattern[0];
+}
+#else // !__ARM_EABI_UNWINDER__
+// APPLE LOCAL end LLVM
 // This is the exception class we report -- "GNUCC++\0".
 const _Unwind_Exception_Class __gxx_exception_class
 = ((((((((_Unwind_Exception_Class) 'G' 
@@ -145,6 +230,16 @@
     << 8 | (_Unwind_Exception_Class) '+')
    << 8 | (_Unwind_Exception_Class) '\0');
 
+// APPLE LOCAL begin LLVM
+static inline bool
+__is_gxx_exception_class(_Unwind_Exception_Class c)
+{
+  return c == __gxx_exception_class;
+}
+
+#define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class
+// APPLE LOCAL end LLVM
+
 // GNU C++ personality routine, Version 0.
 extern "C" _Unwind_Reason_Code __gxx_personality_v0
      (int, _Unwind_Action, _Unwind_Exception_Class,
@@ -155,20 +250,16 @@
      (int, _Unwind_Action, _Unwind_Exception_Class,
       struct _Unwind_Exception *, struct _Unwind_Context *);
 
-// Acquire the C++ exception header from the C++ object.
-static inline __cxa_exception *
-__get_exception_header_from_obj (void *ptr)
+// APPLE LOCAL begin LLVM
+static inline void*
+__gxx_caught_object(_Unwind_Exception* eo)
 {
-  return reinterpret_cast<__cxa_exception *>(ptr) - 1;
+  __cxa_exception* header = __get_exception_header_from_ue (eo);
+  return header->adjustedPtr;
 }
+#endif // !__ARM_EABI_UNWINDER__
+// APPLE LOCAL end LLVM
 
-// 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;
-}
-
 } /* namespace __cxxabiv1 */
 
 #pragma GCC visibility pop

Modified: apple-local/branches/llvm/libstdc++-v3/po/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/po/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/po/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Modified: apple-local/branches/llvm/libstdc++-v3/src/Makefile.in
===================================================================
--- apple-local/branches/llvm/libstdc++-v3/src/Makefile.in	2007-04-02 21:58:58 UTC (rev 125636)
+++ apple-local/branches/llvm/libstdc++-v3/src/Makefile.in	2007-04-03 00:10:47 UTC (rev 125637)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.





More information about the llvm-commits mailing list