rpms/gcc/devel gcc41-ppc-libffi.patch, NONE, 1.1 gcc41-pr25717.patch, NONE, 1.1 gcc41-rh177918.patch, NONE, 1.1 .cvsignore, 1.125, 1.126 gcc41.spec, 1.16, 1.17 sources, 1.127, 1.128 gcc41-gomp-lastprivate-static.patch, 1.1, NONE gcc41-pr24940.patch, 1.1, NONE gcc41-pr25535.patch, 1.1, NONE gcc41-rh176562.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jan 17 18:05:15 UTC 2006


Author: jakub

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

Modified Files:
	.cvsignore gcc41.spec sources 
Added Files:
	gcc41-ppc-libffi.patch gcc41-pr25717.patch 
	gcc41-rh177918.patch 
Removed Files:
	gcc41-gomp-lastprivate-static.patch gcc41-pr24940.patch 
	gcc41-pr25535.patch gcc41-rh176562.patch 
Log Message:
4.1.0-0.15


gcc41-ppc-libffi.patch:
 ppc_closure.S |   62 ++++++++++++++++++++++++++--------------------------------
 sysv.S        |   10 +++++++--
 2 files changed, 36 insertions(+), 36 deletions(-)

--- NEW FILE gcc41-ppc-libffi.patch ---
On Tue, Jul 19, 2005 at 11:19:14PM +0200, Andreas Tobler wrote:
> 
> >Okay with those changes.
> >
> >Thanks, David
> 
> I committed the attached.
> Thanks David, for review.

2005-07-19  Andreas Tobler  <a.tobler at schweiz.ch>

        * Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD.
        * Makefile.in: Regenerate.
        * include/Makefile.in: Likewise.
        * testsuite/Makefile.in: Likewise.
        * configure.ac: Add POWERPC_FREEBSD rules.
        * configure: Regenerate.
        * src/powerpc/ffitarget.h: Add POWERPC_FREEBSD rules.
        (FFI_SYSV_TYPE_SMALL_STRUCT): Define.
        * src/powerpc/ffi.c: Add flags to handle small structure returns
        in ffi_call_SYSV.
        (ffi_prep_cif_machdep): Handle small structures for SYSV 4 ABI.
        Aka FFI_SYSV.
        (ffi_closure_helper_SYSV): Likewise.
        * src/powerpc/ppc_closure.S: Add return types for small structures.
        * src/powerpc/sysv.S: Add bits to handle small structures for
        final SYSV 4 ABI.

This patch broke libffi on powerpc*-linux, because the

> +	lwz %r3,0(%r6)
> +	lwz %r4,4(%r6)
> +	bl __lshrdi3	# libgcc function to shift r3/r4, shift value in r5.
> +	b .Lfinish

and

> +	rlwinm  %r5,%r31,5+23,32-5,31 /* Extract the value to shift.  */
> +	bl	__ashldi3  /* libgcc function to shift r3/r4,
> +			      shift value in r5.  */

calls aren't PLT calls even in libffi.so and libffi_convenience.a.
This in turn makes libgcj.so.7 a DT_TEXTREL library and
a) in largish Java programs the relocation can easily fail, libgcc_s.so.1
   can be mapped too far from libgcj.so.7
b) SELinux policy might by default refuse textrel libraries, unless
   whitelisted

Simply adding @plt is not an option, because that would still be broken
on -msecure-plt builds.
So, either we'd need to add configury stuff to detect -msecure-plt support
in the assembler, conditionally add the:
        bcl 20,31,.LCF0
.LCF0:
        stw 30,8(1)
        mflr 30
...
        addis 30,30,_GLOBAL_OFFSET_TABLE_-.LCF0 at ha
        addi 30,30,_GLOBAL_OFFSET_TABLE_-.LCF0 at l
