Iain Buclaw avatar Iain Buclaw committed 1003c8d

More gcc-4.7 fixes, remove d-apple-gcc and d-c-stubs.

Comments (0)

Files changed (11)

 # Would be better to configure these rather than running shell script again and again,
 # but would require a patch to gcc/configure.ac
 D_gcc_main_ver:=$(shell echo $(version) | sed -e 's/\([0-9]*\.[0-9]*\).*/\1/')
-ifeq ($(D_gcc_main_ver),4.2)
-  D_is_apple_ver:=$(shell grep VERSUFFIX $(srcdir)/../gcc/version.c | grep 'Apple')
-endif
 
 gcc_d_target_include_dir=$(gcc_d_include_dir)/$(target_noncanonical)
 
 .PHONY: D d
 
 D_BORROWED_C_OBJS=attribs.o
-ifdef D_is_apple_ver
-  ifeq ($(D_gcc_main_ver),4.2)
-    D_BORROWED_C_OBJS += cppdefault.o
-  endif
-endif
 
 D_INCLUDES = -I$(srcdir)/d -I$(srcdir)/$(D_dmd_srcdir) -Id
 # -Wno-long-double is for MacOS X -- needs to be configurated
 D_EXTRA_LIBS =
 D_EXTRA_SPEC_LIBS =
 
-ifdef D_is_apple_ver
-  ifeq ($(D_gcc_main_ver),4.2)
-    D_GLUE_OBJS += d/d-apple-gcc.cglue.o
-    D_BORROWED_C_OBJS += stub-objc.o prefix.o
-  endif
-else
-  ifeq ($(D_gcc_main_ver),4.5)
-    D_GLUE_OBJS += d/d-c-stubs.cglue.o
-    D_BORROWED_C_OBJS += stub-objc.o prefix.o
-    D_EXTRA_LIBS += $(BACKENDLIBS)
-  endif
-  ifeq ($(D_gcc_main_ver),4.6)
-    D_GLUE_OBJS += d/d-c-stubs.cglue.o
-    D_BORROWED_C_OBJS += c-family/stub-objc.o prefix.o
-    D_EXTRA_LIBS += $(BACKENDLIBS)
-  endif
-  ifeq ($(D_gcc_main_ver),4.7)
-    D_GLUE_OBJS += d/d-c-stubs.cglue.o
-    D_BORROWED_C_OBJS += c-family/stub-objc.o prefix.o
-    D_EXTRA_LIBS += $(BACKENDLIBS)
-    D_EXTRA_SPEC_LIBS += libcommon-target.a
-  endif
+ifeq ($(D_gcc_main_ver),4.5)
+  D_BORROWED_C_OBJS += stub-objc.o prefix.o
+  D_EXTRA_LIBS += $(BACKENDLIBS)
+endif
+ifeq ($(D_gcc_main_ver),4.6)
+  D_BORROWED_C_OBJS += c-family/stub-objc.o prefix.o
+  D_EXTRA_LIBS += $(BACKENDLIBS)
+endif
+ifeq ($(D_gcc_main_ver),4.7)
+  D_BORROWED_C_OBJS += c-family/stub-objc.o prefix.o
+  D_EXTRA_LIBS += $(BACKENDLIBS)
+  D_EXTRA_SPEC_LIBS += libcommon-target.a
 endif
 
 # ALL_D_COMPILER_FLAGS causes issues -- c++ <complex.h> instead of C <complex.h>
 d/d-gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
     Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H)
 	(SHLIB_LINK='$(SHLIB_LINK)' \
-	SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
+	 SHLIB='$(SHLIB)'; \
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
   $(DRIVER_DEFINES) -DD_DRIVER_ONLY=1 \
   -c $(srcdir)/gcc.c $(OUTPUT_OPTION))
 
 d/d-spec.o: $(srcdir)/d/d-spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) $(CONFIG_H)
 	(SHLIB_LINK='$(SHLIB_LINK)' \
-	SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
+	 SHLIB='$(SHLIB)'; \
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
 		$(ALL_D_CFLAGS) $(D_LIBPHOBOS) \
 		$(INCLUDES) -o $@ $(srcdir)/d/d-spec.c)

d/d-apple-gcc.c

-/* GDC -- D front-end for GCC
-   Copyright (C) 2004 David Friedman
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "flags.h"
-#include "convert.h"
-
-/* Various functions not needed by GDC but referenced from the
-   C front end. These definitions satisfy the link requirements,
-   but should never be executed. */
-

d/d-c-stubs.c

-/* GDC -- D front-end for GCC
-   Copyright (C) 2004 David Friedman
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tree.h"
-#include "flags.h"
-#include "convert.h"
-
-/* Various functions not needed by GDC but referenced from the
-   C front end. These definitions satisfy the link requirements,
-   but should never be executed. */
-
 elem *
 HaltExp::toElem(IRState* irs)
 {
-    // Needs improvement.  Avoid library calls if possible..
-    tree t_abort = d_built_in_decls(BUILT_IN_ABORT);
-    return irs->buildCall(t_abort, 0);
+    tree t_unreachable = d_built_in_decls(BUILT_IN_UNREACHABLE);
+    return irs->buildCall(t_unreachable, 0);
 }
 
 #if V2
                          &new_decoded_options[j]);
         j++;
     }
-    else
-    {
-        generate_option (OPT_l, "gcc_eh", 1, CL_DRIVER,
-                         &new_decoded_options[j]);
-        added_libraries++;
-        j++;
-    }
 
     *in_decoded_options_count = j;
     *in_decoded_options = new_decoded_options;

d/patches/patch-apple-gcc-5465

