rpms/gcc/devel gcc4-dwarf2-prefer-1elt-vartracking.patch, NONE, 1.1 gcc4-dwarf2-usefbreg.patch, NONE, 1.1 gcc4-libffi-x86.patch, NONE, 1.1 gcc4-pr23299.patch, NONE, 1.1 .cvsignore, 1.104, 1.105 gcc4.spec, 1.63, 1.64 sources, 1.106, 1.107 gcc4-fortran-buffer-overflow.patch, 1.1, NONE gcc4-libffi-ppc-cfi.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Aug 10 21:18:27 UTC 2005


Author: jakub

Update of /cvs/dist/rpms/gcc/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25725

Modified Files:
	.cvsignore gcc4.spec sources 
Added Files:
	gcc4-dwarf2-prefer-1elt-vartracking.patch 
	gcc4-dwarf2-usefbreg.patch gcc4-libffi-x86.patch 
	gcc4-pr23299.patch 
Removed Files:
	gcc4-fortran-buffer-overflow.patch gcc4-libffi-ppc-cfi.patch 
Log Message:
4.0.1-8


gcc4-dwarf2-prefer-1elt-vartracking.patch:
 dwarf2out.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

--- NEW FILE gcc4-dwarf2-prefer-1elt-vartracking.patch ---
2005-08-10  Jakub Jelinek  <jakub at redhat.com>

	* dwarf2out.c (add_location_or_const_value_attribute): Prefer
	locations gathered by var-tracking in single entry loc_list
	over loc_descriptor_from_tree.

--- gcc/dwarf2out.c.jj	2005-08-10 10:23:26.000000000 +0200
+++ gcc/dwarf2out.c	2005-08-10 17:33:35.000000000 +0200
@@ -10235,16 +10235,7 @@ add_location_or_const_value_attribute (d
       return;
     }
   
-  /* We couldn't get any rtl, and we had no >1 element location list, so try
-     directly generating the location description from the tree.  */
-  descr = loc_descriptor_from_tree (decl);
-  if (descr)
-    {
-      add_AT_location_description (die, attr, descr);
-      return;
-    }
-  
-  /* Lastly, if we have tried to generate the location otherwise, and it
+  /* If we have tried to generate the location otherwise, and it
      didn't work out (we wouldn't be here if we did), and we have a one entry
      location list, try generating a location from that.  */
   if (loc_list && loc_list->first)
@@ -10253,7 +10244,19 @@ add_location_or_const_value_attribute (d
       descr = loc_descriptor (NOTE_VAR_LOCATION (node->var_loc_note), 
 			      can_use_fb);
       if (descr)
-	add_AT_location_description (die, attr, descr);
+	{
+	  add_AT_location_description (die, attr, descr);
+	  return;
+	}
+    }
+
+  /* We couldn't get any rtl, so try directly generating the location
+     description from the tree.  */
+  descr = loc_descriptor_from_tree (decl);
+  if (descr)
+    {
+      add_AT_location_description (die, attr, descr);
+      return;
     }
 }
 

gcc4-dwarf2-usefbreg.patch:
 dwarf2out.c |   66 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 35 insertions(+), 31 deletions(-)

--- NEW FILE gcc4-dwarf2-usefbreg.patch ---
2005-08-10  Jakub Jelinek  <jakub at redhat.com>

	* dwarf2out.c (concat_loc_descriptor): Add can_use_fbreg argument,
	pass it down to loc_descriptor.
	(loc_descriptor): Pass can_use_fbreg to concat_loc_descriptor.
	(containing_function_has_frame_base): Move earlier in the file.
	(loc_descriptor_from_tree_1): Use containing_function_has_frame_base
	instead of always assuming fbreg can't be used.

--- gcc/dwarf2out.c.jj	2005-08-06 10:39:55.000000000 +0200
+++ gcc/dwarf2out.c	2005-08-10 10:23:26.000000000 +0200
@@ -3982,7 +3982,7 @@ static dw_loc_descr_ref int_loc_descript
 static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT, bool);
 static int is_based_loc (rtx);
 static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode, bool);
-static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx);
+static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx, bool);
 static dw_loc_descr_ref loc_descriptor (rtx, bool);
 static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int);
 static dw_loc_descr_ref loc_descriptor_from_tree (tree);