etc. stuff and make the 2 calls @plt, or we can inline the calls.
The latter is done by the attached patch.
The __ashldi3 inline call can be simplified, because we know %r5 must be
0, 8, 16 or 24, so it will be also faster than __ashldi3, even when not
counting the overhead of a PLT call.
For the closure, the small struct reg passing patch added IMHO completely
unnecessarily 7 instructions to the fast path - returning small structs
is pretty rare and those insns would be wasting time for all return types.
For 1, 2, 3, 4 and 8 byte structs we can easily fit the insn sequences
into the 4 insn slots and don't need to run through lots of nops.
For 5, 6 and 7 byte structs 4 insns is not enough, but in that case
we know the shift count is only 8, 16 or 24, so the __lshrdi3 operation can
be simplified even further and inlined.

I don't have access to powerpc*-*-freebsd*, so I have just briefly tested
the sysv.S change with powerpc64-*-linux -> powerpc*-*-freebsd* cross
compiling and writing my own testcase that called the freebsd cross compiler
compiled routines, but I haven't really tested the ppc_closure.S bits
(I ran make check on powerpc64-*-linux* -m32, but that doesn't test those
bits).

Can anyone please test this on powerpc*-*-freebsd*?

Ok for trunk/4.1 if that testing succeeds?

2006-01-17  Jakub Jelinek  <jakub at redhat.com>

	* src/powerpc/sysv.S (smst_two_register): Don't call __ashldi3, instead
	do the shifting inline.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't compute %r5
	shift count unconditionally.  Simplify load sequences for 1, 2, 3, 4
	and 8 byte structs, for the remaining struct sizes don't call __lshrdi3,
	instead do the shifting inline.

--- libffi/src/powerpc/sysv.S.jj	2005-11-12 18:08:36.000000000 +0100
+++ libffi/src/powerpc/sysv.S	2006-01-17 13:36:16.000000000 +0100
@@ -140,8 +140,14 @@ L(smst_one_register):
 	b	L(done_return_value)
 L(smst_two_register):
 	rlwinm  %r5,%r31,5+23,32-5,31 /* Extract the value to shift.  */
-	bl	__ashldi3  /* libgcc function to shift r3/r4,
-			      shift value in r5.  */
+	cmpwi	%r5,0
+	subfic	%r9,%r5,32
+	slw	%r29,%r3,%r5
+	srw	%r9,%r4,%r9
+	beq-	L(smst_8byte)
+	or	%r3,%r9,%r29
+	slw	%r4,%r4,%r5
+L(smst_8byte):
 	stw	%r3,0(%r30)
 	stw	%r4,4(%r30)
 	b	L(done_return_value)
--- libffi/src/powerpc/ppc_closure.S.jj	2005-11-12 18:08:36.000000000 +0100
+++ libffi/src/powerpc/ppc_closure.S	2006-01-17 13:59:59.000000000 +0100
@@ -63,19 +63,6 @@ ENTRY(ffi_closure_SYSV)
 	# so use it to look up in a table
 	# so we know how to deal with each type
 
-	# Extract the size of the return type for small structures.
-	# Then calculate (4 - size) and multiply the result by 8.
-	# This gives the value needed for the shift operation below.
-	# This part is only needed for FFI_SYSV and small structures.
-	addi	%r5,%r3,-(FFI_SYSV_TYPE_SMALL_STRUCT)
-	cmpwi	cr0,%r5,4
-	ble	cr0,.Lnext
-	addi	%r5,%r5,-4
-.Lnext:
-	addi	%r5,%r5,-4
-	neg	%r5,%r5
-	slwi	%r5,%r5,3
-
 	# look up the proper starting point in table
 	# by using return type as offset
 	addi %r6,%r1,112   # get pointer to results area
@@ -207,66 +194,66 @@ ENTRY(ffi_closure_SYSV)
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
 .Lret_type15:
 # fall through.
-	nop
-	nop
+	lbz %r3,0(%r6)
+	b .Lfinish
 	nop
 	nop
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct.
 .Lret_type16:
 # fall through.
-	nop
-	nop
+	lhz %r3,0(%r6)
+	b .Lfinish
 	nop
 	nop
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct.
 .Lret_type17:
 # fall through.
