Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2002 15:13:03 -0600 (CST)
From:      Dan Nelson <dnelson@allantgroup.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        obrien@FreeBSD.org
Subject:   ports/45769: PATCH: Add bounds-checking option to lang/gcc32
Message-ID:  <200211262113.gAQLD31S001836@dan.emsphone.com>

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

>Number:         45769
>Category:       ports
>Synopsis:       PATCH: Add bounds-checking option to lang/gcc32
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 26 13:20:01 PST 2002
>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 #223: Sun Nov 24 14:13:14 CST 2002 dan@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386


	
>Description:

Patch to the lang/gcc32 port allowing it to build with Herman ten
Brugge's bounds-checking patches

http://web.inter.nl.net/hcc/Haj.Ten.Brugge/
http://www.doc.ic.ac.uk/~phjk/BoundsChecking.html

	
>How-To-Repeat:
	
>Fix:

Apply the following patch.

Because both patch-va and the bounds-checking patches hit
gcc/Makefile.in, I had to split patch-va into two versions.  the
Makefile determines which one to apply.

I don't really know what to do with the extra distfile.  Just make sure
you set WITH_BOUNDSCHECKING=yes when running "make makesum", or else
the checksum will disappear from distinfo.  It actually should not hurt
to enable bounds-checking by default for package builds, since it only
does anything when -fbounds-checking is used.

	-Dan Nelson
	dnelson@allantgroup.com

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/lang/gcc32/Makefile,v
retrieving revision 1.135
diff -u -r1.135 Makefile
--- Makefile	26 Nov 2002 01:59:10 -0000	1.135
+++ Makefile	26 Nov 2002 21:06:33 -0000
@@ -13,7 +13,8 @@
 PORTVERSION=	3.2.1
 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,15 @@
 		gcc-java-${PORTVERSION}${EXTRACT_SUFX} \
 		gcc-objc-${PORTVERSION}${EXTRACT_SUFX}
 