-diff -cr gcc.orig/cgraph.c gcc/cgraph.c
-*** gcc.orig/cgraph.c	2005-04-09 07:13:35.000000000 +0100
---- gcc/cgraph.c	2010-10-27 17:11:22.312795001 +0100
-***************
-*** 172,177 ****
---- 172,178 ----
-  cgraph_node (tree decl)
-  {
-    struct cgraph_node key, *node, **slot;
-+   tree context;
-  
-    gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
-  
-***************
-*** 188,198 ****
-    node = cgraph_create_node ();
-    node->decl = decl;
-    *slot = node;
-!   if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
-      {
-!       node->origin = cgraph_node (DECL_CONTEXT (decl));
-!       node->next_nested = node->origin->nested;
-!       node->origin->nested = node;
-      }
-    return node;
-  }
---- 189,203 ----
-    node = cgraph_create_node ();
-    node->decl = decl;
-    *slot = node;
-!   if (!DECL_NO_STATIC_CHAIN (decl))
-      {
-!       context = decl_function_context (decl);
-!       if (context)
-!         {
-!           node->origin = cgraph_node (context);
-!           node->next_nested = node->origin->nested;
-!           node->origin->nested = node;
-!         }
-      }
-    return node;
-  }
-diff -cr gcc.orig/config/i386/i386.c gcc/config/i386/i386.c
-*** gcc.orig/config/i386/i386.c	2007-05-17 00:52:55.000000000 +0100
---- gcc/config/i386/i386.c	2010-10-27 17:11:22.336795001 +0100
-***************
-*** 5202,5207 ****
---- 5202,5212 ----
-      frame->red_zone_size = 0;
-    frame->to_allocate -= frame->red_zone_size;
-    frame->stack_pointer_offset -= frame->red_zone_size;
-+ 
-+   if (cfun->naked)
-+       /* As above, skip return address */
-+       frame->stack_pointer_offset = UNITS_PER_WORD;
-+ 
-  #if 0
-    fprintf (stderr, "nregs: %i\n", frame->nregs);
-    fprintf (stderr, "size: %i\n", size);
-***************
-*** 18329,18335 ****
-  	  output_set_got (tmp, NULL_RTX);
-  
-  	  xops[1] = tmp;
-! 	  output_asm_insn ("mov{l}\t{%0@GOT(%1), %1|%1, %0@GOT[%1]}", xops);
-  	  output_asm_insn ("jmp\t{*}%1", xops);
-  	}
-      }
---- 18334,18340 ----
-  	  output_set_got (tmp, NULL_RTX);
-  
-  	  xops[1] = tmp;
-! 	  output_asm_insn ("mov{l}\t{%a0@GOT(%1), %1|%1, %a0@GOT[%1]}", xops);
-  	  output_asm_insn ("jmp\t{*}%1", xops);
-  	}
-      }
-diff -cr gcc.orig/config/rs6000/rs6000.c gcc/config/rs6000/rs6000.c
-*** gcc.orig/config/rs6000/rs6000.c	2007-07-05 23:26:15.000000000 +0100
---- gcc/config/rs6000/rs6000.c	2010-10-27 17:11:22.392795001 +0100
-***************
-*** 17596,17602 ****
-  	 use language_string.
-  	 C is 0.  Fortran is 1.  Pascal is 2.  Ada is 3.  C++ is 9.
-  	 Java is 13.  Objective-C is 14.  */
-!       if (! strcmp (language_string, "GNU C"))
-  	i = 0;
-        else if (! strcmp (language_string, "GNU F77")
-  	       || ! strcmp (language_string, "GNU F95"))
---- 17596,17603 ----
-  	 use language_string.
-  	 C is 0.  Fortran is 1.  Pascal is 2.  Ada is 3.  C++ is 9.
-  	 Java is 13.  Objective-C is 14.  */
-!       if (! strcmp (language_string, "GNU C") ||
-!  	  ! strcmp (language_string, "GNU D"))
-  	i = 0;
-        else if (! strcmp (language_string, "GNU F77")
-  	       || ! strcmp (language_string, "GNU F95"))
-diff -cr gcc.orig/convert.c gcc/convert.c
-*** gcc.orig/convert.c	2006-11-02 17:43:32.000000000 +0000
---- gcc/convert.c	2010-10-27 17:11:22.404795001 +0100
-***************
-*** 30,39 ****
---- 30,41 ----
-  #include "tree.h"
-  #include "flags.h"
-  #include "convert.h"
-+ #if 0
-  /* APPLE LOCAL begin AltiVec */
-  #include "c-tree.h"
-  #include "c-common.h"
-  /* APPLE LOCAL end AltiVec */
-+ #endif
-  #include "toplev.h"
-  #include "langhooks.h"
-  #include "real.h"
-***************
-*** 703,708 ****
---- 705,711 ----
-      }
-  }
-  
-+ #if 0
-  /* APPLE LOCAL begin AltiVec */
-  /* Build a COMPOUND_LITERAL_EXPR.  TYPE is the type given in the compound
-     literal.  INIT is a CONSTRUCTOR that initializes the compound literal.  */
-***************
-*** 727,732 ****
---- 730,736 ----
-    return complit;
-  }
-  /* APPLE LOCAL end AltiVec */
-+ #endif
-  
-  /* Convert EXPR to the vector type TYPE in the usual ways.  */
-  
-***************
-*** 742,747 ****
---- 746,752 ----
-  	  error ("can't convert between vector values of different size");
-  	  return error_mark_node;
-  	}
-+ #if 0
-        /* APPLE LOCAL begin AltiVec */
-        if (TREE_CODE (type) == VECTOR_TYPE  
-  	  && TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE
-***************
-*** 749,754 ****
---- 754,760 ----
-  	  /* converting a constant vector to new vector type with Motorola Syntax. */
-  	  return convert (type, build_compound_literal_vector (TREE_TYPE (expr), expr));
-        /* APPLE LOCAL end AltiVec */
-+ #endif
-  
-        /* APPLE LOCAL mainline 4253848 */
-        return build1 (VIEW_CONVERT_EXPR, type, expr);
-diff -cr gcc.orig/dwarf2out.c gcc/dwarf2out.c
-*** gcc.orig/dwarf2out.c	2007-03-27 07:05:04.000000000 +0100
---- gcc/dwarf2out.c	2010-10-27 17:11:22.420795001 +0100
-***************
-*** 5481,5487 ****
-  /* APPLE LOCAL begin mainline 2006-03-24 4485597 */
-    return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC
-  	  || lang == DW_LANG_C99
-! 	  || lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus);
-  /* APPLE LOCAL end mainline 2006-03-24 4485597 */
-  }
-  
---- 5481,5488 ----
-  /* APPLE LOCAL begin mainline 2006-03-24 4485597 */
-    return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC
-  	  || lang == DW_LANG_C99
-! 	  || lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus
-! 	  || lang == DW_LANG_D);
-  /* APPLE LOCAL end mainline 2006-03-24 4485597 */
-  }
-  
-***************
-*** 12531,12536 ****
---- 12532,12539 ----
-    else if (strcmp (language_string, "GNU Objective-C++") == 0)
-      language = DW_LANG_ObjC_plus_plus;
-  /* APPLE LOCAL end mainline 2006-03-24 4485597 */
-+   else if (strcmp (language_string, "GNU D") == 0)
-+     language = DW_LANG_D;
-    else
-      language = DW_LANG_C89;
-  
-diff -cr gcc.orig/expr.c gcc/expr.c
-*** gcc.orig/expr.c	2007-07-03 20:11:00.000000000 +0100
---- gcc/expr.c	2010-10-27 17:11:22.440795001 +0100
-***************
-*** 8338,8343 ****
---- 8338,8348 ----
-        /* Lowered by gimplify.c.  */
-        gcc_unreachable ();
-  
-+     case STATIC_CHAIN_EXPR:
-+     case STATIC_CHAIN_DECL:
-+       /* Lowered by tree-nested.c */
-+       gcc_unreachable ();
-+ 
-      case EXC_PTR_EXPR:
-        return get_exception_pointer (cfun);
-  
-diff -cr gcc.orig/function.c gcc/function.c
-*** gcc.orig/function.c	2007-06-19 17:30:52.000000000 +0100
---- gcc/function.c	2010-10-27 17:11:22.448795001 +0100
-***************
-*** 3149,3155 ****
-            FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
-  			        data.passed_type, data.named_arg);
-  
-!           assign_parm_adjust_stack_rtl (&data);
-  
-            if (assign_parm_setup_block_p (&data))
-  	    assign_parm_setup_block (&all, parm, &data);
---- 3149,3156 ----
-            FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
-  			        data.passed_type, data.named_arg);
-  
-! 	  if (!cfun->naked)
-! 	    assign_parm_adjust_stack_rtl (&data);
-  
-            if (assign_parm_setup_block_p (&data))
-  	    assign_parm_setup_block (&all, parm, &data);
-***************
-*** 3166,3172 ****
-  
-    /* Output all parameter conversion instructions (possibly including calls)
-       now that all parameters have been copied out of hard registers.  */
-!   emit_insn (all.conversion_insns);
-  
-    /* If we are receiving a struct value address as the first argument, set up
-       the RTL for the function result. As this might require code to convert
---- 3167,3174 ----
-  
-    /* Output all parameter conversion instructions (possibly including calls)
-       now that all parameters have been copied out of hard registers.  */
-!   if (!cfun->naked)
-!     emit_insn (all.conversion_insns);
-  
-    /* If we are receiving a struct value address as the first argument, set up
-       the RTL for the function result. As this might require code to convert
-***************
-*** 3306,3311 ****
---- 3308,3316 ----
-    struct assign_parm_data_all all;
-    tree fnargs, parm, stmts = NULL;
-  
-+   if (cfun->naked)
-+     return NULL;
-+ 
-    assign_parms_initialize_all (&all);
-    fnargs = assign_parms_augmented_arg_list (&all);
-  
-***************
-*** 4331,4341 ****
-        tree parm = cfun->static_chain_decl;
-        rtx local = gen_reg_rtx (Pmode);
-  
--       set_decl_incoming_rtl (parm, static_chain_incoming_rtx);
-        SET_DECL_RTL (parm, local);
-        mark_reg_pointer (local, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm))));
-  
-!       emit_move_insn (local, static_chain_incoming_rtx);
-      }
-  
-    /* If the function receives a non-local goto, then store the
---- 4336,4350 ----
-        tree parm = cfun->static_chain_decl;
-        rtx local = gen_reg_rtx (Pmode);
-  
-        SET_DECL_RTL (parm, local);
-        mark_reg_pointer (local, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm))));
-  
-!       if (! cfun->custom_static_chain)
-!         {
-! 	    set_decl_incoming_rtl (parm, static_chain_incoming_rtx);
-! 	    emit_move_insn (local, static_chain_incoming_rtx);
-! 	}
-!       /* else, the static chain will be set in the main body */
-      }
-  
-    /* If the function receives a non-local goto, then store the
-***************
-*** 5250,5255 ****
---- 5259,5267 ----
-  #endif
-    edge_iterator ei;
-  
-+   if (cfun->naked)
-+       return;
-+ 
-  #ifdef HAVE_prologue
-    if (HAVE_prologue)
-      {
-diff -cr gcc.orig/function.h gcc/function.h
-*** gcc.orig/function.h	2007-06-27 22:23:44.000000000 +0100
---- gcc/function.h	2010-10-27 17:11:22.456795001 +0100
-***************
-*** 464,469 ****
---- 464,477 ----
-    unsigned int calls_builtin_ret_addr : 1;
-    unsigned int calls_builtin_frame_addr : 1;
-    /* APPLE LOCAL end ARM reliable backtraces */
-+ 
-+   /* Nonzero if static chain is initialized by something other than
-+      static_chain_incoming_rtx. */
-+   unsigned int custom_static_chain : 1;
-+ 
-+   /* Nonzero if no code should be generated for prologues, copying
-+      parameters, etc. */
-+   unsigned int naked : 1;
-  };
-  
-  /* The function currently being compiled.  */
-diff -cr gcc.orig/gcc.c gcc/gcc.c
-*** gcc.orig/gcc.c	2007-06-28 18:01:41.000000000 +0100
---- gcc/gcc.c	2010-10-27 17:11:22.468795001 +0100
-***************
-*** 134,139 ****
---- 134,142 ----
-  /* Flag set by cppspec.c to 1.  */
-  int is_cpp_driver;
-  
-+ /* Flag set by drivers needing Pthreads. */
-+ int need_pthreads;
-+ 
-  /* Flag saying to pass the greatest exit code returned by a sub-process
-     to the calling program.  */
-  static int pass_exit_codes;
-***************
-*** 3975,3980 ****
---- 3981,3989 ----
-  	}
-      }
-  
-+   if (need_pthreads)
-+       n_switches++;
-+ 
-    if ((save_temps_flag || report_times) && use_pipes)
-      {
-        /* -save-temps overrides -pipe, so that temp files are produced */
-***************
-*** 4359,4364 ****
---- 4368,4385 ----
-  	}
-      }
-  
-+   if (need_pthreads)
-+     {
-+ 	switches[n_switches].part1 = "pthread";
-+ 	switches[n_switches].args = 0;
-+ 	switches[n_switches].live_cond = SWITCH_OK;
-+ 	/* Do not print an error if there is not expansion for -pthread. */
-+ 	switches[n_switches].validated = 1;
-+ 	switches[n_switches].ordering = 0;
-+ 
-+ 	n_switches++;
-+     }
-+ 
-    switches[n_switches].part1 = 0;
-    infiles[n_infiles].name = 0;
-  }
-diff -cr gcc.orig/gcc.h gcc/gcc.h
-*** gcc.orig/gcc.h	2005-03-04 20:17:11.000000000 +0000
---- gcc/gcc.h	2010-10-27 17:11:22.472795001 +0100
-***************
-*** 40,46 ****
-     || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
-     /* APPLE LOCAL frameworks */ \
-     || (CHAR) == 'F' \
-!    || (CHAR) == 'B' || (CHAR) == 'b')
-  
-  /* This defines which multi-letter switches take arguments.  */
-  
---- 40,46 ----
-     || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
-     /* APPLE LOCAL frameworks */ \
-     || (CHAR) == 'F' \
-!    || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'J')
-  
-  /* This defines which multi-letter switches take arguments.  */
-  
-diff -cr gcc.orig/tree.def gcc/tree.def
-*** gcc.orig/tree.def	2005-10-03 21:31:24.000000000 +0100
---- gcc/tree.def	2010-10-27 17:11:22.512795001 +0100
-***************
-*** 528,533 ****
---- 528,540 ----
-     Operand 2 is the static chain argument, or NULL.  */
-  DEFTREECODE (CALL_EXPR, "call_expr", tcc_expression, 3)
-  
-+ /* Operand 0 is the FUNC_DECL of the outer function for
-+    which the static chain is to be computed. */
-+ DEFTREECODE (STATIC_CHAIN_EXPR, "static_chain_expr", tcc_expression, 1)
-+     
-+ /* Represents a function's static chain.  It can be used as an lvalue. */
-+ DEFTREECODE (STATIC_CHAIN_DECL, "static_chain_decl", tcc_expression, 0)
-+ 
-  /* Specify a value to compute along with its corresponding cleanup.
-     Operand 0 is the cleanup expression.
-     The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR,
-***************
-*** 901,907 ****
-  
-  /* APPLE LOCAL begin AV vmul_uch --haifa  */
-  /* Used during vectorization to represent computation idioms.  */
-! DEFTREECODE (MULT_UCH_EXPR, "mult_uch", '2', 2)
-  /* APPLE LOCAL end AV vmul_uch --haifa  */
-  
-  /* Value handles.  Artificial nodes to represent expressions in
---- 908,914 ----
-  
-  /* APPLE LOCAL begin AV vmul_uch --haifa  */
-  /* Used during vectorization to represent computation idioms.  */
-! DEFTREECODE (MULT_UCH_EXPR, "mult_uch", tcc_binary, 2)
-  /* APPLE LOCAL end AV vmul_uch --haifa  */
-  
-  /* Value handles.  Artificial nodes to represent expressions in
-diff -cr gcc.orig/tree-gimple.c gcc/tree-gimple.c
-*** gcc.orig/tree-gimple.c	2005-07-09 23:14:08.000000000 +0100
---- gcc/tree-gimple.c	2010-10-27 17:11:22.492795001 +0100
-***************
-*** 73,78 ****
---- 73,80 ----
-      case COMPLEX_CST:
-      case VECTOR_CST:
-      case OBJ_TYPE_REF:
-+     case STATIC_CHAIN_EXPR: /* not sure if this is right...*/
-+     case STATIC_CHAIN_DECL:
-        return true;
-  
-      default:
-***************
-*** 144,150 ****
-  	  || TREE_CODE (t) == WITH_SIZE_EXPR
-  	  /* These are complex lvalues, but don't have addresses, so they
-  	     go here.  */
-! 	  || TREE_CODE (t) == BIT_FIELD_REF);
-  }
-  
-  /*  Return true if T is a GIMPLE condition.  */
---- 146,155 ----
-  	  || TREE_CODE (t) == WITH_SIZE_EXPR
-  	  /* These are complex lvalues, but don't have addresses, so they
-  	     go here.  */
-! 	  || TREE_CODE (t) == BIT_FIELD_REF
-!           /* This is an lvalue because it will be replaced with the real
-! 	     static chain decl. */
-! 	  || TREE_CODE (t) == STATIC_CHAIN_DECL);
-  }
-  
-  /*  Return true if T is a GIMPLE condition.  */
-diff -cr gcc.orig/tree-inline.c gcc/tree-inline.c
-*** gcc.orig/tree-inline.c	2007-06-29 00:17:08.000000000 +0100
---- gcc/tree-inline.c	2010-10-27 17:11:22.496795001 +0100
-***************
-*** 559,565 ****
-      {
-        tree old_node = *tp;
-  
-!       if (TREE_CODE (*tp) == MODIFY_EXPR
-  	  && TREE_OPERAND (*tp, 0) == TREE_OPERAND (*tp, 1)
-  	  && (lang_hooks.tree_inlining.auto_var_in_fn_p
-  	      (TREE_OPERAND (*tp, 0), fn)))
---- 559,576 ----
-      {
-        tree old_node = *tp;
-  
-!       if (! id->cloning_p && ! id->saving_p &&
-! 	  TREE_CODE (*tp) == MODIFY_EXPR &&
-! 	  TREE_OPERAND (*tp, 0) ==
-! 	  DECL_STRUCT_FUNCTION (fn)->static_chain_decl)
-! 	{
-! 	  /* Don't use special methods to initialize the static chain
-! 	     if expanding inline.  If this code could somehow be
-! 	     expanded in expand_start_function, it would not be
-! 	     necessary to deal with it here. */
-! 	  *tp = build_empty_stmt ();
-! 	}
-!       else if (TREE_CODE (*tp) == MODIFY_EXPR
-  	  && TREE_OPERAND (*tp, 0) == TREE_OPERAND (*tp, 1)
-  	  && (lang_hooks.tree_inlining.auto_var_in_fn_p
-  	      (TREE_OPERAND (*tp, 0), fn)))
-diff -cr gcc.orig/tree-nested.c gcc/tree-nested.c
-*** gcc.orig/tree-nested.c	2005-08-08 20:02:59.000000000 +0100
---- gcc/tree-nested.c	2010-10-27 17:11:22.500795001 +0100
-***************
-*** 298,303 ****
---- 298,304 ----
-    if (!decl)
-      {
-        tree type;
-+       enum tree_code code;
-  
-        type = get_frame_type (info->outer);
-        type = build_pointer_type (type);
-***************
-*** 308,319 ****
-  	 Note also that it's represented as a parameter.  This is more
-  	 close to the truth, since the initial value does come from 
-  	 the caller.  */
-!       decl = build_decl (PARM_DECL, create_tmp_var_name ("CHAIN"), type);
-        DECL_ARTIFICIAL (decl) = 1;
-        DECL_IGNORED_P (decl) = 1;
-        TREE_USED (decl) = 1;
-        DECL_CONTEXT (decl) = info->context;
-!       DECL_ARG_TYPE (decl) = type;
-  
-        /* Tell tree-inline.c that we never write to this variable, so
-  	 it can copy-prop the replacement value immediately.  */
---- 309,325 ----
-  	 Note also that it's represented as a parameter.  This is more
-  	 close to the truth, since the initial value does come from 
-  	 the caller.  */
-!       /* If the function has a custom static chain, a VAR_DECL is more
-! 	 appropriate. */
-!       code = DECL_STRUCT_FUNCTION (info->context)->custom_static_chain ?
-! 	  VAR_DECL : PARM_DECL;
-!       decl = build_decl (code, create_tmp_var_name ("CHAIN"), type);
-        DECL_ARTIFICIAL (decl) = 1;
-        DECL_IGNORED_P (decl) = 1;
-        TREE_USED (decl) = 1;
-        DECL_CONTEXT (decl) = info->context;
-!       if (TREE_CODE (decl) == PARM_DECL)
-! 	  DECL_ARG_TYPE (decl) = type;
-  
-        /* Tell tree-inline.c that we never write to this variable, so
-  	 it can copy-prop the replacement value immediately.  */
-***************
-*** 717,722 ****
---- 723,730 ----
-  
-    if (info->context == target_context)
-      {
-+       /* might be doing something wrong to need the following line.. */
-+       get_frame_type (info);
-        x = build_addr (info->frame_decl);
-      }
-    else
-***************
-*** 1195,1200 ****
---- 1203,1212 ----
-        if (DECL_NO_STATIC_CHAIN (decl))
-  	break;
-  
-+       /* Don't use a trampoline for a static reference. */
-+       if (TREE_STATIC (t))
-+ 	break;
-+ 
-        /* Lookup the immediate parent of the callee, as that's where
-  	 we need to insert the trampoline.  */
-        for (i = info; i->context != target_context; i = i->outer)
-***************
-*** 1259,1264 ****
---- 1271,1284 ----
-  	  = get_static_chain (info, target_context, &wi->tsi);
-        break;
-  
-+     case STATIC_CHAIN_EXPR:
-+       *tp = get_static_chain (info, TREE_OPERAND (t, 0), &wi->tsi);
-+       break;
-+ 
-+     case STATIC_CHAIN_DECL:
-+       *tp = get_chain_decl (info);
-+       break;
-+  
-      case RETURN_EXPR:
-      case MODIFY_EXPR:
-      case WITH_SIZE_EXPR:
-***************
-*** 1360,1366 ****
-        tree x = build (COMPONENT_REF, TREE_TYPE (root->chain_field),
-  		      root->frame_decl, root->chain_field, NULL_TREE);
-        x = build (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
-!       append_to_statement_list (x, &stmt_list);
-      }
-  
-    /* If trampolines were created, then we need to initialize them.  */
---- 1380,1407 ----
-        tree x = build (COMPONENT_REF, TREE_TYPE (root->chain_field),
-  		      root->frame_decl, root->chain_field, NULL_TREE);
-        x = build (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
-!       /* If the function has a custom static chain, chain_field must
-! 	 be set after the static chain. */
-!       if (DECL_STRUCT_FUNCTION (root->context)->custom_static_chain)
-! 	{
-! 	  /* Should use walk_function instead. */
-! 	  tree_stmt_iterator i =
-! 	      tsi_start ( BIND_EXPR_BODY (DECL_SAVED_TREE (context)));
-! 	  while (!tsi_end_p (i))
-! 	    {
-! 	      tree t = tsi_stmt (i);
-! 	      if (TREE_CODE (t) == MODIFY_EXPR &&
-! 		  TREE_OPERAND (t, 0) == root->chain_decl)
-! 		{
-! 		  tsi_link_after(& i, x, TSI_SAME_STMT);
-! 		  x = NULL_TREE;
-! 		  break;
-! 		}
-! 	    }
-! 	  gcc_assert(x == NULL_TREE);
-! 	}
-!       else
-! 	append_to_statement_list (x, &stmt_list);
-      }
-  
-    /* If trampolines were created, then we need to initialize them.  */
-diff -cr gcc.orig/tree-pretty-print.c gcc/tree-pretty-print.c
-*** gcc.orig/tree-pretty-print.c	2004-12-09 10:54:50.000000000 +0000
---- gcc/tree-pretty-print.c	2010-10-27 17:11:22.504795001 +0100
-***************
-*** 953,958 ****
---- 953,968 ----
-  	pp_string (buffer, " [tail call]");
-        break;
-  
-+     case STATIC_CHAIN_EXPR:
-+ 	pp_string (buffer, "<<static chain of ");
-+ 	dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
-+ 	pp_string (buffer, ">>");
-+       break;
-+ 
-+     case STATIC_CHAIN_DECL:
-+        pp_string (buffer, "<<static chain decl>>");
-+        break;
-+ 	
-      case WITH_CLEANUP_EXPR:
-        NIY;
-        break;
-diff -cr gcc.orig/tree-sra.c gcc/tree-sra.c
-*** gcc.orig/tree-sra.c	2007-05-19 05:56:18.000000000 +0100
---- gcc/tree-sra.c	2010-10-27 17:11:22.512795001 +0100
-***************
-*** 206,211 ****
---- 206,213 ----
-      case RECORD_TYPE:
-        {
-  	bool saw_one_field = false;
-+ 	tree last_offset = size_zero_node;
-+ 	tree cmp;
-  
-  	for (t = TYPE_FIELDS (type); t ; t = TREE_CHAIN (t))
-  	  if (TREE_CODE (t) == FIELD_DECL)
-***************
-*** 215,220 ****
---- 217,227 ----
-  		  && (tree_low_cst (DECL_SIZE (t), 1)
-  		      != TYPE_PRECISION (TREE_TYPE (t))))
-  		goto fail;
-+ 	      /* Reject aliased fields created by GDC for anonymous unions. */
-+ 	      cmp = fold_binary_to_constant (LE_EXPR, boolean_type_node,
-+ 		DECL_FIELD_OFFSET (t), last_offset);
-+ 	      if (cmp == NULL_TREE || TREE_CODE (cmp) != INTEGER_CST || TREE_INT_CST_LOW (cmp))
-+ 		goto fail;
-  
-  	      saw_one_field = true;
-  	    }

d/patches/patch-apple-gcc-5664

-diff -cr gcc.orig/cgraph.c gcc/cgraph.c
-*** gcc.orig/cgraph.c	2008-08-13 22:38:39.000000000 +0100
---- gcc/cgraph.c	2010-10-27 18:25:21.540795001 +0100
-***************
-*** 201,206 ****
---- 201,207 ----
-  cgraph_node (tree decl)
-  {
-    struct cgraph_node key, *node, **slot;
-+   tree context;
-  
-    gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
-  
-***************
-*** 222,233 ****
-    node = cgraph_create_node ();
-    node->decl = decl;
-    *slot = node;
-!   if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
-      {
-!       node->origin = cgraph_node (DECL_CONTEXT (decl));
-!       node->next_nested = node->origin->nested;
-!       node->origin->nested = node;
-!       node->master_clone = node;
-      }
-    return node;
-  }
---- 223,238 ----
-    node = cgraph_create_node ();
-    node->decl = decl;
-    *slot = node;
-!   if (!DECL_NO_STATIC_CHAIN (decl))
-      {
-!       context = decl_function_context (decl);
-!       if (context)
-! 	{
-! 	  node->origin = cgraph_node (context);
-! 	  node->next_nested = node->origin->nested;
-! 	  node->origin->nested = node;
-! 	  node->master_clone = node;
-! 	}
-      }
-    return node;
-  }
-diff -cr gcc.orig/config/i386/i386.c gcc/config/i386/i386.c
-*** gcc.orig/config/i386/i386.c	2010-03-18 20:58:49.000000000 +0000
---- gcc/config/i386/i386.c	2010-10-27 18:29:33.728795000 +0100
-***************
-*** 5707,5712 ****
---- 5707,5715 ----
-      frame->red_zone_size = 0;
-    frame->to_allocate -= frame->red_zone_size;
-    frame->stack_pointer_offset -= frame->red_zone_size;
-+   if (cfun->naked)
-+     /* As above, skip return address */
-+     frame->stack_pointer_offset = UNITS_PER_WORD;
-  #if 0
-    fprintf (stderr, "nregs: %i\n", frame->nregs);
-    fprintf (stderr, "size: %i\n", size);
-***************
-*** 20551,20557 ****
-  	  output_set_got (tmp, NULL_RTX);
-  
-  	  xops[1] = tmp;
-! 	  output_asm_insn ("mov{l}\t{%0@GOT(%1), %1|%1, %0@GOT[%1]}", xops);
-  	  output_asm_insn ("jmp\t{*}%1", xops);
-  	}
-      }
---- 20554,20560 ----
-  	  output_set_got (tmp, NULL_RTX);
-  
-  	  xops[1] = tmp;
-! 	  output_asm_insn ("mov{l}\t{%a0@GOT(%1), %1|%1, %0@GOT[%1]}", xops);
-  	  output_asm_insn ("jmp\t{*}%1", xops);
-  	}
-      }
-diff -cr gcc.orig/config/rs6000/rs6000.c gcc/config/rs6000/rs6000.c
-*** gcc.orig/config/rs6000/rs6000.c	2009-07-31 19:05:38.000000000 +0100
---- gcc/config/rs6000/rs6000.c	2010-10-27 18:30:14.400795000 +0100
-***************
-*** 17932,17937 ****
---- 17932,17938 ----
-  	 Java is 13.  Objective-C is 14.  Objective-C++ isn't assigned
-  	 a number, so for now use 9.  */
-        if (! strcmp (language_string, "GNU C"))
-+ 	  || ! strcmp (language_string, "GNU D"))
-  	i = 0;
-        else if (! strcmp (language_string, "GNU F77")
-  	       || ! strcmp (language_string, "GNU F95"))
-diff -cr gcc.orig/convert.c gcc/convert.c
-*** gcc.orig/convert.c	2008-07-15 23:56:59.000000000 +0100
---- gcc/convert.c	2010-10-27 18:31:59.272795002 +0100
-***************
-*** 30,39 ****
---- 30,43 ----
-  #include "tree.h"
-  #include "flags.h"
-  #include "convert.h"
-+ #if 0
-  /* APPLE LOCAL begin AltiVec */
-  #include "c-tree.h"
-  #include "c-common.h"
-  /* APPLE LOCAL end AltiVec */
-+ #else
-+ #include "c-common.h"
-+ #endif
-  #include "toplev.h"
-  #include "langhooks.h"
-  #include "real.h"
-***************
-*** 854,859 ****
---- 856,862 ----
-      }
-  }
-  
-+ #if 0
-  /* APPLE LOCAL begin AltiVec */
-  /* Build a COMPOUND_LITERAL_EXPR.  TYPE is the type given in the compound
-     literal.  INIT is a CONSTRUCTOR that initializes the compound literal.  */
-***************
-*** 878,883 ****
---- 881,887 ----
-    return complit;
-  }
-  /* APPLE LOCAL end AltiVec */
-+ #endif
-  
-  /* Convert EXPR to the vector type TYPE in the usual ways.  */
-  
-***************
-*** 893,898 ****
---- 897,903 ----
-  	  error ("can't convert between vector values of different size");
-  	  return error_mark_node;
-  	}
-+ #if 0
-        /* APPLE LOCAL begin AltiVec */
-        if (TREE_CODE (type) == VECTOR_TYPE  
-  	  && TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE
-***************
-*** 900,905 ****
---- 905,911 ----
-  	  /* converting a constant vector to new vector type with Motorola Syntax. */
-  	  return convert (type, build_compound_literal_vector (TREE_TYPE (expr), expr));
-        /* APPLE LOCAL end AltiVec */
-+ #endif
-  
-        return build1 (VIEW_CONVERT_EXPR, type, expr);
-  
-diff -cr gcc.orig/dwarf2out.c gcc/dwarf2out.c
-*** gcc.orig/dwarf2out.c	2010-01-27 16:18:52.000000000 +0000
---- gcc/dwarf2out.c	2010-10-27 18:52:37.048795002 +0100
-***************
-*** 5582,5588 ****
-  
-    return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC
-  	  || lang == DW_LANG_C99
-! 	  || lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus);
-  }
-  
-  /* Return TRUE if the language is C++.  */
---- 5582,5589 ----
-  
-    return (lang == DW_LANG_C || lang == DW_LANG_C89 || lang == DW_LANG_ObjC
-  	  || lang == DW_LANG_C99
-! 	  || lang == DW_LANG_C_plus_plus || lang == DW_LANG_ObjC_plus_plus
-! 	  || lang == DW_LANG_D);
-  }
-  
-  /* Return TRUE if the language is C++.  */
-***************
-*** 13584,13589 ****
---- 13585,13592 ----
-      language = DW_LANG_ObjC;
-    else if (strcmp (language_string, "GNU Objective-C++") == 0)
-      language = DW_LANG_ObjC_plus_plus;
-+   else if (strcmp (language_string, "GNU D") == 0)
-+     language = DW_LANG_D;
-    else
-      language = DW_LANG_C89;
-  
-***************
-*** 14726,14732 ****
-  
-        /* For local statics lookup proper context die.  */
-        if (TREE_STATIC (decl) && decl_function_context (decl))
-! 	context_die = lookup_decl_die (DECL_CONTEXT (decl));
-  
-        /* If we are in terse mode, don't generate any DIEs to represent any
-  	 variable declarations or definitions.  */
---- 14729,14735 ----
-  
-        /* For local statics lookup proper context die.  */
-        if (TREE_STATIC (decl) && decl_function_context (decl))
-! 	context_die = lookup_decl_die (decl_function_context (decl));
-  
-        /* If we are in terse mode, don't generate any DIEs to represent any
-  	 variable declarations or definitions.  */
-diff -cr gcc.orig/expr.c gcc/expr.c
-*** gcc.orig/expr.c	2008-08-06 01:07:14.000000000 +0100
---- gcc/expr.c	2010-10-27 18:35:09.872795000 +0100
-***************
-*** 8806,8811 ****
---- 8806,8816 ----
-        /* Lowered by gimplify.c.  */
-        gcc_unreachable ();
-  
-+     case STATIC_CHAIN_EXPR:
-+     case STATIC_CHAIN_DECL:
-+       /* Lowered by tree-nested.c */
-+       gcc_unreachable ();
-+ 
-      case EXC_PTR_EXPR:
-        return get_exception_pointer (cfun);
-  
-diff -cr gcc.orig/function.c gcc/function.c
-*** gcc.orig/function.c	2008-10-09 18:08:15.000000000 +0100
---- gcc/function.c	2010-10-27 18:40:05.092795002 +0100
-***************
-*** 3081,3087 ****
-            FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
-  			        data.passed_type, data.named_arg);
-  
-!           assign_parm_adjust_stack_rtl (&data);
-  
-            if (assign_parm_setup_block_p (&data))
-  	    assign_parm_setup_block (&all, parm, &data);
---- 3081,3088 ----
-            FUNCTION_ARG_ADVANCE (all.args_so_far, data.promoted_mode,
-  			        data.passed_type, data.named_arg);
-  
-! 	  if (!cfun->naked)
-! 	    assign_parm_adjust_stack_rtl (&data);
-  
-            if (assign_parm_setup_block_p (&data))
-  	    assign_parm_setup_block (&all, parm, &data);
-***************
-*** 3098,3104 ****
-  
-    /* Output all parameter conversion instructions (possibly including calls)
-       now that all parameters have been copied out of hard registers.  */
-!   emit_insn (all.conversion_insns);
-  
-    /* If we are receiving a struct value address as the first argument, set up
-       the RTL for the function result. As this might require code to convert
---- 3099,3106 ----
-  
-    /* Output all parameter conversion instructions (possibly including calls)
-       now that all parameters have been copied out of hard registers.  */
-!   if (!cfun->naked)
-!     emit_insn (all.conversion_insns);
-  
-    /* If we are receiving a struct value address as the first argument, set up
-       the RTL for the function result. As this might require code to convert
-***************
-*** 3232,3237 ****
---- 3234,3242 ----
-    struct assign_parm_data_all all;
-    tree fnargs, parm, stmts = NULL;
-  
-+   if (cfun->naked)
-+     return NULL;
-+ 
-    assign_parms_initialize_all (&all);
-    fnargs = assign_parms_augmented_arg_list (&all);
-  
-***************
-*** 4230,4240 ****
-        tree parm = cfun->static_chain_decl;
-        rtx local = gen_reg_rtx (Pmode);
-  
--       set_decl_incoming_rtl (parm, static_chain_incoming_rtx);
-        SET_DECL_RTL (parm, local);
-        mark_reg_pointer (local, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm))));
-! 
-!       emit_move_insn (local, static_chain_incoming_rtx);
-      }
-  
-    /* If the function receives a non-local goto, then store the
---- 4235,4248 ----
-        tree parm = cfun->static_chain_decl;
-        rtx local = gen_reg_rtx (Pmode);
-  
-        SET_DECL_RTL (parm, local);
-        mark_reg_pointer (local, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (parm))));
-!       if (!cfun->custom_static_chain)
-! 	{
-! 	  set_decl_incoming_rtl (parm, static_chain_incoming_rtx);
-! 	  emit_move_insn (local, static_chain_incoming_rtx);
-! 	}
-!       /* else, the static chain will be set in the main body */
-      }
-  
-    /* If the function receives a non-local goto, then store the
-***************
-*** 5286,5291 ****
---- 5294,5302 ----
-  #endif
-    edge_iterator ei;
-  
-+   if (cfun->naked)
-+     return;
-+ 
-  #ifdef HAVE_prologue
-    if (HAVE_prologue)
-      {
-diff -cr gcc.orig/function.h gcc/function.h
-*** gcc.orig/function.h	2008-12-03 17:43:56.000000000 +0000
---- gcc/function.h	2010-10-27 18:41:14.556795002 +0100
-***************
-*** 495,500 ****
---- 495,508 ----
-    /* Number of units of floating point registers that need saving in stdarg
-       function.  */
-    unsigned int va_list_fpr_size : 8;
-+ 
-+   /* Nonzero if static chain is initialized by something other than
-+      static_chain_incoming_rtx. */
-+   unsigned int custom_static_chain : 1;
-+ 
-+   /* Nonzero if no code should be generated for prologues, copying
-+      parameters, etc. */
-+   unsigned int naked : 1;
-  };
-  
-  /* If va_list_[gf]pr_size is set to this, it means we don't know how
-diff -cr gcc.orig/gcc.c gcc/gcc.c
-*** gcc.orig/gcc.c	2008-11-12 19:57:33.000000000 +0000
---- gcc/gcc.c	2010-10-27 18:45:59.332795000 +0100
-***************
-*** 127,132 ****
---- 127,135 ----
-  /* Flag set by cppspec.c to 1.  */
-  int is_cpp_driver;
-  
-+ /* Flag set by drivers needing Pthreads. */
-+ int need_pthreads;
-+ 
-  /* Flag saying to pass the greatest exit code returned by a sub-process
-     to the calling program.  */
-  static int pass_exit_codes;
-***************
-*** 4095,4100 ****
---- 4101,4109 ----
-  	}
-      }
-  
-+   if (need_pthreads)
-+     n_switches++;
-+ 
-    if (save_temps_flag && use_pipes)
-      {
-        /* -save-temps overrides -pipe, so that temp files are produced */
-***************
-*** 4475,4480 ****
---- 4484,4501 ----
-  	}
-      }
-  
-+   if (need_pthreads)
-+     {
-+       switches[n_switches].part1 = "pthread";
-+       switches[n_switches].args = 0;
-+       switches[n_switches].live_cond = SWITCH_OK;
-+       /* Do not print an error if there is not expansion for -pthread. */
-+       switches[n_switches].validated = 1;
-+       switches[n_switches].ordering = 0;
-+ 
-+       n_switches++;
-+     }
-+ 
-    switches[n_switches].part1 = 0;
-    infiles[n_infiles].name = 0;
-  }
-diff -cr gcc.orig/gcc.h gcc/gcc.h
-*** gcc.orig/gcc.h	2008-05-27 23:39:57.000000000 +0100
---- gcc/gcc.h	2010-10-27 18:46:24.452795001 +0100
-***************
-*** 40,46 ****
-     || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
-     /* APPLE LOCAL frameworks */ \
-     || (CHAR) == 'F' \
-!    || (CHAR) == 'B' || (CHAR) == 'b')
-  
-  /* This defines which multi-letter switches take arguments.  */
-  
---- 40,46 ----
-     || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \
-     /* APPLE LOCAL frameworks */ \
-     || (CHAR) == 'F' \
-!    || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'J')
-  
-  /* This defines which multi-letter switches take arguments.  */
-  
-diff -cr gcc.orig/predict.c gcc/predict.c
-*** gcc.orig/predict.c	2007-07-06 14:59:24.000000000 +0100
---- gcc/predict.c	2010-10-27 18:56:10.580795000 +0100
-***************
-*** 1317,1322 ****
---- 1317,1323 ----
-  	     care for error returns and other cases are often used for
-  	     fast paths through function.  */
-  	  if (e->dest == EXIT_BLOCK_PTR
-+ 	      && last_stmt (bb) == NULL_TREE
-  	      && TREE_CODE (last_stmt (bb)) == RETURN_EXPR
-  	      && !single_pred_p (bb))
-  	    {
-diff -cr gcc.orig/tree.def gcc/tree.def
-*** gcc.orig/tree.def	2008-07-09 01:37:53.000000000 +0100
---- gcc/tree.def	2010-10-27 18:48:30.944795000 +0100
-***************
-*** 533,538 ****
---- 533,545 ----
-     Operand 2 is the static chain argument, or NULL.  */
-  DEFTREECODE (CALL_EXPR, "call_expr", tcc_expression, 3)
-  
-+ /* Operand 0 is the FUNC_DECL of the outer function for
-+    which the static chain is to be computed. */
-+ DEFTREECODE (STATIC_CHAIN_EXPR, "static_chain_expr", tcc_expression, 1)
-+     
-+ /* Represents a function's static chain.  It can be used as an lvalue. */
-+ DEFTREECODE (STATIC_CHAIN_DECL, "static_chain_decl", tcc_expression, 0)
-+ 
-  /* Specify a value to compute along with its corresponding cleanup.
-     Operand 0 is the cleanup expression.
-     The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR,
-***************
-*** 906,912 ****
-  
-  /* APPLE LOCAL begin AV vmul_uch --haifa  */
-  /* Used during vectorization to represent computation idioms.  */
-! DEFTREECODE (MULT_UCH_EXPR, "mult_uch", '2', 2)
-  /* APPLE LOCAL end AV vmul_uch --haifa  */
-  
-  /* Value handles.  Artificial nodes to represent expressions in
---- 913,919 ----
-  
-  /* APPLE LOCAL begin AV vmul_uch --haifa  */
-  /* Used during vectorization to represent computation idioms.  */
-! DEFTREECODE (MULT_UCH_EXPR, "mult_uch", tcc_binary, 2)
-  /* APPLE LOCAL end AV vmul_uch --haifa  */
-  
-  /* Value handles.  Artificial nodes to represent expressions in
-diff -cr gcc.orig/tree-gimple.c gcc/tree-gimple.c
-*** gcc.orig/tree-gimple.c	2006-10-31 03:22:44.000000000 +0000
---- gcc/tree-gimple.c	2010-10-27 18:50:13.892795002 +0100
-***************
-*** 72,77 ****
---- 72,79 ----
-      case VECTOR_CST:
-      case OBJ_TYPE_REF:
-      case ASSERT_EXPR:
-+     case STATIC_CHAIN_EXPR: /* not sure if this is right...*/
-+     case STATIC_CHAIN_DECL:
-        return true;
-  
-      default:
-***************
-*** 145,151 ****
-  	  || TREE_CODE (t) == WITH_SIZE_EXPR
-  	  /* These are complex lvalues, but don't have addresses, so they
-  	     go here.  */
-! 	  || TREE_CODE (t) == BIT_FIELD_REF);
-  }
-  
-  /*  Return true if T is a GIMPLE condition.  */
---- 147,156 ----
-  	  || TREE_CODE (t) == WITH_SIZE_EXPR
-  	  /* These are complex lvalues, but don't have addresses, so they
-  	     go here.  */
-! 	  || TREE_CODE (t) == BIT_FIELD_REF
-! 	  /* This is an lvalue because it will be replaced with the real
-! 	     static chain decl. */
-! 	  || TREE_CODE (t) == STATIC_CHAIN_DECL);
-  }
-  
-  /*  Return true if T is a GIMPLE condition.  */
-diff -cr gcc.orig/tree-inline.c gcc/tree-inline.c
-*** gcc.orig/tree-inline.c	2008-08-18 19:53:16.000000000 +0100
---- gcc/tree-inline.c	2010-10-27 19:00:07.800795002 +0100
-***************
-*** 554,563 ****
-       knows not to copy VAR_DECLs, etc., so this is safe.  */
-    else
-      {
-        /* Here we handle trees that are not completely rewritten.
-  	 First we detect some inlining-induced bogosities for
-  	 discarding.  */
-!       if (TREE_CODE (*tp) == MODIFY_EXPR
-  	  && TREE_OPERAND (*tp, 0) == TREE_OPERAND (*tp, 1)
-  	  && (lang_hooks.tree_inlining.auto_var_in_fn_p
-  	      (TREE_OPERAND (*tp, 0), fn)))
---- 554,574 ----
-       knows not to copy VAR_DECLs, etc., so this is safe.  */
-    else
-      {
-+       if (id->transform_call_graph_edges == CB_CGE_MOVE
-+ 	  && TREE_CODE (*tp) == MODIFY_EXPR
-+ 	  && TREE_OPERAND (*tp, 0) ==
-+ 		DECL_STRUCT_FUNCTION (fn)->static_chain_decl)
-+ 	{
-+ 	  /* Don't use special methods to initialize the static chain
-+ 	     if expanding inline.  If this code could somehow be
-+ 	     expanded in expand_start_function, it would not be
-+ 	     necessary to deal with it here. */
-+ 	  *tp = build_empty_stmt ();
-+ 	}
-        /* Here we handle trees that are not completely rewritten.
-  	 First we detect some inlining-induced bogosities for
-  	 discarding.  */
-!       else if (TREE_CODE (*tp) == MODIFY_EXPR
-  	  && TREE_OPERAND (*tp, 0) == TREE_OPERAND (*tp, 1)
-  	  && (lang_hooks.tree_inlining.auto_var_in_fn_p
-  	      (TREE_OPERAND (*tp, 0), fn)))
-diff -cr gcc.orig/tree-nested.c gcc/tree-nested.c
-*** gcc.orig/tree-nested.c	2008-10-27 17:10:05.000000000 +0000
---- gcc/tree-nested.c	2010-10-27 19:04:20.940795001 +0100
-***************
-*** 801,806 ****
---- 801,808 ----
-  
-    if (info->context == target_context)
-      {
-+       /* might be doing something wrong to need the following line.. */
-+       get_frame_type (info);
-        x = build_addr (info->frame_decl, target_context);
-      }
-    else
-***************
-*** 1623,1628 ****
---- 1625,1634 ----
-        if (DECL_NO_STATIC_CHAIN (decl))
-  	break;
-  
-+       /* Don't use a trampoline for a static reference. */
-+       if (TREE_STATIC (t))
-+ 	break;
-+ 
-        /* Lookup the immediate parent of the callee, as that's where
-  	 we need to insert the trampoline.  */
-        for (i = info; i->context != target_context; i = i->outer)
-***************
-*** 1693,1698 ****
---- 1699,1712 ----
-  	}
-        break;
-  
-+     case STATIC_CHAIN_EXPR:
-+       *tp = get_static_chain (info, TREE_OPERAND (t, 0), &wi->tsi);
-+       break;
-+ 
-+     case STATIC_CHAIN_DECL:
-+       *tp = get_chain_decl (info);
-+       break;
-+ 
-      case RETURN_EXPR:
-      case MODIFY_EXPR:
-      case WITH_SIZE_EXPR:
-***************
-*** 1828,1834 ****
-        tree x = build3 (COMPONENT_REF, TREE_TYPE (root->chain_field),
-  		       root->frame_decl, root->chain_field, NULL_TREE);
-        x = build2 (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
-!       append_to_statement_list (x, &stmt_list);
-      }
-  
-    /* If trampolines were created, then we need to initialize them.  */
---- 1842,1866 ----
-        tree x = build3 (COMPONENT_REF, TREE_TYPE (root->chain_field),
-  		       root->frame_decl, root->chain_field, NULL_TREE);
-        x = build2 (MODIFY_EXPR, TREE_TYPE (x), x, get_chain_decl (root));
-!       if (DECL_STRUCT_FUNCTION (root->context)->custom_static_chain)
-! 	{
-! 	  tree_stmt_iterator i =
-! 	      tsi_start ( BIND_EXPR_BODY (DECL_SAVED_TREE (context)));
-! 	  while (!tsi_end_p (i))
-! 	    {
-! 	      tree t = tsi_stmt (i);
-! 	      if (TREE_CODE (t) == MODIFY_EXPR &&
-! 		  TREE_OPERAND (t, 0) == root->chain_decl)
-! 		{
-! 		  tsi_link_after (& i, x, TSI_SAME_STMT);
-! 		  x = NULL_TREE;
-! 		  break;
-! 		}
-! 	    }
-! 	  gcc_assert (x == NULL_TREE);
-! 	}
-!       else
-! 	append_to_statement_list (x, &stmt_list);
-      }
-  
-    /* If trampolines were created, then we need to initialize them.  */
-diff -cr gcc.orig/tree-pretty-print.c gcc/tree-pretty-print.c
-*** gcc.orig/tree-pretty-print.c	2006-06-04 20:13:47.000000000 +0100
---- gcc/tree-pretty-print.c	2010-10-27 19:05:17.384795001 +0100
-***************
-*** 1156,1161 ****
---- 1156,1171 ----
-  	pp_string (buffer, " [tail call]");
-        break;
-  
-+     case STATIC_CHAIN_EXPR:
-+       pp_string (buffer, "<<static chain of ");
-+       dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
-+       pp_string (buffer, ">>");
-+       break;
-+ 
-+     case STATIC_CHAIN_DECL:
-+       pp_string (buffer, "<<static chain decl>>");
-+       break;
-+ 
-      case WITH_CLEANUP_EXPR:
-        NIY;
-        break;
-diff -cr gcc.orig/tree-sra.c gcc/tree-sra.c
-*** gcc.orig/tree-sra.c	2007-11-28 18:58:25.000000000 +0000
---- gcc/tree-sra.c	2010-10-27 19:06:59.540795002 +0100
-***************
-*** 259,264 ****
---- 259,266 ----
-      case RECORD_TYPE:
-        {
-  	bool saw_one_field = false;
-+ 	tree last_offset = size_zero_node;
-+ 	tree cmp;
-  
-  	for (t = TYPE_FIELDS (type); t ; t = TREE_CHAIN (t))
-  	  if (TREE_CODE (t) == FIELD_DECL)
-***************
-*** 268,273 ****
---- 270,280 ----
-  		  && (tree_low_cst (DECL_SIZE (t), 1)
-  		      != TYPE_PRECISION (TREE_TYPE (t))))
-  		goto fail;
-+ 	      /* Reject aliased fields created by GDC for anonymous unions. */
-+ 	      cmp = fold_binary_to_constant (LE_EXPR, boolean_type_node,
-+ 					     DECL_FIELD_OFFSET (t), last_offset);
-+ 	      if (cmp == NULL_TREE || tree_expr_nonzero_p (cmp))
-+ 		goto fail;
-  
-  	      saw_one_field = true;
-  	    }
-diff -cr gcc.orig/tree-vect-analyze.c gcc/tree-vect-analyze.c
-*** gcc.orig/tree-vect-analyze.c	2007-12-11 19:58:17.000000000 +0000
---- gcc/tree-vect-analyze.c	2010-10-27 19:09:40.268795001 +0100
-***************
-*** 595,600 ****
---- 595,603 ----
-           
-    if (DDR_ARE_DEPENDENT (ddr) == chrec_known)
-      return false;
-+ 
-+   if ((DR_IS_READ (dra) && DR_IS_READ (drb)) || (dra == drb))
-+     return false;
-    
-    if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
-      {
-***************
-*** 605,610 ****
---- 608,619 ----
-            print_generic_expr (vect_dump, DR_REF (dra), TDF_SLIM);
-            fprintf (vect_dump, " and ");
-            print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM);
-+ 	  fprintf (vect_dump, "\n");
-+ 	  dump_data_reference (vect_dump, dra);
-+ 	  fprintf (vect_dump, " ---- ");
-+ 	  dump_data_reference (vect_dump, drb);
-+ 	  fprintf (vect_dump, "\n");
-+ 	  fprintf (vect_dump, "Eq test %i\n", DR_REF (dra) == DR_REF (drb));
-          }
-        return true;
-      }