-	nop
-	nop
-	nop
+	lwz %r3,0(%r6)
+	srwi %r3,%r3,8
+	b .Lfinish
 	nop
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct.
 .Lret_type18:
 # this one handles the structs from above too.
 	lwz %r3,0(%r6)
-	srw %r3,%r3,%r5
 	b .Lfinish
 	nop
+	nop
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct.
 .Lret_type19:
 # fall through.
-	nop
-	nop
-	nop
-	nop
+	lwz %r3,0(%r6)
+	lwz %r4,4(%r6)
+	li %r5,24
+	b .Lstruct567
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct.
 .Lret_type20:
 # fall through.
-	nop
-	nop
-	nop
-	nop
+	lwz %r3,0(%r6)
+	lwz %r4,4(%r6)
+	li %r5,16
+	b .Lstruct567
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct.
 .Lret_type21:
 # fall through.
-	nop
-	nop
-	nop
-	nop
+	lwz %r3,0(%r6)
+	lwz %r4,4(%r6)
+	li %r5,8
+	b .Lstruct567
 
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct.
 .Lret_type22:
 # this one handles the above unhandled structs.
 	lwz %r3,0(%r6)
 	lwz %r4,4(%r6)
-	bl __lshrdi3	# libgcc function to shift r3/r4, shift value in r5.
 	b .Lfinish
+	nop
 
 # case done
 .Lfinish:
@@ -275,6 +262,13 @@ ENTRY(ffi_closure_SYSV)
 	mtlr %r0
 	addi %r1,%r1,144
 	blr
+
+.Lstruct567:
+	slw %r0,%r3,%r5
+	srw %r4,%r4,%r5
+	srw %r3,%r3,%r5
+	or %r4,%r0,%r4
+	b .Lfinish
 END(ffi_closure_SYSV)
 
 	.section	".eh_frame",EH_FRAME_FLAGS, at progbits


	Jakub

gcc41-pr25717.patch:
 init.c  |    8 +++++++-
 macro.c |   14 +++++---------
 2 files changed, 12 insertions(+), 10 deletions(-)

--- NEW FILE gcc41-pr25717.patch ---
Hi!

PR25717 complains that gcc -E -dD -xc /dev/null doesn't print __STDC__ macro
definition like it used to do up to GCC 3.2.
__STDC__ macro still won't be printed on Solaris/Interix with -dD/-dM and
when not using one of the pedantic standards (-std=c89, -std=c99, etc.),
but in that case it is IMHO desirable, because __STDC__ doesn't act as a
normal macro in that case, and it also matches GCC 3.2 behaviour which had:
#ifdef STDC_0_IN_SYSTEM_HEADERS
  B("__STDC__",          BT_STDC),
#else
  C("__STDC__",          "1"),
#endif

Ok for 4.0/4.1/trunk?

2006-01-16  Jakub Jelinek  <jakub at redhat.com>

	PR preprocessor/25717
	* init.c (cpp_init_builtins): If __STDC__ will not change value
	between system headers and other sources, define it as a normal
	macro rather than a builtin.
	* macro.c (_cpp_builtin_macro_text) <case BT_STDC>: Only check
	cpp_in_system_header condition.

