GCC: Upgrade to 4.4.6; improved exception handling
authorJohn Marino <draco@marino.st>
Fri, 29 Apr 2011 21:04:59 +0000 (23:04 +0200)
committerJohn Marino <draco@marino.st>
Sat, 30 Apr 2011 00:56:45 +0000 (02:56 +0200)
In addition to 70 bug fixes provided by GNU, this version handles
exceptions through the new rtld, which is important to C++.  This
compiler also now incorporates MD_UNWIND_SUPPORT from gnat-aux, but
it's not clear if C++ utilizes this frame unwinding or not yet.

contrib/gcc-4.4/README.DELETED
contrib/gcc-4.4/README.DRAGONFLY
contrib/gcc-4.4/gcc/config/i386/dragonfly-unwind.h [new file with mode: 0644]
contrib/gcc-4.4/gcc/config/i386/dragonfly.h
contrib/gcc-4.4/gcc/crtstuff.c
contrib/gcc-4.4/gcc/unwind-dw2-fde-glibc.c
gnu/lib/gcc44/libgcc/Makefile
gnu/usr.bin/cc44/Makefile.inc
gnu/usr.bin/cc44/cc_prep/auto-host.h

index fa3c6d6..27fb975 100644 (file)
@@ -3,10 +3,20 @@ ChangeLog
 ChangeLog.tree-ssa
 INSTALL/
 MAINTAINERS
+Makefile.def
+Makefile.in
+Makefile.tpl
 MD5SUMS
 NEWS
+boehm-gc/
 compile
 config/
+config-ml.in
+config.guess
+config.rpath
+config.sub
+configure
+configure.ac
 contrib/
 depcomp
 fixincludes/
@@ -37,6 +47,7 @@ gcc/LANGUAGES
 gcc/ONEWS
 gcc/acinclude.m4
 gcc/aclocal.m4
+gcc/ada/
 gcc/collect2.c
 gcc/collect2.h
 gcc/config/alpha/
@@ -294,6 +305,12 @@ gcc/config/x-hpux
 gcc/config/x-linux
 gcc/config/x-solaris
 gcc/config/xtensa/
+gcc/config.build
+gcc/config.gcc
+gcc/config.host
+gcc/config.in
+gcc/configure
+gcc/configure.ac
 gcc/cp/ChangeLog
 gcc/cp/ChangeLog-1993
 gcc/cp/ChangeLog-1994
@@ -345,6 +362,7 @@ gcc/emutls.c
 gcc/exec-tool.in
 gcc/fix-header.c
 gcc/fixproto
+gcc/fortran/
 gcc/fp-test.c
 gcc/gccbug.in
 gcc/gcov-dump.c
@@ -376,6 +394,7 @@ gcc/gthr-solaris.h
 gcc/gthr-tpf.h
 gcc/gthr-vxworks.h
 gcc/gthr-win32.h
+gcc/java/
 gcc/limitx.h
 gcc/limity.h
 gcc/mips-tdump.c
@@ -395,25 +414,28 @@ gcc/sdbout.h
 gcc/sort-protos
 gcc/sys-protos.h
 gcc/sys-types.h
+gcc/testsuite/
 gcc/tlink.c
 gcc/tree-browser.c
 gcc/tree-browser.def
 gcc/unwind-compat.c
-gcc/unwind-compat.h
 gcc/unwind-dw2-fde-compat.c
 gcc/unwind-dw2-fde-darwin.c
-gcc/unwind-dw2-fde-glibc.c
 gcc/vmsdbg.h
 gcc/xcoff.h
 gcc/xcoffout.h
+gnattools/
 include/ChangeLog
 include/ChangeLog-9103
 include/symcat.h
 include/xtensa-config.h
 install-sh
 intl/
+libada/
 libcpp/ChangeLog
 libcpp/aclocal.m4
+libcpp/configure
+libcpp/configure.ac
 libcpp/makedepend.c
 libcpp/makeucnid.c
 libcpp/po/
@@ -421,6 +443,8 @@ libcpp/ucnid.tab
 libdecnumber/ChangeLog
 libdecnumber/aclocal.m4
 libdecnumber/bid/
+libdecnumber/configure
+libdecnumber/configure.ac
 libdecnumber/decBasic.c
 libdecnumber/decCommon.c
 libdecnumber/decDouble.c
