This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fine grained bounds checking patches for egcs-20000501


I have converted Herman Brugge's gcc-2.95.2 port of Richard Jones' fine-grain
bounds-checker to work with egcs-20000501.  The patches against egcs
are about 650 KB compressed with bzip2.  I tested them under SuSE Linux 6.2.

The patches are available by ftp through the URL
<A HREF="ftp://nscs.fast.net/pub/binaries/boundschecking"> Bounds Checking Patches</A>
The server has a dial-up PPP line, so the download will take about 5 minutes.
I update the patches periodically as I have time.

I have included the gcc/bounds/README.103 with additional notes below.

My changes are freely copyable, and I can have the necessary paperwork filled
out, but for now, it looks like FSF will go with the fat pointer bounds
checker by Greg McGary.

William Bader
Senior Analyst
Software Consulting Services
3162 Bath Pike
Nazareth, PA  18064-8978
www:   www.newspapersystems.com (SCS)
work:  610-837-8485
fax:   610-837-8080
email: william@nscs.fast.net
(nscs.fast.net is currently 206.245.160.97)

--------------------------------------------------

Bounds Checking Patches for GCC 2.96
------------------------------------

Version: 1.03

02May00

I updated the gcc-2.95.2 bounds checking patches for egcs-20000501.
The original distribution described in README is a tar that contained patches.
This distribution is all patches made by the script makediffs.sh which runs
  gdiff -ruN egcs-yyyymmdd/gcc begcs-yyyymmdd/gcc
where egcs-yyyymmdd is an unmodified built version of egcs and
begcs-yyyymmdd is a built version with the bounds checking patches.
I used SuSE Linux 6.2 with a 2.2.12 kernel.

To build a bounds checking egcs:
  cd /u/gnu					# go to a work area
  tar xzf egcs-yyyymmdd.tar.gz			# unpack egcs
  mv egcs-yyyymmdd begcs-yyyymmdd		# rename the egcs directory
  cd begcs-yyyymmdd				# go to the begcs directory
  patch -p1 -T < egcs-yyyymmdd-begcs-yyyymmdd.pat	# apply the patches
  touch gcc/c-parse.in				# force a rebuild of .y and .c
  mkdir objdir					# make an object file area
  cd objdir					# enter the area
  /u/gnu/begcs-yyyymmdd/configure		# initialize the build
  make bootstrap				# do the build

The patches change c-parse.in but do not include the generated .y or .c files.
You must "touch" gcc/c-parse.in after applying the patches, and you will need
yacc or bison.

Many versions of egcs fail to bootstrap unless you set CFLAGS=-O0 to disable
optimization.  This reflects egcs problems.  The bounds checking patches have
no effect on the generated code unless you compile with "-fbounds-checking".

You can run your new begcs without installing it through the script
  /u/gnu/begcs-yyyymmdd/gcc/bounds/bgcc
If you build in a different area or copy the script, you will need
to edit the initial sequence that locates the root directory.

You can test the bounds checker with
  cd /u/gnu/begcs-yyyymmdd/gcc/bounds/bgcc/tests
  chmod +x ../bgcc
  make CC=../bgcc
All tests should return OK.

If you want to experiment with changes, you can recompile your changes with
  cd objdir
  make bootstrap3

I started with Herman van Brugge's bounds checking patches for gcc-2.95.2 at
http://www.inter.NL.net/hcc/Haj.Ten.Brugge
In addition to updating Richard Jones's work for gcc-2.7, he added some lookup
optimizations and support for threads.  Herman updates the patches only for
gcc releases.  If the latest gcc release works for you, you should use his
patches instead of mine.

As I have time, I will put patches into
ftp://nscs.fast.net/pub/binaries/boundschecking

You may freely mix objects compiled with and without bounds checking.
I find this convenient because I must link programs to third-party object
libraries.

These patches are unrelated to the fat pointer bounds checking patches by Greg
McGary gkm@eng.ascend.com which change the size of pointers and require building
modified versions of libc and every other library that your program calls.
I have heard that Greg's patches will eventually be incorporated into egcs.
If you can use Greg's fat pointer bounds checker, it has the advantage of
better run-time performance and support for languages other than C.

William Bader (william@nscs.fast.net, williambader@hotmail.com)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]