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]

[PATCH] Precompiled header alignment fix


Geoff,

This is a part of:

http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00963.html

that got left in the dust. This part is still relevant to the
current state of affairs.

Earl

	* ggc-common.c (gt_pch_save): Sense result from ftell() before
	performing simplified alignment arithmetic.

*** ../../gcc-3.4.1-dist/gcc/ggc-common.c       Wed Oct 29 14:13:59 2003
--- ./ggc-common.c      Tue Oct 12 23:27:50 2004
***************
*** 494,507 ****

/* Pad the PCH file so that the mmapped area starts on a page boundary. */
{
! long o;
! o = ftell (state.f) + sizeof (mmi);
if (o == -1)
fatal_error ("can't get position in PCH file: %m");
! mmi.offset = page_size - o % page_size;
! if (mmi.offset == page_size)
! mmi.offset = 0;
! mmi.offset += o;
}
if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
fatal_error ("can't write PCH file: %m");
--- 494,504 ----


/* Pad the PCH file so that the mmapped area starts on a page boundary. */
{
! long o = ftell (state.f);
if (o == -1)
fatal_error ("can't get position in PCH file: %m");
! o += sizeof (mmi) + mmap_offset_alignment - 1;
! mmi.offset = o - o % mmap_offset_alignment;
}
if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
fatal_error ("can't write PCH file: %m");



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