This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: PCH merge bootstrap failure on irix6.2 due to missing ftello/fseeko
- From: Geoff Keating <geoffk at geoffk dot org>
- To: ghazi at caip dot rutgers dot edu
- Cc: gcc-bugs at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 10 Jan 2003 22:11:10 -0800
- Subject: Re: PCH merge bootstrap failure on irix6.2 due to missing ftello/fseeko
- References: <200301110519.AAA29330@caip.rutgers.edu>
> Date: Sat, 11 Jan 2003 00:19:47 -0500 (EST)
> From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> Bootstrapping on mips-sgi-irix6.2 after the recent merge yields an
> error in stage1 linking cc1 because ftello and fseeko are missing on
> that platform.
>
> Irix6.2 does have regular ftell/fseek which we already use elsewhere
> in GCC.
>
> I can either apply something like the patch below, or do autoconf
> magic to define e.g. fseeko-> fseek only when the o versions are
> missing.
>
> 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'.
> diff -rup orig/egcc-CVS20030109/gcc/c-pch.c egcc-CVS20030109/gcc/c-pch.c
> --- orig/egcc-CVS20030109/gcc/c-pch.c 2003-01-09 21:21:58.000000000 -0500
> +++ egcc-CVS20030109/gcc/c-pch.c 2003-01-10 09:45:28.975404000 -0500
> @@ -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);
> }
> @@ -83,7 +83,7 @@ c_common_write_pch ()
>
> 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,7 +92,7 @@ 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; )
> diff -rup orig/egcc-CVS20030109/gcc/ggc-common.c egcc-CVS20030109/gcc/ggc-common.c
> --- orig/egcc-CVS20030109/gcc/ggc-common.c 2003-01-09 22:15:00.000000000 -0500
> +++ egcc-CVS20030109/gcc/ggc-common.c 2003-01-10 09:45:44.370023000 -0500
> @@ -496,7 +496,7 @@ 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);
> + o = ftell (state.f) + sizeof (mmi);
> if (o == (off_t) -1)
> fatal_io_error ("can't get position in PCH file");
> mmi.offset = page_size - o % page_size;
>
--
- Geoffrey Keating <geoffk@geoffk.org>