public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
@ 2011-05-30 18:08 Rainer Orth
  2011-05-30 20:14 ` Kai Tietz
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: Rainer Orth @ 2011-05-30 18:08 UTC (permalink / raw)
  To: gcc-patches
  Cc: Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump

Once the initial Solaris 2 toplevel libgcc move

	http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00098.html

is complete, there are only two macros left that could be moved for my
targets: MD_UNWIND_SUPPORT (handled in this patch) and
ENABLE_EXECUTE_STACK (in a followup).

The following patch moves MD_UNWIND_SUPPORT and is pretty mechanical:

* It removes the macro in the gcc/config headers and poisons it in
  gcc/system.h.

* It introduces a new md_unwind_header variable in libgcc/config.host to
  capture the info.

* The three users of MD_UNWIND_SUPPORT are modified to unconditionally
  include a new md-unwind-support.h header which is created from the
  info in config.host: if md_unwind_header exists, it is included in
  md-unwind-support.h, otherwise the generated header is empty.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

I'm Cc'ing the OS port maintainers if listed, but not the CPU port ones.

Given the straightforward nature of the patch, I'd really appreciate if
a build maintainer and global reviewer could approve it.

Thanks.
	Rainer


2011-05-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/mips/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove.
	* config/sh/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha.
	* config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin.
	* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/sol2-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/w32-unwind.h: Move to ../libgcc/config/i386.
	* config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64.
	* config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64.
	* config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k.
	* config/mips/linux-unwind.h: Move to ../libgcc/config/mips.
	* config/pa/hpux-unwind.h: Move to ../libgcc/config/pa.
	* config/pa/linux-unwind.h: Move to ../libgcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000.
	* config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000.
	* config/s390/linux-unwind.h: Move to ../libgcc/config/s390.
	* config/s390/tpf-unwind.h: Move to ../libgcc/config/s390.
	* config/sh/linux-unwind.h: Move to ../libgcc/config/sh.
	* config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa.
	* system.h (MD_UNWIND_SUPPORT): Poison.
	* doc/tm.texi.in (Exception Handling, MD_UNWIND_SUPPORT): Remove.
	* doc/tm.texi: Regenerate.
	* unwind-dw2.c: Include md-unwind-support.h instead of
	MD_UNWIND_SUPPORT.
	* config/ia64/unwind-ia64.c: Likewise.
	* config/xtensa/unwind-dw2-xtensa.c: Likewise.

	libgcc:
	* config/alpha/linux-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/vms-unwind.h: Move from ../gcc/config/alpha.
	* config/bfin/linux-unwind.h: Move from ../gcc/config/bfin.
	* config/i386/linux-unwind.h: Move from ../gcc/config/i386.
	* config/i386/sol2-unwind.h: Move from ../gcc/config/i386.
	* config/i386/w32-unwind.h: Move from ../gcc/config/i386.
	* config/ia64/linux-unwind.h: Move from ../gcc/config/ia64.
	* config/ia64/vms-unwind.h: Move from ../gcc/config/ia64.
	* config/m68k/linux-unwind.h: Move from ../gcc/config/m68k.
	* config/mips/linux-unwind.h: Move from ../gcc/config/mips.
	* config/pa/hpux-unwind.h: Move from ../gcc/config/pa.
	* config/pa/linux-unwind.h: Move from ../gcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move from ../gcc/config/rs6000.
	* config/rs6000/linux-unwind.h: Move from ../gcc/config/rs6000.
	* config/s390/linux-unwind.h: Move from ../gcc/config/s390.
	* config/s390/tpf-unwind.h: Move from ../gcc/config/s390.
	* config/sh/linux-unwind.h: Move from ../gcc/config/sh.
	* config/sparc/linux-unwind.h: Move from ../gcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move from ../gcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move from ../gcc/config/xtensa.
	* config.host (md_unwind_header): Document.
	Define.
	(alpha*-*-linux*, alpha*-dec-osf5.1*, alpha64-dec-*vms*,
	alpha*-dec-*vms*, bfin*-uclinux*, bfin*-linux-uclibc*,
	hppa*-*-linux*, hppa[12]*-*-hpux10*, hppa*64*-*-hpux11*,
	hppa[12]*-*-hpux11*): Set md_unwind_header.
	(i[34567]86-*-linux*): Handle i[34567]86-*-kopensolaris*-gnu.
	Set md_unwind_header.
	(x86_64-*-linux*, i[34567]86-*-solaris2*): Set md_unwind_header.
	(i[34567]86-*-cygwin*): Split from i[34567]86-*-mingw*.
	(i[34567]86-*-mingw*, ia64*-*-linux*, ia64-hp-*vms*,
	m68k-*-uclinux*, m68k-*-linux*, mips64*-*-linux*, mips*-*-linux*,
	powerpc-*-darwin*, powerpc-*-linux*, s390-*-linux*,
	s390x-*-linux*,  s390x-ibm-tpf*, sh*-*-linux*, sparc-*-linux*,
	sparc*-*-solaris2*, sparc64-*-linux*, xtensa*-*-linux*): Set
	md_unwind_header.
	* configure.ac (md_unwind_header): Substitute.
	* configure: Regenerate.
	* Makefile.in (md_unwind_header): New variable.
	(clean): Remove md-unwind-support.h.
	(md-unwind-support.h): New target.
	(libgcc-eh-static-objects, libgcc-eh-shared-objects,
	libgcc-eh-objects ): New variables
	Depend on md-unwind-support.
	(libgcc-eh-objects, libgcc-s-objects, libgcc-objects): Use them.

diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler,
    for Alpha Linux-based GNU systems.
    Copyright (C) 1996, 1997, 1998, 2002, 2003, 2004, 2005, 2006, 2007, 2009,
-   2010 Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
    Contributed by Richard Henderson.
 
 This file is part of GCC.
@@ -84,8 +84,6 @@ along with GCC; see the file COPYING3.  
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/alpha/linux-unwind.h"
-
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
 
diff --git a/gcc/config/alpha/osf5.h b/gcc/config/alpha/osf5.h
--- a/gcc/config/alpha/osf5.h
+++ b/gcc/config/alpha/osf5.h
@@ -274,5 +274,3 @@ __enable_execute_stack (void *addr)					
 
 /* Handle #pragma extern_prefix.  */
 #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1
-
-#define MD_UNWIND_SUPPORT "config/alpha/osf5-unwind.h"
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -225,14 +225,6 @@ typedef struct {int num_args; enum avms_
 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
 
-#ifdef IN_LIBGCC2
-/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
-   file. This avoids having to recompile the world instead of libgcc only
-   when changes to this macro are exercised.  */
-
-#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
-#endif
-
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
   avms_asm_output_external (FILE, DECL, NAME)
 
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -48,7 +48,5 @@ see the files COPYING3 and COPYING.RUNTI
    -dynamic-linker /lib/ld-uClibc.so.0} \
    %{static}} -init __init -fini __fini"
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 #undef TARGET_SUPPORTS_SYNC_CALLS
 #define TARGET_SUPPORTS_SYNC_CALLS 1
diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
--- a/gcc/config/bfin/uclinux.h
+++ b/gcc/config/bfin/uclinux.h
@@ -32,8 +32,6 @@ see the files COPYING3 and COPYING.RUNTI
   %{mfast-fp:-lbffastfp} %G %L %{mfast-fp:-lbffastfp} %G \
 "
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 /* Like the definition in gcc.c, but for purposes of uClinux, every link is
    static.  */
 #define MFWRAP_SPEC " %{fmudflap|fmudflapth: \
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -22,5 +22,3 @@ along with GCC; see the file COPYING3.  
 
 #define GNU_USER_LINK_EMULATION "elf_i386"
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -26,5 +26,3 @@ see the files COPYING3 and COPYING.RUNTI
 
 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -241,12 +241,6 @@ __enable_execute_stack (void *addr)					
 #include <windows.h>
 #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
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -171,5 +171,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  PTRDIFF_TYPE
 #define PTRDIFF_TYPE "int"
-
-#define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h"
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -77,8 +77,6 @@ do {						\
 #undef LINK_EH_SPEC
 #define LINK_EH_SPEC ""
 
-#define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
-
 /* Put all *tf routines in libgcc.  */
 #undef LIBGCC2_HAS_TF_MODE
 #define LIBGCC2_HAS_TF_MODE 1
diff --git a/gcc/config/ia64/unwind-ia64.c b/gcc/config/ia64/unwind-ia64.c
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/gcc/config/ia64/unwind-ia64.c
@@ -1,7 +1,7 @@
 /* Subroutines needed for unwinding IA-64 standard format stack frame
    info for exception handling.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
-   2009  Free Software Foundation, Inc.
+   2009, 2011  Free Software Foundation, Inc.
    Contributed by Andrew MacLeod  <amacleod@cygnus.com>
 	          Andrew Haley  <aph@cygnus.com>
 		  David Mosberger-Tang <davidm@hpl.hp.com>
@@ -1767,9 +1767,7 @@ _Unwind_GetBSP (struct _Unwind_Context *
   return (_Unwind_Ptr) context->bsp;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 static _Unwind_Reason_Code
 uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -185,8 +185,6 @@ typedef struct crtl_name_spec
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
-
 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
 
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -235,5 +235,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/m68k/linux-unwind.h"
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -99,8 +99,6 @@ along with GCC; see the file COPYING3.  
 %{!shared: \
   %{profile:-lc_p} %{!profile:-lc}}"
 
-#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
-
 #ifdef HAVE_AS_NO_SHARED
 /* Default to -mno-shared for non-PIC.  */
 # define NO_SHARED_SPECS \
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for HP-UX.
-   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009,
+   2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -115,5 +115,3 @@ along with GCC; see the file COPYING3.  
    compatibility with the HP-UX unwind library.  */
 #undef TARGET_HPUX_UNWIND_LIBRARY
 #define TARGET_HPUX_UNWIND_LIBRARY 1
-
-#define MD_UNWIND_SUPPORT "config/pa/hpux-unwind.h"
diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h
--- a/gcc/config/pa/pa32-linux.h
+++ b/gcc/config/pa/pa32-linux.h
@@ -1,5 +1,5 @@
 /* Definitions for PA_RISC with ELF-32 format
-   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010
+   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -63,5 +63,3 @@ call_ ## FUNC (void)					\
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/pa/linux-unwind.h"
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
 #include <stdbool.h>
 #endif
 
-#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
-#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
-#endif
-
 /* True, iff we're generating fast turn around debugging code.  When
    true, we arrange for function prologues to start with 5 nops so
    that gdb may insert code to redirect them, and for data to be
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -113,8 +113,6 @@
 
 #define TARGET_POSIX_IO
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
 #define TARGET_THREAD_SSP_OFFSET	-0x7008
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -539,8 +539,6 @@ extern int dot_symbols;
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
    ppc64 glibc provides it at -0x7010(13).  */
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -79,8 +79,6 @@ along with GCC; see the file COPYING3.  
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
    s390x glibc provides it at 0x28(tp).  */
diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h
--- a/gcc/config/s390/tpf.h
+++ b/gcc/config/s390/tpf.h
@@ -118,8 +118,6 @@ along with GCC; see the file COPYING3.  
    %{!shared:-shared} \
    %(entry_spec)"
 
-#define MD_UNWIND_SUPPORT "config/s390/tpf-unwind.h"
-
 /* IBM copies these libraries over with these names.  */
 #define MATH_LIBRARY "CLBM"
 #define LIBSTDCXX "CPP1"
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -114,8 +114,6 @@ along with GCC; see the file COPYING3.  
       }									\
   } while (0)
 
-#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
-
 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
    to a fake register number 16 as a placeholder for the return address
    in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -141,8 +141,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -261,8 +261,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -196,5 +196,3 @@ along with GCC; see the file COPYING3.  
 
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
-
-#define MD_UNWIND_SUPPORT "config/sparc/sol2-unwind.h"
diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
@@ -64,5 +64,3 @@ along with GCC; see the file COPYING3.  
 
 #undef DBX_REGISTER_NUMBER
 
-#define MD_UNWIND_SUPPORT "config/xtensa/linux-unwind.h"
-
diff --git a/gcc/config/xtensa/unwind-dw2-xtensa.c b/gcc/config/xtensa/unwind-dw2-xtensa.c
--- a/gcc/config/xtensa/unwind-dw2-xtensa.c
+++ b/gcc/config/xtensa/unwind-dw2-xtensa.c
@@ -1,6 +1,6 @@
 /* DWARF2 exception handling and frame unwinding for Xtensa.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2009
+   2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -208,9 +208,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
   return (_Unwind_Ptr) context->bases.tbase;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -1,5 +1,5 @@
 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
-@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -3361,11 +3361,6 @@ of bytes that the format occupies, @var{
 to be emitted.
 @end defmac
 
-@defmac MD_UNWIND_SUPPORT
-A string specifying a file to be #include'd in unwind-dw2.c.  The file
-so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
-@end defmac
-
 @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
 This macro allows the target to add CPU and operating system specific
 code to the call-frame unwinder for use when there is no unwind data
diff --git a/gcc/system.h b/gcc/system.h
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -763,7 +763,8 @@ extern void fancy_abort (const char *, i
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
- #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX
+ #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX		\
+	MD_UNWIND_SUPPORT
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c
--- a/gcc/unwind-dw2.c
+++ b/gcc/unwind-dw2.c
@@ -333,9 +333,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
 }
 #endif
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -40,6 +40,7 @@ enable_shared = @enable_shared@
 decimal_float = @decimal_float@
 enable_decimal_float = @enable_decimal_float@
 fixed_point = @fixed_point@
+md_unwind_header = @md_unwind_header@
 
 host_noncanonical = @host_noncanonical@
 target_noncanonical = @target_noncanonical@
@@ -117,7 +118,7 @@ installcheck:
 .PHONY: all clean
 
 clean:
-	-rm -f config.h stamp-h stmp-ldirs libgcc.map
+	-rm -f config.h stamp-h stmp-ldirs libgcc.map md-unwind-support.h
 	-rm -f *$(objext)
 	-rm -f *.dep
 	-rm -f *.a
@@ -139,6 +140,13 @@ config.h: stamp-h ; @true
 stamp-h: $(srcdir)/config.in config.status Makefile
 	CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
 
+md-unwind-support.h: config.status
+	if test -n "$(md_unwind_header)"; then \
+	  echo "#include \"config/$(md_unwind_header)\"" > $@; \
+	else \
+	  : > $@; \
+	fi
+
 config.status: $(srcdir)/configure $(srcdir)/config.host
 	$(SHELL) ./config.status --recheck
 
@@ -715,8 +723,13 @@ c_flags := -fexceptions
 
 ifeq ($(enable_shared),yes)
 
-libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
-libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
+libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
+libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
+
+$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
+
+libgcc-eh-objects += $(libgcc-eh-static-objects)
+libgcc-s-objects += $(libgcc-eh-shared-objects)
 
 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
 include $(iterator)
@@ -724,7 +737,11 @@ include $(iterator)
 else
 # Not shared.  LIB2ADDEH are added to libgcc.a.
 
-libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
+libgcc-eh-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
+
+$(libgcc-eh-objects): md-unwind-support.h
+
+libgcc-objects += $(libgcc-eh-objects)
 
 iter-items := $(LIB2ADDEH)
 include $(iterator)
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -50,6 +50,8 @@
 #			If either is set, EXTRA_PARTS and
 #			EXTRA_MULTILIB_PARTS inherited from the GCC
 #			subdirectory will be ignored.
+#  md_unwind_header	The name of a header file defining
+#			MD_FALLBACK_FRAME_STATE_FOR.
 #  tmake_file		A list of machine-description-specific
 #			makefile-fragments, if different from
 #			"$cpu_type/t-$cpu_type".
@@ -57,6 +59,7 @@
 asm_hidden_op=.hidden
 extra_parts=
 tmake_file=
+md_unwind_header=
 
 # Set default cpu_type so it can be updated in each machine entry.
 cpu_type=`echo ${host} | sed 's/-.*$//'`
@@ -210,6 +213,7 @@ case ${host} in
 alpha*-*-linux*)
 	tmake_file="${tmake_file} alpha/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=alpha/linux-unwind.h
 	;;
 alpha*-*-freebsd*)
 	;;
@@ -225,12 +229,15 @@ alpha*-dec-osf5.1*)
 	    ;;
 	esac
 	extra_parts="${extra_parts} qrnnd.o crtfastmath.o gthr-posix.o"
+	md_unwind_header=alpha/osf5-unwind.h
 	;;
 alpha64-dec-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 alpha*-dec-*vms*)
 	tmake_file="vms/t-vms alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 arm-wrs-vxworks)
 	;;
@@ -261,11 +268,13 @@ avr-*-*)
 bfin*-elf*)
         ;;
 bfin*-uclinux*)
+	md_unwind_header=bfin/linux-unwind.h
         ;;
 bfin*-linux-uclibc*)
 	# No need to build crtbeginT.o on uClibc systems.  Should probably
 	# be moved to the OS specific section above.
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+	md_unwind_header=bfin/linux-unwind.h
 	;;
 bfin*-*)
         ;;
@@ -289,12 +298,16 @@ h8300-*-elf*)
 hppa*64*-*-linux*)
 	;;
 hppa*-*-linux*)
+	md_unwind_header=pa/pa32-linux.h
 	;;
 hppa[12]*-*-hpux10*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa*64*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa[12]*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 i[34567]86-*-darwin*)
 	;;
@@ -319,13 +332,15 @@ i[34567]86-*-openbsd2.*|i[34567]86-*open
 	;;
 i[34567]86-*-openbsd*)
 	;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
+i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 i[34567]86-pc-msdosdjgpp*)
 	;;
@@ -347,13 +362,19 @@ i[34567]86-*-rtems*)
 i[34567]86-*-solaris2*)
 	tmake_file="$tmake_file i386/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=i386/sol2-unwind.h
 	;;
 i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
 	;;
-i[34567]86-*-cygwin* | i[34567]86-*-mingw*)
+i[34567]86-*-cygwin*)
 	extra_parts="crtbegin.o crtend.o crtfastmath.o"
 	tmake_file="i386/t-cygming i386/t-crtfm"
 	;;
+i[34567]86-*-mingw*)
+	extra_parts="crtbegin.o crtend.o crtfastmath.o"
+	tmake_file="i386/t-cygming i386/t-crtfm"
+	md_unwind_header=i386/w32-unwind.h
+	;;
 x86_64-*-mingw*)
 	;;
 i[34567]86-*-interix3*)
@@ -369,11 +390,13 @@ ia64*-*-freebsd*)
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat"
+	md_unwind_header=ia64/linux-unwind.h
 	;;
 ia64*-*-hpux*)
 	;;
 ia64-hp-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms"
+	md_unwind_header=ia64/vms-unwind.h
 	;;
 iq2000*-*-elf*)
         ;;
@@ -400,10 +423,12 @@ m68k*-*-netbsdelf*)
 m68k*-*-openbsd*)
 	;;
 m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux with uClibc
+	md_unwind_header=m68k/linux-unwind.h
 	;;
-m68k-*-linux*)		# Motorola m68k's running GNU/Linux
+m68k-*-linux*)			# Motorola m68k's running GNU/Linux
 				# with ELF format using glibc 2
 				# aka the GNU/Linux C library 6.
+	md_unwind_header=m68k/linux-unwind.h
 	;;
 m68k-*-rtems*)
 	;;
@@ -421,10 +446,12 @@ mips*-*-netbsd*)			# NetBSD/mips, either
 mips64*-*-linux*)
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-openbsd*)
 	;;
@@ -469,6 +496,13 @@ pdp11-*-*)
 picochip-*-*)
         ;;
 powerpc-*-darwin*)
+	case ${host} in
+	*-*-darwin9* | *-*-darwin[12][0-9]*)
+	  ;;
+	*)
+	  md_unwind_header=rs6000/darwin-unwind.h
+	  ;;
+	esac
 	;;
 powerpc64-*-darwin*)
 	;;
@@ -495,6 +529,7 @@ powerpc-*-rtems*)
 	;;
 powerpc-*-linux* | powerpc64-*-linux*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp"
+	md_unwind_header=rs6000/linux-unwind.h
 	;;
 powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
 	;;
@@ -518,12 +553,15 @@ rx-*-elf)
 	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-ibm-tpf*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
+	md_unwind_header-s390/tpf-unwind.h
 	;;
 score-*-elf)
         ;;
@@ -534,6 +572,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
 	case ${host} in
 	sh*-*-linux*)
 		tmake_file="${tmake_file} sh/t-linux"
+		md_unwind_header=sh/unwind-linux.h
 		;;
 	esac
 	;;
@@ -559,6 +598,7 @@ sparc-*-elf*)
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux.h
 	;;
 sparc-*-rtems* | sparc64-*-rtems* )
 	tmake_file="sparc/t-elf t-crtin t-crtfm t-rtems"
@@ -567,6 +607,7 @@ sparc-*-rtems* | sparc64-*-rtems* )
 sparc*-*-solaris2*)
 	tmake_file="$tmake_file t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=sparc/sol2-unwind.h
 	;;
 sparc64-*-elf*)
 	tmake_file="${tmake_file} t-crtin t-crtfm"
@@ -579,6 +620,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux-unwind.h
 	;;
 sparc64-*-netbsd*)
 	;;
@@ -601,6 +643,7 @@ xstormy16-*-elf)
 xtensa*-*-elf*)
 	;;
 xtensa*-*-linux*)
+	md_unwind_header=xtensa/linux-unwind.h
 	;;
 am33_2.0-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
diff --git a/gcc/config/alpha/linux-unwind.h b/libgcc/config/alpha/linux-unwind.h
rename from gcc/config/alpha/linux-unwind.h
rename to libgcc/config/alpha/linux-unwind.h
diff --git a/gcc/config/alpha/osf5-unwind.h b/libgcc/config/alpha/osf5-unwind.h
rename from gcc/config/alpha/osf5-unwind.h
rename to libgcc/config/alpha/osf5-unwind.h
diff --git a/gcc/config/alpha/vms-unwind.h b/libgcc/config/alpha/vms-unwind.h
rename from gcc/config/alpha/vms-unwind.h
rename to libgcc/config/alpha/vms-unwind.h
diff --git a/gcc/config/bfin/linux-unwind.h b/libgcc/config/bfin/linux-unwind.h
rename from gcc/config/bfin/linux-unwind.h
rename to libgcc/config/bfin/linux-unwind.h
diff --git a/gcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h
rename from gcc/config/i386/linux-unwind.h
rename to libgcc/config/i386/linux-unwind.h
diff --git a/gcc/config/i386/sol2-unwind.h b/libgcc/config/i386/sol2-unwind.h
rename from gcc/config/i386/sol2-unwind.h
rename to libgcc/config/i386/sol2-unwind.h
diff --git a/gcc/config/i386/w32-unwind.h b/libgcc/config/i386/w32-unwind.h
rename from gcc/config/i386/w32-unwind.h
rename to libgcc/config/i386/w32-unwind.h
diff --git a/gcc/config/ia64/linux-unwind.h b/libgcc/config/ia64/linux-unwind.h
rename from gcc/config/ia64/linux-unwind.h
rename to libgcc/config/ia64/linux-unwind.h
diff --git a/gcc/config/ia64/vms-unwind.h b/libgcc/config/ia64/vms-unwind.h
rename from gcc/config/ia64/vms-unwind.h
rename to libgcc/config/ia64/vms-unwind.h
diff --git a/gcc/config/m68k/linux-unwind.h b/libgcc/config/m68k/linux-unwind.h
rename from gcc/config/m68k/linux-unwind.h
rename to libgcc/config/m68k/linux-unwind.h
diff --git a/gcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h
rename from gcc/config/mips/linux-unwind.h
rename to libgcc/config/mips/linux-unwind.h
diff --git a/gcc/config/pa/hpux-unwind.h b/libgcc/config/pa/hpux-unwind.h
rename from gcc/config/pa/hpux-unwind.h
rename to libgcc/config/pa/hpux-unwind.h
diff --git a/gcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h
rename from gcc/config/pa/linux-unwind.h
rename to libgcc/config/pa/linux-unwind.h
diff --git a/gcc/config/rs6000/darwin-unwind.h b/libgcc/config/rs6000/darwin-unwind.h
rename from gcc/config/rs6000/darwin-unwind.h
rename to libgcc/config/rs6000/darwin-unwind.h
diff --git a/gcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h
rename from gcc/config/rs6000/linux-unwind.h
rename to libgcc/config/rs6000/linux-unwind.h
diff --git a/gcc/config/s390/linux-unwind.h b/libgcc/config/s390/linux-unwind.h
rename from gcc/config/s390/linux-unwind.h
rename to libgcc/config/s390/linux-unwind.h
diff --git a/gcc/config/s390/tpf-unwind.h b/libgcc/config/s390/tpf-unwind.h
rename from gcc/config/s390/tpf-unwind.h
rename to libgcc/config/s390/tpf-unwind.h
diff --git a/gcc/config/sh/linux-unwind.h b/libgcc/config/sh/linux-unwind.h
rename from gcc/config/sh/linux-unwind.h
rename to libgcc/config/sh/linux-unwind.h
diff --git a/gcc/config/sparc/linux-unwind.h b/libgcc/config/sparc/linux-unwind.h
rename from gcc/config/sparc/linux-unwind.h
rename to libgcc/config/sparc/linux-unwind.h
diff --git a/gcc/config/sparc/sol2-unwind.h b/libgcc/config/sparc/sol2-unwind.h
rename from gcc/config/sparc/sol2-unwind.h
rename to libgcc/config/sparc/sol2-unwind.h
diff --git a/gcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h
rename from gcc/config/xtensa/linux-unwind.h
rename to libgcc/config/xtensa/linux-unwind.h
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -278,6 +278,7 @@ AC_SUBST(tmake_file)
 AC_SUBST(cpu_type)
 AC_SUBST(extra_parts)
 AC_SUBST(asm_hidden_op)
+AC_SUBST(md_unwind_header)
 
 # We need multilib support.
 AC_CONFIG_FILES([Makefile])

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-30 18:08 [build] Move MD_UNWIND_SUPPORT to toplevel libgcc Rainer Orth
@ 2011-05-30 20:14 ` Kai Tietz
  2011-05-31  9:30   ` Paolo Bonzini
  2011-05-31  9:44 ` Paolo Bonzini
  2011-05-31 19:59 ` Mike Stump
  2 siblings, 1 reply; 29+ messages in thread
From: Kai Tietz @ 2011-05-30 20:14 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Dave Korn,
	Mike Stump, gcc-patches

----- Original Message -----
From: "Rainer Orth" <ro@CeBiTec.Uni-Bielefeld.DE>
To: gcc-patches@gcc.gnu.org
Cc: "Joseph S. Myers" <joseph@codesourcery.com>, "Paolo Bonzini" <bonzini@gnu.org>, "Ralf Wildenhues" <Ralf.Wildenhues@gmx.de>, "Douglas Rupp" <rupp@gnat.com>, "Tristan Gingold" <gingold@adacore.com>, "John David Anglin" <dave.anglin@nrc-cnrc.gc.ca>, "Steve Ellcey" <sje@cup.hp.com>, "Kai Tietz" <ktietz@redhat.com>, "Dave Korn" <dave.korn.cygwin@gmail.com>, "Mike Stump" <mikestump@comcast.net>
Sent: Monday, May 30, 2011 5:43:22 PM
Subject: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

Once the initial Solaris 2 toplevel libgcc move

	http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00098.html

is complete, there are only two macros left that could be moved for my
targets: MD_UNWIND_SUPPORT (handled in this patch) and
ENABLE_EXECUTE_STACK (in a followup).

The following patch moves MD_UNWIND_SUPPORT and is pretty mechanical:

* It removes the macro in the gcc/config headers and poisons it in
  gcc/system.h.

* It introduces a new md_unwind_header variable in libgcc/config.host to
  capture the info.

* The three users of MD_UNWIND_SUPPORT are modified to unconditionally
  include a new md-unwind-support.h header which is created from the
  info in config.host: if md_unwind_header exists, it is included in
  md-unwind-support.h, otherwise the generated header is empty.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

I'm Cc'ing the OS port maintainers if listed, but not the CPU port ones.

Given the straightforward nature of the patch, I'd really appreciate if
a build maintainer and global reviewer could approve it.

Thanks.
	Rainer


2011-05-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/mips/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove.
	* config/sh/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha.
	* config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin.
	* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/sol2-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/w32-unwind.h: Move to ../libgcc/config/i386.
	* config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64.
	* config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64.
	* config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k.
	* config/mips/linux-unwind.h: Move to ../libgcc/config/mips.
	* config/pa/hpux-unwind.h: Move to ../libgcc/config/pa.
	* config/pa/linux-unwind.h: Move to ../libgcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000.
	* config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000.
	* config/s390/linux-unwind.h: Move to ../libgcc/config/s390.
	* config/s390/tpf-unwind.h: Move to ../libgcc/config/s390.
	* config/sh/linux-unwind.h: Move to ../libgcc/config/sh.
	* config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa.
	* system.h (MD_UNWIND_SUPPORT): Poison.
	* doc/tm.texi.in (Exception Handling, MD_UNWIND_SUPPORT): Remove.
	* doc/tm.texi: Regenerate.
	* unwind-dw2.c: Include md-unwind-support.h instead of
	MD_UNWIND_SUPPORT.
	* config/ia64/unwind-ia64.c: Likewise.
	* config/xtensa/unwind-dw2-xtensa.c: Likewise.

	libgcc:
	* config/alpha/linux-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/vms-unwind.h: Move from ../gcc/config/alpha.
	* config/bfin/linux-unwind.h: Move from ../gcc/config/bfin.
	* config/i386/linux-unwind.h: Move from ../gcc/config/i386.
	* config/i386/sol2-unwind.h: Move from ../gcc/config/i386.
	* config/i386/w32-unwind.h: Move from ../gcc/config/i386.
	* config/ia64/linux-unwind.h: Move from ../gcc/config/ia64.
	* config/ia64/vms-unwind.h: Move from ../gcc/config/ia64.
	* config/m68k/linux-unwind.h: Move from ../gcc/config/m68k.
	* config/mips/linux-unwind.h: Move from ../gcc/config/mips.
	* config/pa/hpux-unwind.h: Move from ../gcc/config/pa.
	* config/pa/linux-unwind.h: Move from ../gcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move from ../gcc/config/rs6000.
	* config/rs6000/linux-unwind.h: Move from ../gcc/config/rs6000.
	* config/s390/linux-unwind.h: Move from ../gcc/config/s390.
	* config/s390/tpf-unwind.h: Move from ../gcc/config/s390.
	* config/sh/linux-unwind.h: Move from ../gcc/config/sh.
	* config/sparc/linux-unwind.h: Move from ../gcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move from ../gcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move from ../gcc/config/xtensa.
	* config.host (md_unwind_header): Document.
	Define.
	(alpha*-*-linux*, alpha*-dec-osf5.1*, alpha64-dec-*vms*,
	alpha*-dec-*vms*, bfin*-uclinux*, bfin*-linux-uclibc*,
	hppa*-*-linux*, hppa[12]*-*-hpux10*, hppa*64*-*-hpux11*,
	hppa[12]*-*-hpux11*): Set md_unwind_header.
	(i[34567]86-*-linux*): Handle i[34567]86-*-kopensolaris*-gnu.
	Set md_unwind_header.
	(x86_64-*-linux*, i[34567]86-*-solaris2*): Set md_unwind_header.
	(i[34567]86-*-cygwin*): Split from i[34567]86-*-mingw*.
	(i[34567]86-*-mingw*, ia64*-*-linux*, ia64-hp-*vms*,
	m68k-*-uclinux*, m68k-*-linux*, mips64*-*-linux*, mips*-*-linux*,
	powerpc-*-darwin*, powerpc-*-linux*, s390-*-linux*,
	s390x-*-linux*,  s390x-ibm-tpf*, sh*-*-linux*, sparc-*-linux*,
	sparc*-*-solaris2*, sparc64-*-linux*, xtensa*-*-linux*): Set
	md_unwind_header.
	* configure.ac (md_unwind_header): Substitute.
	* configure: Regenerate.
	* Makefile.in (md_unwind_header): New variable.
	(clean): Remove md-unwind-support.h.
	(md-unwind-support.h): New target.
	(libgcc-eh-static-objects, libgcc-eh-shared-objects,
	libgcc-eh-objects ): New variables
	Depend on md-unwind-support.
	(libgcc-eh-objects, libgcc-s-objects, libgcc-objects): Use them.

diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler,
    for Alpha Linux-based GNU systems.
    Copyright (C) 1996, 1997, 1998, 2002, 2003, 2004, 2005, 2006, 2007, 2009,
-   2010 Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
    Contributed by Richard Henderson.
 
 This file is part of GCC.
@@ -84,8 +84,6 @@ along with GCC; see the file COPYING3.  
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/alpha/linux-unwind.h"
-
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
 
diff --git a/gcc/config/alpha/osf5.h b/gcc/config/alpha/osf5.h
--- a/gcc/config/alpha/osf5.h
+++ b/gcc/config/alpha/osf5.h
@@ -274,5 +274,3 @@ __enable_execute_stack (void *addr)					
 
 /* Handle #pragma extern_prefix.  */
 #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1
-
-#define MD_UNWIND_SUPPORT "config/alpha/osf5-unwind.h"
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -225,14 +225,6 @@ typedef struct {int num_args; enum avms_
 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
 
-#ifdef IN_LIBGCC2
-/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
-   file. This avoids having to recompile the world instead of libgcc only
-   when changes to this macro are exercised.  */
-
-#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
-#endif
-
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
   avms_asm_output_external (FILE, DECL, NAME)
 
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -48,7 +48,5 @@ see the files COPYING3 and COPYING.RUNTI
    -dynamic-linker /lib/ld-uClibc.so.0} \
    %{static}} -init __init -fini __fini"
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 #undef TARGET_SUPPORTS_SYNC_CALLS
 #define TARGET_SUPPORTS_SYNC_CALLS 1
diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
--- a/gcc/config/bfin/uclinux.h
+++ b/gcc/config/bfin/uclinux.h
@@ -32,8 +32,6 @@ see the files COPYING3 and COPYING.RUNTI
   %{mfast-fp:-lbffastfp} %G %L %{mfast-fp:-lbffastfp} %G \
 "
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 /* Like the definition in gcc.c, but for purposes of uClinux, every link is
    static.  */
 #define MFWRAP_SPEC " %{fmudflap|fmudflapth: \
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -22,5 +22,3 @@ along with GCC; see the file COPYING3.  
 
 #define GNU_USER_LINK_EMULATION "elf_i386"
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -26,5 +26,3 @@ see the files COPYING3 and COPYING.RUNTI
 
 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -241,12 +241,6 @@ __enable_execute_stack (void *addr)					
 #include <windows.h>
 #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
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -171,5 +171,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  PTRDIFF_TYPE
 #define PTRDIFF_TYPE "int"
-
-#define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h"
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -77,8 +77,6 @@ do {						\
 #undef LINK_EH_SPEC
 #define LINK_EH_SPEC ""
 
-#define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
-
 /* Put all *tf routines in libgcc.  */
 #undef LIBGCC2_HAS_TF_MODE
 #define LIBGCC2_HAS_TF_MODE 1
diff --git a/gcc/config/ia64/unwind-ia64.c b/gcc/config/ia64/unwind-ia64.c
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/gcc/config/ia64/unwind-ia64.c
@@ -1,7 +1,7 @@
 /* Subroutines needed for unwinding IA-64 standard format stack frame
    info for exception handling.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
-   2009  Free Software Foundation, Inc.
+   2009, 2011  Free Software Foundation, Inc.
    Contributed by Andrew MacLeod  <amacleod@cygnus.com>
 	          Andrew Haley  <aph@cygnus.com>
 		  David Mosberger-Tang <davidm@hpl.hp.com>
@@ -1767,9 +1767,7 @@ _Unwind_GetBSP (struct _Unwind_Context *
   return (_Unwind_Ptr) context->bsp;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 
 static _Unwind_Reason_Code
 uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -185,8 +185,6 @@ typedef struct crtl_name_spec
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
-
 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
 
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -235,5 +235,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/m68k/linux-unwind.h"
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -99,8 +99,6 @@ along with GCC; see the file COPYING3.  
 %{!shared: \
   %{profile:-lc_p} %{!profile:-lc}}"
 
-#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
-
 #ifdef HAVE_AS_NO_SHARED
 /* Default to -mno-shared for non-PIC.  */
 # define NO_SHARED_SPECS \
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for HP-UX.
-   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009,
+   2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -115,5 +115,3 @@ along with GCC; see the file COPYING3.  
    compatibility with the HP-UX unwind library.  */
 #undef TARGET_HPUX_UNWIND_LIBRARY
 #define TARGET_HPUX_UNWIND_LIBRARY 1
-
-#define MD_UNWIND_SUPPORT "config/pa/hpux-unwind.h"
diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h
--- a/gcc/config/pa/pa32-linux.h
+++ b/gcc/config/pa/pa32-linux.h
@@ -1,5 +1,5 @@
 /* Definitions for PA_RISC with ELF-32 format
-   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010
+   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -63,5 +63,3 @@ call_ ## FUNC (void)					\
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/pa/linux-unwind.h"
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
 #include <stdbool.h>
 #endif
 
-#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
-#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
-#endif
-
 /* True, iff we're generating fast turn around debugging code.  When
    true, we arrange for function prologues to start with 5 nops so
    that gdb may insert code to redirect them, and for data to be
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -113,8 +113,6 @@
 
 #define TARGET_POSIX_IO
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
 #define TARGET_THREAD_SSP_OFFSET	-0x7008
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -539,8 +539,6 @@ extern int dot_symbols;
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
    ppc64 glibc provides it at -0x7010(13).  */
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -79,8 +79,6 @@ along with GCC; see the file COPYING3.  
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
    s390x glibc provides it at 0x28(tp).  */
diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h
--- a/gcc/config/s390/tpf.h
+++ b/gcc/config/s390/tpf.h
@@ -118,8 +118,6 @@ along with GCC; see the file COPYING3.  
    %{!shared:-shared} \
    %(entry_spec)"
 
-#define MD_UNWIND_SUPPORT "config/s390/tpf-unwind.h"
-
 /* IBM copies these libraries over with these names.  */
 #define MATH_LIBRARY "CLBM"
 #define LIBSTDCXX "CPP1"
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -114,8 +114,6 @@ along with GCC; see the file COPYING3.  
       }									\
   } while (0)
 
-#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
-
 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
    to a fake register number 16 as a placeholder for the return address
    in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -141,8 +141,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -261,8 +261,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -196,5 +196,3 @@ along with GCC; see the file COPYING3.  
 
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
-
-#define MD_UNWIND_SUPPORT "config/sparc/sol2-unwind.h"
diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
@@ -64,5 +64,3 @@ along with GCC; see the file COPYING3.  
 
 #undef DBX_REGISTER_NUMBER
 
-#define MD_UNWIND_SUPPORT "config/xtensa/linux-unwind.h"
-
diff --git a/gcc/config/xtensa/unwind-dw2-xtensa.c b/gcc/config/xtensa/unwind-dw2-xtensa.c
--- a/gcc/config/xtensa/unwind-dw2-xtensa.c
+++ b/gcc/config/xtensa/unwind-dw2-xtensa.c
@@ -1,6 +1,6 @@
 /* DWARF2 exception handling and frame unwinding for Xtensa.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2009
+   2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -208,9 +208,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
   return (_Unwind_Ptr) context->bases.tbase;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -1,5 +1,5 @@
 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
-@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -3361,11 +3361,6 @@ of bytes that the format occupies, @var{
 to be emitted.
 @end defmac
 
-@defmac MD_UNWIND_SUPPORT
-A string specifying a file to be #include'd in unwind-dw2.c.  The file
-so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
-@end defmac
-
 @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
 This macro allows the target to add CPU and operating system specific
 code to the call-frame unwinder for use when there is no unwind data
diff --git a/gcc/system.h b/gcc/system.h
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -763,7 +763,8 @@ extern void fancy_abort (const char *, i
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
- #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX
+ #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX		\
+	MD_UNWIND_SUPPORT
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c
--- a/gcc/unwind-dw2.c
+++ b/gcc/unwind-dw2.c
@@ -333,9 +333,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
 }
 #endif
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -40,6 +40,7 @@ enable_shared = @enable_shared@
 decimal_float = @decimal_float@
 enable_decimal_float = @enable_decimal_float@
 fixed_point = @fixed_point@
+md_unwind_header = @md_unwind_header@
 
 host_noncanonical = @host_noncanonical@
 target_noncanonical = @target_noncanonical@
@@ -117,7 +118,7 @@ installcheck:
 .PHONY: all clean
 
 clean:
-	-rm -f config.h stamp-h stmp-ldirs libgcc.map
+	-rm -f config.h stamp-h stmp-ldirs libgcc.map md-unwind-support.h
 	-rm -f *$(objext)
 	-rm -f *.dep
 	-rm -f *.a
@@ -139,6 +140,13 @@ config.h: stamp-h ; @true
 stamp-h: $(srcdir)/config.in config.status Makefile
 	CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
 
+md-unwind-support.h: config.status
+	if test -n "$(md_unwind_header)"; then \
+	  echo "#include \"config/$(md_unwind_header)\"" > $@; \
+	else \
+	  : > $@; \
+	fi
+
 config.status: $(srcdir)/configure $(srcdir)/config.host
 	$(SHELL) ./config.status --recheck
 
@@ -715,8 +723,13 @@ c_flags := -fexceptions
 
 ifeq ($(enable_shared),yes)
 
-libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
-libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
+libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
+libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
+
+$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
+
+libgcc-eh-objects += $(libgcc-eh-static-objects)
+libgcc-s-objects += $(libgcc-eh-shared-objects)
 
 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
 include $(iterator)
@@ -724,7 +737,11 @@ include $(iterator)
 else
 # Not shared.  LIB2ADDEH are added to libgcc.a.
 
-libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
+libgcc-eh-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
+
+$(libgcc-eh-objects): md-unwind-support.h
+
+libgcc-objects += $(libgcc-eh-objects)
 
 iter-items := $(LIB2ADDEH)
 include $(iterator)
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -50,6 +50,8 @@
 #			If either is set, EXTRA_PARTS and
 #			EXTRA_MULTILIB_PARTS inherited from the GCC
 #			subdirectory will be ignored.
+#  md_unwind_header	The name of a header file defining
+#			MD_FALLBACK_FRAME_STATE_FOR.
 #  tmake_file		A list of machine-description-specific
 #			makefile-fragments, if different from
 #			"$cpu_type/t-$cpu_type".
@@ -57,6 +59,7 @@
 asm_hidden_op=.hidden
 extra_parts=
 tmake_file=
+md_unwind_header=
 
 # Set default cpu_type so it can be updated in each machine entry.
 cpu_type=`echo ${host} | sed 's/-.*$//'`
@@ -210,6 +213,7 @@ case ${host} in
 alpha*-*-linux*)
 	tmake_file="${tmake_file} alpha/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=alpha/linux-unwind.h
 	;;
 alpha*-*-freebsd*)
 	;;
@@ -225,12 +229,15 @@ alpha*-dec-osf5.1*)
 	    ;;
 	esac
 	extra_parts="${extra_parts} qrnnd.o crtfastmath.o gthr-posix.o"
+	md_unwind_header=alpha/osf5-unwind.h
 	;;
 alpha64-dec-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 alpha*-dec-*vms*)
 	tmake_file="vms/t-vms alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 arm-wrs-vxworks)
 	;;
@@ -261,11 +268,13 @@ avr-*-*)
 bfin*-elf*)
         ;;
 bfin*-uclinux*)
+	md_unwind_header=bfin/linux-unwind.h
         ;;
 bfin*-linux-uclibc*)
 	# No need to build crtbeginT.o on uClibc systems.  Should probably
 	# be moved to the OS specific section above.
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+	md_unwind_header=bfin/linux-unwind.h
 	;;
 bfin*-*)
         ;;
@@ -289,12 +298,16 @@ h8300-*-elf*)
 hppa*64*-*-linux*)
 	;;
 hppa*-*-linux*)
+	md_unwind_header=pa/pa32-linux.h
 	;;
 hppa[12]*-*-hpux10*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa*64*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa[12]*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 i[34567]86-*-darwin*)
 	;;
@@ -319,13 +332,15 @@ i[34567]86-*-openbsd2.*|i[34567]86-*open
 	;;
 i[34567]86-*-openbsd*)
 	;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
+i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 i[34567]86-pc-msdosdjgpp*)
 	;;
@@ -347,13 +362,19 @@ i[34567]86-*-rtems*)
 i[34567]86-*-solaris2*)
 	tmake_file="$tmake_file i386/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=i386/sol2-unwind.h
 	;;
 i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
 	;;
-i[34567]86-*-cygwin* | i[34567]86-*-mingw*)
+i[34567]86-*-cygwin*)
 	extra_parts="crtbegin.o crtend.o crtfastmath.o"
 	tmake_file="i386/t-cygming i386/t-crtfm"
 	;;
+i[34567]86-*-mingw*)
+	extra_parts="crtbegin.o crtend.o crtfastmath.o"
+	tmake_file="i386/t-cygming i386/t-crtfm"
+	md_unwind_header=i386/w32-unwind.h
+	;;
 x86_64-*-mingw*)
 	;;
 i[34567]86-*-interix3*)
@@ -369,11 +390,13 @@ ia64*-*-freebsd*)
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat"
+	md_unwind_header=ia64/linux-unwind.h
 	;;
 ia64*-*-hpux*)
 	;;
 ia64-hp-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms"
+	md_unwind_header=ia64/vms-unwind.h
 	;;
 iq2000*-*-elf*)
         ;;
@@ -400,10 +423,12 @@ m68k*-*-netbsdelf*)
 m68k*-*-openbsd*)
 	;;
 m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux with uClibc
+	md_unwind_header=m68k/linux-unwind.h
 	;;
-m68k-*-linux*)		# Motorola m68k's running GNU/Linux
+m68k-*-linux*)			# Motorola m68k's running GNU/Linux
 				# with ELF format using glibc 2
 				# aka the GNU/Linux C library 6.
+	md_unwind_header=m68k/linux-unwind.h
 	;;
 m68k-*-rtems*)
 	;;
@@ -421,10 +446,12 @@ mips*-*-netbsd*)			# NetBSD/mips, either
 mips64*-*-linux*)
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-openbsd*)
 	;;
@@ -469,6 +496,13 @@ pdp11-*-*)
 picochip-*-*)
         ;;
 powerpc-*-darwin*)
+	case ${host} in
+	*-*-darwin9* | *-*-darwin[12][0-9]*)
+	  ;;
+	*)
+	  md_unwind_header=rs6000/darwin-unwind.h
+	  ;;
+	esac
 	;;
 powerpc64-*-darwin*)
 	;;
@@ -495,6 +529,7 @@ powerpc-*-rtems*)
 	;;
 powerpc-*-linux* | powerpc64-*-linux*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp"
+	md_unwind_header=rs6000/linux-unwind.h
 	;;
 powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
 	;;
@@ -518,12 +553,15 @@ rx-*-elf)
 	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-ibm-tpf*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
+	md_unwind_header-s390/tpf-unwind.h
 	;;
 score-*-elf)
         ;;
@@ -534,6 +572,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
 	case ${host} in
 	sh*-*-linux*)
 		tmake_file="${tmake_file} sh/t-linux"
+		md_unwind_header=sh/unwind-linux.h
 		;;
 	esac
 	;;
@@ -559,6 +598,7 @@ sparc-*-elf*)
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux.h
 	;;
 sparc-*-rtems* | sparc64-*-rtems* )
 	tmake_file="sparc/t-elf t-crtin t-crtfm t-rtems"
@@ -567,6 +607,7 @@ sparc-*-rtems* | sparc64-*-rtems* )
 sparc*-*-solaris2*)
 	tmake_file="$tmake_file t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=sparc/sol2-unwind.h
 	;;
 sparc64-*-elf*)
 	tmake_file="${tmake_file} t-crtin t-crtfm"
@@ -579,6 +620,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux-unwind.h
 	;;
 sparc64-*-netbsd*)
 	;;
@@ -601,6 +643,7 @@ xstormy16-*-elf)
 xtensa*-*-elf*)
 	;;
 xtensa*-*-linux*)
+	md_unwind_header=xtensa/linux-unwind.h
 	;;
 am33_2.0-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
diff --git a/gcc/config/alpha/linux-unwind.h b/libgcc/config/alpha/linux-unwind.h
rename from gcc/config/alpha/linux-unwind.h
rename to libgcc/config/alpha/linux-unwind.h
diff --git a/gcc/config/alpha/osf5-unwind.h b/libgcc/config/alpha/osf5-unwind.h
rename from gcc/config/alpha/osf5-unwind.h
rename to libgcc/config/alpha/osf5-unwind.h
diff --git a/gcc/config/alpha/vms-unwind.h b/libgcc/config/alpha/vms-unwind.h
rename from gcc/config/alpha/vms-unwind.h
rename to libgcc/config/alpha/vms-unwind.h
diff --git a/gcc/config/bfin/linux-unwind.h b/libgcc/config/bfin/linux-unwind.h
rename from gcc/config/bfin/linux-unwind.h
rename to libgcc/config/bfin/linux-unwind.h
diff --git a/gcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h
rename from gcc/config/i386/linux-unwind.h
rename to libgcc/config/i386/linux-unwind.h
diff --git a/gcc/config/i386/sol2-unwind.h b/libgcc/config/i386/sol2-unwind.h
rename from gcc/config/i386/sol2-unwind.h
rename to libgcc/config/i386/sol2-unwind.h
diff --git a/gcc/config/i386/w32-unwind.h b/libgcc/config/i386/w32-unwind.h
rename from gcc/config/i386/w32-unwind.h
rename to libgcc/config/i386/w32-unwind.h
diff --git a/gcc/config/ia64/linux-unwind.h b/libgcc/config/ia64/linux-unwind.h
rename from gcc/config/ia64/linux-unwind.h
rename to libgcc/config/ia64/linux-unwind.h
diff --git a/gcc/config/ia64/vms-unwind.h b/libgcc/config/ia64/vms-unwind.h
rename from gcc/config/ia64/vms-unwind.h
rename to libgcc/config/ia64/vms-unwind.h
diff --git a/gcc/config/m68k/linux-unwind.h b/libgcc/config/m68k/linux-unwind.h
rename from gcc/config/m68k/linux-unwind.h
rename to libgcc/config/m68k/linux-unwind.h
diff --git a/gcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h
rename from gcc/config/mips/linux-unwind.h
rename to libgcc/config/mips/linux-unwind.h
diff --git a/gcc/config/pa/hpux-unwind.h b/libgcc/config/pa/hpux-unwind.h
rename from gcc/config/pa/hpux-unwind.h
rename to libgcc/config/pa/hpux-unwind.h
diff --git a/gcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h
rename from gcc/config/pa/linux-unwind.h
rename to libgcc/config/pa/linux-unwind.h
diff --git a/gcc/config/rs6000/darwin-unwind.h b/libgcc/config/rs6000/darwin-unwind.h
rename from gcc/config/rs6000/darwin-unwind.h
rename to libgcc/config/rs6000/darwin-unwind.h
diff --git a/gcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h
rename from gcc/config/rs6000/linux-unwind.h
rename to libgcc/config/rs6000/linux-unwind.h
diff --git a/gcc/config/s390/linux-unwind.h b/libgcc/config/s390/linux-unwind.h
rename from gcc/config/s390/linux-unwind.h
rename to libgcc/config/s390/linux-unwind.h
diff --git a/gcc/config/s390/tpf-unwind.h b/libgcc/config/s390/tpf-unwind.h
rename from gcc/config/s390/tpf-unwind.h
rename to libgcc/config/s390/tpf-unwind.h
diff --git a/gcc/config/sh/linux-unwind.h b/libgcc/config/sh/linux-unwind.h
rename from gcc/config/sh/linux-unwind.h
rename to libgcc/config/sh/linux-unwind.h
diff --git a/gcc/config/sparc/linux-unwind.h b/libgcc/config/sparc/linux-unwind.h
rename from gcc/config/sparc/linux-unwind.h
rename to libgcc/config/sparc/linux-unwind.h
diff --git a/gcc/config/sparc/sol2-unwind.h b/libgcc/config/sparc/sol2-unwind.h
rename from gcc/config/sparc/sol2-unwind.h
rename to libgcc/config/sparc/sol2-unwind.h
diff --git a/gcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h
rename from gcc/config/xtensa/linux-unwind.h
rename to libgcc/config/xtensa/linux-unwind.h
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -278,6 +278,7 @@ AC_SUBST(tmake_file)
 AC_SUBST(cpu_type)
 AC_SUBST(extra_parts)
 AC_SUBST(asm_hidden_op)
+AC_SUBST(md_unwind_header)
 
 # We need multilib support.
 AC_CONFIG_FILES([Makefile])

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Windows mingw part is not ok, as it breaks 32-bit defaulted multilib version compiler.

Regards,
Kai

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-30 20:14 ` Kai Tietz
@ 2011-05-31  9:30   ` Paolo Bonzini
  2011-05-31 12:31     ` Kai Tietz
  2011-05-31 17:57     ` Rainer Orth
  0 siblings, 2 replies; 29+ messages in thread
From: Paolo Bonzini @ 2011-05-31  9:30 UTC (permalink / raw)
  To: Kai Tietz
  Cc: Rainer Orth, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Dave Korn,
	Mike Stump, gcc-patches

On 05/30/2011 07:54 PM, Kai Tietz wrote:
> > -/* 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
>
> mingw part is not ok, as it breaks 32-bit defaulted multilib version
> compiler.

Can you explain what is going on here?  Could it be fixed by wrapping 
w32-unwind.h in a #ifdef __x86_64__?

Rainer, the same solution that is found for Windows should be used for 
darwin, too.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-30 18:08 [build] Move MD_UNWIND_SUPPORT to toplevel libgcc Rainer Orth
  2011-05-30 20:14 ` Kai Tietz