d/patches/patch-build_gcc-5465

-diff -cr gcc-5465.orig/build_gcc gcc-5465/build_gcc
-*** gcc-5465.orig/build_gcc	2007-07-20 18:53:27.000000000 +0100
---- gcc-5465/build_gcc	2010-10-27 17:11:22.308795001 +0100
-***************
-*** 114,124 ****
-  CONFIGFLAGS="--disable-checking -enable-werror \
-    --prefix=$DEST_ROOT \
-    --mandir=\${prefix}/share/man \
-!   --enable-languages=c,objc,c++,obj-c++ \
-    --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
-    --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \
-    --with-slibdir=/usr/lib \
-!   --build=$BUILD-apple-darwin$DARWIN_VERS"
-  
-  # Figure out how many make processes to run.
-  SYSCTL=`sysctl -n hw.activecpu`
---- 114,125 ----
-  CONFIGFLAGS="--disable-checking -enable-werror \
-    --prefix=$DEST_ROOT \
-    --mandir=\${prefix}/share/man \
-!   --enable-languages=c,objc,c++,obj-c++,d \
-    --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
-    --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \
-    --with-slibdir=/usr/lib \
-!   --build=$BUILD-apple-darwin$DARWIN_VERS \
-!   $EXTRA_CONFIG_FLAGS"
-  
-  # Figure out how many make processes to run.
-  SYSCTL=`sysctl -n hw.activecpu`
-***************
-*** 150,156 ****
-  # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
-  RC_DEBUG_OPTIONS= \
-    make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-! make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
-    CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  
---- 151,157 ----
-  # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
-  RC_DEBUG_OPTIONS= \
-    make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-! #make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
-    CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  
-***************
-*** 253,261 ****
-  rm -rf * || exit 1
-  
-  # HTML documentation
-! HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
-! mkdir -p ".$HTMLDIR" || exit 1
-! cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
-  
-  # Manual pages
-  mkdir -p .$DEST_ROOT/share || exit 1
---- 254,262 ----
-  rm -rf * || exit 1
-  
-  # HTML documentation
-! #HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
-! #mkdir -p ".$HTMLDIR" || exit 1
-! #cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
-  
-  # Manual pages
-  mkdir -p .$DEST_ROOT/share || exit 1
-***************
-*** 287,293 ****
-  # bin
-  # The native drivers ('native' is different in different architectures).
-  BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
-!   | grep -v gccbug | grep -v gcov || exit 1`
-  mkdir .$DEST_ROOT/bin
-  for f in $BIN_FILES ; do
-    lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
---- 288,294 ----
-  # bin
-  # The native drivers ('native' is different in different architectures).
-  BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
-!   | grep -v gccbug | grep -v gcov | grep -v gdmd || exit 1`
-  mkdir .$DEST_ROOT/bin
-  for f in $BIN_FILES ; do
-    lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
-***************
-*** 303,308 ****
---- 304,311 ----
-      $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS || exit 1
-    lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++-$VERS -create \
-      $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++* || exit 1
-+   lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc-$VERS -create \
-+     $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc* || exit 1
-  done
-  
-  # lib
-***************
-*** 351,356 ****
---- 354,395 ----
-    fi
-  done
-  
-+ # GDC: Phobos and gdmd
-+ if test -e $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d2; then
-+     phobos_sfx=2;
-+ else
-+     phobos_sfx='';
-+ fi
-+ cp -p $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin/gdmd-* $DEST_DIR$DEST_ROOT/bin
-+ cp -pR $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d$phobos_sfx $DEST_DIR$DEST_ROOT/include \
-+     || exit 1
-+ phobos_lib_list=
-+ for t in $TARGETS ; do
-+     if test $t = $BUILD ; then
-+ 	phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/lib"
-+     else
-+ 	cp -pR $DIR/dst-$BUILD-$t$DEST_ROOT/include/d$phobos_sfx/$VERS/$t-apple-darwin$DARWIN_VERS \
-+ 	    $DEST_DIR$DEST_ROOT/include/d$phobos_sfx/$VERS || exit 1
-+ 	phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib"
-+     fi
-+     phobos_lib_list="$phobos_lib_list $phobos_lib_dir/libgphobos$phobos_sfx.a"
-+ 
-+     # Get 64-bit variants
-+     other_libdir=''
-+     if test "$t" = i686; then
-+ 	other_libdir="x86_64"
-+     elif test "$t" = powerpc; then
-+ 	other_libdir="ppc64"
-+     fi
-+     if test -n "$other_libdir"; then
-+ 	other_phobos="$phobos_lib_dir/$other_libdir/libgphobos$phobos_sfx.a"
-+ 	if test -r "$other_phobos"; then
-+ 	    phobos_lib_list="$phobos_lib_list $other_phobos"
-+ 	fi
-+     fi
-+ done
-+ lipo -output $DEST_DIR$DEST_ROOT/lib/libgphobos$phobos_sfx.a -create $phobos_lib_list || exit 1
-+ 
-  # Add extra man page symlinks for 'c++' and for arch-specific names.
-  MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
-  ln -f $MDIR/g++-$MAJ_VERS.1 $MDIR/c++-$MAJ_VERS.1 || exit 1
-***************
-*** 385,390 ****
---- 424,440 ----
-          -L$DIR/obj-$h-$BUILD/libiberty/                                        \
-          -L$DIR/obj-$h-$h/libiberty/                                        \
-  	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-g++-$MAJ_VERS || exit 1
-+ 
-+     $DIR/dst-$BUILD-$h$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gcc-$VERS                 \
-+ 	$ORIG_SRC_DIR/driverdriver.c                               \
-+ 	-DPDN="\"-apple-darwin$DARWIN_VERS-gdc-$VERS\""                                    \
-+ 	-DIL="\"$DEST_ROOT/bin/\"" -I  $ORIG_SRC_DIR/include                   \
-+ 	-I  $ORIG_SRC_DIR/gcc -I  $ORIG_SRC_DIR/gcc/config                     \
-+ 	-liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/                           \
-+ 	-L$DIR/dst-$BUILD-$h$DEST_ROOT/$h-apple-darwin$DARWIN_VERS/lib/                    \
-+         -L$DIR/obj-$h-$BUILD/libiberty/                                        \
-+         -L$DIR/obj-$h-$h/libiberty/                                        \
-+ 	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-gdc-$MAJ_VERS || exit 1
-  done
-  # APPLE LOCAL end ARM native compiler support
-  
-***************
-*** 394,403 ****
---- 444,467 ----
-  lipo -output $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS -create \
-    $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
-  
-+ lipo -output $DEST_DIR/$DEST_ROOT/bin/gdc-$MAJ_VERS -create \
-+   $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
-+ 
-  ln -f $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/c++-$MAJ_VERS || exit 1
-  
-  rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
-  rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
-+ rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
-+ 
-+ # Build rdmd
-+ for h in $HOSTS ; do
-+     $DEST_DIR$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gdc-$VERS \
-+ 	$ORIG_SRC_DIR/gcc/d/rdmd.d \
-+ 	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-rdmd || exit 1
-+ done
-+ lipo -output $DEST_DIR/$DEST_ROOT/bin/rdmd -create \
-+   $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
-+ rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
-  
-  ########################################
-  # Create SYM_DIR with information required for debugging.

