From dd220a5e26ef3831910ca3a1251ca6ccced4e2a4 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 22 Jun 2008 10:52:51 +0000
Subject: Fix for building with newer gcc versions #225743 by Emil Wojak.
 (Portage version: 2.2_rc1/cvs/Linux 2.6.25 x86_64, RepoMan options: --force)

---
 sys-devel/gcc/ChangeLog                            |  6 +++-
 .../files/3.2.3/gcc-3.2.3-poisoned-malloc.patch    | 41 ++++++++++++++++++++++
 sys-devel/gcc/gcc-3.2.3-r4.ebuild                  | 37 ++-----------------
 3 files changed, 49 insertions(+), 35 deletions(-)
 create mode 100644 sys-devel/gcc/files/3.2.3/gcc-3.2.3-poisoned-malloc.patch

(limited to 'sys-devel')

diff --git a/sys-devel/gcc/ChangeLog b/sys-devel/gcc/ChangeLog
index 8f8c9d042af3..6ca5ffb68af4 100644
--- a/sys-devel/gcc/ChangeLog
+++ b/sys-devel/gcc/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog for sys-devel/gcc
 # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.653 2008/06/21 04:23:11 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/ChangeLog,v 1.654 2008/06/22 10:52:50 vapier Exp $
+
+  22 Jun 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/3.2.3/gcc-3.2.3-poisoned-malloc.patch, gcc-3.2.3-r4.ebuild:
+  Fix for building with newer gcc versions #225743 by Emil Wojak.
 
   21 Jun 2008; Mike Frysinger <vapier@gentoo.org> gcc-4.3.0.ebuild,
   gcc-4.3.1.ebuild:
