[ghdl] update to svn150

sailer sailer at fedoraproject.org
Fri Feb 1 17:22:49 UTC 2013


commit c1043eec6f0594d65727f70703b2ed509799b208
Author: Thomas Sailer <t.sailer at alumni.ethz.ch>
Date:   Fri Feb 1 17:44:58 2013 +0100

    update to svn150

 .gitignore                         |    6 +-
 gcc47-arm-hfp-ldso.patch           |   52 +
 gcc47-c++-builtin-redecl.patch     |  134 +++
 gcc47-cloog-dl.patch               |  472 +++++++++
 gcc47-hack.patch                   |  102 ++
 gcc47-i386-libgomp.patch           |   28 +
 gcc47-java-nomulti.patch           |   44 +
 gcc47-libgomp-omp_h-multilib.patch |   17 +
 gcc47-libitm-fno-exceptions.patch  |   28 +
 gcc47-libtool-no-rpath.patch       |   27 +
 gcc47-no-add-needed.patch          |   52 +
 gcc47-ppc32-retaddr.patch          |   86 ++
 gcc47-ppl-0.10.patch               |  121 +++
 gcc47-pr38757.patch                |  105 ++
 gcc47-pr55137.patch                |  180 ++++
 gcc47-pr55236.patch                |   62 ++
 gcc47-rh330771.patch               |   27 +
 gcc47-rh837630.patch               |   16 +
 gcc47-sparc-config-detection.patch |   40 +
 ghdl-libgomp.patch                 |   22 +
 ghdl-make.patch                    |   11 +
 ghdl-svn143.patch                  |  172 ----
 ghdl-svn150.patch                  | 1902 ++++++++++++++++++++++++++++++++++++
 ghdl-typeforsize.patch             |   13 +
 ghdl.spec                          |  140 +++-
 sources                            |    2 +-
 26 files changed, 3668 insertions(+), 193 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index b1e98c4..4b73dc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,10 @@
 gcc-core-4.1.2.tar.bz2
-ghdl-0.26.tar.bz2
-ghdl-0.27.tar.bz2
 gcc-core-4.2.4.tar.bz2
 gcc-core-4.3.1.tar.bz2
 gcc-core-4.3.4.tar.bz2
+gcc-4.7.2.tar.bz2
+gcc-4.7.2-20121109.tar.bz2
+ghdl-0.26.tar.bz2
+ghdl-0.27.tar.bz2
 ghdl-0.28.tar.bz2
 ghdl-0.29.tar.bz2
