This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: PCH merge bootstrap failure on irix6.2 due to missing ftello/fseeko


> Date: Sat, 11 Jan 2003 11:41:29 -0500 (EST)
> From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> Cc: gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org,
>    ghazi@caip.rutgers.edu
> X-OriginalArrivalTime: 11 Jan 2003 16:41:46.0737 (UTC) FILETIME=[54B4F610:01C2B990]
> 
>  > From: Geoff Keating <geoffk@geoffk.org>
>  > 
>  > > What is your preference?
>  > 
>  > Hmmm.  I think the autoconf magic would be better, but it shouldn't
>  > matter since asm_out_file should never really go past the 2G limit.
>  > If you go with this patch, please also change the type of the
>  > variables (asm_file_startpos, asm_file_end, h.asm_size, o) to be
>  > 'long int' rather than 'off_t'.
> 
> Ok.  h.asm_size was an 'unsigned long' so I didn't touch it.
> 
> Here's the patch, I'll rebootstrap on irix6.2.  Assuming that works,
> ok to install?

Yes, this is OK.

> 2003-01-11  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
> 
> 	* c-pch.c (asm_file_startpos): Change to `long'.
> 	(pch_init): Use ftell, not ftello.
> 	(c_common_write_pch): Use ftell/fseek, not ftello/fseeko.
> 	Use `long' instead of `off_t'.
> 	(c_common_read_pch): Likewise.
> 	* ggc-common.c (gt_pch_save): Use long/ftell instead of
> 	off_t/ftello.
> 	
> diff -rup orig/egcc-CVS20030110/gcc/c-pch.c egcc-CVS20030110/gcc/c-pch.c
> --- orig/egcc-CVS20030110/gcc/c-pch.c	Thu Jan  9 21:21:58 2003
> +++ egcc-CVS20030110/gcc/c-pch.c	Sat Jan 11 11:27:14 2003
> @@ -40,7 +40,7 @@ static const char pch_ident[8] = "gpchC0
>  static FILE *pch_outfile;
>  
>  extern char *asm_file_name;
> -static off_t asm_file_startpos;
> +static long asm_file_startpos;
>  
>  void
>  pch_init ()
> @@ -67,7 +67,7 @@ pch_init ()
>  	  || strcmp (asm_file_name, "-") == 0)
>  	fatal_error ("`%s' is not a valid output file", asm_file_name);
>  
> -      asm_file_startpos = ftello (asm_out_file);
> +      asm_file_startpos = ftell (asm_out_file);
>        
>        cpp_save_state (parse_in, f);
>      }
> @@ -77,13 +77,13 @@ void
>  c_common_write_pch ()
>  {
>    char *buf;
> -  off_t asm_file_end;
> -  off_t written;
> +  long asm_file_end;
> +  long written;
>    struct c_pch_header h;
>  
>    cpp_write_pch_deps (parse_in, pch_outfile);
>  
> -  asm_file_end = ftello (asm_out_file);
> +  asm_file_end = ftell (asm_out_file);
>    h.asm_size = asm_file_end - asm_file_startpos;
>    
>    if (fwrite (&h, sizeof (h), 1, pch_outfile) != 1)
> @@ -92,12 +92,12 @@ c_common_write_pch ()
>    buf = xmalloc (16384);
>    fflush (asm_out_file);
>  
> -  if (fseeko (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
> +  if (fseek (asm_out_file, asm_file_startpos, SEEK_SET) != 0)
>      fatal_io_error ("can't seek in %s", asm_file_name);
>  
>    for (written = asm_file_startpos; written < asm_file_end; )
>      {
> -      off_t size = asm_file_end - written;
> +      long size = asm_file_end - written;
>        if (size > 16384)
>  	size = 16384;
>        if (fread (buf, size, 1, asm_out_file) != 1)
> @@ -203,7 +203,7 @@ c_common_read_pch (pfile, name, fd, orig
>    buf = xmalloc (16384);
>    for (written = 0; written < h.asm_size; )
>      {
> -      off_t size = h.asm_size - written;
> +      long size = h.asm_size - written;
>        if (size > 16384)
>  	size = 16384;
>        if (fread (buf, size, 1, f) != 1
> diff -rup orig/egcc-CVS20030110/gcc/ggc-common.c egcc-CVS20030110/gcc/ggc-common.c
> --- orig/egcc-CVS20030110/gcc/ggc-common.c	Thu Jan  9 22:15:00 2003
> +++ egcc-CVS20030110/gcc/ggc-common.c	Sat Jan 11 11:29:30 2003
> @@ -495,9 +495,9 @@ gt_pch_save (f)
>    
>    /* Pad the PCH file so that the mmaped area starts on a page boundary.  */
>    {
> -    off_t o;
> -    o = ftello (state.f) + sizeof (mmi);
> -    if (o == (off_t) -1)
> +    long o;
> +    o = ftell (state.f) + sizeof (mmi);
> +    if (o == -1)
>        fatal_io_error ("can't get position in PCH file");
>      mmi.offset = page_size - o % page_size;
>      if (mmi.offset == page_size)
> 


-- 
- Geoffrey Keating <geoffk@geoffk.org>


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