recent change to gcc

Bruce Korb bkorb@sco.COM
Tue Sep 5 15:27:00 GMT 2000


Tom Tromey wrote:
> 
> With this change:
> 
> 2000-09-05  Bruce Korb  <bkorb@gnu.org>
> 
>         * gcc/fixinc/fixincl.c(load_file): always read header files
>         with sizes that are a multiple of the page size.
> 
> I am no longer able to build gcc on my x86 Linux box.
> The changed code uses PAGESIZE, which doesn't seem to be defined anywhere.
> I changed it to use getpagesize() and now it builds.
> 
> Tom

"getpagesize" is not POSIX.  This is all getting way too yummy.  :-(
How about forgetting mmap because its implementation is too lame?



#ifdef HAVE_MMAP_FILE
  curr_data_mapped = BOOL_TRUE;

  /*  IF the file size is a multiple of the page size,
      THEN sometimes you will seg fault trying to access a trailing byte */

#if defined( PAGESIZE )
# define FI_PAGEMASK (PAGESIZE-1)
#elif defined (HAVE_GETPAGESIZE)
# define FI_PAGEMASK (getpagesize()-1)
#else
# define FI_PAGEMASK 0x0FFF
#endif

  if ((stbf.st_size & FI_PAGEMASK) == 0)
    res = (char*)BAD_ADDR;
  else
    res = (char*)mmap ((void*)NULL, data_map_size, PROT_READ,
                       MAP_PRIVATE, data_map_fd, 0);
  if (res == (char*)BAD_ADDR)
    {
      curr_data_mapped = BOOL_FALSE;
      res = load_file_data ( fdopen (data_map_fd, "r"));
    }


More information about the Gcc-bugs mailing list