+.if defined (WITH_BOUNDSCHECKING)
+BCCPATCH=	bounds-checking-gcc-3.2.1-1.00.patch.bz2
+DISTFILES+=	${BCCPATCH}:bgcc
+EXTRACT_ONLY=	${DISTFILES:S/${BCCPATCH}:bgcc//}
+EXTRA_PATCHES=	${.CURDIR}/files/opt.patch-aa ${FILESDIR}/opt.patch-va.gccbc
+.else
+EXTRA_PATCHES=	${FILESDIR}/opt.patch-va.gcc
+.endif
+
 #PATCH_SITES=	ftp://relay.nuxi.com/obrien/
 #PATCHFILES=	port_gcc32_${SNAPDATE}.diff
 
@@ -77,6 +87,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}
@@ -108,6 +123,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.76
diff -u -r1.76 distinfo
--- distinfo	26 Nov 2002 01:59:10 -0000	1.76
+++ distinfo	26 Nov 2002 16:55:24 -0000
@@ -1,3 +1,4 @@
+MD5 (bounds-checking-gcc-3.2.1-1.00.patch.bz2) = 9ad51d77b9f4398b802cc339b8c98e3b
 MD5 (gcc-core-3.2.1.tar.bz2) = e87b2970e96c54b8e45d11bb41a3e915
 MD5 (gcc-g++-3.2.1.tar.bz2) = 8164fb818bed5ab11d0f6a2800aafb23
 MD5 (gcc-g77-3.2.1.tar.bz2) = db0b9bd892cdba585e0694050a8abcd8
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) \
Index: files/opt.patch-va.gcc
===================================================================
RCS file: files/opt.patch-va.gcc
diff -N files/opt.patch-va.gcc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/opt.patch-va.gcc	25 Nov 2002 22:05:54 -0000
@@ -0,0 +1,20 @@
+--- gcc/Makefile.in.orig	Thu May 23 10:57:21 2002
++++ gcc/Makefile.in	Tue Sep 10 19:52:35 2002
+@@ -156,6 +156,3 @@
+ # to programs compiled with GCC.
+-USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
+-    $(srcdir)/ginclude/varargs.h \
+-    $(srcdir)/ginclude/stdbool.h $(srcdir)/ginclude/iso646.h \
+-    $(EXTRA_HEADERS)
++USER_H = $(EXTRA_HEADERS)
+ 
+@@ -858,3 +855,3 @@
+ $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in
+-	(cd $(srcdir) && autoconf)
++	(cd $(srcdir) && echo "wants to run autoconf, blah")
+ 
+@@ -880,3 +877,3 @@
+ @MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
+-@MAINT@	(cd $(srcdir) && autoheader)
++@MAINT@	(cd $(srcdir) && echo "wants to run autoheader, blah")
+ @MAINT@	@rm -f $(srcdir)/cstamp-h.in
Index: files/opt.patch-va.gccbc
===================================================================
RCS file: files/opt.patch-va.gccbc
diff -N files/opt.patch-va.gccbc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/opt.patch-va.gccbc	25 Nov 2002 17:36:42 -0000
@@ -0,0 +1,32 @@
+--- gcc/Makefile.in.orig	Mon Nov 25 11:22:42 2002
++++ gcc/Makefile.in	Mon Nov 25 11:31:02 2002
+@@ -154,10 +154,7 @@ INSTALL_HEADERS_DIR = @build_install_hea
+ 
+ # Header files that are made available under the same name
+ # to programs compiled with GCC.
+-USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
+-    $(srcdir)/ginclude/varargs.h \
+-    $(srcdir)/ginclude/stdbool.h $(srcdir)/ginclude/iso646.h \
+-    $(srcdir)/ginclude/unchecked.h $(EXTRA_HEADERS)
++USER_H = $(srcdir)/ginclude/unchecked.h $(EXTRA_HEADERS)
+ 
+ # The GCC to use for compiling libgcc.a, enquire, and crt*.o.
+ # Usually the one we just built.
+@@ -861,7 +858,7 @@ cs-tm_p.h: Makefile
+ # then do allow autoconf to be run.
+ 
+ $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in
+-	(cd $(srcdir) && autoconf)
++	(cd $(srcdir) && echo "wants to run autoconf, blah")
+ 
+ gccbug:	$(srcdir)/gccbug.in
+ 	CONFIG_FILES=gccbug CONFIG_HEADERS= ./config.status
+@@ -883,7 +880,7 @@ mklibgcc: $(srcdir)/mklibgcc.in
+ # Only run it if maintainer mode is enabled.
+ @MAINT@ $(srcdir)/config.in: $(srcdir)/cstamp-h.in
+ @MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
+-@MAINT@	(cd $(srcdir) && autoheader)
++@MAINT@	(cd $(srcdir) && echo "wants to run autoheader, blah")
+ @MAINT@	@rm -f $(srcdir)/cstamp-h.in
+ @MAINT@	echo timestamp > $(srcdir)/cstamp-h.in
+ auto-host.h: cstamp-h ; @true
Index: files/patch-va
===================================================================
RCS file: files/patch-va
diff -N files/patch-va
--- files/patch-va	11 Sep 2002 16:48:58 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
---- gcc/Makefile.in.orig	Thu May 23 10:57:21 2002
-+++ gcc/Makefile.in	Tue Sep 10 19:52:35 2002
-@@ -156,6 +156,3 @@
- # to programs compiled with GCC.
--USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
--    $(srcdir)/ginclude/varargs.h \
--    $(srcdir)/ginclude/stdbool.h $(srcdir)/ginclude/iso646.h \
--    $(EXTRA_HEADERS)
-+USER_H = $(EXTRA_HEADERS)
- 
-@@ -858,3 +855,3 @@
- $(srcdir)/configure: @MAINT@ $(srcdir)/configure.in
--	(cd $(srcdir) && autoconf)
-+	(cd $(srcdir) && echo "wants to run autoconf, blah")
- 
-@@ -880,3 +877,3 @@
- @MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
--@MAINT@	(cd $(srcdir) && autoheader)
-+@MAINT@	(cd $(srcdir) && echo "wants to run autoheader, blah")
- @MAINT@	@rm -f $(srcdir)/cstamp-h.in
>Release-Note:
>Audit-Trail:
>Unformatted:

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




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