Patch: Initialise new file space to zero for Beos

Ian Lance Taylor ian@zembu.com
Mon Sep 20 09:30:00 GMT 1999


   Date: Mon, 20 Sep 1999 10:51:08 +0100
   From: Nick Clifton <nickc@cygnus.com>

   OK, well I have a patch to libiberty (see below) that creates a new
   function called zero_fseek() for BeOS hosts.  I do have two questions
   though:

     1. At the moment zero_fseek is BeOS specific, should it be, or
	should there be some kind of test to determine if fseek zeroes a
	file ?  (eg create a file 512 bytes long.  Fill it with non-zero
	bytes.  Truncate it to 1 byte long.  Re-extended it to 512
	bytes.  Read in the 511 bytes and check that they are zero).

I don't think a configure test is necessary.  Very few systems have
these characteristics, and for them I think it is reasonable to simply
test the host configuration name.

     2. How can BFD determine if it needs to use the zero_fseek function?
	At the moment the libiberty patch does not create a
	HAVE_zero_fseek define.  (I could not find a way to do this from
	inside config/mh-beos).  Should bfd_seek() just call zero_fseek
	if __BEOS__ is defined ?

The conventional way to set flags for a host in config/mh-* is to set
CC.  However, that is not quite right in this case, since we want to
set the flag in all cases, not depending upon the compiler.

You could add new functionality to the top level Makefile.in to
support CFLAGS to the host, which you would then pass down in
EXTRA_HOST_FLAGS or some such place.  Or you could just modify
bfd/configure.in to use zero_fseek.  Either way, I think it should be
based on a test of $host.  For example, that is how we set
USE_BINARY_FOPEN in bfd/acinclude.m4.

Ian


More information about the Binutils mailing list