Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Mar 2003 16:57:19 -0600 (CST)
From:      Dan Nelson <dnelson@allantgroup.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/50178: [PATCH] gcc-3.2.2 bounds-checking
Message-ID:  <200303212257.h2LMvJki095147@dan.emsphone.com>

next in thread | raw e-mail | index | archive | help

>Number:         50178
>Category:       ports
>Synopsis:       [PATCH] gcc-3.2.2 bounds-checking
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 21 15:00:20 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dan Nelson
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
The Allant Group
>Environment:
System: FreeBSD dan.emsphone.com 5.0-CURRENT FreeBSD 5.0-CURRENT #256: Fri Mar 21 09:51:29 CST 2003 dan@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386


	
>Description:

Patches to the lang/gcc32 port that allow the user to build with Herman
ten Brugge's excellent bounds-checking patches located at
http://web.inter.nl.net/hcc/Haj.Ten.Brugge/

	
>How-To-Repeat:
	
>Fix:

This obsoletes PR 48013 , which applied to GCC 3.2.1.  In addition,
this patch is much simpler (better chance of being committed? :)

Apply the following patch, and set WITH_BOUNDSCHECKING=yes before
building.

	

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/lang/gcc32/Makefile,v
retrieving revision 1.140
diff -u -r1.140 Makefile
--- Makefile	20 Feb 2003 18:37:58 -0000	1.140
+++ Makefile	21 Mar 2003 22:39:27 -0000
@@ -13,7 +13,8 @@
 PORTVERSION=	3.2.2
 PORTREVISION=	${SNAPVER}
 CATEGORIES=	lang java
-MASTER_SITES=	${MASTER_SITE_GCC}
+MASTER_SITES=	${MASTER_SITE_GCC} \
+		http://web.inter.NL.net/hcc/Haj.Ten.Brugge/:bgcc
 MASTER_SITE_SUBDIR=	releases/gcc-${PORTVERSION}
 DISTFILES=	gcc-core-${PORTVERSION}${EXTRACT_SUFX} \
 		gcc-g++-${PORTVERSION}${EXTRACT_SUFX} \
@@ -21,6 +22,16 @@
 		gcc-java-${PORTVERSION}${EXTRACT_SUFX} \
 		gcc-objc-${PORTVERSION}${EXTRACT_SUFX}
 
+WITH_BOUNDSCHECKING=	yes
+
+.if defined (WITH_BOUNDSCHECKING)
+# Fetch another file, but don't extract it.  Also add another patchfile.
+BCCPATCH=	bounds-checking-gcc-3.2.2-1.00.patch.bz2
+DISTFILES+=	${BCCPATCH}:bgcc
+EXTRACT_ONLY=	${DISTFILES:S/${BCCPATCH}:bgcc//}
+EXTRA_PATCHES=	${FILESDIR}/opt.patch-gccbc-aa 
+.endif
+
 #PATCH_SITES=	ftp://relay.nuxi.com/obrien/
 #PATCHFILES=	port_gcc32_${SNAPDATE}.diff
 
@@ -35,7 +46,7 @@
 CONFIGURE_SCRIPT=	../${SRCDIR:C/${WRKDIR}//}/configure
 # do not require GCC 3.2 to compile -- or we have an infinate loop on RELENG_4.
 USE_GCC=	X
-NOMANCOMPRESS=	yes	# to hard to deal with differences on 5-cur and releng4
+NOMANCOMPRESS=	yes	# too hard to deal with differences on 5-cur and releng4
 
 .include <bsd.port.pre.mk>
 
@@ -78,6 +89,11 @@
 
 pre-fetch:
 	@${ECHO} "Making GCC ${DISTNAME:S/^gcc-//} for ${OPSYS} ${OSREL} ${PORTOBJFORMAT}	target ${CONFIGURE_TARGET}"
+.if !defined(WITH_BOUNDSCHECKING)
+	@${ECHO_MSG} "You can enable fine-grained bounds-checking support for compiled C programs"
+	@${ECHO_MSG} "by defining WITH_BOUNDSCHECKING.  Compile and link with \"-fbounds-checking\""
+	@${ECHO_MSG} "to use."
+.endif
 
 .if defined(CVS_DATE)
 DIST_SUBDIR=	${PKGNAME}
@@ -109,6 +125,16 @@
 	${MKDIR} ${SRCDIR}
 	cd ${DISTDIR}/${DIST_SUBDIR}/gcc ; pax -pe -rwt . ${SRCDIR}
 .endif	# CVS_DATE
+
+.if defined(WITH_BOUNDSCHECKING)
+# Extract bounds-checking patch, removing the ada parts of the patch with sed.
+pre-patch:
+	(	cd ${_DISTDIR} && \
+		${BZCAT} ${BCCPATCH} | \
+			${SED} -e '/^--- .*ada/,/^diff/d' | \
+			${PATCH} -d ${PATCH_WRKSRC} -E -p1 --quiet \
+	)
+.endif
 
 pre-configure:
 	@# Keep from running `autoconf' and `autoheader' since we modified
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/lang/gcc32/distinfo,v
retrieving revision 1.77
diff -u -r1.77 distinfo
--- distinfo	8 Feb 2003 18:34:17 -0000	1.77
+++ distinfo	9 Feb 2003 19:52:08 -0000
@@ -3,3 +3,4 @@
 MD5 (gcc-g77-3.2.2.tar.bz2) = 0b220a0cd5dd471c34c080952265e91e
 MD5 (gcc-java-3.2.2.tar.bz2) = 05660a2dc4c874bbb361dec8363da852
 MD5 (gcc-objc-3.2.2.tar.bz2) = c2c99dca89281512403b9805c59ffd2d
+MD5 (bounds-checking-gcc-3.2.2-1.00.patch.bz2) = 44a7e5030fde6e0e9350aa5029eacbaf
Index: files/opt.patch-gccbc-aa
===================================================================
RCS file: files/opt.patch-gccbc-aa
diff -N files/opt.patch-gccbc-aa
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/opt.patch-gccbc-aa	13 Jun 2002 16:38:31 -0000
@@ -0,0 +1,11 @@
+--- gcc/bounds/lib/malloc/Makefile.orig	Fri Sep 28 15:31:19 2001
++++ gcc/bounds/lib/malloc/Makefile	Mon Oct  1 13:58:20 2001
+@@ -52,7 +52,7 @@ VPATH = $(srcdir)/bounds/lib/malloc
+ SUBDIR_INCLUDES = -I$(srcdir)/bounds/lib/malloc -I../../.. -I$(srcdir) -I$(srcdir)/config -I../../../../include
+ 
+ # Use this on System V.
+-CPPFLAGS = -DUSG
++CPPFLAGS = -DBSD4_2
+ 
+ .c.o:
+ 	$(GCC_FOR_TARGET) -Wall $(OPTIMIZE) $(CPPFLAGS) \

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303212257.h2LMvJki095147>