diff --git a/gcc47-arm-hfp-ldso.patch b/gcc47-arm-hfp-ldso.patch
new file mode 100644
index 0000000..2f0b8c4
--- /dev/null
+++ b/gcc47-arm-hfp-ldso.patch
@@ -0,0 +1,52 @@
+2012-05-01  Richard Earnshaw  <rearnsha at arm.com>
+
+	* arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_DEFAULT): Avoid ifdef
+	comparing enumeration values.  Update comments.
+
+2012-04-26  Michael Hope  <michael.hope at linaro.org>
+	    Richard Earnshaw  <rearnsha at arm.com>
+
+	* config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_SOFT_FLOAT): Define.
+	(GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
+	(GLIBC_DYNAMIC_LINKER_DEFAULT): Define.
+	(GLIBC_DYNAMIC_LINKER):	Redefine to use the hard float path.
+
+--- gcc/config/arm/linux-eabi.h	(revision 186858)
++++ gcc/config/arm/linux-eabi.h	(revision 187012)
+@@ -32,7 +32,8 @@
+   while (false)
+ 
+ /* We default to a soft-float ABI so that binaries can run on all
+-   target hardware.  */
++   target hardware.  If you override this to use the hard-float ABI then
++   change the setting of GLIBC_DYNAMIC_LINKER_DEFAULT as well.  */
+ #undef  TARGET_DEFAULT_FLOAT_ABI
+ #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
+ 
+@@ -59,10 +60,23 @@
+ #undef  SUBTARGET_EXTRA_LINK_SPEC
+ #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION
+ 
+-/* Use ld-linux.so.3 so that it will be possible to run "classic"
+-   GNU/Linux binaries on an EABI system.  */
++/* GNU/Linux on ARM currently supports three dynamic linkers:
++   - ld-linux.so.2 - for the legacy ABI
++   - ld-linux.so.3 - for the EABI-derived soft-float ABI
++   - ld-linux-armhf.so.3 - for the EABI-derived hard-float ABI.
++   All the dynamic linkers live in /lib.
++   We default to soft-float, but this can be overridden by changing both
++   GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
++
+ #undef  GLIBC_DYNAMIC_LINKER
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
++#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
++#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
++
++#define GLIBC_DYNAMIC_LINKER \
++   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
++    %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
++    %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+ 
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
diff --git a/gcc47-c++-builtin-redecl.patch b/gcc47-c++-builtin-redecl.patch
new file mode 100644
index 0000000..fa30745
--- /dev/null
+++ b/gcc47-c++-builtin-redecl.patch
@@ -0,0 +1,134 @@
+2007-10-02  Jakub Jelinek  <jakub at redhat.com>
+
+	* decl.c (duplicate_decls): When redeclaring a builtin function,
+	keep the merged decl builtin whenever types match, even if new
+	decl defines a function.
+
+	* gcc.dg/builtins-85.c: New test.
+	* g++.dg/ext/builtin30.C: New test.
+
+--- gcc/cp/decl.c.jj	2007-10-01 22:11:09.000000000 +0200
++++ gcc/cp/decl.c	2007-10-02 11:39:46.000000000 +0200
+@@ -2137,39 +2137,37 @@ duplicate_decls (tree newdecl, tree oldd
+ 	  DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
+ 	  DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
+ 	}
++      /* If redeclaring a builtin function, it stays built in.  */
++      if (types_match && DECL_BUILT_IN (olddecl))
++	{
++	  DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
++	  DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
++	  /* If we're keeping the built-in definition, keep the rtl,
++	     regardless of declaration matches.  */
++	  COPY_DECL_RTL (olddecl, newdecl);
++	  if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL)
++	    {
++	      enum built_in_function fncode = DECL_FUNCTION_CODE (newdecl);
++	      switch (fncode)
++		{
++		  /* If a compatible prototype of these builtin functions
++		     is seen, assume the runtime implements it with the
++		     expected semantics.  */
++		case BUILT_IN_STPCPY:
++		  if (builtin_decl_explicit_p (fncode))
++		    set_builtin_decl_implicit_p (fncode, true);
++		  break;
++		default:
++		  break;
++		}
++	    }
++	}
+       if (new_defines_function)
+ 	/* If defining a function declared with other language
+ 	   linkage, use the previously declared language linkage.  */
+ 	SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
+       else if (types_match)
+ 	{
+-	  /* If redeclaring a builtin function, and not a definition,
+-	     it stays built in.  */
+-	  if (DECL_BUILT_IN (olddecl))
+-	    {
+-	      DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
+-	      DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
+-	      /* If we're keeping the built-in definition, keep the rtl,
+-		 regardless of declaration matches.  */
+-	      COPY_DECL_RTL (olddecl, newdecl);
+-	      if (DECL_BUILT_IN_CLASS (newdecl) == BUILT_IN_NORMAL)
+-		{
+-		  enum built_in_function fncode = DECL_FUNCTION_CODE (newdecl);
+-		  switch (fncode)
+-		    {
+-		      /* If a compatible prototype of these builtin functions
+-			 is seen, assume the runtime implements it with the
+-			 expected semantics.  */
+-		    case BUILT_IN_STPCPY:
+-		      if (builtin_decl_explicit_p (fncode))
+-			set_builtin_decl_implicit_p (fncode, true);
+-		      break;
+-		    default:
+-		      break;
+-		    }
+-		}
+-	    }
+-
+ 	  DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
+ 	  /* Don't clear out the arguments if we're just redeclaring a
+ 	     function.  */
+--- gcc/testsuite/gcc.dg/builtins-85.c.jj	2007-10-02 11:23:51.000000000 +0200
++++ gcc/testsuite/gcc.dg/builtins-85.c	2007-10-02 11:24:12.000000000 +0200
+@@ -0,0 +1,25 @@
++/* { dg-do compile } */
++/* { dg-options "-O2" } */
++
++typedef __SIZE_TYPE__ size_t;
++extern void __chk_fail (void);
++extern int snprintf (char *, size_t, const char *, ...);
++extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
++{
++  if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
++    __chk_fail ();
++  return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
++}
++extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
++
++char buf[10];
++
++int
++main (void)
++{
++  snprintf (buf, 10, "%d%d\n", 10, 10);
++  return 0;
++}
++
++/* { dg-final { scan-assembler "mysnprintf" } } */
++/* { dg-final { scan-assembler-not "__chk_fail" } } */
+--- gcc/testsuite/g++.dg/ext/builtin30.C.jj	2007-10-02 11:19:45.000000000 +0200
++++ gcc/testsuite/g++.dg/ext/builtin30.C	2007-10-02 11:23:26.000000000 +0200
+@@ -0,0 +1,27 @@
++// { dg-do compile }
++// { dg-options "-O2" }
++
++typedef __SIZE_TYPE__ size_t;
++extern "C" {
++extern void __chk_fail (void);
++extern int snprintf (char *, size_t, const char *, ...);
++extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
++{
++  if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
++    __chk_fail ();
++  return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
++}
++extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
++}
++
++char buf[10];
++
++int
++main (void)
++{
++  snprintf (buf, 10, "%d%d\n", 10, 10);
++  return 0;
++}
++
++// { dg-final { scan-assembler "mysnprintf" } }
++// { dg-final { scan-assembler-not "__chk_fail" } }
diff --git a/gcc47-cloog-dl.patch b/gcc47-cloog-dl.patch
new file mode 100644
index 0000000..1ed7165
--- /dev/null
+++ b/gcc47-cloog-dl.patch
@@ -0,0 +1,472 @@
+2011-01-04  Jakub Jelinek  <jakub at redhat.com>
+
+	* Makefile.in (BACKENDLIBS): Link against -ldl instead of
+	-lcloog -lppl.
+	(graphite.o, graphite%.o): Force -O, remove -fkeep-inline-functions.
+	(GRAPHITE_CLOOG_UTIL_H, GRAPHITE_POLY_H): New.
+	(graphite*.o): Adjust dependencies.
+	* graphite-cloog-compat.h: Include <dlfcn.h>.  Reference libcloog and
+	libppl symbols through pointers in cloog_pointers__ variable.
+	* graphite.c (init_cloog_pointers): New function.
+	(graphite_transform_loops): Call init_cloog_pointers.
+	* graphite-clast-to-gimple.c (gcc_type_for_iv_of_clast_loop): Rename
+	stmt_for argument to stmt_fora.
+	* graphite-poly.h: Include graphite-cloog-util.h.
+
+--- gcc/Makefile.in.jj	2011-01-03 13:44:14.163900902 +0100
++++ gcc/Makefile.in	2011-01-04 17:48:53.588775911 +0100
+@@ -962,6 +962,8 @@ GCC_PLUGIN_H = gcc-plugin.h highlev-plug
+ PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
+ PLUGIN_VERSION_H = plugin-version.h configargs.h
+ LIBFUNCS_H = libfuncs.h $(HASHTAB_H)
++GRAPHITE_CLOOG_UTIL_H = graphite-cloog-util.h graphite-cloog-compat.h
++GRAPHITE_POLY_H = graphite-poly.h $(GRAPHITE_CLOOG_UTIL_H)
+ 
+ #
+ # Now figure out from those variables how to compile and link.
+@@ -1016,7 +1018,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
+ # and the system's installed libraries.
+ LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) \
+ 	$(LIBDECNUMBER) $(HOST_LIBS)
+-BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
++BACKENDLIBS = $(GMPLIBS) $(if $(CLOOGLIBS),-ldl) $(PLUGINLIBS) $(HOST_LIBS) \
+ 	$(ZLIB)
+ # Any system libraries needed just for GNAT.
+ SYSLIBS = @GNAT_LIBEXC@
+@@ -2602,40 +2604,40 @@ sese.o : sese.c sese.h $(CONFIG_H) $(SYS
+    $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) tree-pass.h value-prof.h
+ graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) \
+    $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \
+-   $(DBGCNT_H) graphite-ppl.h graphite-poly.h graphite-scop-detection.h \
++   $(DBGCNT_H) graphite-ppl.h $(GRAPHITE_POLY_H) graphite-scop-detection.h \
+    graphite-clast-to-gimple.h graphite-sese-to-poly.h
+ graphite-blocking.o : graphite-blocking.c $(CONFIG_H) $(SYSTEM_H) \
+    coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
+-   sese.h graphite-ppl.h graphite-poly.h
++   sese.h graphite-ppl.h $(GRAPHITE_POLY_H)
+ graphite-clast-to-gimple.o : graphite-clast-to-gimple.c $(CONFIG_H) \
+    $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
+-   $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-cloog-util.h \
+-   graphite-ppl.h graphite-poly.h graphite-clast-to-gimple.h \
++   $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h $(GRAPHITE_CLOOG_UTIL_H) \
++   graphite-ppl.h $(GRAPHITE_POLY_H) graphite-clast-to-gimple.h \
+    graphite-dependences.h graphite-cloog-compat.h
+ graphite-cloog-util.o : graphite-cloog-util.c $(CONFIG_H) $(SYSTEM_H) \
+-   coretypes.h graphite-cloog-util.h graphite-cloog-compat.h
++   coretypes.h $(GRAPHITE_CLOOG_UTIL_H) graphite-cloog-compat.h
+ graphite-dependences.o : graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
+    coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
+-   sese.h graphite-ppl.h graphite-poly.h graphite-dependences.h \
+-   graphite-cloog-util.h
++   sese.h graphite-ppl.h $(GRAPHITE_POLY_H) graphite-dependences.h \
++   $(GRAPHITE_CLOOG_UTIL_H)
+ graphite-flattening.o : graphite-flattening.c $(CONFIG_H) $(SYSTEM_H)	\
+    coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
+-   sese.h graphite-ppl.h graphite-poly.h
++   sese.h graphite-ppl.h $(GRAPHITE_POLY_H)
+ graphite-interchange.o : graphite-interchange.c $(CONFIG_H) $(SYSTEM_H) \
+    coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
+-   sese.h graphite-ppl.h graphite-poly.h
++   sese.h graphite-ppl.h $(GRAPHITE_POLY_H)
+ graphite-poly.o : graphite-poly.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+    $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_DUMP_H) gimple-pretty-print.h \
+-   $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-ppl.h graphite-poly.h \
+-   graphite-dependences.h graphite-cloog-util.h
++   $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-ppl.h $(GRAPHITE_POLY_H) \
++   graphite-dependences.h $(GRAPHITE_CLOOG_UTIL_H)
+ graphite-ppl.o : graphite-ppl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+-   graphite-cloog-util.h graphite-ppl.h
++   $(GRAPHITE_CLOOG_UTIL_H) graphite-ppl.h
+ graphite-scop-detection.o : graphite-scop-detection.c $(CONFIG_H) $(SYSTEM_H) \
+    coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) \
+-   sese.h graphite-ppl.h graphite-poly.h graphite-scop-detection.h
++   sese.h graphite-ppl.h $(GRAPHITE_POLY_H) graphite-scop-detection.h
+ graphite-sese-to-poly.o : graphite-sese-to-poly.c $(CONFIG_H) \
+    $(SYSTEM_H) coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) \
+-   $(TREE_DATA_REF_H) domwalk.h sese.h graphite-ppl.h graphite-poly.h \
++   $(TREE_DATA_REF_H) domwalk.h sese.h graphite-ppl.h $(GRAPHITE_POLY_H) \
+    graphite-sese-to-poly.h
+ tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+    $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
+@@ -3454,6 +3456,15 @@ $(common_out_object_file): $(common_out_
+ 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+ 	  $< $(OUTPUT_OPTION)
+ 
++graphite%.o : \
++  ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite.o : \
++  ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS))
++graphite%.o : \
++  ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
++graphite.o : \
++  ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS))
++
+ # Build auxiliary files that support ecoff format.
+ mips-tfile: mips-tfile.o $(LIBDEPS)
+ 	$(LINKER) $(LINKERFLAGS) $(LDFLAGS) -o $@ \
+--- gcc/graphite-cloog-compat.h.jj	2011-01-03 12:53:05.000000000 +0100
++++ gcc/graphite-cloog-compat.h	2011-01-04 17:34:09.857757544 +0100
+@@ -272,4 +272,279 @@ static inline int cloog_matrix_nrows (Cl
+    return m->NbRows;
+ }
+ #endif /* CLOOG_ORG  */
++
++#include <dlfcn.h>
++#if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
++#define DYNSYMS_PPL11
++#else
++#define DYNSYMS_PPL11 \
++  DYNSYM (ppl_new_PIP_Problem_from_constraints); \
++  DYNSYM (ppl_PIP_Problem_is_satisfiable); \
++  DYNSYM (ppl_delete_PIP_Problem);
++#endif
++#define DYNSYMS \
++  DYNSYM (cloog_block_alloc); \
++  DYNSYM (cloog_block_list_free); \
++  DYNSYM (cloog_block_list_malloc); \
++  DYNSYM (cloog_clast_create); \
++  DYNSYM (cloog_clast_free); \
++  DYNSYM (cloog_domain_free); \
++  DYNSYM (cloog_domain_matrix2domain); \
++  DYNSYM (cloog_initialize); \
++  DYNSYM (cloog_loop_malloc); \
++  DYNSYM (cloog_matrix_alloc); \
++  DYNSYM (cloog_matrix_copy); \
++  DYNSYM (cloog_matrix_free); \
++  DYNSYM (cloog_matrix_print); \
++  DYNSYM (cloog_names_malloc); \
++  DYNSYM (cloog_names_scalarize); \
++  DYNSYM (cloog_options_free); \
++  DYNSYM (cloog_options_malloc); \
++  DYNSYM (cloog_program_dump_cloog); \
++  DYNSYM (cloog_program_extract_scalars); \
++  DYNSYM (cloog_program_free); \
++  DYNSYM (cloog_program_generate); \
++  DYNSYM (cloog_program_malloc); \
++  DYNSYM (cloog_program_print); \
++  DYNSYM (cloog_program_scatter); \
++  DYNSYM (cloog_statement_alloc); \
++  DYNSYM (cloog_domain_union); \
++  DYNSYM (cloog_matrix_read); \
++  DYNSYM (cloog_new_pol); \
++  DYNSYM (cloog_vector_gcd); \
++  DYNSYM (ppl_finalize); \
++  DYNSYM (ppl_assign_Coefficient_from_mpz_t); \
++  DYNSYM (ppl_assign_Linear_Expression_from_Linear_Expression); \
++  DYNSYM (ppl_Coefficient_to_mpz_t); \
++  DYNSYM (ppl_Constraint_coefficient); \
++  DYNSYM (ppl_Constraint_inhomogeneous_term); \
++  DYNSYM (ppl_Constraint_space_dimension); \
++  DYNSYM (ppl_Constraint_System_begin); \
++  DYNSYM (ppl_Constraint_System_const_iterator_dereference); \
++  DYNSYM (ppl_Constraint_System_const_iterator_equal_test); \
++  DYNSYM (ppl_Constraint_System_const_iterator_increment); \
++  DYNSYM (ppl_Constraint_System_end); \
++  DYNSYM (ppl_Constraint_System_insert_Constraint); \
++  DYNSYM (ppl_Constraint_System_space_dimension); \
++  DYNSYM (ppl_Constraint_type); \
++  DYNSYM (ppl_delete_Coefficient); \
++  DYNSYM (ppl_delete_Constraint); \
++  DYNSYM (ppl_delete_Constraint_System_const_iterator); \
++  DYNSYM (ppl_delete_Linear_Expression); \
++  DYNSYM (ppl_delete_Pointset_Powerset_C_Polyhedron); \
++  DYNSYM (ppl_delete_Pointset_Powerset_C_Polyhedron_iterator); \
++  DYNSYM (ppl_delete_Polyhedron); \
++  DYNSYM (ppl_Linear_Expression_add_to_coefficient); \
++  DYNSYM (ppl_Linear_Expression_add_to_inhomogeneous); \
++  DYNSYM (ppl_Linear_Expression_coefficient); \
++  DYNSYM (ppl_Linear_Expression_inhomogeneous_term); \
++  DYNSYM (ppl_Linear_Expression_space_dimension); \
++  DYNSYM (ppl_new_Coefficient); \
++  DYNSYM (ppl_new_Coefficient_from_mpz_t); \
++  DYNSYM (ppl_new_Constraint); \
++  DYNSYM (ppl_new_Constraint_System); \
++  DYNSYM (ppl_new_Constraint_System_const_iterator); \
++  DYNSYM (ppl_new_C_Polyhedron_from_C_Polyhedron); \
++  DYNSYM (ppl_new_C_Polyhedron_from_space_dimension); \
++  DYNSYM (ppl_new_C_Polyhedron_recycle_Constraint_System); \
++  DYNSYM (ppl_new_Linear_Expression); \
++  DYNSYM (ppl_new_Linear_Expression_from_Constraint); \
++  DYNSYM (ppl_new_Linear_Expression_from_Linear_Expression); \
++  DYNSYM (ppl_new_Linear_Expression_with_dimension); \
++  DYNSYM (ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron); \
++  DYNSYM (ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron); \
++  DYNSYM (ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension); \
++  DYNSYM (ppl_new_Pointset_Powerset_C_Polyhedron_iterator); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_add_constraint); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_difference_assign); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_intersection_assign); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_is_empty); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_iterator_end); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_iterator_increment); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_maximize); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_minimize); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_size); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_space_dimension); \
++  DYNSYM (ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign); \
++  DYNSYM (ppl_Polyhedron_add_constraint); \
++  DYNSYM (ppl_Polyhedron_add_constraints); \
++  DYNSYM (ppl_Polyhedron_add_space_dimensions_and_embed); \
++  DYNSYM (ppl_Polyhedron_get_constraints); \
++  DYNSYM (ppl_Polyhedron_map_space_dimensions); \
++  DYNSYM (ppl_Polyhedron_remove_space_dimensions); \
++  DYNSYM (ppl_Polyhedron_space_dimension); \
++  DYNSYM (ppl_subtract_Linear_Expression_from_Linear_Expression); \
++  DYNSYM (pprint); \
++  DYNSYM (stmt_block); \
++  DYNSYM (stmt_for); \
++  DYNSYM (stmt_guard); \
++  DYNSYM (stmt_root); \
++  DYNSYM (stmt_user); \
++  DYNSYM (stmt_ass); \
++  DYNSYM (ppl_delete_Constraint_System); \
++  DYNSYM (ppl_initialize); \
++  DYNSYM (ppl_new_Constraint_System_from_Constraint); \
++  DYNSYM (ppl_new_C_Polyhedron_from_Constraint_System); \
++  DYNSYM (ppl_Polyhedron_affine_image); \
++  DYNSYM (ppl_io_fprint_Pointset_Powerset_C_Polyhedron); \
++  DYNSYMS_PPL11
++extern struct cloog_pointers_s__
++{
++  bool inited;
++  void *h;
++#define DYNSYM(x) __typeof (x) *p_##x
++  DYNSYMS
++#undef DYNSYM
++} cloog_pointers__;
++
++#define cloog_block_alloc (*cloog_pointers__.p_cloog_block_alloc)
++#define cloog_block_list_free (*cloog_pointers__.p_cloog_block_list_free)
++#define cloog_block_list_malloc (*cloog_pointers__.p_cloog_block_list_malloc)
++#define cloog_clast_create (*cloog_pointers__.p_cloog_clast_create)
++#define cloog_clast_free (*cloog_pointers__.p_cloog_clast_free)
++#define cloog_domain_free (*cloog_pointers__.p_cloog_domain_free)
++#define cloog_domain_matrix2domain (*cloog_pointers__.p_cloog_domain_matrix2domain)
++#define cloog_initialize (*cloog_pointers__.p_cloog_initialize)
++#ifndef CLOOG_ORG
++#undef cloog_loop_malloc
++#define cloog_loop_malloc(STATE) (*cloog_pointers__.p_cloog_loop_malloc) ()
++#else
++#define cloog_loop_malloc (*cloog_pointers__.p_cloog_loop_malloc)
++#endif
++#define cloog_matrix_alloc (*cloog_pointers__.p_cloog_matrix_alloc)
++#define cloog_matrix_copy (*cloog_pointers__.p_cloog_matrix_copy)
++#define cloog_matrix_free (*cloog_pointers__.p_cloog_matrix_free)
++#define cloog_matrix_print (*cloog_pointers__.p_cloog_matrix_print)
++#define cloog_names_malloc (*cloog_pointers__.p_cloog_names_malloc)
++#define cloog_names_scalarize (*cloog_pointers__.p_cloog_names_scalarize)
++#define cloog_options_free (*cloog_pointers__.p_cloog_options_free)
++#ifndef CLOOG_ORG
++#undef cloog_options_malloc
++#define cloog_options_malloc(STATE) (*cloog_pointers__.p_cloog_options_malloc) ()
++#undef cloog_program_dump_cloog
++#define cloog_program_dump_cloog(DUMPFILE, PROGRAM, SCATTERINGLIST) \
++  (*cloog_pointers__.p_cloog_program_dump_cloog) (DUMPFILE, PROGRAM)
++#undef cloog_program_extract_scalars
++#define cloog_program_extract_scalars(PROG, SCATT, OPT) \
++  (*cloog_pointers__.p_cloog_program_extract_scalars) (PROG, SCATT)
++#else
++#define cloog_options_malloc (*cloog_pointers__.p_cloog_options_malloc)
++#define cloog_program_dump_cloog (*cloog_pointers__.p_cloog_program_dump_cloog)
++#define cloog_program_extract_scalars (*cloog_pointers__.p_cloog_program_extract_scalars)
++#endif
++#define cloog_program_free (*cloog_pointers__.p_cloog_program_free)
++#define cloog_program_generate (*cloog_pointers__.p_cloog_program_generate)
++#define cloog_program_malloc (*cloog_pointers__.p_cloog_program_malloc)
++#define cloog_program_print (*cloog_pointers__.p_cloog_program_print)
++#ifndef CLOOG_ORG
++#undef cloog_program_scatter
++#define cloog_program_scatter(PROG, SCATT, OPT) \
++  (*cloog_pointers__.p_cloog_program_scatter) (PROG, SCATT)
++#undef cloog_statement_alloc
++#define cloog_statement_alloc(STATE, INDEX) \
++  (*cloog_pointers__.p_cloog_statement_alloc) (INDEX)
++#else
++#define cloog_program_scatter (*cloog_pointers__.p_cloog_program_scatter)
++#define cloog_statement_alloc (*cloog_pointers__.p_cloog_statement_alloc)
++#endif
++#define cloog_domain_union (*cloog_pointers__.p_cloog_domain_union)
++#define cloog_matrix_read (*cloog_pointers__.p_cloog_matrix_read)
++#define cloog_new_pol (*cloog_pointers__.p_cloog_new_pol)
++#define cloog_vector_gcd (*cloog_pointers__.p_cloog_vector_gcd)
++#define ppl_finalize (*cloog_pointers__.p_ppl_finalize)
++#define ppl_assign_Coefficient_from_mpz_t (*cloog_pointers__.p_ppl_assign_Coefficient_from_mpz_t)
++#define ppl_assign_Linear_Expression_from_Linear_Expression (*cloog_pointers__.p_ppl_assign_Linear_Expression_from_Linear_Expression)
++#define ppl_Coefficient_to_mpz_t (*cloog_pointers__.p_ppl_Coefficient_to_mpz_t)
++#define ppl_Constraint_coefficient (*cloog_pointers__.p_ppl_Constraint_coefficient)
++#define ppl_Constraint_inhomogeneous_term (*cloog_pointers__.p_ppl_Constraint_inhomogeneous_term)
++#define ppl_Constraint_space_dimension (*cloog_pointers__.p_ppl_Constraint_space_dimension)
++#define ppl_Constraint_System_begin (*cloog_pointers__.p_ppl_Constraint_System_begin)
++#define ppl_Constraint_System_const_iterator_dereference (*cloog_pointers__.p_ppl_Constraint_System_const_iterator_dereference)
++#define ppl_Constraint_System_const_iterator_equal_test (*cloog_pointers__.p_ppl_Constraint_System_const_iterator_equal_test)
++#define ppl_Constraint_System_const_iterator_increment (*cloog_pointers__.p_ppl_Constraint_System_const_iterator_increment)
++#define ppl_Constraint_System_end (*cloog_pointers__.p_ppl_Constraint_System_end)
++#define ppl_Constraint_System_insert_Constraint (*cloog_pointers__.p_ppl_Constraint_System_insert_Constraint)
++#define ppl_Constraint_System_space_dimension (*cloog_pointers__.p_ppl_Constraint_System_space_dimension)
++#define ppl_Constraint_type (*cloog_pointers__.p_ppl_Constraint_type)
++#define ppl_delete_Coefficient (*cloog_pointers__.p_ppl_delete_Coefficient)
++#define ppl_delete_Constraint (*cloog_pointers__.p_ppl_delete_Constraint)
++#define ppl_delete_Constraint_System_const_iterator (*cloog_pointers__.p_ppl_delete_Constraint_System_const_iterator)
++#define ppl_delete_Linear_Expression (*cloog_pointers__.p_ppl_delete_Linear_Expression)
++#define ppl_delete_Pointset_Powerset_C_Polyhedron (*cloog_pointers__.p_ppl_delete_Pointset_Powerset_C_Polyhedron)
++#define ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (*cloog_pointers__.p_ppl_delete_Pointset_Powerset_C_Polyhedron_iterator)
++#define ppl_delete_Polyhedron (*cloog_pointers__.p_ppl_delete_Polyhedron)
++#define ppl_Linear_Expression_add_to_coefficient (*cloog_pointers__.p_ppl_Linear_Expression_add_to_coefficient)
++#define ppl_Linear_Expression_add_to_inhomogeneous (*cloog_pointers__.p_ppl_Linear_Expression_add_to_inhomogeneous)
++#define ppl_Linear_Expression_coefficient (*cloog_pointers__.p_ppl_Linear_Expression_coefficient)
++#define ppl_Linear_Expression_inhomogeneous_term (*cloog_pointers__.p_ppl_Linear_Expression_inhomogeneous_term)
++#define ppl_Linear_Expression_space_dimension (*cloog_pointers__.p_ppl_Linear_Expression_space_dimension)
++#define ppl_new_Coefficient (*cloog_pointers__.p_ppl_new_Coefficient)
++#define ppl_new_Coefficient_from_mpz_t (*cloog_pointers__.p_ppl_new_Coefficient_from_mpz_t)
++#define ppl_new_Constraint (*cloog_pointers__.p_ppl_new_Constraint)
++#define ppl_new_Constraint_System (*cloog_pointers__.p_ppl_new_Constraint_System)
++#define ppl_new_Constraint_System_const_iterator (*cloog_pointers__.p_ppl_new_Constraint_System_const_iterator)
++#define ppl_new_C_Polyhedron_from_C_Polyhedron (*cloog_pointers__.p_ppl_new_C_Polyhedron_from_C_Polyhedron)
++#define ppl_new_C_Polyhedron_from_space_dimension (*cloog_pointers__.p_ppl_new_C_Polyhedron_from_space_dimension)
++#define ppl_new_C_Polyhedron_recycle_Constraint_System (*cloog_pointers__.p_ppl_new_C_Polyhedron_recycle_Constraint_System)
++#define ppl_new_Linear_Expression (*cloog_pointers__.p_ppl_new_Linear_Expression)
++#define ppl_new_Linear_Expression_from_Constraint (*cloog_pointers__.p_ppl_new_Linear_Expression_from_Constraint)
++#define ppl_new_Linear_Expression_from_Linear_Expression (*cloog_pointers__.p_ppl_new_Linear_Expression_from_Linear_Expression)
++#define ppl_new_Linear_Expression_with_dimension (*cloog_pointers__.p_ppl_new_Linear_Expression_with_dimension)
++#define ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (*cloog_pointers__.p_ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron)
++#define ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron (*cloog_pointers__.p_ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron)
++#define ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (*cloog_pointers__.p_ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension)
++#define ppl_new_Pointset_Powerset_C_Polyhedron_iterator (*cloog_pointers__.p_ppl_new_Pointset_Powerset_C_Polyhedron_iterator)
++#define ppl_Pointset_Powerset_C_Polyhedron_add_constraint (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_add_constraint)
++#define ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed)
++#define ppl_Pointset_Powerset_C_Polyhedron_difference_assign (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_difference_assign)
++#define ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_intersection_assign)
++#define ppl_Pointset_Powerset_C_Polyhedron_is_empty (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_is_empty)
++#define ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_iterator_begin)
++#define ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference)
++#define ppl_Pointset_Powerset_C_Polyhedron_iterator_end (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_iterator_end)
++#define ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test)
++#define ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_iterator_increment)
++#define ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions)
++#define ppl_Pointset_Powerset_C_Polyhedron_maximize (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_maximize)
++#define ppl_Pointset_Powerset_C_Polyhedron_minimize (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_minimize)
++#define ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions)
++#define ppl_Pointset_Powerset_C_Polyhedron_size (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_size)
++#define ppl_Pointset_Powerset_C_Polyhedron_space_dimension (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_space_dimension)
++#define ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (*cloog_pointers__.p_ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign)
++#define ppl_Polyhedron_add_constraint (*cloog_pointers__.p_ppl_Polyhedron_add_constraint)
++#define ppl_Polyhedron_add_constraints (*cloog_pointers__.p_ppl_Polyhedron_add_constraints)
++#define ppl_Polyhedron_add_space_dimensions_and_embed (*cloog_pointers__.p_ppl_Polyhedron_add_space_dimensions_and_embed)
++#define ppl_Polyhedron_get_constraints (*cloog_pointers__.p_ppl_Polyhedron_get_constraints)
++#define ppl_Polyhedron_map_space_dimensions (*cloog_pointers__.p_ppl_Polyhedron_map_space_dimensions)
++#define ppl_Polyhedron_remove_space_dimensions (*cloog_pointers__.p_ppl_Polyhedron_remove_space_dimensions)
++#define ppl_Polyhedron_space_dimension (*cloog_pointers__.p_ppl_Polyhedron_space_dimension)
++#define ppl_subtract_Linear_Expression_from_Linear_Expression (*cloog_pointers__.p_ppl_subtract_Linear_Expression_from_Linear_Expression)
++#define pprint (*cloog_pointers__.p_pprint)
++#define stmt_block (*cloog_pointers__.p_stmt_block)
++#define stmt_for (*cloog_pointers__.p_stmt_for)
++#define stmt_guard (*cloog_pointers__.p_stmt_guard)
++#define stmt_root (*cloog_pointers__.p_stmt_root)
++#define stmt_user (*cloog_pointers__.p_stmt_user)
++#define stmt_ass (*cloog_pointers__.p_stmt_ass)
++#define ppl_delete_Constraint_System (*cloog_pointers__.p_ppl_delete_Constraint_System)
++#define ppl_initialize (*cloog_pointers__.p_ppl_initialize)
++#define ppl_new_Constraint_System_from_Constraint (*cloog_pointers__.p_ppl_new_Constraint_System_from_Constraint)
++#define ppl_new_C_Polyhedron_from_Constraint_System (*cloog_pointers__.p_ppl_new_C_Polyhedron_from_Constraint_System)
++#define ppl_Polyhedron_affine_image (*cloog_pointers__.p_ppl_Polyhedron_affine_image)
++#define ppl_io_fprint_Pointset_Powerset_C_Polyhedron (*cloog_pointers__.p_ppl_io_fprint_Pointset_Powerset_C_Polyhedron)
++#if !(PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11)
++#define ppl_new_PIP_Problem_from_constraints (*cloog_pointers__.p_ppl_new_PIP_Problem_from_constraints)
++#define ppl_PIP_Problem_is_satisfiable (*cloog_pointers__.p_ppl_PIP_Problem_is_satisfiable)
++#define ppl_delete_PIP_Problem (*cloog_pointers__.p_ppl_delete_PIP_Problem)
++#endif
++
++#define cloog_finalize (*cloog_pointers__.p_ppl_finalize)
++
++
+ #endif /* GRAPHITE_CLOOG_COMPAT_H  */
+--- gcc/graphite.c.jj	2011-01-03 12:53:05.194056513 +0100
++++ gcc/graphite.c	2011-01-04 16:18:32.385007767 +0100
+@@ -56,6 +56,35 @@ along with GCC; see the file COPYING3.  
+ 
+ CloogState *cloog_state;
+ 
++__typeof (cloog_pointers__) cloog_pointers__;
++
++static bool
++init_cloog_pointers (void)
++{
++  void *h;
++
++  if (cloog_pointers__.inited)
++    return cloog_pointers__.h != NULL;
++  h = dlopen ("libcloog.so.0", RTLD_LAZY);
++  cloog_pointers__.h = h;
++  if (h == NULL)
++    return false;
++#define DYNSYM(x) \
++  do \
++    { \
++      union { __typeof (cloog_pointers__.p_##x) p; void *q; } u; \
++      u.q = dlsym (h, #x); \
++      if (u.q == NULL) \
++	return false; \
++      cloog_pointers__.p_##x = u.p; \
++    } \
++  while (0)
++  DYNSYMS
++#undef DYNSYM
++  return true;
++}
++
++
+ /* Print global statistics to FILE.  */
+ 
+ static void
+@@ -201,6 +230,12 @@ graphite_initialize (void)
+       return false;
+     }
+ 
++  if (!init_cloog_pointers ())
++    {
++      sorry ("Graphite loop optimizations cannot be used");
++      return false;
++    }
++
+   scev_reset ();
+   recompute_all_dominators ();
+   initialize_original_copy_tables ();
+--- gcc/graphite-clast-to-gimple.c.jj	2011-01-03 12:53:05.000000000 +0100
++++ gcc/graphite-clast-to-gimple.c	2011-01-04 16:29:55.738007463 +0100
+@@ -836,7 +836,7 @@ clast_get_body_of_loop (struct clast_stm
+    from STMT_FOR.  */
+ 
+ static tree
+-type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip)
++type_for_clast_for (struct clast_for *stmt_fora, ivs_params_p ip)
+ {
+   mpz_t bound_one, bound_two;
+   tree lb_type, ub_type;
+@@ -844,8 +844,8 @@ type_for_clast_for (struct clast_for *st
+   mpz_init (bound_one);
+   mpz_init (bound_two);
+ 
+-  lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two);
+-  ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two);
++  lb_type = type_for_clast_expr (stmt_fora->LB, ip, bound_one, bound_two);
++  ub_type = type_for_clast_expr (stmt_fora->UB, ip, bound_one, bound_two);
+ 
+   mpz_clear (bound_one);
+   mpz_clear (bound_two);
+--- gcc/graphite-poly.h.jj	2011-01-03 12:53:05.000000000 +0100
++++ gcc/graphite-poly.h	2011-01-04 17:35:53.308788629 +0100
+@@ -22,6 +22,8 @@ along with GCC; see the file COPYING3.  
+ #ifndef GCC_GRAPHITE_POLY_H
+ #define GCC_GRAPHITE_POLY_H
+ 
++#include "graphite-cloog-util.h"
++
+ typedef struct poly_dr *poly_dr_p;
+ DEF_VEC_P(poly_dr_p);
+ DEF_VEC_ALLOC_P (poly_dr_p, heap);
diff --git a/gcc47-hack.patch b/gcc47-hack.patch
new file mode 100644
index 0000000..1903e95
--- /dev/null
+++ b/gcc47-hack.patch
@@ -0,0 +1,102 @@
+--- libada/Makefile.in.jj	2009-01-14 12:07:35.000000000 +0100
++++ libada/Makefile.in	2009-01-15 14:25:33.000000000 +0100
+@@ -66,18 +66,40 @@ libsubdir := $(libdir)/gcc/$(target_nonc
+ ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
+ ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))
+ 
++DEFAULTMULTIFLAGS :=
++ifeq ($(MULTISUBDIR),)
++targ:=$(subst -, ,$(target))
++arch:=$(word 1,$(targ))
++ifeq ($(words $(targ)),2)
++osys:=$(word 2,$(targ))
++else
++osys:=$(word 3,$(targ))
++endif
++ifeq ($(strip $(filter-out i%86 x86_64 powerpc% ppc% s390% sparc% linux%, $(arch) $(osys))),)
++ifeq ($(shell $(CC) $(CFLAGS) -print-multi-os-directory),../lib64)
++DEFAULTMULTIFLAGS := -m64
++else
++ifeq ($(strip $(filter-out s390%, $(arch))),)
++DEFAULTMULTIFLAGS := -m31
++else
++DEFAULTMULTIFLAGS := -m32
++endif
++endif
++endif
++endif
++
+ # exeext should not be used because it's the *host* exeext.  We're building
+ # a *target* library, aren't we?!?  Likewise for CC.  Still, provide bogus
+ # definitions just in case something slips through the safety net provided
+ # by recursive make invocations in gcc/ada/Makefile.in
+ LIBADA_FLAGS_TO_PASS = \
+         "MAKEOVERRIDES=" \
+-        "LDFLAGS=$(LDFLAGS)" \
++        "LDFLAGS=$(LDFLAGS) $(DEFAULTMULTIFLAGS)" \
+         "LN_S=$(LN_S)" \
+         "SHELL=$(SHELL)" \
+-        "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
+-        "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
+-        "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
++        "GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
++        "GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
++        "GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS) $(DEFAULTMULTIFLAGS)" \
+         "PICFLAG_FOR_TARGET=$(PICFLAG)" \
+         "THREAD_KIND=$(THREAD_KIND)" \
+         "TRACE=$(TRACE)" \
+@@ -88,7 +110,7 @@ LIBADA_FLAGS_TO_PASS = \
+         "exeext=.exeext.should.not.be.used " \
+ 	'CC=the.host.compiler.should.not.be.needed' \
+ 	"GCC_FOR_TARGET=$(CC)" \
+-        "CFLAGS=$(CFLAGS)"
++        "CFLAGS=$(CFLAGS) $(DEFAULTMULTIFLAGS)"
+ 
+ # Rules to build gnatlib.
+ .PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
+--- gcc/ada/sem_util.adb	(revision 161677)
++++ gcc/ada/sem_util.adb	(working copy)
+@@ -5487,7 +5487,7 @@ package body Sem_Util is
+             Exp           : Node_Id;
+             Assn          : Node_Id;
+             Choice        : Node_Id;
+-            Comp_Type     : Entity_Id;
++            Comp_Type     : Entity_Id := Empty;
+             Is_Array_Aggr : Boolean;
+ 
+          begin
+--- config-ml.in.jj	2010-06-30 09:50:44.000000000 +0200
++++ config-ml.in	2010-07-02 21:24:17.994211151 +0200
+@@ -516,6 +516,8 @@ multi-do:
+ 				ADAFLAGS="$(ADAFLAGS) $${flags}" \
+ 				prefix="$(prefix)" \
+ 				exec_prefix="$(exec_prefix)" \
++				mandir="$(mandir)" \
++				infodir="$(infodir)" \
+ 				GCJFLAGS="$(GCJFLAGS) $${flags}" \
+ 				GOCFLAGS="$(GOCFLAGS) $${flags}" \
+ 				CXXFLAGS="$(CXXFLAGS) $${flags}" \
+--- libjava/Makefile.am.jj	2010-07-09 11:17:33.729604090 +0200
++++ libjava/Makefile.am	2010-07-09 13:16:41.894375641 +0200
+@@ -710,7 +710,8 @@ if USE_LIBGCJ_BC
+ ## later.
+ 	@echo Installing dummy lib libgcj_bc.so.1.0.0; \
+ 	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+-	mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
++	$(INSTALL) $(INSTALL_STRIP_FLAG) $(here)/.libs/libgcj_bc.so $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
++	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0; \
+ 	$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+ 	-o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
+ 	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+--- libjava/Makefile.in.jj	2010-07-09 11:17:34.000000000 +0200
++++ libjava/Makefile.in	2010-07-09 13:18:07.542572270 +0200
+@@ -12665,7 +12665,8 @@ install-exec-hook: install-binPROGRAMS i
+ 	install-libexecsubPROGRAMS
+ @USE_LIBGCJ_BC_TRUE@	@echo Installing dummy lib libgcj_bc.so.1.0.0; \
+ @USE_LIBGCJ_BC_TRUE@	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+- at USE_LIBGCJ_BC_TRUE@	mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
++ at USE_LIBGCJ_BC_TRUE@	$(INSTALL) $(INSTALL_STRIP_FLAG) $(here)/.libs/libgcj_bc.so $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
++ at USE_LIBGCJ_BC_TRUE@	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0; \
+ @USE_LIBGCJ_BC_TRUE@	$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+ @USE_LIBGCJ_BC_TRUE@	-o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
+ @USE_LIBGCJ_BC_TRUE@	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
diff --git a/gcc47-i386-libgomp.patch b/gcc47-i386-libgomp.patch
new file mode 100644
index 0000000..f6a6b91
--- /dev/null
+++ b/gcc47-i386-libgomp.patch
@@ -0,0 +1,28 @@
+--- libgomp/configure.tgt.jj	2008-01-10 20:53:48.000000000 +0100
++++ libgomp/configure.tgt	2008-03-27 12:44:51.000000000 +0100
+@@ -44,14 +44,14 @@ if test $enable_linux_futex = yes; then
+ 	;;
+ 
+     # Note that bare i386 is not included here.  We need cmpxchg.
+-    i[456]86-*-linux*)
++    i[456]86-*-linux*)
+ 	config_path="linux/x86 linux posix"
+ 	case " ${CC} ${CFLAGS} " in
+ 	  *" -m64 "*)
+ 	    ;;
+ 	  *)
+ 	    if test -z "$with_arch"; then
+-	      XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
++	      XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
+ 	    fi
+ 	esac
+ 	;;
+@@ -63,7 +63,7 @@ if test $enable_linux_futex = yes; then
+ 	config_path="linux/x86 linux posix"
+ 	case " ${CC} ${CFLAGS} " in
+ 	  *" -m32 "*)
+-	    XCFLAGS="${XCFLAGS} -march=i486 -mtune=i686"
++	    XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
+ 	    ;;
+ 	esac
+ 	;;
diff --git a/gcc47-java-nomulti.patch b/gcc47-java-nomulti.patch
new file mode 100644
index 0000000..17334aa
--- /dev/null
+++ b/gcc47-java-nomulti.patch
@@ -0,0 +1,44 @@
+--- libjava/configure.ac.jj	2007-12-07 17:55:50.000000000 +0100
++++ libjava/configure.ac	2007-12-07 18:36:56.000000000 +0100
+@@ -82,6 +82,13 @@ AC_ARG_ENABLE(java-maintainer-mode,
+ 	[allow rebuilding of .class and .h files]))
+ AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
+ 
++AC_ARG_ENABLE(libjava-multilib,
++	AS_HELP_STRING([--enable-libjava-multilib], [build libjava as multilib]))
++if test "$enable_libjava_multilib" = no; then
++  multilib=no
++  ac_configure_args="$ac_configure_args --disable-multilib"
++fi
++
+ # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
+ GCC_NO_EXECUTABLES
+ 
+--- libjava/configure.jj	2007-12-07 17:55:50.000000000 +0100
++++ libjava/configure	2007-12-07 18:39:58.000000000 +0100
+@@ -1021,6 +1021,8 @@ Optional Features:
+                           default=yes
+   --enable-java-maintainer-mode
+                           allow rebuilding of .class and .h files
++  --enable-libjava-multilib
++                          build libjava as multilib
+   --disable-dependency-tracking  speeds up one-time build
+   --enable-dependency-tracking   do not reject slow dependency extractors
+   --enable-maintainer-mode  enable make rules and dependencies not useful
+@@ -1973,6 +1975,16 @@ else
+ fi
+ 
+ 
++# Check whether --enable-libjava-multilib was given.
++if test "${enable_libjava_multilib+set}" = set; then
++  enableval=$enable_libjava_multilib;
++fi
++
++if test "$enable_libjava_multilib" = no; then
++  multilib=no
++  ac_configure_args="$ac_configure_args --disable-multilib"
++fi
++
+ # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
+ 
+ 
diff --git a/gcc47-libgomp-omp_h-multilib.patch b/gcc47-libgomp-omp_h-multilib.patch
new file mode 100644
index 0000000..d0e98d1
--- /dev/null
+++ b/gcc47-libgomp-omp_h-multilib.patch
@@ -0,0 +1,17 @@
+2008-06-09  Jakub Jelinek  <jakub at redhat.com>
+
+	* omp.h.in (omp_nest_lock_t): Fix up for Linux multilibs.
+
+--- libgomp/omp.h.in.jj	2008-06-09 13:34:05.000000000 +0200
++++ libgomp/omp.h.in	2008-06-09 13:34:48.000000000 +0200
+@@ -42,8 +42,8 @@ typedef struct
+ 
+ typedef struct
+ {
+-  unsigned char _x[@OMP_NEST_LOCK_SIZE@] 
+-    __attribute__((__aligned__(@OMP_NEST_LOCK_ALIGN@)));
++  unsigned char _x[8 + sizeof (void *)] 
++    __attribute__((__aligned__(sizeof (void *))));
+ } omp_nest_lock_t;
+ #endif
+ 
diff --git a/gcc47-libitm-fno-exceptions.patch b/gcc47-libitm-fno-exceptions.patch
new file mode 100644
index 0000000..8b9d590
--- /dev/null
+++ b/gcc47-libitm-fno-exceptions.patch
@@ -0,0 +1,28 @@
+2011-12-22  Jakub Jelinek  <jakub at redhat.com>
+
+	* Makefile.am (beginend.lo): Append -fno-exceptions to
+	CXXFLAGS.
+	* Makefile.in: Regenerated.
+
+--- libitm/Makefile.am.jj	2011-12-20 13:47:57.000000000 +0100
++++ libitm/Makefile.am	2011-12-22 09:14:06.663469165 +0100
+@@ -72,6 +72,8 @@ endif
+ if ARCH_X86_AVX
+ x86_avx.lo : XCFLAGS += -mavx
+ endif
++beginend.lo : CXXCOMPILE += -fno-exceptions
++beginend.lo : LTCXXCOMPILE += -fno-exceptions
+ 
+ if ARCH_FUTEX
+ libitm_la_SOURCES += futex.cc
+--- libitm/Makefile.in.jj	2011-12-20 13:47:57.000000000 +0100
++++ libitm/Makefile.in	2011-12-22 09:14:29.466329944 +0100
+@@ -1278,6 +1278,8 @@ vpath % $(strip $(search_path))
+ @LIBITM_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBITM_BUILD_VERSIONED_SHLIB_TRUE@	 > $@ || (rm -f $@ ; exit 1)
+ @ARCH_X86_TRUE at x86_sse.lo : XCFLAGS += -msse
+ @ARCH_X86_AVX_TRUE at x86_avx.lo : XCFLAGS += -mavx
++beginend.lo : CXXCOMPILE += -fno-exceptions
++beginend.lo : LTCXXCOMPILE += -fno-exceptions
+ 
+ all-local: $(STAMP_GENINSRC)
+ 
diff --git a/gcc47-libtool-no-rpath.patch b/gcc47-libtool-no-rpath.patch
new file mode 100644
index 0000000..466c661
--- /dev/null
+++ b/gcc47-libtool-no-rpath.patch
@@ -0,0 +1,27 @@
+libtool sucks.
+--- ltmain.sh.jj	2007-12-07 14:53:21.000000000 +0100
++++ ltmain.sh	2008-09-05 21:51:48.000000000 +0200
+@@ -5394,6 +5394,7 @@ EOF
+ 	  rpath="$finalize_rpath"
+ 	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+ 	  for libdir in $rpath; do
++	    case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ 	    if test -n "$hardcode_libdir_flag_spec"; then
+ 	      if test -n "$hardcode_libdir_separator"; then
+ 		if test -z "$hardcode_libdirs"; then
+@@ -6071,6 +6072,7 @@ EOF
+       rpath=
+       hardcode_libdirs=
+       for libdir in $compile_rpath $finalize_rpath; do
++	case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ 	if test -n "$hardcode_libdir_flag_spec"; then
+ 	  if test -n "$hardcode_libdir_separator"; then
+ 	    if test -z "$hardcode_libdirs"; then
+@@ -6120,6 +6122,7 @@ EOF
+       rpath=
+       hardcode_libdirs=
+       for libdir in $finalize_rpath; do
++	case "$libdir" in /usr/lib|/usr/lib64|/usr/lib/../lib|/usr/lib/../lib64) continue;; esac
+ 	if test -n "$hardcode_libdir_flag_spec"; then
+ 	  if test -n "$hardcode_libdir_separator"; then
+ 	    if test -z "$hardcode_libdirs"; then
diff --git a/gcc47-no-add-needed.patch b/gcc47-no-add-needed.patch
new file mode 100644
index 0000000..7e38b0b
--- /dev/null
+++ b/gcc47-no-add-needed.patch
@@ -0,0 +1,52 @@
+2010-02-08  Roland McGrath  <roland at redhat.com>
+
+	* config/rs6000/sysv4.h (LINK_EH_SPEC): Pass --no-add-needed to the
+	linker.
+	* config/gnu-user.h (LINK_EH_SPEC): Likewise.
+	* config/alpha/elf.h (LINK_EH_SPEC): Likewise.
+	* config/ia64/linux.h (LINK_EH_SPEC): Likewise.
+
+--- gcc/config/alpha/elf.h.jj	2011-01-03 12:52:31.118056764 +0100
++++ gcc/config/alpha/elf.h	2011-01-04 18:14:10.931874160 +0100
+@@ -438,7 +438,7 @@ extern int alpha_this_gpdisp_sequence_nu
+    I imagine that other systems will catch up.  In the meantime, it
+    doesn't harm to make sure that the data exists to be used later.  */
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
++#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
+ #endif
+ 
+ /* A C statement (sans semicolon) to output to the stdio stream STREAM
+--- gcc/config/ia64/linux.h.jj	2011-01-03 13:02:11.462994522 +0100
++++ gcc/config/ia64/linux.h	2011-01-04 18:14:10.931874160 +0100
+@@ -77,7 +77,7 @@ do {						\
+    Signalize that because we have fde-glibc, we don't need all C shared libs
+    linked against -lgcc_s.  */
+ #undef LINK_EH_SPEC
+-#define LINK_EH_SPEC ""
++#define LINK_EH_SPEC "--no-add-needed "
+ 
+ /* Put all *tf routines in libgcc.  */
+ #undef LIBGCC2_HAS_TF_MODE
+--- gcc/config/gnu-user.h.jj	2011-01-03 12:53:03.739057299 +0100
++++ gcc/config/gnu-user.h	2011-01-04 18:14:10.932814884 +0100
+@@ -82,7 +82,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
+ 
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
++#define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
+ #endif
+ 
+ #undef LINK_GCC_C_SEQUENCE_SPEC
+--- gcc/config/rs6000/sysv4.h.jj	2011-01-03 13:02:18.255994215 +0100
++++ gcc/config/rs6000/sysv4.h	2011-01-04 18:14:10.933888871 +0100
+@@ -820,7 +820,7 @@ extern int fixuplabelno;
+   -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
+ 
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
++# define LINK_EH_SPEC "--no-add-needed %{!static:--eh-frame-hdr} "
+ #endif
+ 
+ #define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
diff --git a/gcc47-ppc32-retaddr.patch b/gcc47-ppc32-retaddr.patch
new file mode 100644
index 0000000..e9ae1bc
--- /dev/null
+++ b/gcc47-ppc32-retaddr.patch
@@ -0,0 +1,86 @@
+2005-11-28  Jakub Jelinek  <jakub at redhat.com>
+
+	* config/rs6000/rs6000.c (rs6000_return_addr): If COUNT == 0,
+	read word RETURN_ADDRESS_OFFSET bytes above arg_pointer_rtx
+	instead of doing an extran indirection from frame_pointer_rtx.
+
+	* gcc.dg/20051128-1.c: New test.
+
+--- gcc/config/rs6000/rs6000.c.jj	2005-11-26 14:38:01.000000000 +0100
++++ gcc/config/rs6000/rs6000.c	2005-11-28 20:32:18.000000000 +0100
+@@ -13166,17 +13166,22 @@ rs6000_return_addr (int count, rtx frame
+      don't try to be too clever here.  */
+   if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
+     {
++      rtx x;
+       cfun->machine->ra_needs_full_frame = 1;
+ 
+-      return
+-	gen_rtx_MEM
+-	  (Pmode,
+-	   memory_address
+-	   (Pmode,
+-	    plus_constant (copy_to_reg
+-			   (gen_rtx_MEM (Pmode,
+-					 memory_address (Pmode, frame))),
+-			   RETURN_ADDRESS_OFFSET)));
++      if (count == 0)
++	{
++	  gcc_assert (frame == frame_pointer_rtx);
++	  x = arg_pointer_rtx;
++	}
++      else
++	{
++	  x = memory_address (Pmode, frame);
++	  x = copy_to_reg (gen_rtx_MEM (Pmode, x));
++	}
++
++      x = plus_constant (x, RETURN_ADDRESS_OFFSET);
++      return gen_rtx_MEM (Pmode, memory_address (Pmode, x));
+     }
+ 
+   cfun->machine->ra_need_lr = 1;
+--- gcc/testsuite/gcc.dg/20051128-1.c.jj	2005-10-10 11:21:41.096999000 +0200
++++ gcc/testsuite/gcc.dg/20051128-1.c	2005-11-28 12:30:57.000000000 +0100
+@@ -0,0 +1,41 @@
++/* { dg-do run } */
++/* { dg-options "-O2 -fpic" } */
++
++extern void exit (int);
++extern void abort (void);
++
++int b;
++
++struct A
++{
++  void *pad[147];
++  void *ra, *h;
++  long o;
++};
++
++void
++__attribute__((noinline))
++foo (struct A *a, void *x)
++{
++  __builtin_memset (a, 0, sizeof (a));
++  if (!b)
++    exit (0);
++}
++
++void
++__attribute__((noinline))
++bar (void)
++{
++  struct A a;
++
++  __builtin_unwind_init ();
++  foo (&a, __builtin_return_address (0));
++}
++
++int
++main (void)
++{
++  bar ();
++  abort ();
++  return 0;
++}
diff --git a/gcc47-ppl-0.10.patch b/gcc47-ppl-0.10.patch
new file mode 100644
index 0000000..45b07f4
--- /dev/null
+++ b/gcc47-ppl-0.10.patch
@@ -0,0 +1,121 @@
+2011-01-28  Jakub Jelinek  <jakub at redhat.com>
+
+	Revert:
+	2011-01-25  Sebastian Pop  <sebastian.pop at amd.com>
+
+	* configure: Regenerated.
+	* configure.ac: Check for version 0.11 (or later revision) of PPL.
+gcc/
+	* doc/install.texi: Update the expected version number of PPL to 0.11.
+	* graphite-ppl.c (ppl_powerset_is_empty): Remove now dead code under
+	#if PPL_VERSION_MINOR < 11.
+
+--- gcc/doc/install.texi	(revision 169207)
++++ gcc/doc/install.texi	(revision 169206)
+@@ -362,7 +362,7 @@ installed but it is not in your default 
+ @option{--with-mpc} configure option should be used.  See also
+ @option{--with-mpc-lib} and @option{--with-mpc-include}.
+ 
+- at item Parma Polyhedra Library (PPL) version 0.11
++ at item Parma Polyhedra Library (PPL) version 0.10
+ 
+ Necessary to build GCC with the Graphite loop optimizations.
+ It can be downloaded from @uref{http://www.cs.unipr.it/ppl/Download/}.
+--- gcc/graphite-ppl.c	(revision 169207)
++++ gcc/graphite-ppl.c	(revision 169206)
+@@ -521,6 +521,15 @@ debug_gmp_value (mpz_t val)
+ bool
+ ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t ps)
+ {
++#if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 11
++  /* On PPL 0.10,
++     ppl_Pointset_Powerset_C_Polyhedron_contains_integer_point (ps)
++     takes too long on some cases and so we call _is_empty instead.  */
++  return ppl_Pointset_Powerset_C_Polyhedron_is_empty (ps);
++
++#else
++  /* On PPL 0.11 or later, we can check for integer feasibility using
++     the PIP solver.  */
+   ppl_PIP_Problem_t pip;
+   ppl_dimension_type d;
+   ppl_const_Constraint_System_t pcs;
+@@ -561,6 +570,7 @@ ppl_powerset_is_empty (ppl_Pointset_Powe
+   ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
+ 
+   return !has_integer_solutions;
++#endif
+ }
+ 
+ #endif
+--- configure.ac	(revision 169207)
++++ configure.ac	(revision 169206)
+@@ -1688,9 +1688,9 @@ if test "x$with_ppl" != xno; then
+   if test "$enable_ppl_version_check" != no; then
+     saved_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $pplinc $gmpinc"
+-    AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL])
++    AC_MSG_CHECKING([for version 0.10 (revision 0 or later) of PPL])
+     AC_TRY_COMPILE([#include "ppl_c.h"],[
+-    #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
++    #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
+     choke me
+     #endif
+     ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ])
+--- configure	(revision 169207)
++++ configure	(revision 169206)
+@@ -5775,8 +5775,8 @@ fi
+   if test "$enable_ppl_version_check" != no; then
+     saved_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $pplinc $gmpinc"
+-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.11 (revision 0 or later) of PPL" >&5
+-$as_echo_n "checking for version 0.11 (revision 0 or later) of PPL... " >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.10 (revision 0 or later) of PPL" >&5
++$as_echo_n "checking for version 0.10 (revision 0 or later) of PPL... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include "ppl_c.h"
+@@ -5784,7 +5784,7 @@ int
+ main ()
+ {
+ 
+-    #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11
++    #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 10
+     choke me
+     #endif
+ 
+--- gcc/testsuite/gcc.dg/graphite/interchange-11.c.jj	2011-01-28 09:38:11.000000000 +0100
++++ gcc/testsuite/gcc.dg/graphite/interchange-11.c	2011-01-28 11:06:56.461429848 +0100
+@@ -46,5 +46,5 @@ main (void)
+   return 0;
+ }
+ 
+-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
++/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+ /* { dg-final { cleanup-tree-dump "graphite" } } */
+--- gcc/testsuite/gcc.dg/graphite/interchange-13.c.jj	2011-01-28 09:38:12.000000000 +0100
++++ gcc/testsuite/gcc.dg/graphite/interchange-13.c	2011-01-28 11:07:08.182429223 +0100
+@@ -50,5 +50,5 @@ main (void)
+ }
+ 
+ 
+-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
++/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+ /* { dg-final { cleanup-tree-dump "graphite" } } */
+--- gcc/testsuite/gcc.dg/graphite/interchange-1.c.jj	2011-01-28 09:38:13.000000000 +0100
++++ gcc/testsuite/gcc.dg/graphite/interchange-1.c	2011-01-28 11:06:42.160429193 +0100
+@@ -49,5 +49,5 @@ main (void)
+   return 0;
+ }
+ 
+-/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
++/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+ /* { dg-final { cleanup-tree-dump "graphite" } } */
+--- gcc/testsuite/gfortran.dg/graphite/interchange-3.f90.jj	2011-01-28 09:38:05.000000000 +0100
++++ gcc/testsuite/gfortran.dg/graphite/interchange-3.f90	2011-01-28 11:07:46.313420441 +0100
+@@ -24,5 +24,5 @@ Program FOO
+ 
+ end Program FOO
+ 
+-! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } }
++! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
+ ! { dg-final { cleanup-tree-dump "graphite" } }
diff --git a/gcc47-pr38757.patch b/gcc47-pr38757.patch
new file mode 100644
index 0000000..5fd23ea
--- /dev/null
+++ b/gcc47-pr38757.patch
@@ -0,0 +1,105 @@
+2009-03-18  Jakub Jelinek  <jakub at redhat.com>
+
+	PR debug/38757
+	* langhooks.h (struct lang_hooks): Add source_language langhook.
+	* langhooks-def.h (LANG_HOOKS_SOURCE_LANGUAGE): Define to NULL.
+	(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_SOURCE_LANGUAGE.
+	* c-lang.c (c_source_language): New function.
+	(LANG_HOOKS_SOURCE_LANGUAGE): Define.
+	* dwarf2out.c (add_prototyped_attribute): Add DW_AT_prototype
+	also for DW_LANG_{C,C99,ObjC}.
+	(gen_compile_unit_die): Use lang_hooks.source_language () to
+	determine if DW_LANG_C99 or DW_LANG_C89 should be returned.
+
+--- gcc/langhooks.h.jj	2011-01-03 12:53:05.125745450 +0100
++++ gcc/langhooks.h	2011-01-04 17:59:43.166744926 +0100
+@@ -467,6 +467,10 @@ struct lang_hooks
+      gimplification.  */
+   bool deep_unsharing;
+ 
++  /* Return year of the source language standard version if the FE supports
++     multiple versions of the standard.  */
++  int (*source_language) (void);
++
+   /* Whenever you add entries here, make sure you adjust langhooks-def.h
+      and langhooks.c accordingly.  */
+ };
+--- gcc/langhooks-def.h.jj	2011-01-03 12:53:05.000000000 +0100
++++ gcc/langhooks-def.h	2011-01-04 18:00:44.858851030 +0100
+@@ -118,6 +118,7 @@ extern void lhd_omp_firstprivatize_type_
+ #define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS	NULL
+ #define LANG_HOOKS_EH_USE_CXA_END_CLEANUP	false
+ #define LANG_HOOKS_DEEP_UNSHARING	false
++#define LANG_HOOKS_SOURCE_LANGUAGE	NULL
+ 
+ /* Attribute hooks.  */
+ #define LANG_HOOKS_ATTRIBUTE_TABLE		NULL
+@@ -307,7 +308,8 @@ extern void lhd_end_section (void);
+   LANG_HOOKS_EH_RUNTIME_TYPE, \
+   LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \
+   LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
+-  LANG_HOOKS_DEEP_UNSHARING \
++  LANG_HOOKS_DEEP_UNSHARING, \
++  LANG_HOOKS_SOURCE_LANGUAGE \
+ }
+ 
+ #endif /* GCC_LANG_HOOKS_DEF_H */
+--- gcc/c-lang.c.jj	2011-01-03 12:53:05.376056936 +0100
++++ gcc/c-lang.c	2011-01-04 17:59:43.167743798 +0100
+@@ -36,6 +36,12 @@ along with GCC; see the file COPYING3.
+ 
+ enum c_language_kind c_language = clk_c;
+ 
++static int
++c_source_language (void)
++{
++  return flag_isoc99 ? 1999 : 1989;
++}
++
+ /* Lang hooks common to C and ObjC are declared in c-objc-common.h;
+    consequently, there should be very few hooks below.  */
+ 
+@@ -45,6 +51,8 @@ enum c_language_kind c_language = clk_c;
+ #define LANG_HOOKS_INIT c_objc_common_init
+ #undef LANG_HOOKS_INIT_TS
+ #define LANG_HOOKS_INIT_TS c_common_init_ts
++#undef LANG_HOOKS_SOURCE_LANGUAGE
++#define LANG_HOOKS_SOURCE_LANGUAGE c_source_language
+ 
+ /* Each front end provides its own lang hook initializer.  */
+ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+--- gcc/dwarf2out.c.jj	2011-01-03 12:53:05.102056475 +0100
++++ gcc/dwarf2out.c	2011-01-04 18:03:14.534151763 +0100
+@@ -15793,9 +15793,18 @@ add_bit_size_attribute (dw_die_ref die, 
+ static inline void
+ add_prototyped_attribute (dw_die_ref die, tree func_type)
+ {
+-  if (get_AT_unsigned (comp_unit_die (), DW_AT_language) == DW_LANG_C89
+-      && prototype_p (func_type))
+-    add_AT_flag (die, DW_AT_prototyped, 1);
++  switch (get_AT_unsigned (comp_unit_die (), DW_AT_language))
++    {
++    case DW_LANG_C:
++    case DW_LANG_C89:
++    case DW_LANG_C99:
++    case DW_LANG_ObjC:
++      if (prototype_p (func_type))
++	add_AT_flag (die, DW_AT_prototyped, 1);
++      break;
++    default:
++      break;
++    }
+ }
+ 
+ /* Add an 'abstract_origin' attribute below a given DIE.  The DIE is found
+@@ -18438,6 +18447,10 @@ gen_compile_unit_die (const char *filena
+ 	  if (strcmp (language_string, "GNU Go") == 0)
+ 	    language = DW_LANG_Go;
+ 	}
++      else if (strcmp (language_string, "GNU C") == 0
++	       && lang_hooks.source_language
++	       && lang_hooks.source_language () >= 1999)
++	language = DW_LANG_C99;
+     }
+ 
+   add_AT_unsigned (die, DW_AT_language, language);
diff --git a/gcc47-pr55137.patch b/gcc47-pr55137.patch
new file mode 100644
index 0000000..0595ac5
--- /dev/null
+++ b/gcc47-pr55137.patch
@@ -0,0 +1,180 @@
+2012-11-07  Jakub Jelinek  <jakub at redhat.com>
+
+	PR c++/55137
+	* fold-const.c (fold_binary_loc) <associate>: Don't introduce
+	TREE_OVERFLOW through reassociation.  If type doesn't have defined
+	overflow, but one or both of the operands do, use the wrapping type
+	for reassociation and only convert to type at the end.
+
+	* g++.dg/opt/pr55137.C: New test.
+	* gcc.c-torture/execute/pr55137.c: New test.
+
+--- gcc/fold-const.c.jj	2012-11-07 09:16:41.929494183 +0100
++++ gcc/fold-const.c	2012-11-07 09:47:12.227710542 +0100
+@@ -10309,6 +10309,7 @@ fold_binary_loc (location_t loc,
+ 	{
+ 	  tree var0, con0, lit0, minus_lit0;
+ 	  tree var1, con1, lit1, minus_lit1;
++	  tree atype = type;
+ 	  bool ok = true;
+ 
+ 	  /* Split both trees into variables, constants, and literals.  Then
+@@ -10324,11 +10325,25 @@ fold_binary_loc (location_t loc,
+ 	  if (code == MINUS_EXPR)
+ 	    code = PLUS_EXPR;
+ 
+-	  /* With undefined overflow we can only associate constants with one
+-	     variable, and constants whose association doesn't overflow.  */
++	  /* With undefined overflow prefer doing association in a type
++	     which wraps on overflow, if that is one of the operand types.  */
+ 	  if ((POINTER_TYPE_P (type) && POINTER_TYPE_OVERFLOW_UNDEFINED)
+ 	      || (INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type)))
+ 	    {
++	      if (INTEGRAL_TYPE_P (TREE_TYPE (arg0))
++		  && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0)))
++		atype = TREE_TYPE (arg0);
++	      else if (INTEGRAL_TYPE_P (TREE_TYPE (arg1))
++		       && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1)))
++		atype = TREE_TYPE (arg1);
++	      gcc_assert (TYPE_PRECISION (atype) == TYPE_PRECISION (type));
++	    }
++
++	  /* With undefined overflow we can only associate constants with one
++	     variable, and constants whose association doesn't overflow.  */
++	  if ((POINTER_TYPE_P (atype) && POINTER_TYPE_OVERFLOW_UNDEFINED)
++	      || (INTEGRAL_TYPE_P (atype) && !TYPE_OVERFLOW_WRAPS (atype)))
++	    {
+ 	      if (var0 && var1)
+ 		{
+ 		  tree tmp0 = var0;
+@@ -10343,16 +10358,6 @@ fold_binary_loc (location_t loc,
+ 		  if (!operand_equal_p (tmp0, tmp1, 0))
+ 		    ok = false;
+ 		}
+-
+-	      if (ok && lit0 && lit1)
+-		{
+-		  tree tmp0 = fold_convert (type, lit0);
+-		  tree tmp1 = fold_convert (type, lit1);
+-
+-		  if (!TREE_OVERFLOW (tmp0) && !TREE_OVERFLOW (tmp1)
+-		      && TREE_OVERFLOW (fold_build2 (code, type, tmp0, tmp1)))
+-		    ok = false;
+-		}
+ 	    }
+ 
+ 	  /* Only do something if we found more than two objects.  Otherwise,
+@@ -10363,10 +10368,16 @@ fold_binary_loc (location_t loc,
+ 		       + (lit0 != 0) + (lit1 != 0)
+ 		       + (minus_lit0 != 0) + (minus_lit1 != 0))))
+ 	    {
+-	      var0 = associate_trees (loc, var0, var1, code, type);
+-	      con0 = associate_trees (loc, con0, con1, code, type);
+-	      lit0 = associate_trees (loc, lit0, lit1, code, type);
+-	      minus_lit0 = associate_trees (loc, minus_lit0, minus_lit1, code, type);
++	      bool any_overflows = false;
++	      if (lit0) any_overflows |= TREE_OVERFLOW (lit0);
++	      if (lit1) any_overflows |= TREE_OVERFLOW (lit1);
++	      if (minus_lit0) any_overflows |= TREE_OVERFLOW (minus_lit0);
++	      if (minus_lit1) any_overflows |= TREE_OVERFLOW (minus_lit1);
++	      var0 = associate_trees (loc, var0, var1, code, atype);
++	      con0 = associate_trees (loc, con0, con1, code, atype);
++	      lit0 = associate_trees (loc, lit0, lit1, code, atype);
++	      minus_lit0 = associate_trees (loc, minus_lit0, minus_lit1,
++					    code, atype);
+ 
+ 	      /* Preserve the MINUS_EXPR if the negative part of the literal is
+ 		 greater than the positive part.  Otherwise, the multiplicative
+@@ -10380,38 +10391,45 @@ fold_binary_loc (location_t loc,
+ 		      && tree_int_cst_lt (lit0, minus_lit0))
+ 		    {
+ 		      minus_lit0 = associate_trees (loc, minus_lit0, lit0,
+-						    MINUS_EXPR, type);
++						    MINUS_EXPR, atype);
+ 		      lit0 = 0;
+ 		    }
+ 		  else
+ 		    {
+ 		      lit0 = associate_trees (loc, lit0, minus_lit0,
+-					      MINUS_EXPR, type);
++					      MINUS_EXPR, atype);
+ 		      minus_lit0 = 0;
+ 		    }
+ 		}
++
++	      /* Don't introduce overflows through reassociation.  */
++	      if (!any_overflows
++		  && ((lit0 && TREE_OVERFLOW (lit0))
++		      || (minus_lit0 && TREE_OVERFLOW (minus_lit0))))
++		return NULL_TREE;
++
+ 	      if (minus_lit0)
+ 		{
+ 		  if (con0 == 0)
+ 		    return
+ 		      fold_convert_loc (loc, type,
+ 					associate_trees (loc, var0, minus_lit0,
+-							 MINUS_EXPR, type));
++							 MINUS_EXPR, atype));
+ 		  else
+ 		    {
+ 		      con0 = associate_trees (loc, con0, minus_lit0,
+-					      MINUS_EXPR, type);
++					      MINUS_EXPR, atype);
+ 		      return
+ 			fold_convert_loc (loc, type,
+ 					  associate_trees (loc, var0, con0,
+-							   PLUS_EXPR, type));
++							   PLUS_EXPR, atype));
+ 		    }
+ 		}
+ 
+-	      con0 = associate_trees (loc, con0, lit0, code, type);
++	      con0 = associate_trees (loc, con0, lit0, code, atype);
+ 	      return
+ 		fold_convert_loc (loc, type, associate_trees (loc, var0, con0,
+-							      code, type));
++							      code, atype));
+ 	    }
+ 	}
+ 
+--- gcc/testsuite/g++.dg/opt/pr55137.C.jj	2012-11-07 09:31:45.027160654 +0100
++++ gcc/testsuite/g++.dg/opt/pr55137.C	2012-11-07 09:31:45.028160649 +0100
+@@ -0,0 +1,4 @@
++// PR c++/55137
++// { dg-do compile }
++
++enum E { F = -1 + (int) (sizeof (int) - 1) };
+--- gcc/testsuite/gcc.c-torture/execute/pr55137.c.jj	2012-11-07 09:44:11.226768063 +0100
++++ gcc/testsuite/gcc.c-torture/execute/pr55137.c	2012-11-07 09:44:24.380691303 +0100
+@@ -0,0 +1,30 @@
++/* PR c++/55137 */
++
++extern void abort (void);
++
++int
++foo (unsigned int x)
++{
++  return ((int) (x + 1U) + 1) < (int) x;
++}
++
++int
++bar (unsigned int x)
++{
++  return (int) (x + 1U) + 1;
++}
++
++int
++baz (unsigned int x)
++{
++  return x + 1U;
++}
++
++int
++main ()
++{
++  if (foo (__INT_MAX__) != (bar (__INT_MAX__) < __INT_MAX__)
++      || foo (__INT_MAX__) != ((int) baz (__INT_MAX__) + 1 < __INT_MAX__))
++    abort ();
++  return 0;
++}
diff --git a/gcc47-pr55236.patch b/gcc47-pr55236.patch
new file mode 100644
index 0000000..e661544
--- /dev/null
+++ b/gcc47-pr55236.patch
@@ -0,0 +1,62 @@
+2012-11-08  Jakub Jelinek  <jakub at redhat.com>
+
+	PR tree-optimization/55236
+	* fold-const.c (make_range_step) <case NEGATE_EXPR>: For -fwrapv
+	and signed ARG0_TYPE, force low and high to be non-NULL.
+
+	* gcc.dg/pr55236.c: New test.
+
+--- gcc/fold-const.c.jj	2012-11-07 11:24:34.000000000 +0100
++++ gcc/fold-const.c	2012-11-08 16:54:38.978339040 +0100
+@@ -3880,6 +3880,17 @@ make_range_step (location_t loc, enum tr
+       return arg0;
+ 
+     case NEGATE_EXPR:
++      /* If flag_wrapv and ARG0_TYPE is signed, make sure
++	 low and high are non-NULL, then normalize will DTRT.  */
++      if (!TYPE_UNSIGNED (arg0_type)
++	  && !TYPE_OVERFLOW_UNDEFINED (arg0_type))
++	{
++	  if (low == NULL_TREE)
++	    low = TYPE_MIN_VALUE (arg0_type);
++	  if (high == NULL_TREE)
++	    high = TYPE_MAX_VALUE (arg0_type);
++	}
++
+       /* (-x) IN [a,b] -> x in [-b, -a]  */
+       n_low = range_binop (MINUS_EXPR, exp_type,
+ 			   build_int_cst (exp_type, 0),
+--- gcc/testsuite/gcc.dg/pr55236.c.jj	2012-11-08 16:40:49.171781137 +0100
++++ gcc/testsuite/gcc.dg/pr55236.c	2012-11-08 16:41:20.044578919 +0100
+@@ -0,0 +1,31 @@
++/* PR tree-optimization/55236 */
++/* { dg-do run } */
++/* { dg-options "-O2 -fwrapv" } */
++
++extern void abort ();
++
++__attribute__((noinline, noclone)) void
++foo (int i)
++{
++  if (i > 0)
++    abort ();
++  i = -i;
++  if (i < 0)
++    return;
++  abort ();
++}
++
++__attribute__((noinline, noclone)) void
++bar (int i)
++{
++  if (i > 0 || (-i) >= 0)
++    abort ();
++}
++
++int
++main ()
++{
++  foo (-__INT_MAX__ - 1);
++  bar (-__INT_MAX__ - 1);
++  return 0;
++}
diff --git a/gcc47-rh330771.patch b/gcc47-rh330771.patch
new file mode 100644
index 0000000..102730f
--- /dev/null
+++ b/gcc47-rh330771.patch
@@ -0,0 +1,27 @@
+2007-10-16  Jakub Jelinek  <jakub at redhat.com>
+
+	* Makefile.am (libgcj_tools_la_LIBADD): Add.
+	* Makefile.in: Regenerated.
+
+--- libjava/Makefile.am.jj	2009-05-06 08:14:50.000000000 +0200
++++ libjava/Makefile.am	2009-05-06 10:26:43.000000000 +0200
+@@ -550,7 +550,7 @@ libgcj_tools_la_LDFLAGS = -rpath $(toole
+  $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+  $(LIBJAVA_LDFLAGS_LIBMATH)
+ 
+-libgcj_tools_la_LIBADD = libgcj.la
++libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la
+ libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec \
+  $(libgcj_tools_la_version_dep)
+ if BUILD_SUBLIBS
+--- libjava/Makefile.in.jj	2009-05-06 08:14:49.000000000 +0200
++++ libjava/Makefile.in	2009-05-06 10:27:18.000000000 +0200
+@@ -1110,7 +1110,7 @@ libgcj_tools_la_LDFLAGS = -rpath $(toole
+  $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+  $(LIBJAVA_LDFLAGS_LIBMATH)
+ 
+-libgcj_tools_la_LIBADD = libgcj.la
++libgcj_tools_la_LIBADD = -L$(here)/.libs libgcj.la
+ libgcj_tools_la_DEPENDENCIES = libgcj.la libgcj.spec \
+ 	$(libgcj_tools_la_version_dep) $(am__append_19)
+ libgcj_tools_la_LINK = $(LIBLINK) $(libgcj_tools_la_LDFLAGS) \
diff --git a/gcc47-rh837630.patch b/gcc47-rh837630.patch
new file mode 100644
index 0000000..d7d1e94
--- /dev/null
+++ b/gcc47-rh837630.patch
@@ -0,0 +1,16 @@
+2012-07-16  Alan Modra  <amodra at gmail.com>
+
+	* config/rs6000/rs6000.md (*movdi_internal32): Use m constraint instead
+	of o<>.
+
+--- gcc/config/rs6000/rs6000.md	2012-07-16 10:14:43.198085150 +0200
++++ gcc/config/rs6000/rs6000.md	2012-07-16 10:33:31.856023210 +0200
+@@ -10145,7 +10145,7 @@
+ ; List r->r after r->"o<>", otherwise reload will try to reload a
+ ; non-offsettable address by using r->r which won't make progress.
+ (define_insn "*movdi_internal32"
+-  [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r,?wa")
++  [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=m,r,r,*d,*d,m,r,?wa")
+ 	(match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF,O"))]
+   "! TARGET_POWERPC64
+    && (gpc_reg_operand (operands[0], DImode)
diff --git a/gcc47-sparc-config-detection.patch b/gcc47-sparc-config-detection.patch
new file mode 100644
index 0000000..97fed22
--- /dev/null
+++ b/gcc47-sparc-config-detection.patch
@@ -0,0 +1,40 @@
+--- gcc/config.gcc.jj	2008-04-24 15:42:46.000000000 -0500
++++ gcc/config.gcc	2008-04-24 15:44:51.000000000 -0500
+@@ -2421,7 +2421,7 @@ sparc-*-rtems*)
+ 	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
+ 	tmake_file="sparc/t-sparc sparc/t-elf sparc/t-rtems t-rtems"
+ 	;;
+-sparc-*-linux*)
++sparc-*-linux* | sparcv9-*-linux*)
+ 	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
+ 	extra_options="${extra_options} sparc/long-double-switch.opt"
+ 	case ${target} in
+@@ -2474,7 +2474,7 @@ sparc64-*-rtems*)
+ 	extra_options="${extra_options}"
+ 	tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64 t-rtems"
+ 	;;
+-sparc64-*-linux*)
++sparc64*-*-linux*)
+ 	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default-64.h sparc/linux64.h sparc/tso.h"
+ 	extra_options="${extra_options} sparc/long-double-switch.opt"
+ 	tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
+--- libgcc/config.host.jj	2008-04-24 15:46:19.000000000 -0500
++++ libgcc/config.host	2008-04-24 15:46:49.000000000 -0500
+@@ -1002,7 +1002,7 @@ sparc-*-elf*)
+ 	tmake_file="${tmake_file} t-fdpbit t-crtfm"
+ 	extra_parts="$extra_parts crti.o crtn.o crtfastmath.o"
+ 	;;
+-sparc-*-linux*)		# SPARC's running GNU/Linux, libc6
++sparc-*-linux* | sparcv9-*-linux*)		# SPARC's running GNU/Linux, libc6
+ 	tmake_file="${tmake_file} t-crtfm"
+ 	if test "${host_address}" = 64; then
+ 		tmake_file="$tmake_file sparc/t-linux64"
+@@ -1050,7 +1050,7 @@ sparc64-*-freebsd*|ultrasparc-*-freebsd*
+ 	tmake_file="$tmake_file t-crtfm"
+ 	extra_parts="$extra_parts crtfastmath.o"
+ 	;;
+-sparc64-*-linux*)		# 64-bit SPARC's running GNU/Linux
++sparc64*-*-linux*)		# 64-bit SPARC's running GNU/Linux
+ 	extra_parts="$extra_parts crtfastmath.o"
+ 	tmake_file="${tmake_file} t-crtfm sparc/t-linux"
+ 	if test "${host_address}" = 64; then
diff --git a/ghdl-libgomp.patch b/ghdl-libgomp.patch
new file mode 100644
index 0000000..2305360
--- /dev/null
+++ b/ghdl-libgomp.patch
@@ -0,0 +1,22 @@
+--- libgomp/Makefile.am.orig	2013-01-31 13:28:31.722029106 +0100
++++ libgomp/Makefile.am	2013-01-31 13:28:53.747993506 +0100
+@@ -28,7 +28,7 @@
+ 
+ libgomp.ver: $(top_srcdir)/libgomp.map
+ 	$(EGREP) -v '#(#| |$$)' $< | \
+-	  $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1)
++	  $(PREPROCESS) -include config.h - > $@ || (rm -f $@ ; exit 1)
+ 
+ if LIBGOMP_BUILD_VERSIONED_SHLIB_GNU
+ libgomp_version_script = -Wl,--version-script,libgomp.ver
+--- libgomp/Makefile.in.orig	2013-01-31 13:28:36.051628972 +0100
++++ libgomp/Makefile.in	2013-01-31 13:29:26.166895582 +0100
+@@ -1071,7 +1071,7 @@
+ 
+ @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE at libgomp.ver: $(top_srcdir)/libgomp.map
+ @LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@	$(EGREP) -v '#(#| |$$)' $< | \
+- at LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@	  $(PREPROCESS) -P -include config.h - > $@ || (rm -f $@ ; exit 1)
++ at LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@	  $(PREPROCESS) -include config.h - > $@ || (rm -f $@ ; exit 1)
+ @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE at libgomp.ver-sun : libgomp.ver \
+ @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@		$(top_srcdir)/../contrib/make_sunver.pl \
+ @LIBGOMP_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBGOMP_BUILD_VERSIONED_SHLIB_TRUE@		$(libgomp_la_OBJECTS) $(libgomp_la_LIBADD)
diff --git a/ghdl-make.patch b/ghdl-make.patch
new file mode 100644
index 0000000..a14bc2f
--- /dev/null
+++ b/ghdl-make.patch
@@ -0,0 +1,11 @@
+--- gcc/vhdl/Make-lang.in.orig	2013-02-01 11:58:27.033000063 +0100
++++ gcc/vhdl/Make-lang.in	2013-02-01 11:58:49.612915289 +0100
+@@ -224,6 +224,8 @@
+ 
+ vhdl.install-normal:
+ 
++vhdl.install-plugin:
++
+ # Install the driver program as ghdl.
+ vhdl.install-common: ghdl$(exeext)
+ 	-mkdir $(DESTDIR)$(bindir)
diff --git a/ghdl-svn150.patch b/ghdl-svn150.patch
new file mode 100644
index 0000000..0bd6afa
--- /dev/null
+++ b/ghdl-svn150.patch
@@ -0,0 +1,1902 @@
+diff -urN ghdl-0.29/README ghdl-0.30dev/README
+--- ghdl-0.29/README	2010-01-09 15:32:28.000000000 +0100
++++ ghdl-0.30dev/README	2013-01-30 21:51:02.000000000 +0100
+@@ -27,7 +27,7 @@
+ ***************************
+ 
+ Required:
+-* the sources of gcc-4.3.4 (at least the core part).
++* the sources of gcc-4.7.2 (at least the core part).
+   Note: other versions of gcc sources have not been tested.
+ * the Ada95 GNAT compiler (GNAT GPL 2008 are known to work;
+   Ada compilers in most Linux distributions are more or less buggy)
+@@ -53,7 +53,7 @@
+   file from it).
+ * move or copy the vhdl directory of ghdl into the gcc subdirectory of
+   the gcc distribution.
+-  You should have a gcc-4.3.4/gcc/vhdl directory.
++  You should have a gcc-4.7.2/gcc/vhdl directory.
+ * configure gcc with the --enable-languages=vhdl option.  You may of course
+   add other languages.  Also you'd better to disable bootstraping using
+   --disable-bootstrap.
+diff -urN ghdl-0.29/vhdl/back_end.ads ghdl-0.30dev/vhdl/back_end.ads
+--- ghdl-0.29/vhdl/back_end.ads	2009-12-29 08:07:06.000000000 +0100
++++ ghdl-0.30dev/vhdl/back_end.ads	2013-01-30 21:50:35.000000000 +0100
+@@ -55,4 +55,3 @@
+    type Sem_Foreign_Acc is access procedure (Decl : Iir);
+    Sem_Foreign : Sem_Foreign_Acc := null;
+ end Back_End;
+-
+diff -urN ghdl-0.29/vhdl/errorout.adb ghdl-0.30dev/vhdl/errorout.adb
+--- ghdl-0.29/vhdl/errorout.adb	2009-12-29 08:07:06.000000000 +0100
++++ ghdl-0.30dev/vhdl/errorout.adb	2013-01-30 21:50:35.000000000 +0100
+@@ -86,14 +86,16 @@
+       raise Internal_Error;
+    end Error_Kind;
+ 
+-   -- Disp an error, prepended with program name.
+-   -- This is used for errors before initialisation, such as bad option or
+-   -- bad filename.
+-   procedure Error_Msg_Option (Msg: String) is
++   procedure Error_Msg_Option_NR (Msg: String) is
+    begin
+       Put (Ada.Command_Line.Command_Name);
+-      Put (":*command-line*: ");
++      Put (": ");
+       Put_Line (Msg);
++   end Error_Msg_Option_NR;
++
++   procedure Error_Msg_Option (Msg: String) is
++   begin
++      Error_Msg_Option_NR (Msg);
+       raise Option_Error;
+    end Error_Msg_Option;
+ 
+diff -urN ghdl-0.29/vhdl/errorout.ads ghdl-0.30dev/vhdl/errorout.ads
+--- ghdl-0.29/vhdl/errorout.ads	2009-12-29 08:07:06.000000000 +0100
++++ ghdl-0.30dev/vhdl/errorout.ads	2013-01-30 21:50:35.000000000 +0100
+@@ -49,6 +49,10 @@
+    -- This is used for errors before initialisation, such as bad option or
+    -- bad filename.
+    procedure Error_Msg_Option (Msg: String);
++   pragma No_Return (Error_Msg_Option);
++
++   --  Same as Error_Msg_Option but do not raise Option_Error.
++   procedure Error_Msg_Option_NR (Msg: String);
+ 
+    -- Disp an error location (using AN_IIR location) using the standard
+    -- format `file:line:col: '.
+diff -urN ghdl-0.29/vhdl/evaluation.adb ghdl-0.30dev/vhdl/evaluation.adb
+--- ghdl-0.29/vhdl/evaluation.adb	2010-01-02 16:03:58.000000000 +0100
++++ ghdl-0.30dev/vhdl/evaluation.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -24,7 +24,9 @@
+ with Std_Names;
+ 
+ package body Evaluation is
+-   function Get_Physical_Value (Expr : Iir) return Iir_Int64 is
++   function Get_Physical_Value (Expr : Iir) return Iir_Int64
++   is
++      pragma Unsuppress (Overflow_Check);
+    begin
+       case Get_Kind (Expr) is
+          when Iir_Kind_Physical_Int_Literal =>
+@@ -35,6 +37,10 @@
+          when others =>
+             Error_Kind ("get_physical_value", Expr);
+       end case;
++   exception
++      when Constraint_Error =>
++         Error_Msg_Sem ("arithmetic overflow in physical expression", Expr);
++         return Get_Value (Expr);
+    end Get_Physical_Value;
+ 
+    function Build_Integer (Val : Iir_Int64; Origin : Iir)
+diff -urN ghdl-0.29/vhdl/ghdldrv/ghdldrv.adb ghdl-0.30dev/vhdl/ghdldrv/ghdldrv.adb
+--- ghdl-0.29/vhdl/ghdldrv/ghdldrv.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ghdldrv/ghdldrv.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -671,6 +671,11 @@
+          Add_Argument (Compiler_Args, new String'(Opt));
+          Flag_Expect_Failure := True;
+          Res := Option_Ok;
++      elsif Opt = "-C" then
++         --  Translate -C into --mb-comments, as gcc already has a definition
++         --  for -C.  Done before Flags.Parse_Option.
++         Add_Argument (Compiler_Args, new String'("--mb-comments"));
++         Res := Option_Ok;
+       elsif Options.Parse_Option (Opt) then
+          Add_Argument (Compiler_Args, new String'(Opt));
+          Res := Option_Ok;
+@@ -888,22 +893,21 @@
+ 
+    procedure Bind_Anaelab (Files : Argument_List)
+    is
+-      Comp_List : Argument_List (1 .. 2 * Files'Length + 2);
+-      Flag_C : String_Access;
++      Comp_List : Argument_List (1 .. Files'Length + 2);
+       Index : Natural;
+    begin
+       Comp_List (1) := new String'("--anaelab");
+       Comp_List (2) := Unit_Name;
+-      Flag_C := new String'("-c");
+       Index := 3;
+       for I in Files'Range loop
+-         Comp_List (Index) := Flag_C;
+-         Comp_List (Index + 1) := Files (I);
+-         Index := Index + 2;
++         Comp_List (Index) := new String'("--ghdl-source=" & Files (I).all);
++         Index := Index + 1;
+       end loop;
+       Do_Compile (Comp_List, Elab_Name.all);
+-      Free (Flag_C);
+       Free (Comp_List (1));
++      for I in 3 .. Comp_List'Last loop
++         Free (Comp_List (I));
++      end loop;
+    end Bind_Anaelab;
+ 
+    procedure Link (Add_Std : Boolean;
+diff -urN ghdl-0.29/vhdl/ghdldrv/ghdllocal.adb ghdl-0.30dev/vhdl/ghdldrv/ghdllocal.adb
+--- ghdl-0.29/vhdl/ghdldrv/ghdllocal.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ghdldrv/ghdllocal.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -1125,9 +1125,73 @@
+    function Convert_Name (Name : String_Access) return String_Access
+    is
+       use Name_Table;
++
++      function Is_Bad_Unit_Name return Boolean is
++      begin
++         if Name_Length = 0 then
++            return True;
++         end if;
++         --  Don't try to handle extended identifier.
++         if Name_Buffer (1) = '\' then
++            return False;
++         end if;
++         --  Look for suspicious characters.
++         --  Do not try to be exhaustive as the correct check will be done
++         --  by convert_identifier.
++         for I in 1 .. Name_Length loop
++            case Name_Buffer (I) is
++               when '.' | '/' | '\' =>
++                  return True;
++               when others =>
++                  null;
++            end case;
++         end loop;
++         return False;
++      end Is_Bad_Unit_Name;
++
++      function Is_A_File_Name return Boolean is
++      begin
++         --  Check .vhd
++         if Name_Length > 4
++           and then Name_Buffer (Name_Length - 3 .. Name_Length) = ".vhd"
++         then
++            return True;
++         end if;
++         --  Check .vhdl
++         if Name_Length > 5
++           and then Name_Buffer (Name_Length - 4 .. Name_Length) = ".vhdl"
++         then
++            return True;
++         end if;
++         --  Check ../
++         if Name_Length > 3
++           and then Name_Buffer (1 .. 3) = "../"
++         then
++            return True;
++         end if;
++         --  Check ..\
++         if Name_Length > 3
++           and then Name_Buffer (1 .. 3) = "..\"
++         then
++            return True;
++         end if;
++         --  Should try to find the file ?
++         return False;
++      end Is_A_File_Name;
+    begin
+       Name_Length := Name'Length;
+       Name_Buffer (1 .. Name_Length) := Name.all;
++
++      --  Try to identifier bad names (such as file names), so that
++      --  friendly message can be displayed.
++      if Is_Bad_Unit_Name then
++         Errorout.Error_Msg_Option_NR ("bad unit name '" & Name.all & "'");
++         if Is_A_File_Name then
++            Errorout.Error_Msg_Option_NR
++              ("(a unit name is required instead of a filename)");
++         end if;
++         raise Option_Error;
++      end if;
+       Scan.Convert_Identifier;
+       return new String'(Name_Buffer (1 .. Name_Length));
+    end Convert_Name;
+diff -urN ghdl-0.29/vhdl/ghdldrv/ghdlprint.ads ghdl-0.30dev/vhdl/ghdldrv/ghdlprint.ads
+--- ghdl-0.29/vhdl/ghdldrv/ghdlprint.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ghdldrv/ghdlprint.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -18,5 +18,3 @@
+ package Ghdlprint is
+    procedure Register_Commands;
+ end Ghdlprint;
+-
+-
+diff -urN ghdl-0.29/vhdl/ghdl.texi ghdl-0.30dev/vhdl/ghdl.texi
+--- ghdl-0.29/vhdl/ghdl.texi	2010-01-09 15:11:15.000000000 +0100
++++ ghdl-0.30dev/vhdl/ghdl.texi	2013-01-30 21:50:35.000000000 +0100
+@@ -1931,7 +1931,8 @@
+ @node PSL implementation, Source representation, VHDL standards, GHDL implementation of VHDL
+ @comment  node-name,  next,  previous,  up
+ @section PSL implementation
+-GHDL understands embedded PSL annotations in VHDL files, but in separate files.
++GHDL understands embedded PSL annotations in VHDL files, but not in
++separate files.
+ 
+ As PSL annotations are embedded within comments, you must analyze and elaborate
+ your design with option @option{-fpsl} to enable PSL annotations.
+@@ -1941,8 +1942,8 @@
+ same line) by a PSL keyword such as @code{assert} or @code{default}.
+ To continue a PSL statement on the next line, just start a new comment.
+ 
+-A PSL statement is considered as a concurrent statement, and therefore is
+-allowed only where processes are.
++A PSL statement is considered as a process.  So it is not allowed within
++a process.
+ 
+ All PSL assertions must be clocked (GHDL doesn't support unclocked assertion).
+ Furthermore only one clock per assertion is allowed.
+diff -urN ghdl-0.29/vhdl/grt/grt-cbinding.c ghdl-0.30dev/vhdl/grt/grt-cbinding.c
+--- ghdl-0.29/vhdl/grt/grt-cbinding.c	2010-01-01 04:44:49.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-cbinding.c	2013-01-30 21:50:36.000000000 +0100
+@@ -18,6 +18,7 @@
+ */
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ 
+ FILE *
+ __ghdl_get_stdout (void)
+@@ -56,7 +57,7 @@
+   fprintf (stream, "%3d.%03d", a, b);
+ }
+ 
+-#if 1
++#ifndef WITH_GNAT_RUN_TIME
+ void
+ __gnat_last_chance_handler (void)
+ {
+diff -urN ghdl-0.29/vhdl/grt/grt-disp_signals.adb ghdl-0.30dev/vhdl/grt/grt-disp_signals.adb
+--- ghdl-0.29/vhdl/grt/grt-disp_signals.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-disp_signals.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -110,6 +110,9 @@
+       end case;
+    end Disp_Context;
+ 
++   --  This is a debugging procedure.
++   pragma Unreferenced (Disp_Context);
++
+    --  Option --trace-signals.
+ 
+    --  Disp transaction TRANS from signal SIG.
+diff -urN ghdl-0.29/vhdl/grt/grt-processes.adb ghdl-0.30dev/vhdl/grt/grt-processes.adb
+--- ghdl-0.29/vhdl/grt/grt-processes.adb	2010-01-06 05:12:24.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-processes.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -23,7 +23,6 @@
+ with Grt.Disp;
+ with Grt.Astdio;
+ with Grt.Errors; use Grt.Errors;
+-with Grt.Stacks; use Grt.Stacks;
+ with Grt.Options;
+ with Grt.Rtis_Addr; use Grt.Rtis_Addr;
+ with Grt.Rtis_Utils;
+@@ -46,15 +45,12 @@
+       Table_Low_Bound => 1,
+       Table_Initial => 16);
+ 
+-   function To_Proc_Acc is new Ada.Unchecked_Conversion
+-     (Source => System.Address, Target => Proc_Acc);
+-
+    type Finalizer_Type is record
+       --  Subprogram containing process code.
+       Subprg : Proc_Acc;
+ 
+       --  Instance (THIS parameter) for the subprogram.
+-      This : System.Address;
++      This : Instance_Acc;
+    end record;
+ 
+    --  List of finalizer.
+@@ -111,8 +107,8 @@
+       return Nbr_Resumed_Processes;
+    end Get_Nbr_Resumed_Processes;
+ 
+-   procedure Process_Register (This : System.Address;
+-                               Proc : System.Address;
++   procedure Process_Register (This : Instance_Acc;
++                               Proc : Proc_Acc;
+                                Ctxt : Rti_Context;
+                                State : Process_State;
+                                Postponed : Boolean)
+@@ -128,7 +124,7 @@
+       else
+          Stack := Null_Stack;
+       end if;
+-      P := new Process_Type'(Subprg => To_Proc_Acc (Proc),
++      P := new Process_Type'(Subprg => Proc,
+                              This => This,
+                              Rti => Ctxt,
+                              Sensitivity => null,
+@@ -150,8 +146,8 @@
+    end Process_Register;
+ 
+    procedure Ghdl_Process_Register
+-     (Instance : System.Address;
+-      Proc : System.Address;
++     (Instance : Instance_Acc;
++      Proc : Proc_Acc;
+       Ctxt : Ghdl_Rti_Access;
+       Addr : System.Address)
+    is
+@@ -160,8 +156,8 @@
+    end Ghdl_Process_Register;
+ 
+    procedure Ghdl_Sensitized_Process_Register
+-     (Instance : System.Address;
+-      Proc : System.Address;
++     (Instance : Instance_Acc;
++      Proc : Proc_Acc;
+       Ctxt : Ghdl_Rti_Access;
+       Addr : System.Address)
+    is
+@@ -170,8 +166,8 @@
+    end Ghdl_Sensitized_Process_Register;
+ 
+    procedure Ghdl_Postponed_Process_Register
+-     (Instance : System.Address;
+-      Proc : System.Address;
++     (Instance : Instance_Acc;
++      Proc : Proc_Acc;
+       Ctxt : Ghdl_Rti_Access;
+       Addr : System.Address)
+    is
+@@ -180,8 +176,8 @@
+    end Ghdl_Postponed_Process_Register;
+ 
+    procedure Ghdl_Postponed_Sensitized_Process_Register
+-     (Instance : System.Address;
+-      Proc : System.Address;
++     (Instance : Instance_Acc;
++      Proc : Proc_Acc;
+       Ctxt : Ghdl_Rti_Access;
+       Addr : System.Address)
+    is
+@@ -189,12 +185,10 @@
+       Process_Register (Instance, Proc, (Addr, Ctxt), State_Sensitized, True);
+    end Ghdl_Postponed_Sensitized_Process_Register;
+ 
+-   procedure Verilog_Process_Register (This : System.Address;
+-                                       Proc : System.Address;
++   procedure Verilog_Process_Register (This : Instance_Acc;
++                                       Proc : Proc_Acc;
+                                        Ctxt : Rti_Context)
+    is
+-      function To_Proc_Acc is new Ada.Unchecked_Conversion
+-        (Source => System.Address, Target => Proc_Acc);
+       P : Process_Acc;
+    begin
+       P := new Process_Type'(Rti => Ctxt,
+@@ -205,7 +199,7 @@
+                              Timeout => Bad_Time,
+                              Timeout_Chain_Next => null,
+                              Timeout_Chain_Prev => null,
+-                             Subprg => To_Proc_Acc (Proc),
++                             Subprg => Proc,
+                              This => This,
+                              Stack => Null_Stack);
+       Process_Table.Append (P);
+@@ -213,15 +207,15 @@
+       Set_Current_Process (P);
+    end Verilog_Process_Register;
+ 
+-   procedure Ghdl_Initial_Register (Instance : System.Address;
+-                                    Proc : System.Address)
++   procedure Ghdl_Initial_Register (Instance : Instance_Acc;
++                                    Proc : Proc_Acc)
+    is
+    begin
+       Verilog_Process_Register (Instance, Proc, Null_Context);
+    end Ghdl_Initial_Register;
+ 
+-   procedure Ghdl_Always_Register (Instance : System.Address;
+-                                   Proc : System.Address)
++   procedure Ghdl_Always_Register (Instance : Instance_Acc;
++                                   Proc : Proc_Acc)
+    is
+    begin
+       Verilog_Process_Register (Instance, Proc, Null_Context);
+@@ -234,11 +228,11 @@
+         (Sig, Process_Table.Table (Process_Table.Last));
+    end Ghdl_Process_Add_Sensitivity;
+ 
+-   procedure Ghdl_Finalize_Register (Instance : System.Address;
+-                                     Proc : System.Address)
++   procedure Ghdl_Finalize_Register (Instance : Instance_Acc;
++                                     Proc : Proc_Acc)
+    is
+    begin
+-      Finalizer_Table.Append (Finalizer_Type'(To_Proc_Acc (Proc), Instance));
++      Finalizer_Table.Append (Finalizer_Type'(Proc, Instance));
+    end Ghdl_Finalize_Register;
+ 
+    procedure Call_Finalizers is
+@@ -667,7 +661,7 @@
+             Grt.Astdio.Put ("run process ");
+             Disp_Process_Name (Stdio.stdout, Proc);
+             Grt.Astdio.Put (" [");
+-            Grt.Astdio.Put (Stdio.stdout, Proc.This);
++            Grt.Astdio.Put (Stdio.stdout, To_Address (Proc.This));
+             Grt.Astdio.Put ("]");
+             Grt.Astdio.New_Line;
+          end if;
+@@ -720,7 +714,7 @@
+                   Grt.Astdio.Put ("run process ");
+                   Disp_Process_Name (Stdio.stdout, Proc);
+                   Grt.Astdio.Put (" [");
+-                  Grt.Astdio.Put (Stdio.stdout, Proc.This);
++                  Grt.Astdio.Put (Stdio.stdout, To_Address (Proc.This));
+                   Grt.Astdio.Put ("]");
+                   Grt.Astdio.New_Line;
+                end if;
+diff -urN ghdl-0.29/vhdl/grt/grt-processes.ads ghdl-0.30dev/vhdl/grt/grt-processes.ads
+--- ghdl-0.29/vhdl/grt/grt-processes.ads	2010-01-06 04:55:54.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-processes.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -19,7 +19,7 @@
+ with Grt.Stack2; use Grt.Stack2;
+ with Grt.Types; use Grt.Types;
+ with Grt.Signals; use Grt.Signals;
+-with Grt.Stacks;
++with Grt.Stacks; use Grt.Stacks;
+ with Grt.Rtis; use Grt.Rtis;
+ with Grt.Rtis_Addr;
+ with Grt.Stdio;
+@@ -63,31 +63,32 @@
+ 
+    --  Register a process during elaboration.
+    --  This procedure is called by vhdl elaboration code.
+-   procedure Ghdl_Process_Register (Instance : System.Address;
+-                                    Proc : System.Address;
++   procedure Ghdl_Process_Register (Instance : Instance_Acc;
++                                    Proc : Proc_Acc;
+                                     Ctxt : Ghdl_Rti_Access;
+                                     Addr : System.Address);
+-   procedure Ghdl_Sensitized_Process_Register (Instance : System.Address;
+-                                               Proc : System.Address;
++   procedure Ghdl_Sensitized_Process_Register (Instance : Instance_Acc;
++                                               Proc : Proc_Acc;
+                                                Ctxt : Ghdl_Rti_Access;
+                                                Addr : System.Address);
+-   procedure Ghdl_Postponed_Process_Register (Instance : System.Address;
+-                                              Proc : System.Address;
++   procedure Ghdl_Postponed_Process_Register (Instance : Instance_Acc;
++                                              Proc : Proc_Acc;
+                                               Ctxt : Ghdl_Rti_Access;
+                                               Addr : System.Address);
+    procedure Ghdl_Postponed_Sensitized_Process_Register
+-     (Instance : System.Address;
+-      Proc : System.Address;
++     (Instance : Instance_Acc;
++      Proc : Proc_Acc;
+       Ctxt : Ghdl_Rti_Access;
+       Addr : System.Address);
+ 
+-   procedure Ghdl_Finalize_Register (Instance : System.Address;
+-                                     Proc : System.Address);
+-
+-   procedure Ghdl_Initial_Register (Instance : System.Address;
+-                                    Proc : System.Address);
+-   procedure Ghdl_Always_Register (Instance : System.Address;
+-                                   Proc : System.Address);
++   --  For verilog processes.
++   procedure Ghdl_Finalize_Register (Instance : Instance_Acc;
++                                     Proc : Proc_Acc);
++
++   procedure Ghdl_Initial_Register (Instance : Instance_Acc;
++                                    Proc : Proc_Acc);
++   procedure Ghdl_Always_Register (Instance : Instance_Acc;
++                                   Proc : Proc_Acc);
+ 
+    --  Add a simple signal in the sensitivity of the last registered
+    --  (sensitized) process.
+@@ -113,6 +114,7 @@
+    --  Verilog.
+    procedure Ghdl_Process_Delay (Del : Ghdl_U32);
+ 
++   --  Secondary stack.
+    function Ghdl_Stack2_Allocate (Size : Ghdl_Index_Type)
+      return System.Address;
+    function Ghdl_Stack2_Mark return Mark_Id;
+@@ -125,9 +127,6 @@
+    procedure Ghdl_Protected_Fini (Obj : System.Address);
+ 
+ private
+-   --  Access to a process subprogram.
+-   type Proc_Acc is access procedure (Self : System.Address);
+-
+    --  State of a process.
+    type Process_State is
+      (
+@@ -163,7 +162,7 @@
+       Subprg : Proc_Acc;
+ 
+       --  Instance (THIS parameter) for the subprogram.
+-      This : System.Address;
++      This : Instance_Acc;
+ 
+       --  Name of the process.
+       Rti : Rtis_Addr.Rti_Context;
+diff -urN ghdl-0.29/vhdl/grt/grt-signals.adb ghdl-0.30dev/vhdl/grt/grt-signals.adb
+--- ghdl-0.29/vhdl/grt/grt-signals.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-signals.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -1804,6 +1804,7 @@
+    end Compute_Resolved_Signal;
+ 
+    type Conversion_Func_Acc is access procedure (Instance : System.Address);
++   pragma Convention (C, Conversion_Func_Acc);
+    function To_Conversion_Func_Acc is new Ada.Unchecked_Conversion
+      (Source => System.Address, Target => Conversion_Func_Acc);
+ 
+@@ -2470,7 +2471,7 @@
+                   end if;
+                end if;
+             else
+-               Sig.Net := Signal_Net_Type (Offs (Sig.Net));
++               Sig.Net := Offs (Sig.Net);
+             end if;
+             Sig.Link := null;
+          end loop;
+diff -urN ghdl-0.29/vhdl/grt/grt-signals.ads ghdl-0.30dev/vhdl/grt/grt-signals.ads
+--- ghdl-0.29/vhdl/grt/grt-signals.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-signals.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -76,7 +76,8 @@
+ 
+    --  Function access type used to evaluate the guard expression.
+    type Guard_Func_Acc is access function (This : System.Address)
+-     return Ghdl_B2;
++                                          return Ghdl_B2;
++   pragma Convention (C, Guard_Func_Acc);
+ 
+    --  Simply linked list of processes to be resumed in case of events.
+ 
+diff -urN ghdl-0.29/vhdl/grt/grt-stacks.ads ghdl-0.30dev/vhdl/grt/grt-stacks.ads
+--- ghdl-0.29/vhdl/grt/grt-stacks.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-stacks.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -16,8 +16,24 @@
+ --  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ --  02111-1307, USA.
+ with System; use System;
++with Ada.Unchecked_Conversion;
+ 
+ package Grt.Stacks is
++   --  Instance is the parameter of the process procedure.
++   --  This is in fact a fully opaque type whose content is private to the
++   --  process.
++   type Instance is limited private;
++   type Instance_Acc is access all Instance;
++   pragma Convention (C, Instance_Acc);
++
++   --  A process is identified by a procedure having a single private
++   --  parameter (its instance).
++   type Proc_Acc is access procedure (Self : Instance_Acc);
++   pragma Convention (C, Proc_Acc);
++
++   function To_Address is new Ada.Unchecked_Conversion
++     (Instance_Acc, System.Address);
++
+    type Stack_Type is new Address;
+    Null_Stack : constant Stack_Type := Stack_Type (Null_Address);
+ 
+@@ -28,7 +44,8 @@
+ 
+    --  Create a new stack, which on first execution will call FUNC with
+    --  an argument ARG.
+-   function Stack_Create (Func : Address; Arg : Address) return Stack_Type;
++   function Stack_Create (Func : Proc_Acc; Arg : Instance_Acc)
++                         return Stack_Type;
+ 
+    --  Resume stack TO and save the current context to the stack pointed by
+    --  CUR.
+@@ -50,6 +67,8 @@
+    procedure Error_Null_Access;
+    pragma No_Return (Error_Null_Access);
+ private
++   type Instance is null record;
++
+    pragma Import (C, Stack_Init, "grt_stack_init");
+    pragma Import (C, Stack_Create, "grt_stack_create");
+    pragma Import (C, Stack_Switch, "grt_stack_switch");
+diff -urN ghdl-0.29/vhdl/grt/grt-vpi.ads ghdl-0.30dev/vhdl/grt/grt-vpi.ads
+--- ghdl-0.29/vhdl/grt/grt-vpi.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-vpi.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -137,6 +137,7 @@
+      (Source => Address, Target => p_cb_data);
+ 
+    type cb_rtn_type is access function (Cb : p_cb_data) return Integer;
++   pragma Convention (C, cb_rtn_type);
+ 
+    type s_cb_data is record
+       Reason : Integer;
+diff -urN ghdl-0.29/vhdl/grt/grt-waves.adb ghdl-0.30dev/vhdl/grt/grt-waves.adb
+--- ghdl-0.29/vhdl/grt/grt-waves.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/grt/grt-waves.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -387,7 +387,7 @@
+       Put_I32 (stdout, Ghdl_I32 (Str_AVL.Table (N).Right));
+       New_Line (stdout);
+       Put (stdout, " height: ");
+-      Put_I32 (stdout, Ghdl_I32 (Str_AVL.Table (N).Height));
++      Put_I32 (stdout, Str_AVL.Table (N).Height);
+       New_Line (stdout);
+       Put (stdout, " str: ");
+       --Put (stdout, Str_AVL.Table (N).Val);
+diff -urN ghdl-0.29/vhdl/iirs_utils.ads ghdl-0.30dev/vhdl/iirs_utils.ads
+--- ghdl-0.29/vhdl/iirs_utils.ads	2010-01-03 03:27:39.000000000 +0100
++++ ghdl-0.30dev/vhdl/iirs_utils.ads	2013-01-30 21:50:37.000000000 +0100
+@@ -156,4 +156,3 @@
+    --  IIR wrapper around Get_HDL_Node.
+    function Get_HDL_Node (N : PSL_Node) return Iir;
+ end Iirs_Utils;
+-
+diff -urN ghdl-0.29/vhdl/lang.opt ghdl-0.30dev/vhdl/lang.opt
+--- ghdl-0.29/vhdl/lang.opt	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/lang.opt	2013-01-30 21:50:37.000000000 +0100
+@@ -33,13 +33,14 @@
+ vhdl Separate
+ --anaelab <name>	Used internally during elaboration of <name>
+ 
+-c
+-vhdl Separate
+--c <filename>	Analyze <filename> for --anaelab
+-
+-v
+-vhdl
+-Verbose
++; -c is a driver option for gcc.  --ghdl-source is used instead.
++;c
++;vhdl Separate
++;-c <filename>	Analyze <filename> for --anaelab
++
++;v
++;vhdl
++;Verbose
+ 
+ -warn-
+ vhdl Joined
+@@ -81,9 +82,10 @@
+ vhdl Joined Separate
+ -l<filename>	Put list of files for link in <filename>
+ 
+-C
+-vhdl
+-Allow any character in comments
++; -C was commented out, as it is already defined for C/C++.
++;C
++;vhdl
++;Allow any character in comments
+ 
+ -mb-comments
+ vhdl
+diff -urN ghdl-0.29/vhdl/Makefile.in ghdl-0.30dev/vhdl/Makefile.in
+--- ghdl-0.29/vhdl/Makefile.in	2010-01-09 15:32:26.000000000 +0100
++++ ghdl-0.30dev/vhdl/Makefile.in	2013-01-30 21:51:01.000000000 +0100
+@@ -301,8 +301,8 @@
+ 	mkdir $(STD93_DIR)
+ 	prev=`pwd`; cd $(STD93_DIR); \
+ 	for i in $(STD93_SRCS); do \
+-	  echo $$i; \
+-	  $(ANALYZE93) --bootstrap --work=std $(REL_DIR)/$$i || exit 1; \
++	  cmd="$(ANALYZE93) --bootstrap --work=std $(REL_DIR)/$$i"; \
++	  echo $$cmd; eval $$cmd || exit 1; \
+ 	done; \
+ 	cd $$prev
+ 
+@@ -352,8 +352,8 @@
+ 	mkdir $(STD87_DIR)
+ 	prev=`pwd`; cd $(STD87_DIR); \
+ 	for i in $(STD87_SRCS); do \
+-	  echo $$i; \
+-	  $(ANALYZE87) --bootstrap --work=std $(REL_DIR)/$$i || exit 1; \
++	  cmd="$(ANALYZE87) --bootstrap --work=std $(REL_DIR)/$$i"; \
++	  echo $$cmd; eval $$cmd || exit 1; \
+ 	done; \
+ 	cd $$prev
+ 
+@@ -478,7 +478,11 @@
+ endif
+ ifeq ($(filter-out i%86 darwin%,$(arch) $(osys)),)
+   GRT_TARGET_OBJS=i386.o linux.o times.o
+-  GRT_EXTRA_LIB=-lm
++  GRT_EXTRA_LIB=
++endif
++ifeq ($(filter-out x84_64 darwin%,$(arch) $(osys)),)
++  GRT_TARGET_OBJS=amd64.o linux.o times.o
++  GRT_EXTRA_LIB=
+ endif
+ ifeq ($(filter-out sparc solaris%,$(arch) $(osys)),)
+   GRT_TARGET_OBJS=sparc.o linux.o times.o
+diff -urN ghdl-0.29/vhdl/Make-lang.in ghdl-0.30dev/vhdl/Make-lang.in
+--- ghdl-0.29/vhdl/Make-lang.in	2010-01-09 15:32:26.000000000 +0100
++++ ghdl-0.30dev/vhdl/Make-lang.in	2013-01-30 21:51:01.000000000 +0100
+@@ -122,17 +122,67 @@
+ 
+ 
+ .PHONY: agcc-clean agcc-maintainer-clean
++#  -*- Makefile -*- for the gcc implemantation of ortho.
++#  Copyright (C) 2005 Tristan Gingold
++#
++#  GHDL is free software; you can redistribute it and/or modify it under
++#  the terms of the GNU General Public License as published by the Free
++#  Software Foundation; either version 2, or (at your option) any later
++#  version.
++#
++#  GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
++#  WARRANTY; without even the implied warranty of MERCHANTABILITY or
++#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++#  for more details.
++#
++#  You should have received a copy of the GNU General Public License
++#  along with GCC; see the file COPYING.  If not, write to the Free
++#  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
++#  02111-1307, USA.
++
++# Variable used:
++# AGCC_GCCSRC_DIR: the gcc source base directory (ie gcc-X.Y.Z-objs/)
++# AGCC_GCCOBJ_DIR: the gcc objects base directory
++# agcc_srcdir: the agcc source directory
++# agcc_objdir: the agcc object directory
++
++AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
++ -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
++ -I$(AGCC_GCCSRC_DIR)/libcpp/include
++AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
++
++AGCC_LOCAL_OBJS=ortho-lang.o
++
++AGCC_DEPS := $(AGCC_LOCAL_OBJS)
++AGCC_OBJS := $(AGCC_LOCAL_OBJS) $(AGCC_GCCOBJ_DIR)gcc/attribs.o
++#	$(AGCC_GCCOBJ_DIR)gcc/toplev.o
++
++ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
++ $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
++ $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
++	$(CC) -c -o $@ $< $(AGCC_CFLAGS)
++
++agcc-clean: force
++	$(RM) -f $(agcc_objdir)/*.o
++	$(RM) -f $(agcc_srcdir)/*~
++
++agcc-maintainer-clean: force
++	$(RM) -f $(AGCC_DEPS)
++
++
++.PHONY: agcc-clean agcc-maintainer-clean
+ 
+ # The compiler proper.
+ # It is compiled into the vhdl/ subdirectory to avoid file name clashes but
+ # linked in in gcc directory to be able to access to gcc object files.
+-ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force
++ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force $(BACKEND) $(LIBDEPS)
+ 	CURDIR=`pwd`; cd $(srcdir)/vhdl; VHDLSRCDIR=`pwd`; cd $$CURDIR/vhdl; \
+ 	$(GNATMAKE) -c -aI$$VHDLSRCDIR ortho_gcc-main \
+ 	 -cargs $(CFLAGS) $(GHDL_ADAFLAGS)
+ 	$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
+ 	 -bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
+-	 -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS)
++	 -largs $(AGCC_OBJS) $(filter-out main.o,$(BACKEND)) \
++	 $(LIBS) $(BACKENDLIBS)
+ 
+ # The driver for ghdl.
+ ghdl$(exeext): force
+diff -urN ghdl-0.29/vhdl/ortho_front.adb ghdl-0.30dev/vhdl/ortho_front.adb
+--- ghdl-0.29/vhdl/ortho_front.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ortho_front.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -164,20 +164,23 @@
+          end if;
+          Action := Action_Anaelab;
+          return Decode_Elab_Option (Arg);
+-      elsif Opt.all = "-c" then
++      elsif Opt'Length > 14
++        and then Opt (Opt'First .. Opt'First + 13) = "--ghdl-source="
++      then
+          if Action /= Action_Anaelab then
+             Error_Msg_Option
+-              ("-c option allowed only after --anaelab options");
++              ("--ghdl-source option allowed only after --anaelab options");
+             return 0;
+          end if;
+-         if Arg = null then
+-            Error_Msg_Option ("filename required after -c");
++         if Arg /= null then
++            Error_Msg_Option ("no argument allowed after --ghdl-source");
+             return 0;
+          end if;
+          declare
+             L : Id_Link_Acc;
+          begin
+-            L := new Id_Link'(Id => Name_Table.Get_Identifier (Arg.all),
++            L := new Id_Link'(Id => Name_Table.Get_Identifier
++                                (Opt (Opt'First + 14 .. Opt'Last)),
+                               Link => null);
+             if Anaelab_Files = null then
+                Anaelab_Files := L;
+diff -urN ghdl-0.29/vhdl/ortho_gcc.ads ghdl-0.30dev/vhdl/ortho_gcc.ads
+--- ghdl-0.29/vhdl/ortho_gcc.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ortho_gcc.ads	2013-01-30 21:50:37.000000000 +0100
+@@ -426,6 +426,9 @@
+ private
+    subtype Tree is System.Address;
+    NULL_TREE : constant Tree := System.Null_Address;
++
++   subtype Vec_Ptr is System.Address;
++
+    type O_Cnode is new Tree;
+    type O_Enode is new Tree;
+    type O_Lnode is new Tree;
+@@ -513,9 +516,17 @@
+       Chain : Chain_Constr_Type;
+    end record;
+ 
+-   type O_Record_Aggr_List is new O_Aggr_List;
++   type O_Record_Aggr_List is record
++      Atype : Tree;
++      Afield : Tree;
++      Vec : Vec_Ptr;
++   end record;
+    pragma Convention (C, O_Record_Aggr_List);
+-   type O_Array_Aggr_List is new O_Aggr_List;
++
++   type O_Array_Aggr_List is record
++      Atype : Tree;
++      Vec : Vec_Ptr;
++   end record;
+    pragma Convention (C, O_Array_Aggr_List);
+ 
+    type O_Assoc_List is record
+diff -urN ghdl-0.29/vhdl/ortho-lang.c ghdl-0.30dev/vhdl/ortho-lang.c
+--- ghdl-0.29/vhdl/ortho-lang.c	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/ortho-lang.c	2013-01-30 21:50:37.000000000 +0100
+@@ -15,7 +15,7 @@
+ #include "opts.h"
+ #include "options.h"
+ #include "real.h"
+-#include "tree-gimple.h"
++#include "tree-iterator.h"
+ #include "function.h"
+ #include "cgraph.h"
+ #include "target.h"
+@@ -23,11 +23,16 @@
+ #include "tree-pass.h"
+ #include "tree-dump.h"
+ 
++/* TODO:
++ * remove stmt_list_stack, save in if/case/loop block
++ * Re-add -v (if necessary)
++ */
++
+ static tree type_for_size (unsigned int precision, int unsignedp);
+ 
+ const int tree_identifier_size = sizeof (struct tree_identifier);
+ 
+-struct binding_level GTY(())
++struct GTY(()) binding_level
+ {
+   /*  The BIND_EXPR node for this binding.  */
+   tree bind;
+@@ -56,7 +61,8 @@
+ /*  Chain of unused binding levels.  */
+ static GTY(()) struct binding_level *old_binding_levels = NULL;
+ 
+-static tree cur_stmts = NULL_TREE;
++/*  Chain of statements currently generated.  */
++static GTY(()) tree cur_stmts = NULL_TREE;
+ 
+ static void
+ push_binding (void)
+@@ -64,7 +70,7 @@
+   struct binding_level *res;
+ 
+   if (old_binding_levels == NULL)
+-    res = (struct binding_level *) ggc_alloc (sizeof (struct binding_level));
++    res = ggc_alloc_binding_level ();
+   else
+     {
+       res = old_binding_levels;
+@@ -93,7 +99,7 @@
+       if (cur_binding_level->first_block == NULL)
+ 	cur_binding_level->first_block = res->block;
+       else
+-	TREE_CHAIN (cur_binding_level->last_block) = res->block;
++	BLOCK_CHAIN (cur_binding_level->last_block) = res->block;
+       cur_binding_level->last_block = res->block;
+ 
+       BLOCK_SUPERCONTEXT (res->block) = cur_binding_level->block;
+@@ -133,22 +139,21 @@
+       tree t;
+ 
+       /* Create an artificial var to save the stack pointer.  */
+-      tmp_var = build_decl (VAR_DECL, NULL, ptr_type_node);
++      tmp_var = build_decl (input_location, VAR_DECL, NULL, ptr_type_node);
+       DECL_ARTIFICIAL (tmp_var) = true;
+       DECL_IGNORED_P (tmp_var) = true;
+       TREE_USED (tmp_var) = true;
+       push_decl (tmp_var);
+ 
+       /* Create the save stmt.  */
+-      save_call = build_function_call_expr
+-	(implicit_built_in_decls[BUILT_IN_STACK_SAVE], NULL_TREE);
++      save_call = build_call_expr
++	(builtin_decl_implicit (BUILT_IN_STACK_SAVE), 0);
+       save = build2 (MODIFY_EXPR, ptr_type_node, tmp_var, save_call);
+       TREE_SIDE_EFFECTS (save) = true;
+ 
+       /* Create the restore stmt.  */
+-      restore = build_function_call_expr
+-	(implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
+-	 tree_cons (NULL_TREE, tmp_var, NULL_TREE));
++      restore = build_call_expr
++	(builtin_decl_implicit (BUILT_IN_STACK_RESTORE), 1, tmp_var);
+ 
+       /* Build a try-finally block.
+ 	 The statement list is the block of current statements.  */
+@@ -181,30 +186,29 @@
+   return res;
+ }
+ 
+-static void
+-append_stmt (tree stmt)
+-{
+-  if (!EXPR_HAS_LOCATION (stmt))
+-    SET_EXPR_LOCATION (stmt, input_location);
+-  TREE_SIDE_EFFECTS (stmt) = true;
+-  append_to_statement_list (stmt, &cur_stmts);
+-}
++/* This is a stack of current statement_lists  */
++static GTY(()) VEC_tree_gc * stmt_list_stack;
+ 
+ static void
+ push_stmts (tree stmts)
+ {
+-  TREE_CHAIN (stmts) = cur_stmts;
++  VEC_safe_push (tree, gc, stmt_list_stack, cur_stmts);
+   cur_stmts = stmts;
+ }
+-
++ 
+ static void
+ pop_stmts (void)
+ {
+-  tree prev;
++  cur_stmts = VEC_pop (tree, stmt_list_stack);
++}
+ 
+-  prev = cur_stmts;
+-  cur_stmts = TREE_CHAIN (prev);
+-  TREE_CHAIN (prev) = NULL_TREE;
++static void
++append_stmt (tree stmt)
++{
++  if (!EXPR_HAS_LOCATION (stmt))
++    SET_EXPR_LOCATION (stmt, input_location);
++  TREE_SIDE_EFFECTS (stmt) = true;
++  append_to_statement_list (stmt, &cur_stmts);
+ }
+ 
+ static GTY(()) tree top;
+@@ -212,22 +216,16 @@
+ static GTY(()) tree stack_alloc_function_ptr;
+ extern void ortho_fe_init (void);
+ 
+-static int
++static bool
+ global_bindings_p (void)
+ {
+   return cur_binding_level->prev == NULL;
+ }
+ 
+-static void
+-insert_block (tree b)
+-{
+-  abort ();
+-}
+-
+ static tree
+ pushdecl (tree t)
+ {
+-  abort ();
++  gcc_unreachable ();
+ }
+ 
+ static tree
+@@ -253,13 +251,12 @@
+   push_binding ();
+ 
+   build_common_tree_nodes (0, 0);
+-  size_type_node = type_for_size (GET_MODE_BITSIZE (Pmode), 1);
+-  set_sizetype (size_type_node);
+-  build_common_tree_nodes_2 (0);
+ 
+-  n = build_decl (TYPE_DECL, get_identifier ("int"), integer_type_node);
++  n = build_decl (input_location,
++                  TYPE_DECL, get_identifier ("int"), integer_type_node);
+   push_decl (n);
+-  n = build_decl (TYPE_DECL, get_identifier ("char"), char_type_node);
++  n = build_decl (input_location,
++                  TYPE_DECL, get_identifier ("char"), char_type_node);
+   push_decl (n);
+ 
+   /* Create alloca builtin.  */
+@@ -267,22 +264,26 @@
+     tree args_type = tree_cons (NULL_TREE, size_type_node, void_list_node);
+     tree func_type = build_function_type (ptr_type_node, args_type);
+        
+-    implicit_built_in_decls[BUILT_IN_ALLOCA] = builtin_function
+-      ("__builtin_alloca", func_type,
+-       BUILT_IN_ALLOCA, BUILT_IN_NORMAL, NULL, NULL_TREE);
++    set_builtin_decl
++      (BUILT_IN_ALLOCA,
++       builtin_function
++       ("__builtin_alloca", func_type,
++	BUILT_IN_ALLOCA, BUILT_IN_NORMAL, NULL, NULL_TREE), true);
+     
+     stack_alloc_function_ptr = build1
+       (ADDR_EXPR, 
+        build_pointer_type (func_type),
+-       implicit_built_in_decls[BUILT_IN_ALLOCA]);
++       builtin_decl_implicit (BUILT_IN_ALLOCA));
+   }
+ 
+   {
+     tree ptr_ftype = build_function_type (ptr_type_node, NULL_TREE);
+ 
+-    implicit_built_in_decls[BUILT_IN_STACK_SAVE] = builtin_function
+-      ("__builtin_stack_save", ptr_ftype,
+-       BUILT_IN_STACK_SAVE, BUILT_IN_NORMAL, NULL, NULL_TREE);
++    set_builtin_decl
++      (BUILT_IN_STACK_SAVE,
++       builtin_function
++       ("__builtin_stack_save", ptr_ftype,
++	BUILT_IN_STACK_SAVE, BUILT_IN_NORMAL, NULL, NULL_TREE), true);
+   }
+ 
+   {
+@@ -292,9 +293,11 @@
+       (void_type_node,
+        tree_cons (NULL_TREE, ptr_type_node, NULL_TREE));
+ 
+-    implicit_built_in_decls[BUILT_IN_STACK_RESTORE] = builtin_function
+-      ("__builtin_stack_restore", ftype_ptr,
+-       BUILT_IN_STACK_RESTORE, BUILT_IN_NORMAL, NULL, NULL_TREE);
++    set_builtin_decl
++      (BUILT_IN_STACK_RESTORE,
++       builtin_function
++       ("__builtin_stack_restore", ftype_ptr,
++	BUILT_IN_STACK_RESTORE, BUILT_IN_NORMAL, NULL, NULL_TREE), true);
+   }
+ 
+   {
+@@ -320,7 +323,7 @@
+ }
+ 
+ static unsigned int
+-ortho_init_options (unsigned int argc, const char **argv)
++ortho_option_lang_mask (void)
+ {
+   return CL_vhdl;
+ }
+@@ -331,14 +334,19 @@
+   if (*pfilename == NULL || strcmp (*pfilename, "-") == 0)
+     *pfilename = "*stdin*";
+ 
++  /* Default hook.  */
++  lhd_post_options (pfilename);
++
+   /* Run the back-end.  */
+   return false;
+ }
+ 
+-extern int lang_handle_option (const char *opt, const char *arg);
++extern bool lang_handle_option (const char *opt, const char *arg);
+ 
+-static int
+-ortho_handle_option (size_t code, const char *arg, int value)
++static bool
++ortho_handle_option (size_t code, const char *arg, int value, int kind,
++                     location_t loc,
++                     const struct cl_option_handlers *handlers)
+ {
+   const char *opt;
+ 
+@@ -375,7 +383,7 @@
+ extern int lang_parse_file (const char *filename);
+ 
+ static void
+-ortho_parse_file (int debug)
++ortho_parse_file (void)
+ {
+   const char *filename;
+ 
+@@ -389,11 +397,6 @@
+ 
+   if (!lang_parse_file (filename))
+     errorcount++;
+-  else
+-    {
+-      cgraph_finalize_compilation_unit ();
+-      cgraph_optimize ();
+-    }
+   linemap_add (line_table, LC_LEAVE, 0, NULL, 1);
+ }
+ 
+@@ -436,7 +439,7 @@
+ 	return true;
+ 
+       default:
+-	abort ();
++	gcc_unreachable ();
+       }
+ }
+ 
+@@ -483,7 +486,7 @@
+       return real_zerop (expr) ? f : t;
+ 
+     default:
+-      abort ();
++      gcc_unreachable ();
+     }
+ }
+ 
+@@ -544,8 +547,7 @@
+     return error_mark_node;
+   if (TREE_CODE (TREE_TYPE (expr)) == VOID_TYPE || code == VOID_TYPE)
+     {
+-      abort ();
+-      return error_mark_node;
++      gcc_unreachable ();
+     }
+   if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
+     return fold (convert_to_integer (type, e));
+@@ -567,7 +569,7 @@
+   if (code == REAL_TYPE)
+     return fold (convert_to_real (type, e));
+ 
+-  abort ();
++  gcc_unreachable ();
+ }
+ 
+ /* Return a definition for a builtin function named NAME and whose data type
+@@ -586,7 +588,8 @@
+ 		  const char *library_name,
+ 		  tree attrs ATTRIBUTE_UNUSED)
+ {
+-  tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
++  tree decl = build_decl (input_location,
++                          FUNCTION_DECL, get_identifier (name), type);
+   DECL_EXTERNAL (decl) = 1;
+   TREE_PUBLIC (decl) = 1;
+   if (library_name)
+@@ -646,8 +649,8 @@
+ #define LANG_HOOKS_INIT ortho_init
+ #undef LANG_HOOKS_FINISH
+ #define LANG_HOOKS_FINISH ortho_finish
+-#undef LANG_HOOKS_INIT_OPTIONS
+-#define LANG_HOOKS_INIT_OPTIONS ortho_init_options
++#undef LANG_HOOKS_OPTION_LANG_MASK
++#define LANG_HOOKS_OPTION_LANG_MASK ortho_option_lang_mask
+ #undef LANG_HOOKS_HANDLE_OPTION
+ #define LANG_HOOKS_HANDLE_OPTION ortho_handle_option
+ #undef LANG_HOOKS_POST_OPTIONS
+@@ -678,60 +681,31 @@
+ #undef LANG_HOOKS_GETDECLS
+ #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
+ 
+-const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+-
+-/* Tree code classes.  */
+-
+-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
+-
+-const enum tree_code_class tree_code_type[] = {
+-#include "tree.def"
+-  'x'
+-};
+-#undef DEFTREECODE
+-
+-/* Table indexed by tree code giving number of expression
+-   operands beyond the fixed part of the node structure.
+-   Not used for types or decls.  */
+-
+-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
+-
+-const unsigned char tree_code_length[] = {
+-#include "tree.def"
+-  0
+-};
+-#undef DEFTREECODE
+-
+-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME,
+-const char * const tree_code_name[] = {
+-#include "tree.def"
+-  "@@dummy"
+-};
+-#undef DEFTREECODE
++struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+ 
+-union lang_tree_node 
+-  GTY((desc ("0"),
+-       chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)")))
++union GTY((desc ("0"),
++	   chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
++  lang_tree_node
+ {
+-  union tree_node GTY ((tag ("0"))) generic;
++  union tree_node GTY((tag ("0"),
++		       desc ("tree_node_structure (&%h)"))) generic;
+ };
+ 
+-struct lang_decl GTY(())
+-{
+-  char dummy;
+-};
++/* GHDL does not use the lang_decl and lang_type.
+ 
+-struct lang_type GTY (())
+-{
+-  char dummy;
+-};
++   FIXME: the variable_size annotation here is needed because these types are
++   variable-sized in some other front-ends.  Due to gengtype deficiency, the
++   GTY options of such types have to agree across all front-ends.  */
+ 
+-struct language_function GTY (())
++struct GTY((variable_size)) lang_type { char dummy; };
++struct GTY((variable_size)) lang_decl { char dummy; };
++
++struct GTY(()) language_function
+ {
+   char dummy;
+ };
+ 
+-struct chain_constr_type
++struct GTY(()) chain_constr_type
+ {
+   tree first;
+   tree last;
+@@ -749,8 +723,7 @@
+ {
+   if (constr->first == NULL_TREE)
+     {
+-      if (constr->last != NULL_TREE)
+-	abort ();
++      gcc_assert (constr->last == NULL_TREE);
+       constr->first = el;
+     }
+   else
+@@ -758,7 +731,7 @@
+   constr->last = el;
+ }
+ 
+-struct list_constr_type
++struct GTY(()) list_constr_type
+ {
+   tree first;
+   tree last;
+@@ -855,8 +828,7 @@
+   enum tree_code code;
+ 
+   left_type = TREE_TYPE (left);
+-  if (left_type != TREE_TYPE (right))
+-    abort ();
++  gcc_assert (left_type == TREE_TYPE (right));
+ 
+   switch (kind)
+     {
+@@ -882,10 +854,8 @@
+ tree
+ new_compare_op (enum ON_op_kind kind, tree left, tree right, tree ntype)
+ {
+-  if (TREE_CODE (ntype) != BOOLEAN_TYPE)
+-    abort ();
+-  if (TREE_TYPE (left) != TREE_TYPE (right))
+-    abort ();
++  gcc_assert (TREE_CODE (ntype) == BOOLEAN_TYPE);
++  gcc_assert (TREE_TYPE (left) == TREE_TYPE (right));
+   return build2 (ON_op_to_TREE_CODE[kind], ntype, left, right);
+ }
+ 
+@@ -947,7 +917,7 @@
+   else if (val_code == REAL_TYPE && rtype_code == REAL_TYPE)
+     code = NOP_EXPR;
+   else
+-    abort ();
++    gcc_unreachable ();
+ 
+   return build1 (code, rtype, val);
+ }
+@@ -956,15 +926,14 @@
+ new_alloca (tree rtype, tree size)
+ {
+   tree res;
+-  tree args;
+ 
+   /* Must save stack except when at function level.  */
+   if (cur_binding_level->prev != NULL
+       && cur_binding_level->prev->prev != NULL)
+     cur_binding_level->save_stack = 1;
+ 
+-  args = tree_cons (NULL_TREE, fold_convert (size_type_node, size), NULL_TREE);
+-  res = build_call_list (ptr_type_node, stack_alloc_function_ptr, args);
++  res = build_call_nary (ptr_type_node, stack_alloc_function_ptr,
++                         1, fold_convert (size_type_node, size));
+   return fold_convert (rtype, res);
+ }
+ 
+@@ -976,11 +945,7 @@
+   HOST_WIDE_INT hi;
+ 
+   lo = value;
+-  if (sizeof (HOST_WIDE_INT) == sizeof (long long))
+-    hi = value >> (8 * sizeof (HOST_WIDE_INT) - 1);
+-  else
+-    hi = value >> (8 * sizeof (HOST_WIDE_INT));
+-
++  hi = (value >> 1) >> (8 * sizeof (HOST_WIDE_INT) - 1);
+   res = build_int_cst_wide (ltype, lo, hi);
+   return res;
+ }
+@@ -993,11 +958,7 @@
+   unsigned HOST_WIDE_INT hi;
+ 
+   lo = value;
+-  if (sizeof (HOST_WIDE_INT) == sizeof (long long))
+-    hi = 0;
+-  else
+-    hi = value >> (8 * sizeof (HOST_WIDE_INT));
+-
++  hi = (value >> 1) >> (8 * sizeof (HOST_WIDE_INT) - 1);
+   res = build_int_cst_wide (ltype, lo, hi);
+   return res;
+ }
+@@ -1028,11 +989,7 @@
+   
+   s = ldexp (frac, 60);
+   lo = s;
+-  if (sizeof (HOST_WIDE_INT) == sizeof (long long))
+-    hi = s >> (8 * sizeof (HOST_WIDE_INT) - 1);
+-  else
+-    hi = s >> (8 * sizeof (HOST_WIDE_INT));
+-
++  hi = (s >> 1) >> (8 * sizeof (HOST_WIDE_INT) - 1);
+   res = build_int_cst_wide (long_integer_type_node, lo, hi);
+   REAL_VALUE_FROM_INT (r_sign, lo, hi, DFmode);
+   real_2expN (&r_exp, ex - 60, DFmode);
+@@ -1041,7 +998,7 @@
+   return res;
+ }
+ 
+-struct o_element_list
++struct GTY(()) o_element_list
+ {
+   tree res;
+   struct chain_constr_type chain;
+@@ -1075,7 +1032,8 @@
+ {
+   tree res;
+ 
+-  res = build_decl (FIELD_DECL, ident, etype);
++  res = build_decl (input_location,
++                    FIELD_DECL, ident, etype);
+   DECL_CONTEXT (res) = list->res;
+   chain_append (&list->chain, res);
+   *el = res;
+@@ -1104,7 +1062,6 @@
+     }
+ }
+ 
+-
+ void
+ start_union_type (struct o_element_list *elements)
+ {
+@@ -1162,7 +1119,7 @@
+       res = make_node (POINTER_TYPE);
+       TREE_TYPE (res) = NULL_TREE;
+       /* Seems necessary.  */
+-      TYPE_MODE (res) = Pmode;
++      SET_TYPE_MODE (res, Pmode);
+       layout_type (res);
+       return res;
+     }
+@@ -1173,9 +1130,8 @@
+ void
+ finish_access_type (tree atype, tree dtype)
+ {
+-  if (TREE_CODE (atype) != POINTER_TYPE
+-      || TREE_TYPE (atype) != NULL_TREE)
+-    abort ();
++  gcc_assert (TREE_CODE (atype) == POINTER_TYPE
++	      && TREE_TYPE (atype) == NULL_TREE);
+ 
+   TREE_TYPE (atype) = dtype;
+ }
+@@ -1260,62 +1216,78 @@
+ {
+   *res = list->res;
+   TYPE_VALUES (*res) = list->chain.first;
+-  TYPE_MIN_VALUE (*res) = TREE_VALUE (list->chain.first);
+-  TYPE_MAX_VALUE (*res) = TREE_VALUE (list->chain.last);
+   TYPE_UNSIGNED (*res) = 1;
+   TYPE_PRECISION (*res) = list->size;
++  set_min_and_max_values_for_integral_type (*res, list->size, 1);
+   layout_type (*res);
+ }
+ 
+-struct o_record_aggr_list
++struct GTY(()) o_record_aggr_list
+ {
++  /* Type of the record.  */
+   tree atype;
+-  struct chain_constr_type chain;
++  /* Type of the next field to be added.  */
++  tree field;
++  /* Vector of elements.  */
++  VEC(constructor_elt,gc) *elts;
+ };
+ 
+ void
+ start_record_aggr (struct o_record_aggr_list *list, tree atype)
+ {
+   list->atype = atype;
+-  chain_init (&list->chain);
++  list->field = TYPE_FIELDS (atype);
++  list->elts = VEC_alloc (constructor_elt, gc, fields_length (atype));
++
+ }
+ 
+ void
+ new_record_aggr_el (struct o_record_aggr_list *list, tree value)
+ {
+-  chain_append (&list->chain, build_tree_list (NULL_TREE, value));
++  CONSTRUCTOR_APPEND_ELT (list->elts, list->field, value);
++  list->field = TREE_CHAIN (list->field);
+ }
+ 
+ void
+ finish_record_aggr (struct o_record_aggr_list *list, tree *res)
+ {
+-  *res = build_constructor_from_list (list->atype, list->chain.first);
++  *res = build_constructor (list->atype, list->elts);
+ }
+  
+ 
+-struct o_array_aggr_list
++struct GTY(()) o_array_aggr_list
+ {
+   tree atype;
+-  struct chain_constr_type chain;
++  /* Vector of elements.  */
++  VEC(constructor_elt,gc) *elts;
+ };
+ 
+ void
+ start_array_aggr (struct o_array_aggr_list *list, tree atype)
+ {
++  tree nelts;
++  unsigned HOST_WIDE_INT n;
++
+   list->atype = atype;
+-  chain_init (&list->chain);
++  list->elts = NULL;
++
++  nelts = array_type_nelts (atype);
++  gcc_assert (nelts != NULL_TREE && host_integerp (nelts, 1));
++
++  n = tree_low_cst (nelts, 1) + 1;
++  list->elts = VEC_alloc (constructor_elt, gc, n);
+ }
+ 
+ void
+ new_array_aggr_el (struct o_array_aggr_list *list, tree value)
+ {
+-  chain_append (&list->chain, build_tree_list (NULL_TREE, value));
++  CONSTRUCTOR_APPEND_ELT (list->elts, NULL_TREE, value);
+ }
+  
+ void
+ finish_array_aggr (struct o_array_aggr_list *list, tree *res)
+ {
+-  *res = build_constructor_from_list (list->atype, list->chain.first);
++  *res = build_constructor (list->atype, list->elts);
+ }
+ 
+ 
+@@ -1349,8 +1321,7 @@
+ 
+   /*  *((RES_TYPE *)(&ARR[INDEX]))
+       convert ARR to a pointer, add index, and reconvert to array ?  */
+-  if (TREE_CODE (res_type) != ARRAY_TYPE)
+-    abort ();
++  gcc_assert (TREE_CODE (res_type) == ARRAY_TYPE);
+ 
+   ortho_mark_addressable (arr);
+   return build4 (ARRAY_RANGE_REF, res_type, arr, index, NULL_TREE, NULL_TREE);
+@@ -1372,8 +1343,7 @@
+ {
+   tree res;
+ 
+-  if (TREE_CODE (TREE_TYPE (rec)) != RECORD_TYPE)
+-    abort ();
++  gcc_assert (TREE_CODE (TREE_TYPE (rec)) == RECORD_TYPE);
+ 
+   res = build3 (COMPONENT_REF, TREE_TYPE (el), rec, el, NULL_TREE);
+   return res;
+@@ -1385,8 +1355,7 @@
+   tree acc_type;
+ 
+   acc_type = TREE_TYPE (acc);
+-  if (TREE_CODE (acc_type) != POINTER_TYPE)
+-    abort ();
++  gcc_assert (TREE_CODE (acc_type) == POINTER_TYPE);
+ 
+   return build1 (INDIRECT_REF, TREE_TYPE (acc_type), acc);
+ }
+@@ -1400,18 +1369,14 @@
+   tree res;
+ 
+   off = DECL_FIELD_OFFSET (field);
+-  if (!host_integerp (off, 1))
+-    {
+-      /*  The offset must be a constant.  */
+-      abort ();
+-    }
++
++  /*  The offset must be a constant.  */
++  gcc_assert (host_integerp (off, 1));
+ 
+   bit_off = DECL_FIELD_BIT_OFFSET (field);
+-  if (!host_integerp (bit_off, 1))
+-    {
+-      /*  The offset must be a constant.  */
+-      abort ();
+-    }
++
++  /*  The offset must be a constant.  */
++  gcc_assert (host_integerp (bit_off, 1));
+ 
+   pos = TREE_INT_CST_LOW (off)
+         + (TREE_INT_CST_LOW (bit_off) / BITS_PER_UNIT);
+@@ -1574,7 +1539,7 @@
+   tree decl;
+ 
+   TYPE_NAME (atype) = ident;
+-  decl = build_decl (TYPE_DECL, ident, atype);
++  decl = build_decl (input_location, TYPE_DECL, ident, atype);
+   TYPE_STUB_DECL (atype) = decl;
+   push_decl (decl);
+   /*
+@@ -1623,14 +1588,14 @@
+ {
+   tree cst;
+ 
+-  cst = build_decl (VAR_DECL, ident, atype);
++  cst = build_decl (input_location, VAR_DECL, ident, atype);
+   set_storage (cst, storage);
+   TREE_READONLY (cst) = 1;
+   push_decl (cst);
+   switch (storage)
+     {
+     case o_storage_local:
+-      abort ();
++      gcc_unreachable ();
+     case o_storage_external:
+       /*  We are at top level if Current_Function_Decl is null.  */
+       rest_of_decl_compilation
+@@ -1663,7 +1628,7 @@
+ {
+   tree var;
+ 
+-  var = build_decl (VAR_DECL, ident, atype);
++  var = build_decl (input_location, VAR_DECL, ident, atype);
+   if (current_function_decl != NULL_TREE)
+     {    
+       /*  Local variable. */
+@@ -1682,7 +1647,7 @@
+   *res = var;
+ }
+ 
+-struct o_inter_list
++struct GTY(()) o_inter_list
+ {
+   tree ident;
+   enum o_storage storage;
+@@ -1726,7 +1691,7 @@
+ {
+   tree r;
+ 
+-  r = build_decl (PARM_DECL, ident, atype);
++  r = build_decl (input_location, PARM_DECL, ident, atype);
+   /* DECL_CONTEXT (Res, Xxx); */
+ 
+   /*  Do type conversion: convert boolean and enums to int  */
+@@ -1746,10 +1711,6 @@
+   *res = r;
+ }
+ 
+-/*  Current function nest level, or the number of parents.  */
+-/* static int function_nest_level; */
+-
+-
+ void
+ finish_subprogram_decl (struct o_inter_list *interfaces, tree *res)
+ {
+@@ -1762,7 +1723,7 @@
+      is known not be have variables arguments.  */
+   ortho_list_append (&interfaces->param_list, void_type_node);
+ 
+-  decl = build_decl (FUNCTION_DECL, interfaces->ident,
++  decl = build_decl (input_location, FUNCTION_DECL, interfaces->ident,
+ 		     build_function_type (interfaces->rtype,
+ 					  interfaces->param_list.first));
+   DECL_SOURCE_LOCATION (decl) = input_location;
+@@ -1784,7 +1745,8 @@
+ 
+   /*  Declare the result.
+       FIXME: should be moved in start_function_body. */
+-  result = build_decl (RESULT_DECL, NULL_TREE, interfaces->rtype);
++  result = build_decl (input_location,
++                       RESULT_DECL, NULL_TREE, interfaces->rtype);
+   DECL_RESULT (decl) = result;
+   DECL_CONTEXT (result) = decl;
+ 
+@@ -1811,8 +1773,7 @@
+ void
+ start_subprogram_body (tree func)
+ {
+-  if (current_function_decl != DECL_CONTEXT (func))
+-    abort ();
++  gcc_assert (current_function_decl == DECL_CONTEXT (func));
+   current_function_decl = func;
+ 
+   /* The function is not anymore external.  */
+@@ -1842,19 +1803,11 @@
+   /* Store the end of the function.  */
+   cfun->function_end_locus = input_location;
+   
+-  /* This function is being processed in whole-function mode.  */
+-  /* cfun->x_whole_function_mode_p = 1; */
+-
+-  gimplify_function_tree (func);
+-
+-  /* Dump the genericized tree IR.
+-     Enabled by -fdump-tree-gimple.  */
+-  dump_function (TDI_generic, func);
+ 
+   parent = DECL_CONTEXT (func);
+ 
+   if (parent != NULL)
+-    cgraph_node (func);
++    cgraph_get_create_node (func);
+   else
+     cgraph_finalize_function (func, false);
+ 
+@@ -1887,31 +1840,31 @@
+ }
+ 
+ 
+-struct o_assoc_list
++struct GTY(()) o_assoc_list
+ {
+   tree subprg;
+-  struct list_constr_type list;
++  VEC(tree,gc) *vec;
+ };
+ 
+ void
+ start_association (struct o_assoc_list *assocs, tree subprg)
+ {
+   assocs->subprg = subprg;
+-  list_init (&assocs->list);
++  assocs->vec = NULL;
+ }
+ 
+ void
+ new_association (struct o_assoc_list *assocs, tree val)
+ {
+-  ortho_list_append (&assocs->list, val);
++  VEC_safe_push (tree, gc, assocs->vec, val);
+ }
+ 
+ tree
+ new_function_call (struct o_assoc_list *assocs)
+ {
+-  return build_call_list (TREE_TYPE (TREE_TYPE (assocs->subprg)),
+-			  build_function_ptr (assocs->subprg),
+-			  assocs->list.first);
++  return build_call_vec (TREE_TYPE (TREE_TYPE (assocs->subprg)),
++                         build_function_ptr (assocs->subprg),
++                         assocs->vec);
+ }
+ 
+ void
+@@ -1919,9 +1872,9 @@
+ {
+   tree res;
+ 
+-  res = build_call_list (TREE_TYPE (TREE_TYPE (assocs->subprg)),
+-			 build_function_ptr (assocs->subprg),
+-			 assocs->list.first);
++  res = build_call_vec (TREE_TYPE (TREE_TYPE (assocs->subprg)),
++                        build_function_ptr (assocs->subprg),
++                        assocs->vec);
+   TREE_SIDE_EFFECTS (res) = 1;
+   append_stmt (res);
+ }
+@@ -1962,7 +1915,7 @@
+ }
+ 
+ 
+-struct o_if_block
++struct GTY(()) o_if_block
+ {
+   tree stmt;
+ };
+@@ -2012,13 +1965,7 @@
+ }
+ 
+ 
+-struct o_loop_block
+-{
+-  tree beg_label;
+-  tree end_label;
+-};
+-
+-struct o_snode
++struct GTY(()) o_snode
+ {
+   tree beg_label;
+   tree end_label;
+@@ -2030,7 +1977,7 @@
+ {
+   tree res;
+ 
+-  res = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
++  res = build_decl (input_location, LABEL_DECL, NULL_TREE, void_type_node);
+   DECL_CONTEXT (res) = current_function_decl;
+   DECL_ARTIFICIAL (res) = 1;
+   return res;
+@@ -2086,7 +2033,7 @@
+   append_stmt (stmt);
+ }
+ 
+-struct o_case_block
++struct GTY(()) o_case_block
+ {
+   tree end_label;
+   int add_break;
+@@ -2125,8 +2072,8 @@
+ {
+   tree stmt;
+   
+-  stmt = build3 (CASE_LABEL_EXPR, void_type_node,
+-		 expr, NULL_TREE, create_artificial_label ());
++  stmt = build_case_label
++    (expr, NULL_TREE, create_artificial_label (input_location));
+   append_stmt (stmt);
+ }
+ 
+@@ -2135,8 +2082,8 @@
+ {
+   tree stmt;
+ 
+-  stmt = build3 (CASE_LABEL_EXPR, void_type_node,
+-		 low, high, create_artificial_label ());
++  stmt = build_case_label
++    (low, high, create_artificial_label (input_location));
+   append_stmt (stmt);
+ }
+ 
+@@ -2145,8 +2092,8 @@
+ {
+   tree stmt;
+ 
+-  stmt = build3 (CASE_LABEL_EXPR, void_type_node,
+-		 NULL_TREE, NULL_TREE, create_artificial_label ());
++  stmt = build_case_label
++    (NULL_TREE, NULL_TREE, create_artificial_label (input_location));
+   append_stmt (stmt);
+ }
+ 
+diff -urN ghdl-0.29/vhdl/sa_bools.adb ghdl-0.30dev/vhdl/sa_bools.adb
+--- ghdl-0.29/vhdl/sa_bools.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/sa_bools.adb	1970-01-01 01:00:00.000000000 +0100
+@@ -1,42 +0,0 @@
+-with PSL.Errors; use PSL.Errors;
+-with Name_Table;
+-with Types; use Types;
+-with Ada.Text_IO;
+-
+-package body Sa_Bools is
+-   function Sem (N : Node) return Node is
+-   begin
+-      case Get_Kind (N) is
+-         when N_Or_Bool
+-           | N_And_Bool =>
+-            Set_Left (N, Sem (Get_Left (N)));
+-            Set_Right (N, Sem (Get_Right (N)));
+-            return N;
+-         when N_Not_Bool =>
+-            Set_Boolean (N, Sem (Get_Boolean (N)));
+-            return N;
+-         when N_Name =>
+-            declare
+-               use Name_Table;
+-               Id : constant Name_Id := Get_Identifier (N);
+-               Name : Node;
+-            begin
+-               Name := Node (Get_Info (Id));
+-               if Name /= Null_Node then
+-                  return Name;
+-               end if;
+-               Name := Create_Node (N_HDL_Expr);
+-               Set_HDL_Node (Name, Int32 (Id));
+-               Set_Info (Id, Int32 (Name));
+-               return Name;
+-            end;
+-         when others =>
+-            Error_Kind ("sem", N);
+-      end case;
+-   end Sem;
+-
+-   procedure Print_HDL_Expr (N : Node) is
+-   begin
+-      Ada.Text_IO.Put (Image (Name_Id (Get_HDL_Node (N))));
+-   end Print_HDL_Expr;
+-end Sa_Bools;
+diff -urN ghdl-0.29/vhdl/sa_bools.ads ghdl-0.30dev/vhdl/sa_bools.ads
+--- ghdl-0.29/vhdl/sa_bools.ads	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/sa_bools.ads	1970-01-01 01:00:00.000000000 +0100
+@@ -1,8 +0,0 @@
+-with PSL.Nodes; use PSL.Nodes;
+-
+-package Sa_Bools is
+-   function Sem (N : Node) return Node;
+-
+-   procedure Print_HDL_Expr (N : Node);
+-end Sa_Bools;
+-
+diff -urN ghdl-0.29/vhdl/sem_assocs.adb ghdl-0.30dev/vhdl/sem_assocs.adb
+--- ghdl-0.29/vhdl/sem_assocs.adb	2009-12-29 08:07:07.000000000 +0100
++++ ghdl-0.30dev/vhdl/sem_assocs.adb	2013-01-30 21:50:36.000000000 +0100
+@@ -467,6 +467,7 @@
+       Sub : Iir;
+       Formal_Object : Iir;
+    begin
++      --  Recurse.
+       Formal_Object := Name_To_Object (Formal);
+       case Get_Kind (Formal_Object) is
+          when Iir_Kind_Indexed_Name
+@@ -518,6 +519,7 @@
+       end case;
+    end Add_Individual_Association_1;
+ 
++   --  Insert ASSOC into the tree of individual assoc rooted by IASSOC.
+    procedure Add_Individual_Association (Iassoc : Iir; Assoc : Iir)
+    is
+       Formal : Iir;
+diff -urN ghdl-0.29/vhdl/version.ads ghdl-0.30dev/vhdl/version.ads
+--- ghdl-0.29/vhdl/version.ads	2010-01-09 15:07:10.000000000 +0100
++++ ghdl-0.30dev/vhdl/version.ads	2013-01-30 21:50:36.000000000 +0100
+@@ -1,5 +1,5 @@
+ package Version is
+    Ghdl_Release : constant String :=
+-      "GHDL 0.29 (20100109) [Sokcho edition]";
+-   Ghdl_Ver : constant String := "0.29";
++      "GHDL 0.30dev (20100112) [Sokcho edition]";
++   Ghdl_Ver : constant String := "0.30dev";
+ end Version;
diff --git a/ghdl-typeforsize.patch b/ghdl-typeforsize.patch
new file mode 100644
index 0000000..fbe23c3
--- /dev/null
+++ b/ghdl-typeforsize.patch
@@ -0,0 +1,13 @@
+--- gcc/vhdl/ortho-lang.c.orig	2013-02-01 11:27:40.199726632 +0100
++++ gcc/vhdl/ortho-lang.c	2013-02-01 11:29:00.272327562 +0100
+@@ -629,6 +629,10 @@
+ 
+   if (precision <= MAX_BITS_PER_WORD)
+     signed_and_unsigned_types[precision][unsignedp] = t;
++  else 
++    // Handle larger requests by returning a NULL tree and letting 
++    // the back end default to another approach.
++    t = NULL_TREE;
+ 
+   return t;
+ }
diff --git a/ghdl.spec b/ghdl.spec
index ad71468..6461d41 100644
--- a/ghdl.spec
+++ b/ghdl.spec
@@ -1,11 +1,18 @@
-%global gccver 4.3.4
+%global gccver 4.7.2
+%global gccdate 20121109
+%global gccinstver 4.7.3
 %global ghdlver 0.29
-%global ghdlsvnver 143
+%global ghdlsvnver 150
+%if 0%{?rhel} >= 7
+%global build_cloog 0
+%else
+%global build_cloog 1
+%endif
 
 Summary: A VHDL simulator, using the GCC technology
 Name: ghdl
 Version: %{ghdlver}
-Release: 3.%{ghdlsvnver}svn.8%{?dist}
+Release: 3.%{ghdlsvnver}svn.0%{?dist}
 #Release: 1%{?dist}
 License: GPLv2+
 Group: Development/Languages
@@ -15,7 +22,33 @@ URL: http://ghdl.free.fr/
 # svn co svn://svn.gna.org/svn/ghdl/trunk ghdl
 # cd translate/gcc/
 # ./dist.sh sources
-Source0: ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{gccver}/gcc-core-%{gccver}.tar.bz2
+# The source for this package was pulled from upstream's vcs.  Use the
+# following commands to generate the tarball:
+# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_7-branch@%{SVNREV} gcc-%{gccver}-%{gccdate}
+# tar cf - gcc-%{gccver}-%{gccdate} | bzip2 -9 > gcc-%{gccver}-%{gccdate}.tar.bz2
+%if 0%{?gccdate}
+Source0: gcc-%{gccver}-%{gccdate}.tar.bz2
+%else
+Source0: ftp://ftp.gwdg.de/pub/misc/gcc/releases/gcc-%{gccver}/gcc-%{gccver}.tar.bz2
+%endif
+Patch0: gcc47-hack.patch
+Patch1: gcc47-c++-builtin-redecl.patch
+Patch2: gcc47-java-nomulti.patch
+Patch3: gcc47-ppc32-retaddr.patch
+Patch5: gcc47-rh330771.patch
+Patch6: gcc47-i386-libgomp.patch
+Patch7: gcc47-sparc-config-detection.patch
+Patch8: gcc47-libgomp-omp_h-multilib.patch
+Patch9: gcc47-libtool-no-rpath.patch
+Patch10: gcc47-cloog-dl.patch
+Patch11: gcc47-pr38757.patch
+Patch13: gcc47-no-add-needed.patch
+Patch14: gcc47-ppl-0.10.patch
+Patch15: gcc47-libitm-fno-exceptions.patch
+Patch16: gcc47-rh837630.patch
+Patch17: gcc47-arm-hfp-ldso.patch
+Patch18: gcc47-pr55137.patch
+Patch19: gcc47-pr55236.patch
 Source100: http://ghdl.free.fr/ghdl-%{ghdlver}.tar.bz2
 Patch100: ghdl-svn%{ghdlsvnver}.patch
 Patch103: ghdl-noruntime.patch
@@ -29,7 +62,9 @@ Patch105: ghdl-grtadac.patch
 Patch106: ghdl-ppc64abort.patch
 # https://gna.org/bugs/index.php?13389
 Patch107: ieee-mathreal.patch
-Patch108: ghdl-siginfo.patch
+Patch108: ghdl-libgomp.patch
+Patch109: ghdl-typeforsize.patch
+Patch110: ghdl-make.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires(post): /sbin/install-info
 Requires(preun): /sbin/install-info
@@ -64,7 +99,7 @@ BuildRequires: glibc >= 2.3.90-35
 # Ada requires Ada to build
 BuildRequires: gcc-gnat >= 4.3, libgnat >= 4.3
 # GCC build requirements
-BuildRequires: gmp-devel >= 4.1, mpfr-devel >= 2.3.0
+BuildRequires: gmp-devel >= 4.1.2-8, mpfr-devel >= 2.2.1, libmpc-devel >= 0.8.1
 # Need .eh_frame ld optimizations
 # Need proper visibility support
 # Need -pie support
@@ -80,6 +115,17 @@ Requires: glibc-devel >= 2.2.90-12
 # Make sure glibc supports TFmode long double
 Requires: glibc >= 2.3.90-35
 %endif
+%ifarch ia64
+BuildRequires: libunwind >= 0.98
+%endif
+%if %{build_cloog}
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+BuildRequires: ppl >= 0.11.2, ppl-devel >= 0.11.2
+%else
+BuildRequires: ppl >= 0.10, ppl-devel >= 0.10
+%endif
+BuildRequires: cloog-ppl >= 0.15, cloog-ppl-devel >= 0.15
+%endif
 
 Requires: ghdl-grt = %{version}-%{release}
 Provides: bundled(libiberty)
@@ -128,7 +174,37 @@ object files into simulator executables. grt contains the simulator kernel
 that tracks signal updates and schedules processes.
 
 %prep
+%if 0%{?gccdate}
+%setup -q -n gcc-%{gccver}-%{gccdate} -T -b 0 -a 100
+%else
 %setup -q -n gcc-%{gccver} -T -b 0 -a 100
+%endif
+%patch0 -p0 -b .hack~
+%patch1 -p0 -b .c++-builtin-redecl~
+%patch2 -p0 -b .java-nomulti~
+%patch3 -p0 -b .ppc32-retaddr~
+%patch5 -p0 -b .rh330771~
+%patch6 -p0 -b .i386-libgomp~
+%if 0%{?gccdate}
+%patch7 -p0 -b .sparc-config-detection~
+%endif
+%patch8 -p0 -b .libgomp-omp_h-multilib~
+%patch9 -p0 -b .libtool-no-rpath~
+%if %{build_cloog}
+%patch10 -p0 -b .cloog-dl~
+%endif
+%patch11 -p0 -b .pr38757~
+%patch13 -p0 -b .no-add-needed~
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
+%patch14 -p0 -b .ppl-0.10~
+%endif
+%patch15 -p0 -b .libitm-fno-exceptions~
+%patch16 -p0 -b .rh837630~
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+%patch17 -p0 -b .arm-hfp-ldso~
+%endif
+%patch18 -p0 -b .pr55137~
+%patch19 -p0 -b .pr55236~
 pushd ghdl-%{ghdlver}
 %patch100 -p1
 %patch103 -p0 -b .noruntime
@@ -139,7 +215,26 @@ popd
 %patch104 -p0 -b .libgnat44
 %patch105 -p1 -b .grtadac
 %patch106 -p0 -b .ppc64abort
-%patch108 -p1 -b .siginfo
+%patch108 -p0 -b .libgomp
+%patch109 -p0 -b .typeforsize
+%patch110 -p0 -b .ghdlmake
+
+%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7
+# Default to -gdwarf-4 -fno-debug-types-section rather than -gdwarf-2
+sed -i '/UInteger Var(dwarf_version)/s/Init(2)/Init(4)/' gcc/common.opt
+sed -i '/flag_debug_types_section/s/Init(1)/Init(0)/' gcc/common.opt
+sed -i '/dwarf_record_gcc_switches/s/Init(0)/Init(1)/' gcc/common.opt
+sed -i 's/\(may be either 2, 3 or 4; the default version is \)2\./\14./' gcc/doc/invoke.texi
+%else
+# Default to -gdwarf-3 rather than -gdwarf-2
+sed -i '/UInteger Var(dwarf_version)/s/Init(2)/Init(3)/' gcc/common.opt
+sed -i 's/\(may be either 2, 3 or 4; the default version is \)2\./\13./' gcc/doc/invoke.texi
+sed -i 's/#define[[:blank:]]*EMIT_ENTRY_VALUE[[:blank:]].*$/#define EMIT_ENTRY_VALUE 0/' gcc/{var-tracking,dwarf2out}.c
+sed -i 's/#define[[:blank:]]*EMIT_TYPED_DWARF_STACK[[:blank:]].*$/#define EMIT_TYPED_DWARF_STACK 0/' gcc/dwarf2out.c
+sed -i 's/#define[[:blank:]]*EMIT_DEBUG_MACRO[[:blank:]].*$/#define EMIT_DEBUG_MACRO 0/' gcc/dwarf2out.c
+%endif
+
+cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
 
 %build
 %{__rm} -fr obj-%{gcc_target_platform}
@@ -199,6 +294,13 @@ export TCFLAGS="$OPT_FLAGS"
         --disable-bootstrap \
         --disable-libunwind-exceptions \
         --disable-libgcj \
+	--disable-build-with-cxx \
+	--disable-build-poststage1-with-cxx \
+%if %{build_cloog}
+	--with-ppl --with-cloog \
+%else
+	--without-ppl --without-cloog \
+%endif
 %ifarch sparc
         --host=%{gcc_target_platform} \
         --build=%{gcc_target_platform} \
@@ -226,9 +328,11 @@ popd
 %{__rm} -rf %{buildroot}
 %{__make} -C obj-%{gcc_target_platform} DESTDIR=%{buildroot} install-host
 
+rm -f %{buildroot}/%{_bindir}/{,%{gcc_target_platform}-}gcc-{ar,nm,ranlib}
+
 %ifarch x86_64
 pushd obj-%{gcc_target_platform}/gcc/vhdl
-P32=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/vhdl/lib/32/
+P32=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/vhdl/lib/32/
 %{__install} -d ${P32}
 make ghdllibs-clean
 %if %{!?_without_mock:0}%{?_without_mock:1}
@@ -263,13 +367,13 @@ echo "-lm"
 %ifarch x86_64
 echo "-ldl"
 %endif
-) >> %{buildroot}%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/vhdl/lib/grt.lst
+) >> %{buildroot}%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/vhdl/lib/grt.lst
 
 # Remove files not to be packaged
 pushd %{buildroot}
 %{__rm} -f \
         .%{_bindir}/{cpp,gcc,gccbug,gcov} \
-        .%{_bindir}/%{gcc_target_platform}-gcc{,-%{gccver}} \
+        .%{_bindir}/%{gcc_target_platform}-gcc{,-%{gccinstver}} \
         .%{_includedir}/mf-runtime.h \
         .%{_libdir}/lib* \
         .%{_infodir}/dir \
@@ -283,19 +387,19 @@ pushd %{buildroot}
         .%{_libdir}/32/libiberty.a
 # Remove crt/libgcc, as ghdl invokes the native gcc to perform the linking
 %{__rm} -f \
-        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/crt* \
-        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/libgc* \
-        .%{_libexecdir}/gcc/%{gcc_target_platform}/%{gccver}/{cc1,collect2}
+        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/crt* \
+        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/libgc* \
+        .%{_libexecdir}/gcc/%{gcc_target_platform}/%{gccinstver}/{cc1,collect2}
 
 # Remove directory hierarchies not to be packaged
 %{__rm} -rf \
-        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/{include,install-tools} \
-        .%{_libexecdir}/gcc/%{gcc_target_platform}/%{gccver}/install-tools
+        .%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/{include,install-tools} \
+        .%{_libexecdir}/gcc/%{gcc_target_platform}/%{gccinstver}/install-tools
 
 popd
 
 # copy v08 libraries from v93 for now
-P64=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/vhdl/lib/
+P64=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccinstver}/vhdl/lib/
 %{__cp} -rv ${P64}v93 ${P64}v08
 %{__mv} ${P64}v08/std/std-obj93.cf ${P64}v08/std/std-obj08.cf
 %{__mv} ${P64}v08/ieee/ieee-obj93.cf ${P64}v08/ieee/ieee-obj08.cf
@@ -325,7 +429,7 @@ P64=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/vhdl/lib/
 %{_bindir}/ghdl
 %{_infodir}/ghdl.info.gz
 # Need to own directory %{_libexecdir}/gcc even though we only want the
-# %{gcc_target_platform}/%{gccver} subdirectory
+# %{gcc_target_platform}/%{gccinstver} subdirectory
 %{_libexecdir}/gcc/
 %{_mandir}/man1/*
 
@@ -333,7 +437,7 @@ P64=%{buildroot}/%{_libdir}/gcc/%{gcc_target_platform}/%{gccver}/vhdl/lib/
 %defattr(-,root,root,-)
 %doc ghdl-%{ghdlver}/COPYING
 # Need to own directory %{_libdir}/gcc even though we only want the
-# %{gcc_target_platform}/%{gccver} subdirectory
+# %{gcc_target_platform}/%{gccinstver} subdirectory
 %{_libdir}/gcc/
 
 
diff --git a/sources b/sources
index 344a24d..4861bec 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-575b3220bb8e7060939c429fc8608d22  gcc-core-4.3.4.tar.bz2
 fd3dc7a71ba521e442bef76f48177767  ghdl-0.29.tar.bz2
+2136a229e204d8a4425e21034e56c706  gcc-4.7.2-20121109.tar.bz2


More information about the scm-commits mailing list