@@ -8806,11 +8806,11 @@ mem_loc_descriptor (rtx rtl, enum machin
    This is typically a complex variable.  */
 
 static dw_loc_descr_ref
-concat_loc_descriptor (rtx x0, rtx x1)
+concat_loc_descriptor (rtx x0, rtx x1, bool can_use_fbreg)
 {
   dw_loc_descr_ref cc_loc_result = NULL;
-  dw_loc_descr_ref x0_ref = loc_descriptor (x0, false);
-  dw_loc_descr_ref x1_ref = loc_descriptor (x1, false);
+  dw_loc_descr_ref x0_ref = loc_descriptor (x0, can_use_fbreg);
+  dw_loc_descr_ref x1_ref = loc_descriptor (x1, can_use_fbreg);
 
   if (x0_ref == 0 || x1_ref == 0)
     return 0;
@@ -8824,6 +8824,29 @@ concat_loc_descriptor (rtx x0, rtx x1)
   return cc_loc_result;
 }
 
+/* Return true if DECL's containing function has a frame base attribute.
+   Return false otherwise.  */
+
+static bool
+containing_function_has_frame_base (tree decl)
+{
+  tree declcontext = decl_function_context (decl);
+  dw_die_ref context;
+  dw_attr_ref attr;
+  
+  if (!declcontext)
+    return false;
+
+  context = lookup_decl_die (declcontext);
+  if (!context)
+    return false;
+
+  for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
+    if (attr->dw_attr == DW_AT_frame_base)
+      return true;
+  return false;
+}
+
 /* Output a proper Dwarf location descriptor for a variable or parameter
    which is either allocated in a register or in a memory location.  For a
    register, we just generate an OP_REG and the register number.  For a
@@ -8859,7 +8882,8 @@ loc_descriptor (rtx rtl, bool can_use_fb
       break;
 
     case CONCAT:
-      loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1));
+      loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1),
+					  can_use_fbreg);
       break;
 
     case VAR_LOCATION:
@@ -9019,10 +9043,11 @@ loc_descriptor_from_tree_1 (tree loc, in
 	else
 	  {
 	    enum machine_mode mode;
+	    bool can_use_fb = containing_function_has_frame_base (loc);
 
 	    /* Certain constructs can only be represented at top-level.  */
 	    if (want_address == 2)
-	      return loc_descriptor (rtl, false);
+	      return loc_descriptor (rtl, can_use_fb);
 
 	    mode = GET_MODE (rtl);
 	    if (MEM_P (rtl))
@@ -9030,7 +9055,7 @@ loc_descriptor_from_tree_1 (tree loc, in
 		rtl = XEXP (rtl, 0);
 		have_address = 1;
 	      }
-	    ret = mem_loc_descriptor (rtl, mode, false);
+	    ret = mem_loc_descriptor (rtl, mode, can_use_fb);
 	  }
       }
       break;
@@ -9104,12 +9129,14 @@ loc_descriptor_from_tree_1 (tree loc, in
 	/* Get an RTL for this, if something has been emitted.  */
 	rtx rtl = lookup_constant_def (loc);
 	enum machine_mode mode;
+	bool can_use_fb;
 
 	if (!rtl || !MEM_P (rtl))
 	  return 0;
+	can_use_fb = containing_function_has_frame_base (loc);
 	mode = GET_MODE (rtl);
 	rtl = XEXP (rtl, 0);
-	ret = mem_loc_descriptor (rtl, mode, false);
+	ret = mem_loc_descriptor (rtl, mode, can_use_fb);
 	have_address = 1;
 	break;
       }
@@ -10073,29 +10100,6 @@ rtl_for_decl_location (tree decl)
   return rtl;
 }
 