d/patches/patch-build_gcc-5664

-diff -cr gcc-5664.orig/build_gcc gcc-5664/build_gcc
-*** gcc-5664.orig/build_gcc	2009-12-15 22:21:10.000000000 +0000
---- gcc-5664/build_gcc	2010-10-27 19:50:47.392795002 +0100
-***************
-*** 31,37 ****
-  
-  # Language front-ends to build. This also affects
-  # whether the C++ driver and driver-driver are installed
-! LANGUAGES=${LANGUAGES-c,objc,c++,obj-c++}
-  
-  # The B&I build script (~rc/bin/buildit) accepts an '-othercflags'
-  # command-line flag, and captures the argument to that flag in
---- 31,37 ----
-  
-  # Language front-ends to build. This also affects
-  # whether the C++ driver and driver-driver are installed
-! LANGUAGES=${LANGUAGES-c,objc,c++,obj-c++,d}
-  
-  # The B&I build script (~rc/bin/buildit) accepts an '-othercflags'
-  # command-line flag, and captures the argument to that flag in
-***************
-*** 40,47 ****
-  
-  CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
-  
-  # This isn't a parameter; it is the architecture of the current machine.
-! BUILD=`arch | $TRANSLATE_ARCH`
-  
-  # The third parameter is the path to the compiler sources.  There should
-  # be a shell script named 'configure' in this directory.  This script
---- 40,52 ----
-  
-  CFLAGS="-g -O2 ${RC_NONARCH_CFLAGS/-pipe/}"
-  
-+ ARCH="`arch`"
-+ if [ "x$ARCH" = "xi386" -a "`sysctl -n hw.cpu64bit_capable`" = "1" ]; then
-+   ARCH="x86_64"
-+ fi
-+ 
-  # This isn't a parameter; it is the architecture of the current machine.
-! BUILD=`echo $ARCH | $TRANSLATE_ARCH`
-  
-  # The third parameter is the path to the compiler sources.  There should
-  # be a shell script named 'configure' in this directory.  This script
-***************
-*** 220,226 ****
-  # comparable to the native built libraries.
-  unset RC_DEBUG_OPTIONS
-  make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-! make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
-    CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  
---- 220,226 ----
-  # comparable to the native built libraries.
-  unset RC_DEBUG_OPTIONS
-  make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-! #make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
-    CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
-  
-***************
-*** 387,395 ****
-  rm -rf * || exit 1
-  
-  # HTML documentation
-! HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
-! mkdir -p ".$HTMLDIR" || exit 1
-! cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
-  
-  # Manual pages
-  mkdir -p .$DEST_ROOT/share || exit 1
---- 387,395 ----
-  rm -rf * || exit 1
-  
-  # HTML documentation
-! #HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
-! #mkdir -p ".$HTMLDIR" || exit 1
-! #cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
-  
-  # Manual pages
-  mkdir -p .$DEST_ROOT/share || exit 1
-***************
-*** 424,430 ****
-  # bin
-  # The native drivers ('native' is different in different architectures).
-  BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
-!   | grep -v gccbug | grep -v gcov || exit 1`
-  mkdir .$DEST_ROOT/bin
-  for f in $BIN_FILES ; do
-    lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
---- 424,430 ----
-  # bin
-  # The native drivers ('native' is different in different architectures).
-  BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
-!   | grep -v gccbug | grep -v gcov | grep -v gdmd || exit 1`
-  mkdir .$DEST_ROOT/bin
-  for f in $BIN_FILES ; do
-    lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
-***************
-*** 444,449 ****
---- 444,451 ----
-      lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++-$VERS -create \
-      $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++* || exit 1
-    fi
-+   lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc-$VERS -create \
-+   $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc* || exit 1
-  done
-  
-  # lib
-***************
-*** 521,526 ****
---- 523,564 ----
-    fi
-  done
-  
-+ # GDC: Phobos and gdmd
-+ if test -e $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d2; then
-+   phobos_sfx=2;
-+ else
-+   phobos_sfx='';
-+ fi
-+ cp -p $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin/gdmd-* $DEST_DIR$DEST_ROOT/bin
-+ cp -pR $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d$phobos_sfx $DEST_DIR$DEST_ROOT/include \
-+     || exit 1
-+ phobos_lib_list=
-+ for t in $TARGETS ; do
-+   if test $t = $BUILD ; then
-+     phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/lib"
-+   else
-+     cp -pR $DIR/dst-$BUILD-$t$DEST_ROOT/include/d$phobos_sfx/$VERS/$t-apple-darwin$DARWIN_VERS \
-+ 	$DEST_DIR$DEST_ROOT/include/d$phobos_sfx/$VERS || exit 1
-+     phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib"
-+   fi
-+   phobos_lib_list="$phobos_lib_list $phobos_lib_dir/libgphobos$phobos_sfx.a"
-+ 
-+   # Get 64-bit variants
-+   other_libdir=''
-+   if test "$t" = i686; then
-+     other_libdir="x86_64"
-+   elif test "$t" = powerpc; then
-+     other_libdir="ppc64"
-+   fi
-+   if test -n "$other_libdir"; then
-+     other_phobos="$phobos_lib_dir/$other_libdir/libgphobos$phobos_sfx.a"
-+     if test -r "$other_phobos"; then
-+       phobos_lib_list="$phobos_lib_list $other_phobos"
-+     fi
-+   fi
-+ done
-+ lipo -output $DEST_DIR$DEST_ROOT/lib/libgphobos$phobos_sfx.a -create $phobos_lib_list || exit 1  
-+ 
-  # Add extra man page symlinks for 'c++' and for arch-specific names.
-  MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
-  if [ $BUILD_CXX -eq 1 ]; then
-***************
-*** 568,573 ****
---- 606,620 ----
-              -L$DIR/obj-$h-$BUILD/libiberty/                                        \
-  	    -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-g++-$MAJ_VERS || exit 1
-      fi
-+     $DIR/dst-$BUILD-$h$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gcc-$VERS     \
-+ 	$ORIG_SRC_DIR/driverdriver.c                               \
-+ 	-DPDN="\"-apple-darwin$DARWIN_VERS-gdc-$VERS\""                                    \
-+ 	-DIL="\"$DEST_ROOT/bin/\"" -I  $ORIG_SRC_DIR/include                   \
-+ 	-I  $ORIG_SRC_DIR/gcc -I  $ORIG_SRC_DIR/gcc/config                     \
-+ 	-liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/                           \
-+ 	-L$DIR/dst-$BUILD-$h$DEST_ROOT/$h-apple-darwin$DARWIN_VERS/lib/                    \
-+         -L$DIR/obj-$h-$BUILD/libiberty/                                        \
-+ 	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-gdc-$MAJ_VERS || exit 1
-  done
-  
-  lipo -output $DEST_DIR/$DEST_ROOT/bin/gcc-$MAJ_VERS -create \
-***************
-*** 587,592 ****
---- 634,652 ----
-    rm -rf $DEST_DIR/$DEST_ROOT/lib/gcc/*/*/include/c++
-  fi
-  
-+ lipo -output $DEST_DIR/$DEST_ROOT/bin/gdc-$MAJ_VERS -create \
-+   $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
-+ rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
-+ 
-+ # Build rdmd
-+ for h in $HOSTS ; do
-+   $DEST_DIR$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gdc-$VERS \
-+     $ORIG_SRC_DIR/gcc/d/rdmd.d \
-+     -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-rdmd || exit 1
-+ done
-+ lipo -output $DEST_DIR/$DEST_ROOT/bin/rdmd -create \
-+   $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
-+ rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
-  
-  ########################################
-  # Create SYM_DIR with information required for debugging.