@@ -440,6 +464,7 @@ libdecnumber/decRound.h
 libdecnumber/decSingle.c
 libdecnumber/decSingle.h
 libdecnumber/decSingleSymbols.h
+libffi/
 libgcc/ChangeLog
 libgcc/config/alpha/
 libgcc/config/avr/
@@ -464,6 +489,8 @@ libgcc/config/sparc/
 libgcc/config/t-slibgcc-darwin
 libgcc/config/t-softfp
 libgcc/config/t-tls
+libgcc/configure
+libgcc/configure.ac
 libgcc/empty.mk
 libgcc/fixed-obj.mk
 libgcc/gen-fixed.sh
@@ -471,6 +498,7 @@ libgcc/gstdint.h
 libgcc/shared-object.mk
 libgcc/siditi-object.mk
 libgcc/static-object.mk
+libgfortran/
 libgomp/
 libiberty/ChangeLog
 libiberty/_doprnt.c
@@ -486,6 +514,8 @@ libiberty/calloc.c
 libiberty/clock.c
 libiberty/config/
 libiberty/config.h-vms
+libiberty/configure
+libiberty/configure.ac
 libiberty/copying-lib.texi
 libiberty/copysign.c
 libiberty/ffs.c
@@ -541,6 +571,7 @@ libiberty/vprintf.c
 libiberty/vsnprintf.c
 libiberty/vsprintf.c
 libiberty/waitpid.c
+libjava/
 libmudflap/
 libobjc/ChangeLog
 libobjc/README.threads
@@ -548,6 +579,8 @@ libobjc/THREADS
 libobjc/THREADS.MACH
 libobjc/acinclude.m4
 libobjc/aclocal.m4
+libobjc/configure
+libobjc/configure.ac
 libobjc/libobjc.def
 libobjc/libobjc_entry.c
 libobjc/makefile.dos
@@ -565,6 +598,8 @@ libobjc/thr-vxworks.c
 libobjc/thr-win32.c
 libssp/ChangeLog
 libssp/aclocal.m4
+libssp/configure
+libssp/configure.ac
 libssp/libtool-version
 libstdc++-v3/ChangeLog
 libstdc++-v3/ChangeLog-1998
@@ -601,9 +636,7 @@ libstdc++-v3/config/locale/generic/ctype_members.cc
 libstdc++-v3/config/locale/gnu/
 libstdc++-v3/config/locale/ieee_1003.1-2001/
 libstdc++-v3/config/os/aix/
-libstdc++-v3/config/os/bsd/darwin/
-libstdc++-v3/config/os/bsd/freebsd/
-libstdc++-v3/config/os/bsd/netbsd/
+libstdc++-v3/config/os/bsd/
 libstdc++-v3/config/os/djgpp/
 libstdc++-v3/config/os/generic/ctype_base.h
 libstdc++-v3/config/os/generic/ctype_inline.h
@@ -619,6 +652,8 @@ libstdc++-v3/config/os/solaris/
 libstdc++-v3/config/os/tpf/
 libstdc++-v3/config/os/uclibc/
 libstdc++-v3/config/os/vxworks/
+libstdc++-v3/configure
+libstdc++-v3/configure.ac
 libstdc++-v3/crossconfig.m4
 libstdc++-v3/doc/
 libstdc++-v3/fragment.am
index 174d33a..8cad555 100644 (file)
@@ -1,23 +1,20 @@
 
-                       GCC-4.4.5 AS USED BY DRAGONFLY
+                       GCC-4.4.6 AS USED BY DRAGONFLY
 
     This directory contains a selected set of files from the GNU
-    gcc-4.4.5 distribution, using the `core', `g++' and `objc' parts,
-    which are 197MB together, but we really only need 53MB of those.
-    No files have been moved or modified from their extracted position.
+    gcc-4.4.6 distribution; the subset occupies about 53MB.
 
     ON THE VENDOR BRANCH (vendor/GCC44), DO NOT CREATE OR EDIT ANY FILES
     IN THIS DIRECTORY HIERARCHY!  THIS HIERARCHY REPRESENTS AN EXACT COPY,
     MINUS UNNEEDED FILES, OF THE GNU GCC DISTRIBUTION.
 
     All modifications are made in the master or release branches!
-
     The file README.DELETED contains a list of deleted files.
 