@ 2011-05-31  9:44 ` Paolo Bonzini
  2011-05-31 18:09   ` Rainer Orth
  2011-06-03 14:36   ` Rainer Orth
  2011-05-31 19:59 ` Mike Stump
  2 siblings, 2 replies; 29+ messages in thread
From: Paolo Bonzini @ 2011-05-31  9:44 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump

On 05/30/2011 05:43 PM, Rainer Orth wrote:
> +md-unwind-support.h: config.status
> +	if test -n "$(md_unwind_header)"; then \
> +	  echo "#include \"config/$(md_unwind_header)\"">  $@; \
> +	else \
> +	  :>  $@; \
> +	fi

Can you add a default file md-unwind-none.h and use

AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])

instead of this (and instead of AC_SUBST'ing the variable)?

> -libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
> -libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
> +libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
> +libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
> +
> +$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
> +
> +libgcc-eh-objects += $(libgcc-eh-static-objects)
> +libgcc-s-objects += $(libgcc-eh-shared-objects)

These changes to the dependencies should not be necessary, libgcc does 
automatic dependency tracking.

Also a good start, though.  Thanks for this work.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31  9:30   ` Paolo Bonzini
@ 2011-05-31 12:31     ` Kai Tietz
  2011-05-31 12:36       ` Paolo Bonzini
  2011-05-31 18:07       ` Rainer Orth
  2011-05-31 17:57     ` Rainer Orth
  1 sibling, 2 replies; 29+ messages in thread
From: Kai Tietz @ 2011-05-31 12:31 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kai Tietz, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Dave Korn, Mike Stump, gcc-patches

2011/5/31 Paolo Bonzini <bonzini@gnu.org>:
> On 05/30/2011 07:54 PM, Kai Tietz wrote:
>>
>> > -/* 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
>>
>> mingw part is not ok, as it breaks 32-bit defaulted multilib version
>> compiler.
>
> Can you explain what is going on here?  Could it be fixed by wrapping
> w32-unwind.h in a #ifdef __x86_64__?

To wrap it into __x86_64__ won't help. The issue is that in
combination of 32-bit and 64-bit we need to default here to SjLj, as
64-bit doesn't support dw2 unwinding stuff and uses here internally
instead SEH. So if target is 32-bit default, but a multilib version is
used, we can't use w32-unwind.h.

The line of interest is "#if !TARGET_64BIT_DEFAULT &&  !defined
(TARGET_BI_ARCH)", which says: if target is 64-bit then don't use
w32-unwind.h. if we are building for multilib then don't use
w32-unwind.h.

Well, wrapping header with __x64_64__ might helper partial. . But this
might be worth a try. Nevertheless I assume that then at least
produced DLL names for libgcc could get confused for their extensions.
Rainer: It would be helpful, if you could try this.

> Rainer, the same solution that is found for Windows should be used for
> darwin, too.
>
> Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31 12:31     ` Kai Tietz
@ 2011-05-31 12:36       ` Paolo Bonzini
  2011-05-31 18:07       ` Rainer Orth
  1 sibling, 0 replies; 29+ messages in thread
From: Paolo Bonzini @ 2011-05-31 12:36 UTC (permalink / raw)
  To: Kai Tietz
  Cc: Kai Tietz, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Dave Korn, Mike Stump, gcc-patches

On 05/31/2011 11:30 AM, Kai Tietz wrote:
> The issue is that in
> combination of 32-bit and 64-bit we need to default here to SjLj,

Ok, then what you're testing is actually whether you're using sjlj or 
dw2 unwinding.  config/i386/cygming.h will ensure that this is the same 
as testing TARGET_BI_ARCH and TARGET_64BIT_DEFAULT.

Then you can just pass EH_MODEL or SHLIB_SONAME down to libgcc via 
libgcc.mvars, and look at it in libgcc/config.host to pick the 
appropriate header.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31  9:30   ` Paolo Bonzini
  2011-05-31 12:31     ` Kai Tietz
@ 2011-05-31 17:57     ` Rainer Orth
  1 sibling, 0 replies; 29+ messages in thread
From: Rainer Orth @ 2011-05-31 17:57 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Kai Tietz, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Dave Korn,
	Mike Stump, gcc-patches

Paolo Bonzini <bonzini@gnu.org> writes:

> Rainer, the same solution that is found for Windows should be used for
> darwin, too.

I'm uncertain if anything is needed for Darwin, though:
gcc/config/rs6000/darwin.h has

#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
#endif

gcc/config/darwin9.h defines DARWIN_LIBSYSTEM_HAS_UNWIND, so this only
applies to Darwin 8 and earlier.  That's why I have this in
libgcc/config.host:

powerpc-*-darwin*)
	case ${host} in
	*-*-darwin9* | *-*-darwin[12][0-9]*)
	  ;;
	*)
	  md_unwind_header=rs6000/darwin-unwind.h
	  ;;
	esac

I've no idea if Darwin 8 had 64-bit support, so rs6000/darwin-unwind.h
would still have to be disabled.  Perhaps the Darwin maintainers could
chime in?

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31 12:31     ` Kai Tietz
  2011-05-31 12:36       ` Paolo Bonzini
@ 2011-05-31 18:07       ` Rainer Orth
  1 sibling, 0 replies; 29+ messages in thread
From: Rainer Orth @ 2011-05-31 18:07 UTC (permalink / raw)
  To: Kai Tietz
  Cc: Paolo Bonzini, Kai Tietz, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Dave Korn, Mike Stump, gcc-patches

Kai Tietz <ktietz70@googlemail.com> writes:

>>> mingw part is not ok, as it breaks 32-bit defaulted multilib version
>>> compiler.
>>
>> Can you explain what is going on here?  Could it be fixed by wrapping
>> w32-unwind.h in a #ifdef __x86_64__?
>
> To wrap it into __x86_64__ won't help. The issue is that in
> combination of 32-bit and 64-bit we need to default here to SjLj, as
> 64-bit doesn't support dw2 unwinding stuff and uses here internally
> instead SEH. So if target is 32-bit default, but a multilib version is
> used, we can't use w32-unwind.h.

Wouldn't it work to use DWARF-2 EH in the 32-bit multilib, but SjLj/SEH
for 64-bit?  If so, wrapping i386/w32-unwind.h in #ifdef __x86_64__
would have exactly this effect, irrespective of multilib use.

> Well, wrapping header with __x64_64__ might helper partial. . But this
> might be worth a try. Nevertheless I assume that then at least
> produced DLL names for libgcc could get confused for their extensions.
> Rainer: It would be helpful, if you could try this.

Unfortunately, I cannot: I don't have any access to windows systems, so
I'm relying on the target maintainers or other interested parties to
test.

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31  9:44 ` Paolo Bonzini
@ 2011-05-31 18:09   ` Rainer Orth
  2011-06-03 14:36   ` Rainer Orth
  1 sibling, 0 replies; 29+ messages in thread
From: Rainer Orth @ 2011-05-31 18:09 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump

Paolo Bonzini <bonzini@gnu.org> writes:

> On 05/30/2011 05:43 PM, Rainer Orth wrote:
>> +md-unwind-support.h: config.status
>> +	if test -n "$(md_unwind_header)"; then \
>> +	  echo "#include \"config/$(md_unwind_header)\"">  $@; \
>> +	else \
>> +	  :>  $@; \
>> +	fi
>
> Can you add a default file md-unwind-none.h and use
>
> AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])
>
> instead of this (and instead of AC_SUBST'ing the variable)?

Sure, will do.

>> -libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
>> -libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
>> +libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
>> +libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
>> +
>> +$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
>> +
>> +libgcc-eh-objects += $(libgcc-eh-static-objects)
>> +libgcc-s-objects += $(libgcc-eh-shared-objects)
>
> These changes to the dependencies should not be necessary, libgcc does
> automatic dependency tracking.

That's what I thought, but my bootstraps failed since there wasn't any
dependency that triggered the creation of the header.  That's when I
introduced this explicit dependency.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-30 18:08 [build] Move MD_UNWIND_SUPPORT to toplevel libgcc Rainer Orth
  2011-05-30 20:14 ` Kai Tietz
  2011-05-31  9:44 ` Paolo Bonzini
@ 2011-05-31 19:59 ` Mike Stump
  2011-06-01 16:01   ` Rainer Orth
  2 siblings, 1 reply; 29+ messages in thread
From: Mike Stump @ 2011-05-31 19:59 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

On May 30, 2011, at 8:43 AM, Rainer Orth wrote:
> * The three users of MD_UNWIND_SUPPORT are modified to unconditionally
>  include a new md-unwind-support.h header which is created from the
>  info in config.host: if md_unwind_header exists, it is included in
>  md-unwind-support.h, otherwise the generated header is empty.

> diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
> --- a/gcc/config/rs6000/darwin.h
> +++ b/gcc/config/rs6000/darwin.h
> @@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
> #include <stdbool.h>
> #endif
> 
> -#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
> -#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
> -#endif
> -

So, I'm wondering, can we just roll this check into the header, so instead of:

#if A
#include file
#endif

file:
bla

we have:

#include file

file:
#if A
bla
#endif

The advantages, any wrapping code is handled the exact same way.  Once this is done, then the transformation to port is identical to every other port.  Also, this general rule would apply to the other corner cases as well, if I read them right.

?

Oh, once this is done, I think:

/* libSystem contains unwind information for signal frames.  */
#define DARWIN_LIBSYSTEM_HAS_UNWIND

is only used by libgcc.  Does it have to move at the same time?  If so, then it needs moving.  If it doesn't have to move, you can leave it behind if you want, though my preference would be to move it.

I think the darwin bits are Ok with this change.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31 19:59 ` Mike Stump
@ 2011-06-01 16:01   ` Rainer Orth
  2011-06-01 16:47     ` Mike Stump
  2011-06-01 17:33     ` Richard Henderson
  0 siblings, 2 replies; 29+ messages in thread
From: Rainer Orth @ 2011-06-01 16:01 UTC (permalink / raw)
  To: Mike Stump
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

Mike Stump <mikestump@comcast.net> writes:

> On May 30, 2011, at 8:43 AM, Rainer Orth wrote:
>> * The three users of MD_UNWIND_SUPPORT are modified to unconditionally
>>  include a new md-unwind-support.h header which is created from the
>>  info in config.host: if md_unwind_header exists, it is included in
>>  md-unwind-support.h, otherwise the generated header is empty.
>
>> diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
>> --- a/gcc/config/rs6000/darwin.h
>> +++ b/gcc/config/rs6000/darwin.h
>> @@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
>> #include <stdbool.h>
>> #endif
>> 
>> -#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
>> -#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
>> -#endif
>> -
>
> So, I'm wondering, can we just roll this check into the header, so instead of:
>
> #if A
> #include file
> #endif
>
> file:
> bla
>
> we have:
>
> #include file
>
> file:
> #if A
> bla
> #endif
>
> The advantages, any wrapping code is handled the exact same way.  Once this is done, then the transformation to port is identical to every other port.  Also, this general rule would apply to the other corner cases as well, if I read them right.
>
> ?

The problem with this approach is that some of the macros tested only
live in gcc, not libgcc once the libgcc sources no longer include tm.h
etc.  E.g. look at i386/mingw32.h:

#if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH)
#define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
#endif

Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
least in the medium term, we need different tests here.

> Oh, once this is done, I think:
>
> /* libSystem contains unwind information for signal frames.  */
> #define DARWIN_LIBSYSTEM_HAS_UNWIND
>
> is only used by libgcc.  Does it have to move at the same time?  If so, then it needs moving.  If it doesn't have to move, you can leave it behind if you want, though my preference would be to move it.

It doesn't have to, but it could.  On the other hand, my question still
stands: DARWIN_LIBSYSTEM_HAS_UNWIND is defined in gcc/config/darwin9.h.
So if every release up to Darwin 8 on PowerPC is 32-bit only (I honestly
don't know), then we could just restrict rs6000/darwin-unwind.h to
darwin < 9 and be done with it, no need for the macros above.

> I think the darwin bits are Ok with this change.

I can certainly do it this way for now, but if we could do away with the
tests completely, that would be cleaner.

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 16:01   ` Rainer Orth
@ 2011-06-01 16:47     ` Mike Stump
  2011-06-01 17:52       ` Rainer Orth
  2011-06-01 17:33     ` Richard Henderson
  1 sibling, 1 reply; 29+ messages in thread
From: Mike Stump @ 2011-06-01 16:47 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

On Jun 1, 2011, at 9:01 AM, Rainer Orth wrote:
> Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
> least in the medium term, we need different tests here.

Ah, ick.  Oh well...  The next more general rule would be something like: one can set a feature (implicit -D__GCC_DO_UNWIND_BLA) in the compiler when TARGET_64BIT_DEFAULT and TARGET_BI_ARCH are set a certain way, and then in libgcc, one can just test that feature directly.  Ick, I hate inventing feature names here...

> I can certainly do it this way for now, but if we could do away with the
> tests completely, that would be cleaner.

Agreed, though, I don't believe the test is superfluous.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 16:01   ` Rainer Orth
  2011-06-01 16:47     ` Mike Stump
@ 2011-06-01 17:33     ` Richard Henderson
  2011-06-01 17:41       ` Kai Tietz
  1 sibling, 1 reply; 29+ messages in thread
From: Richard Henderson @ 2011-06-01 17:33 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Mike Stump, gcc-patches, Joseph S. Myers, Paolo Bonzini,
	Ralf Wildenhues, Douglas Rupp, Tristan Gingold,
	John David Anglin, Steve Ellcey, Kai Tietz, Dave Korn, ktietz

On 06/01/2011 09:01 AM, Rainer Orth wrote:
> The problem with this approach is that some of the macros tested only
> live in gcc, not libgcc once the libgcc sources no longer include tm.h
> etc.  E.g. look at i386/mingw32.h:
> 
> #if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH)
> #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
> #endif
> 
> Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
> least in the medium term, we need different tests here.

For this specific case, surely neither isn't relevant.
Surely the proper test, in the target header, is simply 

#ifndef __MINGW64__

as one would write in normal user-level code.


r~

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 17:33     ` Richard Henderson
@ 2011-06-01 17:41       ` Kai Tietz
  0 siblings, 0 replies; 29+ messages in thread
From: Kai Tietz @ 2011-06-01 17:41 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Rainer Orth, Mike Stump, gcc-patches, Joseph S. Myers,
	Paolo Bonzini, Ralf Wildenhues, Douglas Rupp, Tristan Gingold,
	John David Anglin, Steve Ellcey, Kai Tietz, Dave Korn

2011/6/1 Richard Henderson <rth@redhat.com>:
> On 06/01/2011 09:01 AM, Rainer Orth wrote:
>> The problem with this approach is that some of the macros tested only
>> live in gcc, not libgcc once the libgcc sources no longer include tm.h
>> etc.  E.g. look at i386/mingw32.h:
>>
>> #if !TARGET_64BIT_DEFAULT && !defined (TARGET_BI_ARCH)
>> #define MD_UNWIND_SUPPORT "config/i386/w32-unwind.h"
>> #endif
>>
>> Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
>> least in the medium term, we need different tests here.
>
> For this specific case, surely neither isn't relevant.
> Surely the proper test, in the target header, is simply
>
> #ifndef __MINGW64__
>
> as one would write in normal user-level code.
>
>
> r~

Yes, thanks.  Well, we would loose here the ability to build for
mingw-w64 dw2 support for 32-bit (to be compatible to mingw.org's
32-bit variant, as they want to use this dw2 unwinder), but mingw-w64
doesn't want dw2-unwind in general, as dw2-unwind has some issues
about throwing of VC generated code. So this test might be ok too.

Regards,
Kai

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 16:47     ` Mike Stump
@ 2011-06-01 17:52       ` Rainer Orth
  2011-06-01 19:43         ` Mike Stump
  0 siblings, 1 reply; 29+ messages in thread
From: Rainer Orth @ 2011-06-01 17:52 UTC (permalink / raw)
  To: Mike Stump
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

Mike Stump <mikestump@comcast.net> writes:

> On Jun 1, 2011, at 9:01 AM, Rainer Orth wrote:
>> Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
>> least in the medium term, we need different tests here.
>
> Ah, ick.  Oh well...  The next more general rule would be something like: one can set a feature (implicit -D__GCC_DO_UNWIND_BLA) in the compiler when TARGET_64BIT_DEFAULT and TARGET_BI_ARCH are set a certain way, and then in libgcc, one can just test that feature directly.  Ick, I hate inventing feature names here...

True, but only as a last resort.  Alternatively, one could try to
determine the feature with autoconf.

>> I can certainly do it this way for now, but if we could do away with the
>> tests completely, that would be cleaner.
>
> Agreed, though, I don't believe the test is superfluous.

You still haven't answered my question wrt. Darwin 8 vs. 64-bit on
PowerPC.  Perhaps we can do away with DARWIN_LIBSYSTEM_HAS_UNWIND
completely?

        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 17:52       ` Rainer Orth
@ 2011-06-01 19:43         ` Mike Stump
  2011-06-01 20:00           ` IainS
  0 siblings, 1 reply; 29+ messages in thread
From: Mike Stump @ 2011-06-01 19:43 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

On Jun 1, 2011, at 10:51 AM, Rainer Orth wrote:
>>> I can certainly do it this way for now, but if we could do away with the
>>> tests completely, that would be cleaner.
>> 
>> Agreed, though, I don't believe the test is superfluous.
> 
> You still haven't answered my question wrt. Darwin 8 vs. 64-bit on
> PowerPC.  Perhaps we can do away with DARWIN_LIBSYSTEM_HAS_UNWIND
> completely?

To quote my previous email:

>> I don't believe the test is superfluous.

This means that I can't say for sure that is is unneeded.  There was 64-bit support on darwin 8 as I recall.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-01 19:43         ` Mike Stump
@ 2011-06-01 20:00           ` IainS
  0 siblings, 0 replies; 29+ messages in thread
From: IainS @ 2011-06-01 20:00 UTC (permalink / raw)
  To: GCC Patches
  Cc: Mike Stump, Rainer Orth, Joseph S. Myers, Paolo Bonzini,
	Ralf Wildenhues, Douglas Rupp, Tristan Gingold,
	John David Anglin, Steve Ellcey, Kai Tietz, Dave Korn


On 1 Jun 2011, at 20:40, Mike Stump wrote:

> On Jun 1, 2011, at 10:51 AM, Rainer Orth wrote:
>>>> I can certainly do it this way for now, but if we could do away  
>>>> with the
>>>> tests completely, that would be cleaner.
>>>
>>> Agreed, though, I don't believe the test is superfluous.
>>
>> You still haven't answered my question wrt. Darwin 8 vs. 64-bit on
>> PowerPC.  Perhaps we can do away with DARWIN_LIBSYSTEM_HAS_UNWIND
>> completely?
>
> To quote my previous email:
>
>>> I don't believe the test is superfluous.
>
> This means that I can't say for sure that is is unneeded.  There was  
> 64-bit support on darwin 8 as I recall.

It was working last time I checked (around 3-ish months ago)...

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-05-31  9:44 ` Paolo Bonzini
  2011-05-31 18:09   ` Rainer Orth
@ 2011-06-03 14:36   ` Rainer Orth
  2011-06-03 15:37     ` Paolo Bonzini
                       ` (2 more replies)
  1 sibling, 3 replies; 29+ messages in thread
From: Rainer Orth @ 2011-06-03 14:36 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump

Paolo Bonzini <bonzini@gnu.org> writes:

> On 05/30/2011 05:43 PM, Rainer Orth wrote:
>> +md-unwind-support.h: config.status
>> +	if test -n "$(md_unwind_header)"; then \
>> +	  echo "#include \"config/$(md_unwind_header)\"">  $@; \
>> +	else \
>> +	  :>  $@; \
>> +	fi
>
> Can you add a default file md-unwind-none.h and use
>
> AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])
>
> instead of this (and instead of AC_SUBST'ing the variable)?

Sure, done in the revised patch below.

>> -libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
>> -libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
>> +libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
>> +libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
>> +
>> +$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
>> +
>> +libgcc-eh-objects += $(libgcc-eh-static-objects)
>> +libgcc-s-objects += $(libgcc-eh-shared-objects)
>
> These changes to the dependencies should not be necessary, libgcc does
> automatic dependency tracking.

I suppose it was necessary before when md-unwind-support.h didn't exist
at build time, so dependency generation failed  With the new scheme
using AC_CONFIG_LINKS, they are indeed unnecessary.

> Also a good start, though.  Thanks for this work.

Apart from those changes, the patch addresses the PowerPC Darwin and
Windows32 issues as suggested:

* rs6000/darwin-unwind.h is wrapped in !__LP64__, while removing the
  need for the !DARWIN_LIBSYSTEM_HAS_UNWIND test (only defined on Darwin
  9 and up) by using the file only for PowerPC Darwin < 9.

* i386/w32-unwind.h is wrapped in !__MINGW64__.

Bootstrapped without regressions on i386-pc-solaris2.11.

Ok for mainline?

Thanks.
	Rainer


2011-05-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove.
	* config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/mips/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove.
	* config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove.
	* config/sh/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove.
	* config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove.
	* config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove.
	* config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha.
	* config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha.
	* config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin.
	* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/sol2-unwind.h: Move to ../libgcc/config/i386.
	* config/i386/w32-unwind.h: Move to ../libgcc/config/i386.
	* config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64.
	* config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64.
	* config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k.
	* config/mips/linux-unwind.h: Move to ../libgcc/config/mips.
	* config/pa/hpux-unwind.h: Move to ../libgcc/config/pa.
	* config/pa/linux-unwind.h: Move to ../libgcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000.
	* config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000.
	* config/s390/linux-unwind.h: Move to ../libgcc/config/s390.
	* config/s390/tpf-unwind.h: Move to ../libgcc/config/s390.
	* config/sh/linux-unwind.h: Move to ../libgcc/config/sh.
	* config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa.
	* config/darwin9.h (DARWIN_LIBSYSTEM_HAS_UNWIND): Remove.
	* system.h (MD_UNWIND_SUPPORT): Poison.
	* doc/tm.texi.in (Exception Handling, MD_UNWIND_SUPPORT): Remove.
	* doc/tm.texi: Regenerate.
	* unwind-dw2.c: Include md-unwind-support.h instead of
	MD_UNWIND_SUPPORT.
	* config/ia64/unwind-ia64.c: Likewise.
	* config/xtensa/unwind-dw2-xtensa.c: Likewise.

	libgcc:
	* config/alpha/linux-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/osf5-unwind.h: Move from ../gcc/config/alpha.
	* config/alpha/vms-unwind.h: Move from ../gcc/config/alpha.
	* config/bfin/linux-unwind.h: Move from ../gcc/config/bfin.
	* config/i386/linux-unwind.h: Move from ../gcc/config/i386.
	* config/i386/sol2-unwind.h: Move from ../gcc/config/i386.
	* config/i386/w32-unwind.h: Move from ../gcc/config/i386.
	Wrap in !__MINGW64__.
	* config/ia64/linux-unwind.h: Move from ../gcc/config/ia64.
	* config/ia64/vms-unwind.h: Move from ../gcc/config/ia64.
	* config/m68k/linux-unwind.h: Move from ../gcc/config/m68k.
	* config/mips/linux-unwind.h: Move from ../gcc/config/mips.
	* config/pa/hpux-unwind.h: Move from ../gcc/config/pa.
	* config/pa/linux-unwind.h: Move from ../gcc/config/pa.
	* config/rs6000/darwin-unwind.h: Move from ../gcc/config/rs6000.
	Wrap in !__LP64__.
	* config/rs6000/linux-unwind.h: Move from ../gcc/config/rs6000.
	* config/s390/linux-unwind.h: Move from ../gcc/config/s390.
	* config/s390/tpf-unwind.h: Move from ../gcc/config/s390.
	* config/sh/linux-unwind.h: Move from ../gcc/config/sh.
	* config/sparc/linux-unwind.h: Move from ../gcc/config/sparc.
	* config/sparc/sol2-unwind.h: Move from ../gcc/config/sparc.
	* config/xtensa/linux-unwind.h: Move from ../gcc/config/xtensa.
	* config/no-unwind.h: New file.
	* config.host (md_unwind_header): Document.
	Define.
	(alpha*-*-linux*, alpha*-dec-osf5.1*, alpha64-dec-*vms*,
	alpha*-dec-*vms*, bfin*-uclinux*, bfin*-linux-uclibc*,
	hppa*-*-linux*, hppa[12]*-*-hpux10*, hppa*64*-*-hpux11*,
	hppa[12]*-*-hpux11*): Set md_unwind_header.
	(i[34567]86-*-linux*): Handle i[34567]86-*-kopensolaris*-gnu.
	Set md_unwind_header.
	(x86_64-*-linux*, i[34567]86-*-solaris2*): Set md_unwind_header.
	(i[34567]86-*-cygwin*): Split from i[34567]86-*-mingw*.
	(i[34567]86-*-mingw*, ia64*-*-linux*, ia64-hp-*vms*,
	m68k-*-uclinux*, m68k-*-linux*, mips64*-*-linux*, mips*-*-linux*,
	powerpc-*-darwin*, powerpc-*-linux*, s390-*-linux*,
	s390x-*-linux*,  s390x-ibm-tpf*, sh*-*-linux*, sparc-*-linux*,
	sparc*-*-solaris2*, sparc64-*-linux*, xtensa*-*-linux*): Set
	md_unwind_header.
	* configure.ac: Link md-unwind-support.h to $md_unwind_header.
	* configure: Regenerate.

diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler,
    for Alpha Linux-based GNU systems.
    Copyright (C) 1996, 1997, 1998, 2002, 2003, 2004, 2005, 2006, 2007, 2009,
-   2010 Free Software Foundation, Inc.
+   2010, 2011 Free Software Foundation, Inc.
    Contributed by Richard Henderson.
 
 This file is part of GCC.
@@ -84,8 +84,6 @@ along with GCC; see the file COPYING3.  
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/alpha/linux-unwind.h"
-
 /* Define if long doubles should be mangled as 'g'.  */
 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
 
diff --git a/gcc/config/alpha/osf5.h b/gcc/config/alpha/osf5.h
--- a/gcc/config/alpha/osf5.h
+++ b/gcc/config/alpha/osf5.h
@@ -274,5 +274,3 @@ __enable_execute_stack (void *addr)					
 
 /* Handle #pragma extern_prefix.  */
 #define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 1
-
-#define MD_UNWIND_SUPPORT "config/alpha/osf5-unwind.h"
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -225,14 +225,6 @@ typedef struct {int num_args; enum avms_
 #define LINK_EH_SPEC "vms-dwarf2eh.o%s "
 #define LINK_GCC_C_SEQUENCE_SPEC "%G"
 
-#ifdef IN_LIBGCC2
-/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
-   file. This avoids having to recompile the world instead of libgcc only
-   when changes to this macro are exercised.  */
-
-#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
-#endif
-
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
   avms_asm_output_external (FILE, DECL, NAME)
 
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -48,7 +48,5 @@ see the files COPYING3 and COPYING.RUNTI
    -dynamic-linker /lib/ld-uClibc.so.0} \
    %{static}} -init __init -fini __fini"
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 #undef TARGET_SUPPORTS_SYNC_CALLS
 #define TARGET_SUPPORTS_SYNC_CALLS 1
diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
--- a/gcc/config/bfin/uclinux.h
+++ b/gcc/config/bfin/uclinux.h
@@ -32,8 +32,6 @@ see the files COPYING3 and COPYING.RUNTI
   %{mfast-fp:-lbffastfp} %G %L %{mfast-fp:-lbffastfp} %G \
 "
 
-#define MD_UNWIND_SUPPORT "config/bfin/linux-unwind.h"
-
 /* Like the definition in gcc.c, but for purposes of uClinux, every link is
    static.  */
 #define MFWRAP_SPEC " %{fmudflap|fmudflapth: \
diff --git a/gcc/config/darwin9.h b/gcc/config/darwin9.h
--- a/gcc/config/darwin9.h
+++ b/gcc/config/darwin9.h
@@ -1,5 +1,5 @@
 /* Target definitions for Darwin (Mac OS X) systems.
-   Copyright (C) 2006, 2007, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
    Contributed by Apple Inc.
 
 This file is part of GCC.
@@ -35,9 +35,6 @@ along with GCC; see the file COPYING3.  
 /* Tell collect2 to run dsymutil for us as necessary.  */
 #define COLLECT_RUN_DSYMUTIL 1
 
-/* libSystem contains unwind information for signal frames.  */
-#define DARWIN_LIBSYSTEM_HAS_UNWIND
-
 #undef  ASM_OUTPUT_ALIGNED_COMMON
 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
   do {									\
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -22,5 +22,3 @@ along with GCC; see the file COPYING3.  
 
 #define GNU_USER_LINK_EMULATION "elf_i386"
 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -26,5 +26,3 @@ see the files COPYING3 and COPYING.RUNTI
 
 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-
-#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -241,12 +241,6 @@ __enable_execute_stack (void *addr)					
 #include <windows.h>
 #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
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -171,5 +171,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  PTRDIFF_TYPE
 #define PTRDIFF_TYPE "int"
-
-#define MD_UNWIND_SUPPORT "config/i386/sol2-unwind.h"
diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -77,8 +77,6 @@ do {						\
 #undef LINK_EH_SPEC
 #define LINK_EH_SPEC ""
 
-#define MD_UNWIND_SUPPORT "config/ia64/linux-unwind.h"
-
 /* Put all *tf routines in libgcc.  */
 #undef LIBGCC2_HAS_TF_MODE
 #define LIBGCC2_HAS_TF_MODE 1
diff --git a/gcc/config/ia64/unwind-ia64.c b/gcc/config/ia64/unwind-ia64.c
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/gcc/config/ia64/unwind-ia64.c
@@ -1,7 +1,7 @@
 /* Subroutines needed for unwinding IA-64 standard format stack frame
    info for exception handling.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
-   2009  Free Software Foundation, Inc.
+   2009, 2011  Free Software Foundation, Inc.
    Contributed by Andrew MacLeod  <amacleod@cygnus.com>
 	          Andrew Haley  <aph@cygnus.com>
 		  David Mosberger-Tang <davidm@hpl.hp.com>
@@ -1767,9 +1767,7 @@ _Unwind_GetBSP (struct _Unwind_Context *
   return (_Unwind_Ptr) context->bsp;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 static _Unwind_Reason_Code
 uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -185,8 +185,6 @@ typedef struct crtl_name_spec
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
-
 #define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
 #define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
 
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -235,5 +235,3 @@ along with GCC; see the file COPYING3.  
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/m68k/linux-unwind.h"
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -99,8 +99,6 @@ along with GCC; see the file COPYING3.  
 %{!shared: \
   %{profile:-lc_p} %{!profile:-lc}}"
 
-#define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
-
 #ifdef HAVE_AS_NO_SHARED
 /* Default to -mno-shared for non-PIC.  */
 # define NO_SHARED_SPECS \
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for HP-UX.
-   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1996, 2002, 2003, 2004, 2007, 2008, 2009,
+   2010, 2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -115,5 +115,3 @@ along with GCC; see the file COPYING3.  
    compatibility with the HP-UX unwind library.  */
 #undef TARGET_HPUX_UNWIND_LIBRARY
 #define TARGET_HPUX_UNWIND_LIBRARY 1
-
-#define MD_UNWIND_SUPPORT "config/pa/hpux-unwind.h"
diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h
--- a/gcc/config/pa/pa32-linux.h
+++ b/gcc/config/pa/pa32-linux.h
@@ -1,5 +1,5 @@
 /* Definitions for PA_RISC with ELF-32 format
-   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010
+   Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -63,5 +63,3 @@ call_ ## FUNC (void)					\
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
-
-#define MD_UNWIND_SUPPORT "config/pa/linux-unwind.h"
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
 #include <stdbool.h>
 #endif
 
-#if !defined(__LP64__) && !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
-#define MD_UNWIND_SUPPORT "config/rs6000/darwin-unwind.h"
-#endif
-
 /* True, iff we're generating fast turn around debugging code.  When
    true, we arrange for function prologues to start with 5 nops so
    that gdb may insert code to redirect them, and for data to be
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -113,8 +113,6 @@
 
 #define TARGET_POSIX_IO
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
 #define TARGET_THREAD_SSP_OFFSET	-0x7008
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -539,8 +539,6 @@ extern int dot_symbols;
 #define USE_LD_AS_NEEDED 1
 #endif
 
-#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
    ppc64 glibc provides it at -0x7010(13).  */
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -79,8 +79,6 @@ along with GCC; see the file COPYING3.  
 
 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
 
-#define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h"
-
 #ifdef TARGET_LIBC_PROVIDES_SSP
 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
    s390x glibc provides it at 0x28(tp).  */
diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h
--- a/gcc/config/s390/tpf.h
+++ b/gcc/config/s390/tpf.h
@@ -118,8 +118,6 @@ along with GCC; see the file COPYING3.  
    %{!shared:-shared} \
    %(entry_spec)"
 
-#define MD_UNWIND_SUPPORT "config/s390/tpf-unwind.h"
-
 /* IBM copies these libraries over with these names.  */
 #define MATH_LIBRARY "CLBM"
 #define LIBSTDCXX "CPP1"
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -114,8 +114,6 @@ along with GCC; see the file COPYING3.  
       }									\
   } while (0)
 