-/* Return true if DECL's containing function has a frame base attribute.
-   Return false otherwise.  */
-
-static bool
-containing_function_has_frame_base (tree decl)
-{
-  tree declcontext = decl_function_context (decl);
-  dw_die_ref context;
-  dw_attr_ref attr;
-  
-  if (!declcontext)
-    return false;
-
-  context = lookup_decl_die (declcontext);
-  if (!context)
-    return false;
-
-  for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
-    if (attr->dw_attr == DW_AT_frame_base)
-      return true;
-  return false;
-}
-  
 /* Generate *either* a DW_AT_location attribute or else a DW_AT_const_value
    data attribute for a variable or a parameter.  We generate the
    DW_AT_const_value attribute only in those cases where the given variable

gcc4-libffi-x86.patch:
 configure                     |   34 +++++++
 configure.ac                  |   32 ++++++
 fficonfig.h.in                |   19 ++++
 src/powerpc/ffi.c             |   24 +----
 src/powerpc/linux64_closure.S |    3 
 src/x86/ffi.c                 |  110 ++---------------------
 src/x86/sysv.S                |  196 +++++++++++++++++++++++++++++++++++++++++-
 src/x86/win32.S               |  114 ++++++++++++++++++++++++
 8 files changed, 416 insertions(+), 116 deletions(-)

--- NEW FILE gcc4-libffi-x86.patch ---
2005-08-10  Jakub Jelinek  <jakub at redhat.com>

	* configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test.
	(AH_BOTTOM): Add FFI_HIDDEN definition.
	* configure: Rebuilt.
	* fficonfig.h.in: Rebuilt.
	* src/powerpc/ffi.c (hidden): Remove.
	(ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64,
	ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64,
	.ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden.
	* src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove,
	add FFI_HIDDEN to its prototype.
	(ffi_closure_SYSV_inner): New.
	* src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
	* src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.

--- libffi/configure.ac.jj	2004-12-02 12:04:21.000000000 +0100
+++ libffi/configure.ac	2005-08-10 20:34:16.000000000 +0200
@@ -181,6 +181,38 @@ else
 	      [Define to the flags needed for the .section .eh_frame directive.])
 fi
 
+AC_CACHE_CHECK([for __attribute__((visibility("hidden")))],
+    libffi_cv_hidden_visibility_attribute, [
+	echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
+	libffi_cv_hidden_visibility_attribute=no
+	if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
+	    if grep '\.hidden.*foo' conftest.s >/dev/null; then
+		libffi_cv_hidden_visibility_attribute=yes
+	    fi
+	fi
+	rm -f conftest.*
+    ])
+if test $libffi_cv_hidden_visibility_attribute = yes; then
+    AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1,
+	      [Define if __attribute__((visibility("hidden"))) is supported.])
+fi
+
+AH_BOTTOM([
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name) .hidden name
+#else
+#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
+#endif
+#else
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name)
+#else
+#define FFI_HIDDEN
+#endif
+#endif
+])
+
 AC_SUBST(TARGET)
 AC_SUBST(TARGETDIR)
 
--- libffi/configure.jj	2004-12-02 12:04:21.000000000 +0100
+++ libffi/configure	2005-08-10 20:34:19.000000000 +0200
@@ -6726,6 +6726,40 @@ _ACEOF
 
 fi
 
+echo "$as_me:$LINENO: checking for __attribute__((visibility(\"hidden\")))" >&5
+echo $ECHO_N "checking for __attribute__((visibility(\"hidden\")))... $ECHO_C" >&6
+if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+	echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }' > conftest.c
+	libffi_cv_hidden_visibility_attribute=no
+	if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+	    if grep '\.hidden.*foo' conftest.s >/dev/null; then
+		libffi_cv_hidden_visibility_attribute=yes
+	    fi
+	fi
+	rm -f conftest.*
+
+fi
+echo "$as_me:$LINENO: result: $libffi_cv_hidden_visibility_attribute" >&5
+echo "${ECHO_T}$libffi_cv_hidden_visibility_attribute" >&6
+if test $libffi_cv_hidden_visibility_attribute = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
+_ACEOF
+
+fi
+
+
+
+
 
 
 
--- libffi/fficonfig.h.in.jj	2004-06-15 16:47:54.000000000 +0200
+++ libffi/fficonfig.h.in	2005-08-10 20:34:40.000000000 +0200
@@ -37,6 +37,9 @@
    */
 #undef HAVE_AS_SPARC_UA_PCREL
 
+/* Define if __attribute__((visibility("hidden"))) is supported. */
+#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
@@ -139,3 +142,19 @@
 
 /* whether byteorder is bigendian */
 #undef WORDS_BIGENDIAN
+
+
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name) .hidden name
+#else
+#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
+#endif
+#else
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name)
+#else
+#define FFI_HIDDEN
+#endif
+#endif
+
--- libffi/src/powerpc/ffi.c.jj	2005-02-23 15:05:12.000000000 +0100
+++ libffi/src/powerpc/ffi.c	2005-08-10 20:16:54.000000000 +0200
@@ -29,15 +29,9 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 1)
-# define hidden __attribute__ ((visibility ("hidden")))
-#else
-# define hidden
-#endif
-
 
 extern void ffi_closure_SYSV(void);
-extern void hidden ffi_closure_LINUX64(void);
+extern void FFI_HIDDEN ffi_closure_LINUX64(void);
 
 enum {
   /* The assembly depends on these exact flags.  */
@@ -300,7 +294,7 @@ enum { ASM_NEEDS_REGISTERS64 = 4 };
 */
 
 /*@-exportheader@*/
-void hidden ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
+void FFI_HIDDEN ffi_prep_args64(extended_cif *ecif, unsigned long *const stack)
 /*@=exportheader@*/
 {
   const unsigned long bytes = ecif->cif->bytes;
@@ -680,10 +674,10 @@ extern void ffi_call_SYSV(/*@out@*/ exte
 			  unsigned, unsigned,
 			  /*@out@*/ unsigned *,
 			  void (*fn)());
-extern void hidden ffi_call_LINUX64(/*@out@*/ extended_cif *,
-				    unsigned long, unsigned long,
-				    /*@out@*/ unsigned long *,
-				    void (*fn)());
+extern void FFI_HIDDEN ffi_call_LINUX64(/*@out@*/ extended_cif *,
+					unsigned long, unsigned long,
+					/*@out@*/ unsigned long *,
+					void (*fn)());
 /*@=declundef@*/
 /*@=exportheader@*/
 
@@ -991,10 +985,10 @@ ffi_closure_helper_SYSV (ffi_closure* cl
 
 }
 
-int hidden ffi_closure_helper_LINUX64 (ffi_closure*, void*, unsigned long*,
-				       ffi_dblfl*);
+int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure*, void*, unsigned long*,
+					   ffi_dblfl*);
 
-int hidden
+int FFI_HIDDEN
 ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
 			    unsigned long *pst, ffi_dblfl *pfr)
 {
--- libffi/src/powerpc/linux64_closure.S.jj	2005-02-28 13:23:28.000000000 +0100
+++ libffi/src/powerpc/linux64_closure.S	2005-08-10 20:17:24.000000000 +0200
@@ -5,7 +5,8 @@
 	.file	"linux64_closure.S"
 
 #ifdef __powerpc64__
-	.hidden ffi_closure_LINUX64, .ffi_closure_LINUX64
+	FFI_HIDDEN (ffi_closure_LINUX64)
+	FFI_HIDDEN (.ffi_closure_LINUX64)
 	.globl  ffi_closure_LINUX64, .ffi_closure_LINUX64
 	.section        ".opd","aw"
 	.align  3
--- libffi/src/x86/ffi.c.jj	2004-03-16 20:17:33.000000000 +0100
+++ libffi/src/x86/ffi.c	2005-08-10 20:15:24.000000000 +0200
@@ -241,26 +241,24 @@ void ffi_call(/*@dependent@*/ ffi_cif *c
 
 static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
 					 void** args, ffi_cif* cif);
-static void ffi_closure_SYSV (ffi_closure *)
+void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)
      __attribute__ ((regparm(1)));