-
-SHA1 (gcc-core-4.4.5.tar.bz2) = 8e2202cde3be496f0452219c60311f8fe36f87f6
-SHA1 ( gcc-g++-4.4.5.tar.bz2) = cdbf1fc7b367c084b16e8f25089e2bd98fcdf4dc
-SHA1 (gcc-objc-4.4.5.tar.bz2) = d21df03f2f49bf1463422d0b9c68fd44f9c04b5f
+    file = gcc-4.4.6.tar.bz2
+    date = 16 April 2011
+    size = 63135296
+    sha1 = fc5e6c60b03650f6508470c088440d3d9360adf9
 
 
     The following files have been added or patched:
@@ -32,9 +29,11 @@ SHA1 (gcc-objc-4.4.5.tar.bz2) = d21df03f2f49bf1463422d0b9c68fd44f9c04b5f
     /libgcc/config.host
     /gcc/c-format.c
     /gcc/c-opts.c
-    /gcc/config.gcc
+    /gcc/crtstuff.c
     /gcc/tree-inline.c
+    /gcc/unwind-dw2-fde-glibc.c
     /gcc/config/dragonfly.h
+    /gcc/config/i386/dragonfly-unwind.h
     /gcc/config/i386/dragonfly.h
     /gcc/config/i386/dragonfly64.h
     /gcc/config/i386/i386.c
diff --git a/contrib/gcc-4.4/gcc/config/i386/dragonfly-unwind.h b/contrib/gcc-4.4/gcc/config/i386/dragonfly-unwind.h
new file mode 100644 (file)
index 0000000..b50d2b2
--- /dev/null
@@ -0,0 +1,158 @@
+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
+   Copyright (C) 2010 John Marino <draco@marino.st> */
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs. */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+#include <machine/sigframe.h>
+
+
+#define REG_NAME(reg)  sf_uc.uc_mcontext.mc_## reg
+
+#ifdef __x86_64__
+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
+
+
+static void
+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 32;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_64_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(rsp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  /* Register 7 is rsp  */
+  fs->regs.cfa_reg = 7;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
+  fs->regs.reg[4].how = REG_SAVED_OFFSET;
+  fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
+  fs->regs.reg[9].how = REG_SAVED_OFFSET;
+  fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
+  fs->regs.reg[10].how = REG_SAVED_OFFSET;
+  fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
+  fs->regs.reg[11].how = REG_SAVED_OFFSET;
+  fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
+  fs->regs.reg[12].how = REG_SAVED_OFFSET;
+  fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
+  fs->regs.reg[13].how = REG_SAVED_OFFSET;
+  fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
+  fs->regs.reg[14].how = REG_SAVED_OFFSET;
+  fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
+  fs->regs.reg[15].how = REG_SAVED_OFFSET;
+  fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
+  fs->regs.reg[16].how = REG_SAVED_OFFSET;
+  fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
+  fs->retaddr_column = 16;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+
+#else /* Next section is for i386  */
+
+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
+
+
+static void
+x86_sigtramp_range (unsigned char **start, unsigned char **end)
+{
+  unsigned long ps_strings;
+  int mib[2];
+  size_t len;
+
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_PS_STRINGS;
+  len = sizeof (ps_strings);
+  sysctl (mib, 2, &ps_strings, &len, NULL, 0);
+
+  *start = (unsigned char *)ps_strings - 128;
+  *end   = (unsigned char *)ps_strings;
+}
+
+
+static _Unwind_Reason_Code
+x86_dragonfly_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  unsigned char *pc = context->ra;
+  unsigned char *sigtramp_start, *sigtramp_end;
+  struct sigframe *sf;
+  long new_cfa;
+
+  x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
+
+  if (pc >= sigtramp_end || pc < sigtramp_start)
+    return _URC_END_OF_STACK;
+
+  sf = (struct sigframe *) context->cfa;
+  new_cfa = sf->REG_NAME(esp);
+  fs->regs.cfa_how = CFA_REG_OFFSET;
+  fs->regs.cfa_reg = 4;
+  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+
+  /* The SVR4 register numbering macros aren't usable in libgcc.  */
+  fs->regs.reg[0].how = REG_SAVED_OFFSET;
+  fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
+  fs->regs.reg[3].how = REG_SAVED_OFFSET;
+  fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
+  fs->regs.reg[1].how = REG_SAVED_OFFSET;
+  fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
+  fs->regs.reg[2].how = REG_SAVED_OFFSET;
+  fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
+  fs->regs.reg[6].how = REG_SAVED_OFFSET;
+  fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
+  fs->regs.reg[7].how = REG_SAVED_OFFSET;
+  fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
+  fs->regs.reg[5].how = REG_SAVED_OFFSET;
+  fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
+  fs->regs.reg[8].how = REG_SAVED_OFFSET;
+  fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
+  fs->retaddr_column = 8;
+  fs->signal_frame = 1;
+  return _URC_NO_REASON;
+}
+#endif /* ifdef __x86_64__  */
index 52eeea3..bbe79e3 100644 (file)
@@ -94,4 +94,4 @@ along with GCC; see the file COPYING3.  If not see
 /*#define STACK_CHECK_STATIC_BUILTIN 1 */
 
 /* Define location of OS-specific unwind support configuration. */
