This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: recent change to gcc
- To: tromey at cygnus dot com, Zack Weinberg <zack at wolery dot cumb dot org>, Graham Stott <grahams at redhat dot com>
- Subject: Re: recent change to gcc
- From: Bruce Korb <bkorb at sco dot COM>
- Date: Tue, 05 Sep 2000 15:19:32 -0700
- CC: Bruce Korb <bkorb at gnu dot org>, Gcc Bug List <bug-gcc at gnu dot org>, GNU Compiler <gcc at gcc dot gnu dot org>
- Organization: The Santa Cruz Operation
- References: <87zolmo788.fsf@creche.cygnus.com>
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"));
}