diff --git a/sys-devel/gcc/files/3.2.3/gcc-3.2.3-poisoned-malloc.patch b/sys-devel/gcc/files/3.2.3/gcc-3.2.3-poisoned-malloc.patch
new file mode 100644
index 000000000000..2bdd26df4e39
--- /dev/null
+++ b/sys-devel/gcc/files/3.2.3/gcc-3.2.3-poisoned-malloc.patch
@@ -0,0 +1,41 @@
+fix building gcc-3.2.3 with newer versions of gcc
+
+http://bugs.gentoo.org/225743
+http://gcc.gnu.org/ml/gcc-help/2008-01/msg00040.html
+http://www.archivum.info/gnu.gcc.help/2008-05/msg00093.html
+
+--- gcc-3.2.3/gcc/read-rtl.c
++++ gcc-3.2.3/gcc/read-rtl.c
+@@ -659,7 +659,7 @@
+ 	    {
+ 	      ungetc (c, infile);
+ 	      list_counter++;
+-	      obstack_ptr_grow (&vector_stack, (PTR) read_rtx (infile));
++	      obstack_ptr_grow (&vector_stack, read_rtx (infile));
+ 	    }
+ 	  if (list_counter > 0)
+ 	    {
+--- gcc-3.2.3/gcc/system.h
++++ gcc-3.2.3/gcc/system.h
+@@ -589,7 +589,9 @@
+ #undef realloc
+ #undef calloc
+ #undef strdup
++#if ! (defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC))
+  #pragma GCC poison malloc realloc calloc strdup
++#endif
+ 
+ /* Old target macros that have moved to the target hooks structure.  */
+  #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN			\
+@@ -628,4 +630,11 @@
+ 
+ #endif /* GCC >= 3.0 */
+ 
++#if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC)
++/* Flex and bison use malloc and realloc.  Yuk.  Note that this means
++   really_call_* cannot be used in a .l or .y file.  */
++#define malloc xmalloc
++#define realloc xrealloc
++#endif
++
+ #endif /* ! GCC_SYSTEM_H */
diff --git a/sys-devel/gcc/gcc-3.2.3-r4.ebuild b/sys-devel/gcc/gcc-3.2.3-r4.ebuild
index 4c2fb916305a..3b65333dd2bd 100644
--- a/sys-devel/gcc/gcc-3.2.3-r4.ebuild
+++ b/sys-devel/gcc/gcc-3.2.3-r4.ebuild
@@ -1,6 +1,6 @@
 # Copyright 1999-2008 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.3-r4.ebuild,v 1.26 2008/03/20 20:39:50 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-3.2.3-r4.ebuild,v 1.27 2008/06/22 10:52:50 vapier Exp $
 
 inherit eutils flag-o-matic libtool versionator
 
@@ -206,39 +206,7 @@ src_unpack() {
 		cp ${WORKDIR}/protector.h ${WORKDIR}/${P}/gcc/ || die "protector.h not found"
 		version_patch ${FILESDIR}/3.2.3/gcc-323-propolice-version.patch
 
-		# check for the glibc to have the guard
-		if	[ "$(readelf -s /lib/libc.so.6 | grep GLOBAL | grep OBJECT | grep '__guard')" ] &&
-			[ "$(readelf -s /lib/libc.so.6 | grep GLOBAL | grep FUNC | grep '__stack_smash_handler')" ]
-		then
-			ewarn "this sys-libs/glibc has __guard object and __stack_smash_handler functions"
-			ewarn "scanning the system for binaries with __guard - this may take 5-10 minutes"
-			ewarn "please do not press crtl-C or crtl-Z during this period - it will continue"
-			SCANPATH="$(for i in $(cat /etc/ld.so.conf | grep -v '/usr/lib/gcc-lib' | grep -v '^\#'); do echo -n $i; echo -n ' '; done) $(echo ${PATH} | sed 's,:, ,g')"
-			if [ "$(find ${SCANPATH} -type f -perm -1 -maxdepth 9 -exec readelf -s {} \; 2>&1 | grep "__guard\@GCC" 2>&1 1>/dev/null; echo $?)" == "0" ]
-			then
-				eerror "found binaries that are dynamically linked to the libgcc with __guard@@GCC"
-				eerror "you need to compile these binaries without CFLAGS -fstack-protector/hcc -r"
-				echo
-				eerror "also you have to make sure that using ccache needs the cache to be flushed"
-				eerror "wipe out /var/tmp/ccache or /root/.ccache, this will remove possible saved"
-				eerror "-fstack-protector arguments that still may reside in such a compiler cache"
-				echo
-				eerror "when such binaries are found, gcc cannot remove libgcc propolice functions"
-				eerror "leading to gcc -static -fstack-protector breaking, see gentoo bug id 25299"
-				einfo  "you can run 'qpkg -f' from the gentoolkit package and reemerge the program"
-				einfo  "to do a full scan on your system, enter this following command in a shell:"
-				echo
-				einfo  "find / -type f -perm -1 -maxdepth 9 -exec echo -n '__guard at GCC check in: {} ' \; -exec qpkg -f {} \; -exec readelf -s {} \; 2>&1 | grep __guard | grep -B1 '__guard\@GCC'"
-				echo
-				exit 1
-			else
-				echo
-				einfo  "no binaries with suspicious libgcc __guard@GCC dependencies in ${SCANPATH}"
-				echo
-				epatch ${FILESDIR}/3.2.3/gcc-3.2.3-move-propolice-into-glibc.patch
-			fi
-		fi
-		# end of check for the glibc to have the guard
+		epatch ${FILESDIR}/3.2.3/gcc-3.2.3-move-propolice-into-glibc.patch
 	fi
 
 	# Patches from Mandrake/Suse ...
@@ -251,6 +219,7 @@ src_unpack() {
 	# GCC bugfixes ...
 	epatch ${FILESDIR}/3.2.2/gcc32-pr7768.patch
 	epatch ${FILESDIR}/3.2.2/gcc32-pr8213.patch
+	epatch ${FILESDIR}/3.2.3/gcc-3.2.3-poisoned-malloc.patch #225743
 
 	# Get gcc to decreases the number of times the collector has to be run
 	# by increasing its memory workspace, bug #16548.
-- 
cgit v1.2.3-65-gdbad