--- libcpp/init.c.jj	2005-11-09 22:09:47.000000000 +0100
+++ libcpp/init.c	2006-01-16 14:28:53.000000000 +0100
@@ -357,8 +357,14 @@ cpp_init_builtins (cpp_reader *pfile, in
 
   if (CPP_OPTION (pfile, traditional))
     n -= 2;
+  else if (! CPP_OPTION (pfile, stdc_0_in_system_headers)
+	   || CPP_OPTION (pfile, std))
+    {
+      n--;
+      _cpp_define_builtin (pfile, "__STDC__ 1");
+    }
 
-  for(b = builtin_array; b < builtin_array + n; b++)
+  for (b = builtin_array; b < builtin_array + n; b++)
     {
       cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len);
       hp->type = NT_MACRO;
--- libcpp/macro.c.jj	2006-01-05 10:00:21.000000000 +0100
+++ libcpp/macro.c	2006-01-16 14:25:57.000000000 +0100
@@ -169,16 +169,12 @@ _cpp_builtin_macro_text (cpp_reader *pfi
 	 However, if (a) we are in a system header, (b) the option
 	 stdc_0_in_system_headers is true (set by target config), and
 	 (c) we are not in strictly conforming mode, then it has the
-	 value 0.  */
+	 value 0.  (b) and (c) is already checked in cpp_init_builtins.  */
     case BT_STDC:
-      {
-	if (cpp_in_system_header (pfile)
-	    && CPP_OPTION (pfile, stdc_0_in_system_headers)
-	    && !CPP_OPTION (pfile,std))
-	  number = 0;
-	else
-	  number = 1;
-      }
+      if (cpp_in_system_header (pfile))
+	number = 0;
+      else
+	number = 1;
       break;
 
     case BT_DATE:

	Jakub

gcc41-rh177918.patch:
 cp/search.c                      |    2 +-
 testsuite/g++.dg/parse/lookup5.C |   26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

--- NEW FILE gcc41-rh177918.patch ---
Hi!

On the attached testcase we ICE in lookup_conversions_r, parent_convs is
NULL.  The code was introduced by Nathan for 4.0+ with
http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02102.html
and to me, without deep understanding what exactly it is doing, it
looks like a pasto from a few lines above it and indeed changing it
fixes the testcase.
Is my guess right (I'm really not familiar with that part of C+ FE)?
If so, is this ok for 4.0/4.1/trunk after testing?

2006-01-17  Jakub Jelinek  <jakub at redhat.com>

	* search.c (lookup_conversions_r): Fix a pasto.

	* g++.dg/parse/lookup5.C: New test.

--- gcc/cp/search.c.jj	2005-10-28 22:59:33.000000000 +0200
+++ gcc/cp/search.c	2006-01-17 16:34:38.000000000 +0100
@@ -2355,7 +2355,7 @@ lookup_conversions_r (tree binfo,
     {
       parent_tpl_convs = tree_cons (binfo, my_tpl_convs, parent_tpl_convs);
       if (virtual_depth)
-	TREE_STATIC (parent_convs) = 1;
+	TREE_STATIC (parent_tpl_convs) = 1;
     }
 
   child_convs = other_convs;
--- gcc/testsuite/g++.dg/parse/lookup5.C.jj	2006-01-17 16:42:26.000000000 +0100
+++ gcc/testsuite/g++.dg/parse/lookup5.C	2006-01-17 16:42:36.000000000 +0100
@@ -0,0 +1,26 @@
+// { dg-do compile }
+
+struct A {};
+
+template <class T> struct B
+{
+  T a, b;
+  B() {}
+  B(T x, T y) : a(x), b(y) {}
+  template <class U> operator B<U> () const
+  { return B<U>((U)(this->a), (U)(this->b)); }
+};
+
+template <class T> struct C : public B<int>
+{
+  T *c;
+  inline T & operator *() { return *c; }
+};
+
+template <class T> struct D : virtual public C<T> { };
+
+void
+foo (D<A> x)
+{
+  *x;
+}

	Jakub


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/.cvsignore,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- .cvsignore	6 Jan 2006 09:12:36 -0000	1.125
+++ .cvsignore	17 Jan 2006 18:05:12 -0000	1.126
@@ -1 +1 @@
-gcc-4.1.0-20060106.tar.bz2
+gcc-4.1.0-20060117.tar.bz2


Index: gcc41.spec
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/gcc41.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- gcc41.spec	6 Jan 2006 09:12:36 -0000	1.16
+++ gcc41.spec	17 Jan 2006 18:05:12 -0000	1.17
@@ -1,6 +1,6 @@
-%define DATE 20060106
+%define DATE 20060117
 %define gcc_version 4.1.0
-%define gcc_release 0.14
+%define gcc_release 0.15
 %define _unpackaged_files_terminate_build 0
 %define multilib_64_archs sparc64 ppc64 s390x x86_64
 %ifarch %{ix86} x86_64 ia64
@@ -95,11 +95,10 @@
 Patch14: gcc41-ppc64-sync.patch
 Patch15: gcc41-ppc32-retaddr.patch
 Patch16: gcc41-s390-atomic1.patch
-Patch17: gcc41-gomp-lastprivate-static.patch
-Patch18: gcc41-pr25535.patch
+Patch17: gcc41-ppc-libffi.patch
+Patch18: gcc41-pr25717.patch
 Patch19: gcc41-pr25324.patch
-Patch20: gcc41-rh176562.patch
-Patch21: gcc41-pr24940.patch
+Patch20: gcc41-rh177918.patch
 
 %define _gnu %{nil}
 %ifarch sparc
@@ -446,11 +445,10 @@
 %patch14 -p0 -b .ppc64-sync~
 %patch15 -p0 -b .ppc32-retaddr~
 %patch16 -p0 -b .s390-atomic1~
-%patch17 -p0 -b .gomp-lastprivate-static~
-%patch18 -p0 -b .pr25535~
+%patch17 -p0 -b .ppc-libffi~
+%patch18 -p0 -b .pr25717~
 %patch19 -p0 -b .pr25324~
-%patch20 -p0 -b .rh176562~
-%patch21 -p0 -b .pr24940~
+%patch20 -p0 -b .rh177918~
 
 sed -i -e 's/4\.1\.0/4.1.0/' gcc/BASE-VER gcc/version.c
 sed -i -e 's/" (Red Hat[^)]*)"/" (Red Hat %{version}-%{gcc_release})"/' gcc/version.c
@@ -1536,6 +1534,25 @@
 %endif
 
 %changelog
+* Tue Jan 17 2006 Jakub Jelinek <jakub at redhat.com> 4.1.0-0.15
+- update from gcc-4_1-branch (-r109401:109815)
+  - PRs c++/24824, c++/25386, c++/25663, c/25682, classpath/25803,
+	fortran/12456, fortran/20868, fortran/20870, fortran/21256,
+	fortran/21977, fortran/22146, fortran/24640, fortran/25029,
+	fortran/25093, fortran/25101, fortran/25486, fortran/25598,
+	fortran/25730, libgcj/21637, libgcj/23499, libgfortran/25598,
+	libstdc++/23591, libstdc++/25472, rtl-optimization/24257,
+	rtl-optimization/25367, rtl-optimization/25662, target/20754,
+	target/25042, target/25168, testsuite/25728, testsuite/25777,
+	tree-opt/24365, tree-optimization/23109, tree-optimization/23948,
+	tree-optimization/24123, tree-optimization/25125
+- update from gomp-20050608-branch (up to -r109816)
+- fix ppc32 libffi (#177655)
+- fix lookup_conversions_r (#177918)
+- define __STDC__ as a normal macro rather than a preprocessor builtin
+  unless it needs to change its value between system and non-system
+  headers (PR preprocessor/25717)
+
 * Fri Jan  6 2006 Jakub Jelinek <jakub at redhat.com> 4.1.0-0.14
 - update from gcc-4_1-branch (-r109369:109401)
   - PR fortran/23675


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/gcc/devel/sources,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -r1.127 -r1.128
--- sources	6 Jan 2006 09:12:36 -0000	1.127
+++ sources	17 Jan 2006 18:05:12 -0000	1.128
@@ -1 +1 @@
-b2a01514112261eafd8c302d347ef632  gcc-4.1.0-20060106.tar.bz2
+893769a66a2abbeda6d0bbacace7f9c2  gcc-4.1.0-20060117.tar.bz2


--- gcc41-gomp-lastprivate-static.patch DELETED ---


--- gcc41-pr24940.patch DELETED ---


--- gcc41-pr25535.patch DELETED ---


--- gcc41-rh176562.patch DELETED ---




More information about the fedora-cvs-commits mailing list