-/* #define MD_UNWIND_SUPPORT "config/i386/dragonfly-unwind.h"  */
+#define MD_UNWIND_SUPPORT "config/i386/dragonfly-unwind.h"
index 884a2a5..575f155 100644 (file)
@@ -81,20 +81,11 @@ call_ ## FUNC (void)                                        \
 }
 #endif
 
-#if defined(OBJECT_FORMAT_ELF) \
-    && !defined(OBJECT_FORMAT_FLAT) \
-    && defined(HAVE_LD_EH_FRAME_HDR) \
-    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
-    && defined(__GLIBC__) && __GLIBC__ >= 2
+#if defined(__DragonFly__)  /* implement dl_iterate_phdr EH */
 #include <link.h>
-/* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
-   But it doesn't use PT_GNU_EH_FRAME ELF segment currently.  */
-# if !defined(__UCLIBC__) \
-     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
-     || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
-#  define USE_PT_GNU_EH_FRAME
-# endif
+#define USE_PT_GNU_EH_FRAME
 #endif
+
 #if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
 # define USE_EH_FRAME_REGISTRY
 #endif
index d246ae1..220afc0 100644 (file)
@@ -32,9 +32,7 @@
 
 #include "tconfig.h"
 #include "tsystem.h"
-#ifndef inhibit_libc
 #include <link.h>
-#endif
 #include "coretypes.h"
 #include "tm.h"
 #include "dwarf2.h"
@@ -45,9 +43,9 @@
 #include "unwind-compat.h"
 #include "gthr.h"
 
-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
-    && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
-       || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+#if defined(__DragonFly__)
+
+#define ElfW __ElfN
 
 #ifndef __RELOC_POINTER
 # define __RELOC_POINTER(ptr, base) ((ptr) + (base))
index 32c200b..4091918 100644 (file)
@@ -38,7 +38,7 @@ SRCS+=                ${FUNCS:S/$/.c/g}
 CLEANFILES+=   ${FUNCS:S/$/.c/g}
 
 # LIB2ADDEH, gcc/Makefile
-SRCS+= unwind-dw2.c unwind-dw2-fde.c unwind-sjlj.c
+SRCS+= unwind-dw2.c unwind-dw2-fde-glibc.c unwind-sjlj.c
 SRCS+= gthr-gnat.c unwind-c.c
 
 SRCS+= unwind.h
index c3fcafc..0e619a8 100644 (file)
@@ -1,7 +1,7 @@
 .if !target(__<cc.Makefile.inc>__)
 __<cc.Makefile.inc>__:
 
-GCCCOMPLETEVER=        4.4.5
+GCCCOMPLETEVER=        4.4.6
 GCCPOINTVER=   ${GCCCOMPLETEVER:R}
 GCCSHORTVER=   ${GCCPOINTVER:S/.//}
 
index 4c4ae5a..25fb996 100644 (file)
 
 /* Define if your assembler supports the --debug-prefix-map option. */
 #ifndef USED_FOR_TARGET
-/* #undef HAVE_AS_DEBUG_PREFIX_MAP */
+#define HAVE_AS_DEBUG_PREFIX_MAP 1
 #endif
 
 
 
 /* Define 0/1 if your assembler supports .cfi_personality. */
 #ifndef USED_FOR_TARGET
-#define HAVE_GAS_CFI_PERSONALITY_DIRECTIVE 0
+#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 0
+#define HAVE_GAS_CFI_SECTIONS_DIRECTIVE 1
 #endif