-static void ffi_closure_raw_SYSV (ffi_raw_closure *)
+unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
+     __attribute__ ((regparm(1)));
+void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
      __attribute__ ((regparm(1)));
 
 /* This function is jumped to by the trampoline */
 
-static void
-ffi_closure_SYSV (closure)
+unsigned int FFI_HIDDEN
+ffi_closure_SYSV_inner (closure, respp, args)
      ffi_closure *closure;
+     void **respp;
+     void *args;
 {
-  // this is our return value storage
-  long double    res;
-
   // our various things...
   ffi_cif       *cif;
   void         **arg_area;
-  unsigned short rtype;
-  void          *resp = (void*)&res;
-  void *args = __builtin_dwarf_cfa ();
 
   cif         = closure->cif;
   arg_area    = (void**) alloca (cif->nargs * sizeof (void*));  
@@ -271,46 +269,11 @@ ffi_closure_SYSV (closure)
    * a structure, it will re-set RESP to point to the
    * structure return address.  */
 
-  ffi_prep_incoming_args_SYSV(args, (void**)&resp, arg_area, cif);
-  
-  (closure->fun) (cif, resp, arg_area, closure->user_data);
+  ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif);
 
-  rtype = cif->flags;
+  (closure->fun) (cif, *respp, arg_area, closure->user_data);
 