d/patches/patch-gcc-darwin-eh-3.4.x

-*** gcc-orig/config/darwin.h	Sat Sep 11 16:32:17 2004
---- gcc/config/darwin.h	Wed Jan 19 17:07:34 2005
-***************
-*** 644,650 ****
-  		".section __DATA,__gcc_except_tab", 0)	\
-  SECTION_FUNCTION (darwin_eh_frame_section,		\
-  		in_darwin_eh_frame,			\
-! 		".section __TEXT,__eh_frame", 0)	\
-  							\
-  static void					\
-  objc_section_init (void)			\
---- 644,650 ----
-  		".section __DATA,__gcc_except_tab", 0)	\
-  SECTION_FUNCTION (darwin_eh_frame_section,		\
-  		in_darwin_eh_frame,			\
-! 		".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms", 0)/*df*/	\
-  							\
-  static void					\
-  objc_section_init (void)			\
-*** gcc-orig/dwarf2out.c	Mon Oct 25 17:46:45 2004
---- gcc/dwarf2out.c	Sat May  7 21:19:29 2005
-***************
-*** 390,396 ****
---- 390,400 ----
-  #define FUNC_END_LABEL		"LFE"
-  #endif
-  
-+ #ifdef DARWIN_REGISTER_TARGET_PRAGMAS
-+ #define FRAME_BEGIN_LABEL	"EH_frame"
-+ #else
-  #define FRAME_BEGIN_LABEL	"Lframe"
-+ #endif
-  #define CIE_AFTER_SIZE_LABEL	"LSCIE"
-  #define CIE_END_LABEL		"LECIE"
-  #define FDE_LABEL		"LSFDE"
 
 gcc_patch_key=${gcc_ver}.x
 