-#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
-
 /* For SH3 and SH4, we use a slot of the unwind frame which correspond
    to a fake register number 16 as a placeholder for the return address
    in MD_FALLBACK_FRAME_STATE_FOR and its content will be read with
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -141,8 +141,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -261,8 +261,6 @@ do {									\
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
-
 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
    TMO, and TMO in multiprocessor mode.  But they reserve the right to
    change their minds.  */
diff --git a/gcc/config/sparc/sol2.h b/gcc/config/sparc/sol2.h
--- a/gcc/config/sparc/sol2.h
+++ b/gcc/config/sparc/sol2.h
@@ -196,5 +196,3 @@ along with GCC; see the file COPYING3.  
 
 /* Static stack checking is supported by means of probes.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
-
-#define MD_UNWIND_SUPPORT "config/sparc/sol2-unwind.h"
diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
@@ -64,5 +64,3 @@ along with GCC; see the file COPYING3.  
 
 #undef DBX_REGISTER_NUMBER
 
-#define MD_UNWIND_SUPPORT "config/xtensa/linux-unwind.h"
-
diff --git a/gcc/config/xtensa/unwind-dw2-xtensa.c b/gcc/config/xtensa/unwind-dw2-xtensa.c
--- a/gcc/config/xtensa/unwind-dw2-xtensa.c
+++ b/gcc/config/xtensa/unwind-dw2-xtensa.c
@@ -1,6 +1,6 @@
 /* DWARF2 exception handling and frame unwinding for Xtensa.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008, 2009
+   2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
 
    This file is part of GCC.
@@ -208,9 +208,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
   return (_Unwind_Ptr) context->bases.tbase;
 }
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -1,5 +1,5 @@
 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
-@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -3373,11 +3373,6 @@ of bytes that the format occupies, @var{
 to be emitted.
 @end defmac
 
-@defmac MD_UNWIND_SUPPORT
-A string specifying a file to be #include'd in unwind-dw2.c.  The file
-so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
-@end defmac
-
 @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
 This macro allows the target to add CPU and operating system specific
 code to the call-frame unwinder for use when there is no unwind data
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -1,5 +1,5 @@
 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
-@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+@c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -3361,11 +3361,6 @@ of bytes that the format occupies, @var{
 to be emitted.
 @end defmac
 
-@defmac MD_UNWIND_SUPPORT
-A string specifying a file to be #include'd in unwind-dw2.c.  The file
-so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
-@end defmac
-
 @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
 This macro allows the target to add CPU and operating system specific
 code to the call-frame unwinder for use when there is no unwind data
diff --git a/gcc/system.h b/gcc/system.h
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -763,7 +763,8 @@ extern void fancy_abort (const char *, i
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
- #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX
+ #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX		\
+	MD_UNWIND_SUPPORT
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c
--- a/gcc/unwind-dw2.c
+++ b/gcc/unwind-dw2.c
@@ -333,9 +333,7 @@ _Unwind_GetTextRelBase (struct _Unwind_C
 }
 #endif
 
-#ifdef MD_UNWIND_SUPPORT
-#include MD_UNWIND_SUPPORT
-#endif
+#include "md-unwind-support.h"
 \f
 /* Extract any interesting information from the CIE for the translation
    unit F belongs to.  Return a pointer to the byte after the augmentation,
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -50,6 +50,8 @@
 #			If either is set, EXTRA_PARTS and
 #			EXTRA_MULTILIB_PARTS inherited from the GCC
 #			subdirectory will be ignored.
+#  md_unwind_header	The name of a header file defining
+#			MD_FALLBACK_FRAME_STATE_FOR.
 #  tmake_file		A list of machine-description-specific
 #			makefile-fragments, if different from
 #			"$cpu_type/t-$cpu_type".
@@ -57,6 +59,7 @@
 asm_hidden_op=.hidden
 extra_parts=
 tmake_file=
+md_unwind_header=no-unwind.h
 
 # Set default cpu_type so it can be updated in each machine entry.
 cpu_type=`echo ${host} | sed 's/-.*$//'`
@@ -210,6 +213,7 @@ case ${host} in
 alpha*-*-linux*)
 	tmake_file="${tmake_file} alpha/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=alpha/linux-unwind.h
 	;;
 alpha*-*-freebsd*)
 	;;
@@ -225,12 +229,15 @@ alpha*-dec-osf5.1*)
 	    ;;
 	esac
 	extra_parts="${extra_parts} qrnnd.o crtfastmath.o gthr-posix.o"
+	md_unwind_header=alpha/osf5-unwind.h
 	;;
 alpha64-dec-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 alpha*-dec-*vms*)
 	tmake_file="vms/t-vms alpha/t-vms"
+	md_unwind_header=alpha/vms-unwind.h
 	;;
 arm-wrs-vxworks)
 	;;
@@ -261,11 +268,13 @@ avr-*-*)
 bfin*-elf*)
         ;;
 bfin*-uclinux*)
+	md_unwind_header=bfin/linux-unwind.h
         ;;
 bfin*-linux-uclibc*)
 	# No need to build crtbeginT.o on uClibc systems.  Should probably
 	# be moved to the OS specific section above.
 	extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
+	md_unwind_header=bfin/linux-unwind.h
 	;;
 bfin*-*)
         ;;
@@ -289,12 +298,16 @@ h8300-*-elf*)
 hppa*64*-*-linux*)
 	;;
 hppa*-*-linux*)
+	md_unwind_header=pa/pa32-linux.h
 	;;
 hppa[12]*-*-hpux10*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa*64*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 hppa[12]*-*-hpux11*)
+	md_unwind_header=pa/hpux-unwind.h
 	;;
 i[34567]86-*-darwin*)
 	;;
@@ -319,13 +332,15 @@ i[34567]86-*-openbsd2.*|i[34567]86-*open
 	;;
 i[34567]86-*-openbsd*)
 	;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
+i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	md_unwind_header=i386/linux-unwind.h
 	;;
 i[34567]86-pc-msdosdjgpp*)
 	;;
@@ -347,13 +362,19 @@ i[34567]86-*-rtems*)
 i[34567]86-*-solaris2*)
 	tmake_file="$tmake_file i386/t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=i386/sol2-unwind.h
 	;;
 i[4567]86-wrs-vxworks|i[4567]86-wrs-vxworksae)
 	;;
-i[34567]86-*-cygwin* | i[34567]86-*-mingw*)
+i[34567]86-*-cygwin*)
 	extra_parts="crtbegin.o crtend.o crtfastmath.o"
 	tmake_file="i386/t-cygming i386/t-crtfm"
 	;;
+i[34567]86-*-mingw*)
+	extra_parts="crtbegin.o crtend.o crtfastmath.o"
+	tmake_file="i386/t-cygming i386/t-crtfm"
+	md_unwind_header=i386/w32-unwind.h
+	;;
 x86_64-*-mingw*)
 	;;
 i[34567]86-*-interix3*)
@@ -369,11 +390,13 @@ ia64*-*-freebsd*)
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	tmake_file="ia64/t-ia64 t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat"
+	md_unwind_header=ia64/linux-unwind.h
 	;;
 ia64*-*-hpux*)
 	;;
 ia64-hp-*vms*)
 	tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms"
+	md_unwind_header=ia64/vms-unwind.h
 	;;
 iq2000*-*-elf*)
         ;;
@@ -400,10 +423,12 @@ m68k*-*-netbsdelf*)
 m68k*-*-openbsd*)
 	;;
 m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux with uClibc
+	md_unwind_header=m68k/linux-unwind.h
 	;;
-m68k-*-linux*)		# Motorola m68k's running GNU/Linux
+m68k-*-linux*)			# Motorola m68k's running GNU/Linux
 				# with ELF format using glibc 2
 				# aka the GNU/Linux C library 6.
+	md_unwind_header=m68k/linux-unwind.h
 	;;
 m68k-*-rtems*)
 	;;
@@ -421,10 +446,12 @@ mips*-*-netbsd*)			# NetBSD/mips, either
 mips64*-*-linux*)
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-linux*)				# Linux MIPS, either endian.
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="{$tmake_file} t-crtfm"
+	md_unwind_header=mips/linux-unwind.h
 	;;
 mips*-*-openbsd*)
 	;;
@@ -469,6 +496,15 @@ pdp11-*-*)
 picochip-*-*)
         ;;
 powerpc-*-darwin*)
+	case ${host} in
+	*-*-darwin9* | *-*-darwin[12][0-9]*)
+	  # libSystem contains unwind information for signal frames since
+	  # Darwin 9.
+	  ;;
+	*)
+	  md_unwind_header=rs6000/darwin-unwind.h
+	  ;;
+	esac
 	;;
 powerpc64-*-darwin*)
 	;;
@@ -495,6 +531,7 @@ powerpc-*-rtems*)
 	;;
 powerpc-*-linux* | powerpc64-*-linux*)
 	tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-ldbl128 t-softfp"
+	md_unwind_header=rs6000/linux-unwind.h
 	;;
 powerpc-wrs-vxworks|powerpc-wrs-vxworksae)
 	;;
@@ -518,12 +555,15 @@ rx-*-elf)
 	;;
 s390-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-*-linux*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux"
+	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-ibm-tpf*)
 	tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
+	md_unwind_header-s390/tpf-unwind.h
 	;;
 score-*-elf)
         ;;
@@ -534,6 +574,7 @@ sh-*-elf* | sh[12346l]*-*-elf* | \
 	case ${host} in
 	sh*-*-linux*)
 		tmake_file="${tmake_file} sh/t-linux"
+		md_unwind_header=sh/unwind-linux.h
 		;;
 	esac
 	;;
@@ -559,6 +600,7 @@ sparc-*-elf*)
 sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux.h
 	;;
 sparc-*-rtems* | sparc64-*-rtems* )
 	tmake_file="sparc/t-elf t-crtin t-crtfm t-rtems"
@@ -567,6 +609,7 @@ sparc-*-rtems* | sparc64-*-rtems* )
 sparc*-*-solaris2*)
 	tmake_file="$tmake_file t-crtfm"
 	extra_parts="$extra_parts crtfastmath.o"
+	md_unwind_header=sparc/sol2-unwind.h
 	;;
 sparc64-*-elf*)
 	tmake_file="${tmake_file} t-crtin t-crtfm"
@@ -579,6 +622,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
 sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
 	extra_parts="$extra_parts crtfastmath.o"
 	tmake_file="${tmake_file} t-crtfm"
+	md_unwind_header=sparc/linux-unwind.h
 	;;
 sparc64-*-netbsd*)
 	;;
@@ -601,6 +645,7 @@ xstormy16-*-elf)
 xtensa*-*-elf*)
 	;;
 xtensa*-*-linux*)
+	md_unwind_header=xtensa/linux-unwind.h
 	;;
 am33_2.0-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
diff --git a/gcc/config/alpha/linux-unwind.h b/libgcc/config/alpha/linux-unwind.h
rename from gcc/config/alpha/linux-unwind.h
rename to libgcc/config/alpha/linux-unwind.h
diff --git a/gcc/config/alpha/osf5-unwind.h b/libgcc/config/alpha/osf5-unwind.h
rename from gcc/config/alpha/osf5-unwind.h
rename to libgcc/config/alpha/osf5-unwind.h
diff --git a/gcc/config/alpha/vms-unwind.h b/libgcc/config/alpha/vms-unwind.h
rename from gcc/config/alpha/vms-unwind.h
rename to libgcc/config/alpha/vms-unwind.h
diff --git a/gcc/config/bfin/linux-unwind.h b/libgcc/config/bfin/linux-unwind.h
rename from gcc/config/bfin/linux-unwind.h
rename to libgcc/config/bfin/linux-unwind.h
diff --git a/gcc/config/i386/linux-unwind.h b/libgcc/config/i386/linux-unwind.h
rename from gcc/config/i386/linux-unwind.h
rename to libgcc/config/i386/linux-unwind.h
diff --git a/gcc/config/i386/sol2-unwind.h b/libgcc/config/i386/sol2-unwind.h
rename from gcc/config/i386/sol2-unwind.h
rename to libgcc/config/i386/sol2-unwind.h
diff --git a/gcc/config/i386/w32-unwind.h b/libgcc/config/i386/w32-unwind.h
rename from gcc/config/i386/w32-unwind.h
rename to libgcc/config/i386/w32-unwind.h
--- a/gcc/config/i386/w32-unwind.h
+++ b/libgcc/config/i386/w32-unwind.h
@@ -1,5 +1,5 @@
 /* Definitions for Dwarf2 EH unwind support for Windows32 targets
-   Copyright (C) 2007, 2009, 2010
+   Copyright (C) 2007, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Pascal Obry  <obry@adacore.com>
 
@@ -82,6 +82,8 @@ see the files COPYING3 and COPYING.RUNTI
    Note that this implementation follows closely the same principles as the
    GNU/Linux and OSF ones.  */
 