-  /* now, do a generic return based on the value of rtype */
-  if (rtype == FFI_TYPE_INT)
-    {
-      asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (rtype == FFI_TYPE_FLOAT)
-    {
-      asm ("flds (%0)" : : "r" (resp) : "st" );
-    }
-  else if (rtype == FFI_TYPE_DOUBLE)
-    {
-      asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_LONGDOUBLE)
-    {
-      asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_SINT64)
-    {
-      asm ("movl 0(%0),%%eax;"
-	   "movl 4(%0),%%edx" 
-	   : : "r"(resp)
-	   : "eax", "edx");
-    }
-#ifdef X86_WIN32
-  else if (rtype == FFI_TYPE_SINT8) /* 1-byte struct  */
-    {
-      asm ("movsbl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (rtype == FFI_TYPE_SINT16) /* 2-bytes struct */
-    {
-      asm ("movswl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-#endif
+  return cif->flags;
 }
 
 /*@-exportheader@*/
@@ -394,57 +357,6 @@ ffi_prep_closure (ffi_closure* closure,
 
 #if !FFI_NO_RAW_API
 
-static void
-ffi_closure_raw_SYSV (closure)
-     ffi_raw_closure *closure;
-{
-  // this is our return value storage
-  long double    res;
-
-  // our various things...
-  ffi_raw         *raw_args;
-  ffi_cif         *cif;
-  unsigned short   rtype;
-  void            *resp = (void*)&res;
-
-  /* get the cif */
-  cif = closure->cif;
-
-  /* the SYSV/X86 abi matches the RAW API exactly, well.. almost */
-  raw_args = (ffi_raw*) __builtin_dwarf_cfa ();
-
-  (closure->fun) (cif, resp, raw_args, closure->user_data);
-
-  rtype = cif->flags;
-
-  /* now, do a generic return based on the value of rtype */
-  if (rtype == FFI_TYPE_INT)
-    {
-      asm ("movl (%0),%%eax" : : "r" (resp) : "eax");
-    }
-  else if (rtype == FFI_TYPE_FLOAT)
-    {
-      asm ("flds (%0)" : : "r" (resp) : "st" );
-    }
-  else if (rtype == FFI_TYPE_DOUBLE)
-    {
-      asm ("fldl (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_LONGDOUBLE)
-    {
-      asm ("fldt (%0)" : : "r" (resp) : "st", "st(1)" );
-    }
-  else if (rtype == FFI_TYPE_SINT64)
-    {
-      asm ("movl 0(%0),%%eax; movl 4(%0),%%edx" 
-	   : : "r"(resp)
-	   : "eax", "edx");
-    }
-}
-
- 
-
-
 ffi_status
 ffi_prep_raw_closure (ffi_raw_closure* closure,
 		      ffi_cif* cif,
--- libffi/src/x86/sysv.S.jj	2005-02-28 13:23:32.000000000 +0100
+++ libffi/src/x86/sysv.S	2005-08-10 20:16:01.000000000 +0200
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003  Red Hat, Inc.
+   sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005  Red Hat, Inc.
    
    X86 Foreign Function Interface 
 
@@ -130,6 +130,135 @@ epilogue:
 .ffi_call_SYSV_end:
         .size    ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
 
+	.align	4
+FFI_HIDDEN (ffi_closure_SYSV)
+.globl ffi_closure_SYSV
+	.type	ffi_closure_SYSV, @function
+
+ffi_closure_SYSV:
+.LFB2:
+	pushl	%ebp
+.LCFI2:
+	movl	%esp, %ebp
+.LCFI3:
+	subl	$40, %esp
+	leal	-24(%ebp), %edx
+	movl	%edx, -12(%ebp)	/* resp */
+	leal	8(%ebp), %edx
+	movl	%edx, 4(%esp)	/* args = __builtin_dwarf_cfa () */
+	leal	-12(%ebp), %edx
+	movl	%edx, (%esp)	/* &resp */
+#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
+	call	ffi_closure_SYSV_inner
+#else
+	movl	%ebx, 8(%esp)
+.LCFI7:
+	call	1f
+1:	popl	%ebx
+	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
+	call	ffi_closure_SYSV_inner at PLT
+	movl	8(%esp), %ebx
+#endif
+	movl	-12(%ebp), %ecx
+	cmpl	$FFI_TYPE_INT, %eax
+	je	.Lcls_retint
+	cmpl	$FFI_TYPE_FLOAT, %eax
+	je	.Lcls_retfloat
+	cmpl	$FFI_TYPE_DOUBLE, %eax
+	je	.Lcls_retdouble
+	cmpl	$FFI_TYPE_LONGDOUBLE, %eax
+	je	.Lcls_retldouble
+	cmpl	$FFI_TYPE_SINT64, %eax
+	je	.Lcls_retllong
+.Lcls_epilogue:
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+.Lcls_retint:
+	movl	(%ecx), %eax
+	jmp	.Lcls_epilogue
+.Lcls_retfloat:
+	flds	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retdouble:
+	fldl	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retldouble:
+	fldt	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retllong:
+	movl	(%ecx), %eax
+	movl	4(%ecx), %edx
+	jmp	.Lcls_epilogue
+.LFE2:
+	.size	ffi_closure_SYSV, .-ffi_closure_SYSV
+
+#if !FFI_NO_RAW_API
+
+#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
+#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
+#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
+#define CIF_FLAGS_OFFSET 20
+
+	.align	4
+FFI_HIDDEN (ffi_closure_raw_SYSV)
+.globl ffi_closure_raw_SYSV
+	.type	ffi_closure_raw_SYSV, @function
+
+ffi_closure_raw_SYSV:
+.LFB3:
+	pushl	%ebp
+.LCFI4:
+	movl	%esp, %ebp
+.LCFI5:
+	pushl	%esi
+.LCFI6:
+	subl	$36, %esp
+	movl	RAW_CLOSURE_CIF_OFFSET(%eax), %esi	 /* closure->cif */
+	movl	RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
+	movl	%edx, 12(%esp)	/* user_data */
+	leal	8(%ebp), %edx	/* __builtin_dwarf_cfa () */
+	movl	%edx, 8(%esp)	/* raw_args */
+	leal	-24(%ebp), %edx
+	movl	%edx, 4(%esp)	/* &res */
+	movl	%esi, (%esp)	/* cif */
+	call	*RAW_CLOSURE_FUN_OFFSET(%eax)		 /* closure->fun */
+	movl	CIF_FLAGS_OFFSET(%esi), %eax		 /* rtype */
+	cmpl	$FFI_TYPE_INT, %eax
+	je	.Lrcls_retint
+	cmpl	$FFI_TYPE_FLOAT, %eax
+	je	.Lrcls_retfloat
+	cmpl	$FFI_TYPE_DOUBLE, %eax
+	je	.Lrcls_retdouble
+	cmpl	$FFI_TYPE_LONGDOUBLE, %eax
+	je	.Lrcls_retldouble
+	cmpl	$FFI_TYPE_SINT64, %eax
+	je	.Lrcls_retllong
+.Lrcls_epilogue:
+	addl	$36, %esp
+	popl	%esi
+	popl	%ebp
+	ret
+.Lrcls_retint:
+	movl	-24(%ebp), %eax
+	jmp	.Lrcls_epilogue
+.Lrcls_retfloat:
+	flds	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retdouble:
+	fldl	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retldouble:
+	fldt	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retllong:
+	movl	-24(%ebp), %eax
+	movl	-20(%ebp), %edx
+	jmp	.Lrcls_epilogue
+.LFE3:
+	.size	ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
+#endif
+
 	.section	.eh_frame,EH_FRAME_FLAGS, at progbits
 .Lframe1:
 	.long	.LECIE1-.LSCIE1	/* Length of Common Information Entry */
@@ -180,6 +309,71 @@ epilogue:
 	.byte	0x5	/* .uleb128 0x5 */
 	.align 4
 .LEFDE1:
+.LSFDE2:
+	.long	.LEFDE2-.LASFDE2	/* FDE Length */
+.LASFDE2:
+	.long	.LASFDE2-.Lframe1	/* FDE CIE offset */
+#ifdef __PIC__
+	.long	.LFB2-.	/* FDE initial location */
+#else
+	.long	.LFB2
+#endif
+	.long	.LFE2-.LFB2	/* FDE address range */
+#ifdef __PIC__
+	.byte	0x0	/* .uleb128 0x0; Augmentation size */
+#endif
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI2-.LFB2
+	.byte	0xe	/* DW_CFA_def_cfa_offset */
+	.byte	0x8	/* .uleb128 0x8 */
+	.byte	0x85	/* DW_CFA_offset, column 0x5 */
+	.byte	0x2	/* .uleb128 0x2 */
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI3-.LCFI2
+	.byte	0xd	/* DW_CFA_def_cfa_register */
+	.byte	0x5	/* .uleb128 0x5 */
+#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI7-.LCFI3
+	.byte	0x83	/* DW_CFA_offset, column 0x3 */
+	.byte	0xa	/* .uleb128 0xa */
+#endif
+	.align 4
+.LEFDE2:
+
+#if !FFI_NO_RAW_API
+
+.LSFDE3:
+	.long	.LEFDE3-.LASFDE3	/* FDE Length */
+.LASFDE3:
+	.long	.LASFDE3-.Lframe1	/* FDE CIE offset */
+#ifdef __PIC__
+	.long	.LFB3-.	/* FDE initial location */
+#else
+	.long	.LFB3
+#endif
+	.long	.LFE3-.LFB3	/* FDE address range */
+#ifdef __PIC__
+	.byte	0x0	/* .uleb128 0x0; Augmentation size */
+#endif
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI4-.LFB3
+	.byte	0xe	/* DW_CFA_def_cfa_offset */
+	.byte	0x8	/* .uleb128 0x8 */
+	.byte	0x85	/* DW_CFA_offset, column 0x5 */
+	.byte	0x2	/* .uleb128 0x2 */
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI5-.LCFI4
+	.byte	0xd	/* DW_CFA_def_cfa_register */
+	.byte	0x5	/* .uleb128 0x5 */
+	.byte	0x4	/* DW_CFA_advance_loc4 */
+	.long	.LCFI6-.LCFI5
+	.byte	0x86	/* DW_CFA_offset, column 0x6 */
+	.byte	0x3	/* .uleb128 0x3 */
+	.align 4
+.LEFDE3:
+
+#endif
 
 #endif /* ifndef __x86_64__ */
 
--- libffi/src/x86/win32.S.jj	2004-03-16 20:17:33.000000000 +0100
+++ libffi/src/x86/win32.S	2005-08-10 11:55:10.000000000 +0200
@@ -257,3 +257,117 @@ sc_epilogue:
         ret
 
 .ffi_call_STDCALL_end:
+
+	.globl _ffi_closure_SYSV
+_ffi_closure_SYSV:
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$40, %esp
+	leal	-24(%ebp), %edx
+	movl	%edx, -12(%ebp)	/* resp */
+	leal	8(%ebp), %edx
+	movl	%edx, 4(%esp)	/* args = __builtin_dwarf_cfa () */
+	leal	-12(%ebp), %edx
+	movl	%edx, (%esp)	/* &resp */
+	call	_ffi_closure_SYSV_inner
+	movl	-12(%ebp), %ecx
+	cmpl	$FFI_TYPE_INT, %eax
+	je	.Lcls_retint
+	cmpl	$FFI_TYPE_FLOAT, %eax
+	je	.Lcls_retfloat
+	cmpl	$FFI_TYPE_DOUBLE, %eax
+	je	.Lcls_retdouble
+	cmpl	$FFI_TYPE_LONGDOUBLE, %eax
+	je	.Lcls_retldouble
+	cmpl	$FFI_TYPE_SINT64, %eax
+	je	.Lcls_retllong
+	cmpl	$FFI_TYPE_SINT8, %eax	/* 1-byte struct */
+	je	.Lcls_retstruct1
+	cmpl	$FFI_TYPE_SINT16, %eax	/* 2-bytes struct */
+	je	.Lcls_retstruct2
+.Lcls_epilogue:
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+.Lcls_retint:
+	movl	(%ecx), %eax
+	jmp	.Lcls_epilogue
+.Lcls_retfloat:
+	flds	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retdouble:
+	fldl	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retldouble:
+	fldt	(%ecx)
+	jmp	.Lcls_epilogue
+.Lcls_retllong:
+	movl	(%ecx), %eax
+	movl	4(%ecx), %edx
+	jmp	.Lcls_epilogue
+.Lcls_retstruct1:
+	movsbl	(%ecx), %eax
+	jmp	.Lcls_epilogue
+.Lcls_retstruct2:
+	movswl	(%ecx), %eax
+	jmp	.Lcls_epilogue
+.ffi_closure_SYSV_end:
+
+#if !FFI_NO_RAW_API
+
+#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3)
+#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
+#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
+#define CIF_FLAGS_OFFSET 20
+
+	.balign	16
+	.globl _ffi_closure_raw_SYSV
+_ffi_closure_raw_SYSV:
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%esi
+	subl	$36, %esp
+	movl	RAW_CLOSURE_CIF_OFFSET(%eax), %esi	 /* closure->cif */
+	movl	RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
+	movl	%edx, 12(%esp)	/* user_data */
+	leal	8(%ebp), %edx	/* __builtin_dwarf_cfa () */
+	movl	%edx, 8(%esp)	/* raw_args */
+	leal	-24(%ebp), %edx
+	movl	%edx, 4(%esp)	/* &res */
+	movl	%esi, (%esp)	/* cif */
+	call	*RAW_CLOSURE_FUN_OFFSET(%eax)		 /* closure->fun */
+	movl	CIF_FLAGS_OFFSET(%esi), %eax		 /* rtype */
+	cmpl	$FFI_TYPE_INT, %eax
+	je	.Lrcls_retint
+	cmpl	$FFI_TYPE_FLOAT, %eax
+	je	.Lrcls_retfloat
+	cmpl	$FFI_TYPE_DOUBLE, %eax
+	je	.Lrcls_retdouble
+	cmpl	$FFI_TYPE_LONGDOUBLE, %eax
+	je	.Lrcls_retldouble
+	cmpl	$FFI_TYPE_SINT64, %eax
+	je	.Lrcls_retllong
+.Lrcls_epilogue:
+	addl	$36, %esp
+	popl	%esi
+	popl	%ebp
+	ret
+.Lrcls_retint:
+	movl	-24(%ebp), %eax
+	jmp	.Lrcls_epilogue
+.Lrcls_retfloat:
+	flds	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retdouble:
+	fldl	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retldouble:
+	fldt	-24(%ebp)
+	jmp	.Lrcls_epilogue
+.Lrcls_retllong:
+	movl	-24(%ebp), %eax
+	movl	-20(%ebp), %edx
+	jmp	.Lrcls_epilogue
+.ffi_closure_raw_SYSV_end:
+
+#endif

gcc4-pr23299.patch:
 rtlanal.c                      |   21 +++++++++++--
 testsuite/g++.dg/opt/pr23299.C |   63 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 3 deletions(-)

--- NEW FILE gcc4-pr23299.patch ---
2005-08-09  Jakub Jelinek  <jakub at redhat.com>

	PR rtl-optimization/23299
	Backport from mainline
	2005-03-16 Dale Johannesen  <dalej at apple.com>
	* rtlanal.c (find_first_parameter_load):  Rewrite to
	return actual first param load or the call if none,
	instead of first in block, when not all loads exist.

	* g++.dg/opt/pr23299.C: New test.

--- gcc/rtlanal.c	11 Mar 2005 03:14:44 -0000	1.212
+++ gcc/rtlanal.c	16 Mar 2005 20:42:37 -0000	1.213
@@ -3159,12 +3159,15 @@ parms_set (rtx x, rtx pat ATTRIBUTE_UNUS
 }
 
 /* Look backward for first parameter to be loaded.
+   Note that loads of all parameters will not necessarily be
+   found if CSE has eliminated some of them (e.g., an argument
+   to the outer function is passed down as a parameter).
    Do not skip BOUNDARY.  */
 rtx
 find_first_parameter_load (rtx call_insn, rtx boundary)
 {
   struct parms_set_data parm;
-  rtx p, before;
+  rtx p, before, first_set;
 
   /* Since different machines initialize their parameter registers
      in different orders, assume nothing.  Collect the set of all
@@ -3186,6 +3189,7 @@ find_first_parameter_load (rtx call_insn
 	parm.nregs++;
       }
   before = call_insn;
+  first_set = call_insn;
 
   /* Search backward for the first set of a register in this set.  */
   while (parm.nregs && before != boundary)
@@ -3208,9 +3212,20 @@ find_first_parameter_load (rtx call_insn
 	}
 
       if (INSN_P (before))
-	note_stores (PATTERN (before), parms_set, &parm);
+	{
+	  int nregs_old = parm.nregs;
+	  note_stores (PATTERN (before), parms_set, &parm);
+	  /* If we found something that did not set a parameter reg,
+	     we're done.  Do not keep going, as that might result
+	     in hoisting an insn before the setting of a pseudo
+	     that is used by the hoisted insn. */
+	  if (nregs_old != parm.nregs)
+	    first_set = before;
+	  else
+	    break;
+	}
     }
-  return before;
+  return first_set;
 }
 
 /* Return true if we should avoid inserting code between INSN and preceding
--- gcc/testsuite/g++.dg/opt/pr23299.C.jj	2005-08-09 19:59:26.000000000 +0200
+++ gcc/testsuite/g++.dg/opt/pr23299.C	2005-08-09 19:59:38.000000000 +0200
@@ -0,0 +1,63 @@
+// PR rtl-optimization/23299
+// { dg-do run }
+// { dg-options "-Os" }
+
+extern "C" void abort ();
+
+struct A
+{
+  virtual int a () {}
+};
+struct B : public A
+{
+  virtual int b () {}
+};
+struct C : public A
+{
+  virtual int c () {}
+};
+struct D
+{
+  D () { d = 64; }
+  ~D ();
+  int d;
+};
+
+int x;
+D::~D ()
+{
+  x |= 1;
+  if (d != 64)
+    abort ();
+}
+
+struct E : public B, public C
+{
+  E () {}
+  virtual int c ();
+  ~E ();
+  D dv;
+};
+
+E::~E ()
+{
+  int r = c ();
+}
+
+int
+E::c ()
+{
+  if (x > 10)
+    throw 1;
+  x |= 2;
+}
+
+int
+main (void)
+{
+  {
+    E e;
+  }
+  if (x != 3)
+    abort ();
+}


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/.cvsignore,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- .cvsignore	8 Aug 2005 14:48:45 -0000	1.104
+++ .cvsignore	10 Aug 2005 21:18:25 -0000	1.105
@@ -1 +1 @@
-gcc-4.0.1-20050808.tar.bz2
+gcc-4.0.1-20050810.tar.bz2


Index: gcc4.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc4.spec,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- gcc4.spec	8 Aug 2005 20:07:10 -0000	1.63
+++ gcc4.spec	10 Aug 2005 21:18:25 -0000	1.64
@@ -1,6 +1,6 @@
-%define DATE 20050808
+%define DATE 20050810
 %define gcc_version 4.0.1
-%define gcc_release 7
+%define gcc_release 8
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
 %ifarch %{ix86} alpha ia64 x86_64 s390 sparc sparc64
@@ -100,10 +100,12 @@
 Patch18: gcc4-ia64-stack-protector.patch
 Patch19: gcc4-s390-stack-protector.patch
 Patch20: gcc4-pr22052.patch
-Patch21: gcc4-libffi-ppc-cfi.patch
+Patch21: gcc4-libffi-x86.patch
 Patch22: gcc4-ppc32-msecure-plt.patch
 Patch23: gcc4-pr17828-test.patch
-Patch24: gcc4-fortran-buffer-overflow.patch
+Patch24: gcc4-pr23299.patch
+Patch25: gcc4-dwarf2-usefbreg.patch
+Patch26: gcc4-dwarf2-prefer-1elt-vartracking.patch
 
 %define _gnu %{nil}
 %ifarch sparc
@@ -433,10 +435,12 @@
 %patch18 -p0 -b .ia64-stack-protector~
 %patch19 -p0 -b .s390-stack-protector~
 %patch20 -p0 -b .pr22052~
-%patch21 -p0 -b .libffi-ppc-cfi~
+%patch21 -p0 -b .libffi-x86~
 %patch22 -p0 -b .ppc32-msecure-plt~
 %patch23 -p0 -b .pr17828-test~
-%patch24 -p0 -b .fortran-buffer-overflow~
+%patch24 -p0 -b .pr23299~
+%patch25 -p0 -b .dwarf2-usefbreg~
+%patch26 -p0 -b .dwarf2-prefer-1elt-vartracking~
 
 perl -pi -e 's/4\.0\.2/4.0.1/' gcc/version.c
 perl -pi -e 's/"%{gcc_version}"/"%{gcc_version} \(release\)"/' gcc/version.c
@@ -1464,6 +1468,19 @@
 %endif
 
 %changelog
+* Wed Aug 10 2005 Jakub Jelinek  <jakub at redhat.com> 4.0.1-8
+- update from CVS
+  - PRs middle-end/21894, middle-end/22439, target/23309, c++/20646,
+	c++/22508, libffi/21819, libfortran/22143, libfortran/23154,
+	rtl-optimization/23241
+- fix x86 libffi with -fstack-protector
+- fix hoisting to basic blocks ending with possibly throwing call
+  whose some hard register arg setups have been CSEd out
+  (Dale Johannesen, #163195, PR rtl-optimization/23299)
+- use DW_OP_fbreg where possible (#165514)
+- prefer var tracking gathered locations even if they are the same
+  throughout the whole function (#165514)
+
 * Mon Aug  8 2005 Jakub Jelinek  <jakub at redhat.com> 4.0.1-7
 - update from CVS
   - PRs c++/23191, c/22311, c/22458, fortran/22010, libfortran/23178,


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/sources,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- sources	8 Aug 2005 14:48:45 -0000	1.106
+++ sources	10 Aug 2005 21:18:25 -0000	1.107
@@ -1 +1 @@
-22bcd7ef4b40e18afdc0a16ac20f7d58  gcc-4.0.1-20050808.tar.bz2
+03206f00f288097d5afd3d65dd3403a3  gcc-4.0.1-20050810.tar.bz2


--- gcc4-fortran-buffer-overflow.patch DELETED ---


--- gcc4-libffi-ppc-cfi.patch DELETED ---




More information about the fedora-cvs-commits mailing list