-# 0.1. Find out if this is Apple's GCC
-if grep -qF '(Apple' gcc/version.c; then
-    gcc_apple=apple-
-    gcc_apple_build_ver=`grep '(Apple' gcc/version.c | sed -e 's/^.*build \([0-9][0-9]*\).*$/\1/'`
-    if test "$gcc_apple_build_ver" -eq 5465; then
-        gcc_patch_key=5465
-    elif test "$gcc_apple_build_ver" -eq 5664; then
-        gcc_patch_key=5664
-    else
-        echo "This version of Apple GCC ($gcc_apple_build_ver) is not supported."
-        exit 1
-    fi
-fi
-
 # 0.2. Determine if this version of GCC is supported
-gcc_patch_fn=d/patches/patch-${gcc_apple}gcc-$gcc_patch_key
+gcc_patch_fn=d/patches/patch-gcc-$gcc_patch_key
 if test ! -f gcc/"$gcc_patch_fn"; then
     echo "This version of GCC ($gcc_ver) is not supported."
     exit 1
 # You will need the autogen package to do this. (http://autogen.sf.net/)
 patch -p1 < gcc/d/patches/patch-toplev-$gcc_patch_key || exit 1
 
-if test -n "$gcc_apple"; then
-    patch -l -p1 < "gcc/d/patches/patch-build_gcc-$gcc_patch_key" || exit 1
-fi
-
 
 # 3. Patch the gcc subdirectory
 cd gcc || exit 1
 patch -p1 < "$gcc_patch_fn" || exit 1
 
 
-# 4. Maybe apply Darwin patches
-if test -z "$gcc_apple" && test "`uname`" = Darwin; then
-    if test -f d/patches/patch-gcc-darwin-eh-$gcc_patch_key; then
-        patch -p1 < d/patches/patch-gcc-darwin-eh-$gcc_patch_key || exit 1
-    fi
-fi
-
 echo
 echo "Building D language version $d_lang_version."
 echo
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.