+#ifndef __MINGW64__
+
 #define WIN32_MEAN_AND_LEAN
 #include <windows.h>
 /* Patterns found experimentally to be on a Windows signal handler  */
@@ -202,3 +204,5 @@ i386_w32_fallback_frame_state (struct _U
   else
     return _URC_END_OF_STACK;
 }
+
+#endif /* !__MINGW64__ */
diff --git a/gcc/config/ia64/linux-unwind.h b/libgcc/config/ia64/linux-unwind.h
rename from gcc/config/ia64/linux-unwind.h
rename to libgcc/config/ia64/linux-unwind.h
diff --git a/gcc/config/ia64/vms-unwind.h b/libgcc/config/ia64/vms-unwind.h
rename from gcc/config/ia64/vms-unwind.h
rename to libgcc/config/ia64/vms-unwind.h
diff --git a/gcc/config/m68k/linux-unwind.h b/libgcc/config/m68k/linux-unwind.h
rename from gcc/config/m68k/linux-unwind.h
rename to libgcc/config/m68k/linux-unwind.h
diff --git a/gcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h
rename from gcc/config/mips/linux-unwind.h
rename to libgcc/config/mips/linux-unwind.h
diff --git a/libgcc/config/no-unwind.h b/libgcc/config/no-unwind.h
new file mode 100644
--- /dev/null
+++ b/libgcc/config/no-unwind.h
@@ -0,0 +1,2 @@
+/* Dummy header for targets without a definition of
+   MD_FALLBACK_FRAME_STATE_FOR.  */
diff --git a/gcc/config/pa/hpux-unwind.h b/libgcc/config/pa/hpux-unwind.h
rename from gcc/config/pa/hpux-unwind.h
rename to libgcc/config/pa/hpux-unwind.h
diff --git a/gcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h
rename from gcc/config/pa/linux-unwind.h
rename to libgcc/config/pa/linux-unwind.h
diff --git a/gcc/config/rs6000/darwin-unwind.h b/libgcc/config/rs6000/darwin-unwind.h
rename from gcc/config/rs6000/darwin-unwind.h
rename to libgcc/config/rs6000/darwin-unwind.h
--- a/gcc/config/rs6000/darwin-unwind.h
+++ b/libgcc/config/rs6000/darwin-unwind.h
@@ -1,5 +1,5 @@
-/* DWARF2 EH unwinding support for Darwin.
-   Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+/* DWARF2 EH unwinding support for 32-bit PowerPC Darwin.
+   Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -22,9 +22,13 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef __LP64__
+
 extern bool _Unwind_fallback_frame_state_for
   (struct _Unwind_Context *context, _Unwind_FrameState *fs);
 
 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS)	\
   (_Unwind_fallback_frame_state_for (CONTEXT, FS)	\
    ? _URC_NO_REASON : _URC_END_OF_STACK)
+
+#endif
diff --git a/gcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h
rename from gcc/config/rs6000/linux-unwind.h
rename to libgcc/config/rs6000/linux-unwind.h
diff --git a/gcc/config/s390/linux-unwind.h b/libgcc/config/s390/linux-unwind.h
rename from gcc/config/s390/linux-unwind.h
rename to libgcc/config/s390/linux-unwind.h
diff --git a/gcc/config/s390/tpf-unwind.h b/libgcc/config/s390/tpf-unwind.h
rename from gcc/config/s390/tpf-unwind.h
rename to libgcc/config/s390/tpf-unwind.h
diff --git a/gcc/config/sh/linux-unwind.h b/libgcc/config/sh/linux-unwind.h
rename from gcc/config/sh/linux-unwind.h
rename to libgcc/config/sh/linux-unwind.h
diff --git a/gcc/config/sparc/linux-unwind.h b/libgcc/config/sparc/linux-unwind.h
rename from gcc/config/sparc/linux-unwind.h
rename to libgcc/config/sparc/linux-unwind.h
diff --git a/gcc/config/sparc/sol2-unwind.h b/libgcc/config/sparc/sol2-unwind.h
rename from gcc/config/sparc/sol2-unwind.h
rename to libgcc/config/sparc/sol2-unwind.h
diff --git a/gcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h
rename from gcc/config/xtensa/linux-unwind.h
rename to libgcc/config/xtensa/linux-unwind.h
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -278,6 +278,7 @@ AC_SUBST(tmake_file)
 AC_SUBST(cpu_type)
 AC_SUBST(extra_parts)
 AC_SUBST(asm_hidden_op)
+AC_CONFIG_LINKS([md-unwind-support.h:config/$md_unwind_header])
 
 # We need multilib support.
 AC_CONFIG_FILES([Makefile])


-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-03 14:36   ` Rainer Orth
@ 2011-06-03 15:37     ` Paolo Bonzini
  2011-06-03 16:44       ` Kai Tietz
  2011-06-03 18:13     ` Mike Stump
  2011-06-21  9:53     ` Thomas Schwinge
  2 siblings, 1 reply; 29+ messages in thread
From: Paolo Bonzini @ 2011-06-03 15:37 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump, Dominique Dhumieres

On 06/03/2011 04:35 PM, Rainer Orth wrote:
> Apart from those changes, the patch addresses the PowerPC Darwin and
> Windows32 issues as suggested:
>
> * rs6000/darwin-unwind.h is wrapped in !__LP64__, while removing the
>    need for the !DARWIN_LIBSYSTEM_HAS_UNWIND test (only defined on Darwin
>    9 and up) by using the file only for PowerPC Darwin<  9.
>
> * i386/w32-unwind.h is wrapped in !__MINGW64__.
>
> Bootstrapped without regressions on i386-pc-solaris2.11.

Please give time to Kai and someone from Darwin (CCed Mike and 
Dominique) to test it and approve it.  The .h changes are trivial, so I 
think I can otherwise approve it.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-03 15:37     ` Paolo Bonzini
@ 2011-06-03 16:44       ` Kai Tietz
  0 siblings, 0 replies; 29+ messages in thread
From: Kai Tietz @ 2011-06-03 16:44 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Rainer Orth, gcc-patches, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn, Mike Stump, Dominique Dhumieres

Ok, windows part of the patch is ok.

Thanks,
Kai

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-03 14:36   ` Rainer Orth
  2011-06-03 15:37     ` Paolo Bonzini
@ 2011-06-03 18:13     ` Mike Stump
  2011-06-21  9:53     ` Thomas Schwinge
  2 siblings, 0 replies; 29+ messages in thread
From: Mike Stump @ 2011-06-03 18:13 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Paolo Bonzini, gcc-patches, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn

On Jun 3, 2011, at 7:35 AM, Rainer Orth wrote:
> Apart from those changes, the patch addresses the PowerPC Darwin and
> Windows32 issues as suggested:

Darwin bits: Ok.

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-03 14:36   ` Rainer Orth
  2011-06-03 15:37     ` Paolo Bonzini
  2011-06-03 18:13     ` Mike Stump
@ 2011-06-21  9:53     ` Thomas Schwinge
  2011-06-21 10:11       ` Rainer Orth
  2 siblings, 1 reply; 29+ messages in thread
From: Thomas Schwinge @ 2011-06-21  9:53 UTC (permalink / raw)
  To: Rainer Orth, Paolo Bonzini
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Douglas Rupp,
	Tristan Gingold, John David Anglin, Steve Ellcey, Kai Tietz,
	Dave Korn, Mike Stump

[-- Attachment #1: Type: text/plain, Size: 2738 bytes --]

Hallo!

(Sorry for being late with this -- I'm listed as a GNU/Hurd OS Port
Maintainer, but I have not been CCed in the original patch email, and I'm
only able to read gcc-patches/the Git log at irregular times.)


On Fri, 03 Jun 2011 16:35:21 +0200, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> 	gcc:
> [...]
> 	* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
> [...]
> 	* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
> [...]
> 
> 	libgcc:
> [...]
> 	* config/i386/linux-unwind.h: Move from ../gcc/config/i386.
> [...]
> 	* config/no-unwind.h: New file.
> 	* config.host (md_unwind_header): Document.
> 	Define.  [...]
> 	(i[34567]86-*-linux*): Handle i[34567]86-*-kopensolaris*-gnu.
> 	Set md_unwind_header.
> 	[...]

> diff --git a/libgcc/config.host b/libgcc/config.host
> --- a/libgcc/config.host
> +++ b/libgcc/config.host
> @@ -50,6 +50,8 @@
>  #			If either is set, EXTRA_PARTS and
>  #			EXTRA_MULTILIB_PARTS inherited from the GCC
>  #			subdirectory will be ignored.
> +#  md_unwind_header	The name of a header file defining
> +#			MD_FALLBACK_FRAME_STATE_FOR.
>  #  tmake_file		A list of machine-description-specific
>  #			makefile-fragments, if different from
>  #			"$cpu_type/t-$cpu_type".
> @@ -57,6 +59,7 @@
>  asm_hidden_op=.hidden
>  extra_parts=
>  tmake_file=
> +md_unwind_header=no-unwind.h
> [...] 

> -i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
> +i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
>  	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
>  	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
> +	md_unwind_header=i386/linux-unwind.h
>  	;;

This is wrong for the non-Linux x86 configurations.  (Previously
MD_UNWIND_SUPPORT explicitly has only been set in config/i386/linux.h,
which the non-Linux configurations don't use anymore, thanks to Joseph's
recent effort.)

>  x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
>  	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
>  	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
> +	md_unwind_header=i386/linux-unwind.h

This also looks wrong for the non-Linux x86_64 configurations.

(I didn't examine any further configurations.)


How should this be fixed?  Probably my moving the md_unwind_header
definitions outside of...

    case ${host} in
    # Support site-specific machine types.

... (where they currently reside), and create a new ``case $host'' as
done just above for enable_execute_stack, for example?


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-21  9:53     ` Thomas Schwinge
@ 2011-06-21 10:11       ` Rainer Orth
  2011-06-29  8:54         ` Paolo Bonzini
  0 siblings, 1 reply; 29+ messages in thread
From: Rainer Orth @ 2011-06-21 10:11 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Paolo Bonzini, gcc-patches, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn, Mike Stump

Hi Thomas,

> (Sorry for being late with this -- I'm listed as a GNU/Hurd OS Port
> Maintainer, but I have not been CCed in the original patch email, and I'm
> only able to read gcc-patches/the Git log at irregular times.)

sorry for not including you in the Cc: I must have simply overlooked it
and the Cc: list was too long already ;-)

> How should this be fixed?  Probably my moving the md_unwind_header
> definitions outside of...
>
>     case ${host} in
>     # Support site-specific machine types.
>
> ... (where they currently reside), and create a new ``case $host'' as
> done just above for enable_execute_stack, for example?

No, I don't think this is appropriate.  For enable_execute_stack, we
have only 3 cases, so it's easier to create its own case statement, one
with many labels.

For md_unwind_header on the other hand, you'd have almost as many cases
as in the general case.  I fear it's hard to have the configuration
split over too many places.  So I'd suggest to split the affected cases
into Linux and non-Linux ones, with the slight duplication necessary for
extra_parts and tmake_file.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-21 10:11       ` Rainer Orth
@ 2011-06-29  8:54         ` Paolo Bonzini
  2011-07-05 11:52           ` Thomas Schwinge
  0 siblings, 1 reply; 29+ messages in thread
From: Paolo Bonzini @ 2011-06-29  8:54 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Thomas Schwinge, gcc-patches, Joseph S. Myers, Ralf Wildenhues,
	Douglas Rupp, Tristan Gingold, John David Anglin, Steve Ellcey,
	Kai Tietz, Dave Korn, Mike Stump

On 06/21/2011 12:04 PM, Rainer Orth wrote:
> For md_unwind_header on the other hand, you'd have almost as many cases
> as in the general case.  I fear it's hard to have the configuration
> split over too many places.  So I'd suggest to split the affected cases
> into Linux and non-Linux ones, with the slight duplication necessary for
> extra_parts and tmake_file.

I agree.  Thomas, are you going to do that?

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-06-29  8:54         ` Paolo Bonzini
@ 2011-07-05 11:52           ` Thomas Schwinge
  2011-07-05 11:53             ` Rainer Orth
  0 siblings, 1 reply; 29+ messages in thread
From: Thomas Schwinge @ 2011-07-05 11:52 UTC (permalink / raw)
  To: Paolo Bonzini, Rainer Orth; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2378 bytes --]

Hallo!

On Wed, 29 Jun 2011 10:40:10 +0200, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 06/21/2011 12:04 PM, Rainer Orth wrote:
> > For md_unwind_header on the other hand, you'd have almost as many cases
> > as in the general case.  I fear it's hard to have the configuration
> > split over too many places.  So I'd suggest to split the affected cases
> > into Linux and non-Linux ones, with the slight duplication necessary for
> > extra_parts and tmake_file.
> 
> I agree.  Thomas, are you going to do that?

Like this?


	libgcc/
	config.host: Use i386/linux-unwind.h only for *-*-linux*.

---
 libgcc/config.host |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index 326ce91..1d5b887 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -354,12 +354,18 @@ i[34567]86-*-openbsd*)
 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
-	md_unwind_header=i386/linux-unwind.h
+        case $host in
+            *-*-linux*)
+	        md_unwind_header=i386/linux-unwind.h;;
+        esac
 	;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
-	md_unwind_header=i386/linux-unwind.h
+        case $host in
+            *-*-linux*)
+	        md_unwind_header=i386/linux-unwind.h;;
+        esac
 	;;
 i[34567]86-pc-msdosdjgpp*)
 	;;
-- 
tg: (1677490..) linux-unwind.h (depends on: master)

Manually tested as follows -- is that enough?

    $ (host=i686-pc-linux-gnu && . libgcc/config.host && echo "$md_unwind_header")
    i386/linux-unwind.h
    $ (host=i686-pc-kfreebsd-gnu && . libgcc/config.host && echo "$md_unwind_header")
    no-unwind.h
    $ (host=i686-pc-gnu && . libgcc/config.host && echo "$md_unwind_header")
    no-unwind.h
    $ (host=x86_64-pc-linux-gnu && . libgcc/config.host && echo "$md_unwind_header")
    i386/linux-unwind.h
    $ (host=x86_64-pc-kfreebsd-gnu && . libgcc/config.host && echo "$md_unwind_header")
    no-unwind.h


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-07-05 11:52           ` Thomas Schwinge
@ 2011-07-05 11:53             ` Rainer Orth
  2011-07-05 12:14               ` Paolo Bonzini
  2011-07-05 13:03               ` Thomas Schwinge
  0 siblings, 2 replies; 29+ messages in thread
From: Rainer Orth @ 2011-07-05 11:53 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: Paolo Bonzini, gcc-patches

Hi Thomas,

> Like this?
>
>
> 	libgcc/
> 	config.host: Use i386/linux-unwind.h only for *-*-linux*.
>
> ---
>  libgcc/config.host |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libgcc/config.host b/libgcc/config.host
> index 326ce91..1d5b887 100644
> --- a/libgcc/config.host
> +++ b/libgcc/config.host
> @@ -354,12 +354,18 @@ i[34567]86-*-openbsd*)
>  i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
>  	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
>  	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
> -	md_unwind_header=i386/linux-unwind.h
> +        case $host in
> +            *-*-linux*)
> +	        md_unwind_header=i386/linux-unwind.h;;
> +        esac
>  	;;
>  x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
>  	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
>  	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
> -	md_unwind_header=i386/linux-unwind.h
> +        case $host in
> +            *-*-linux*)
> +	        md_unwind_header=i386/linux-unwind.h;;
> +        esac

Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
another for the rest, duplicating extra_parts and tmake_file.  Same for
x86_64-*-linux* vs. the rest.

But that's just me.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-07-05 11:53             ` Rainer Orth
@ 2011-07-05 12:14               ` Paolo Bonzini
  2011-07-05 13:03               ` Thomas Schwinge
  1 sibling, 0 replies; 29+ messages in thread
From: Paolo Bonzini @ 2011-07-05 12:14 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Thomas Schwinge, gcc-patches

On 07/05/2011 01:52 PM, Rainer Orth wrote:
> Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
> another for the rest, duplicating extra_parts and tmake_file.  Same for
> x86_64-*-linux* vs. the rest.
>
> But that's just me.

I agree.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-07-05 11:53             ` Rainer Orth
  2011-07-05 12:14               ` Paolo Bonzini
@ 2011-07-05 13:03               ` Thomas Schwinge
  2011-07-05 14:16                 ` Paolo Bonzini
  1 sibling, 1 reply; 29+ messages in thread
From: Thomas Schwinge @ 2011-07-05 13:03 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Paolo Bonzini, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2206 bytes --]

Hallo!

On Tue, 05 Jul 2011 13:52:08 +0200, Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> wrote:
> > Like this?  [...]
> 
> Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
> another for the rest, duplicating extra_parts and tmake_file.  Same for
> x86_64-*-linux* vs. the rest.
> 
> But that's just me.

My idea was to keep the GNU systems' extra_parts and tmake_file stanzas
together.  But it's a bit wishi washi anyway in all these configuration
files, so we might as well use the following patch.

Manually tested as before -- more testing required?

	libgcc/
	config.host: Use i386/linux-unwind.h only for *-*-linux*.

---
 libgcc/config.host |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index 326ce91..c89155f 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -351,16 +351,24 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
 	;;
 i[34567]86-*-openbsd*)
 	;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+i[34567]86-*-linux*)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
 	md_unwind_header=i386/linux-unwind.h
 	;;
-x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
+i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	;;
+x86_64-*-linux*)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
 	md_unwind_header=i386/linux-unwind.h
 	;;
+x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
+	;;
 i[34567]86-pc-msdosdjgpp*)
 	;;
 i[34567]86-*-lynxos*)
-- 
tg: (1677490..) linux-unwind.h (depends on: master)


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc
  2011-07-05 13:03               ` Thomas Schwinge
@ 2011-07-05 14:16                 ` Paolo Bonzini
  0 siblings, 0 replies; 29+ messages in thread
From: Paolo Bonzini @ 2011-07-05 14:16 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: Rainer Orth, gcc-patches

On 07/05/2011 02:13 PM, Thomas Schwinge wrote:
> Hallo!
>
> On Tue, 05 Jul 2011 13:52:08 +0200, Rainer Orth<ro@CeBiTec.Uni-Bielefeld.DE>  wrote:
>>> Like this?  [...]
>>
>> Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
>> another for the rest, duplicating extra_parts and tmake_file.  Same for
>> x86_64-*-linux* vs. the rest.
>>
>> But that's just me.
>
> My idea was to keep the GNU systems' extra_parts and tmake_file stanzas
> together.  But it's a bit wishi washi anyway in all these configuration
> files, so we might as well use the following patch.
>
> Manually tested as before -- more testing required?
>
> 	libgcc/
> 	config.host: Use i386/linux-unwind.h only for *-*-linux*.

Ok, with changelog entry like

	* config.host (i[34567]86-*-kfreebsd*-gnu,
	i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*,
	i[34567]86-*-kopensolaris*-gnu): Remove md_unwind_header
	by splitting out of...
	(i[34567]86-*-linux*): ... this.
	* config.host (x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu):
	Remove md_unwind_header by splitting out of...
	(x86_64-*-linux*): ... this.

Paolo

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-07-05 14:08 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-30 18:08 [build] Move MD_UNWIND_SUPPORT to toplevel libgcc Rainer Orth
2011-05-30 20:14 ` Kai Tietz
2011-05-31  9:30   ` Paolo Bonzini
2011-05-31 12:31     ` Kai Tietz
2011-05-31 12:36       ` Paolo Bonzini
2011-05-31 18:07       ` Rainer Orth
2011-05-31 17:57     ` Rainer Orth
2011-05-31  9:44 ` Paolo Bonzini
2011-05-31 18:09   ` Rainer Orth
2011-06-03 14:36   ` Rainer Orth
2011-06-03 15:37     ` Paolo Bonzini
2011-06-03 16:44       ` Kai Tietz
2011-06-03 18:13     ` Mike Stump
2011-06-21  9:53     ` Thomas Schwinge
2011-06-21 10:11       ` Rainer Orth
2011-06-29  8:54         ` Paolo Bonzini
2011-07-05 11:52           ` Thomas Schwinge
2011-07-05 11:53             ` Rainer Orth
2011-07-05 12:14               ` Paolo Bonzini
2011-07-05 13:03               ` Thomas Schwinge
2011-07-05 14:16                 ` Paolo Bonzini
2011-05-31 19:59 ` Mike Stump
2011-06-01 16:01   ` Rainer Orth
2011-06-01 16:47     ` Mike Stump
2011-06-01 17:52       ` Rainer Orth
2011-06-01 19:43         ` Mike Stump
2011-06-01 20:00           ` IainS
2011-06-01 17:33     ` Richard Henderson
2011-06-01 17:41       ` Kai Tietz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).