From: Andris Pavenis To: djgpp-workers AT delorie DOT com, DJ Delorie Subject: Re: Binutils bug causes GCC bootstrap comparision failures Date: Wed, 11 Jun 2003 11:21:49 +0300 User-Agent: KMail/1.5.2 Cc: djgpp-workers AT delorie DOT com References: <200306052334 DOT 12918 DOT pavenis AT latnet DOT lv> <200306052058 DOT h55KwFM6020876 AT envy DOT delorie DOT com> In-Reply-To: <200306052058.h55KwFM6020876@envy.delorie.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_dau5+w6nCylAMCb" Message-Id: <200306111121.49638.pavenis@latnet.lv> Reply-To: djgpp-workers AT delorie DOT com --Boundary-00=_dau5+w6nCylAMCb Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 05 June 2003 23:58, DJ Delorie wrote: > This sounds like the usual MS-DOS "fill seeks with garbage" bug. Seems like that. Attached ugly "brute force" patch seems to workaround problem. It doesn't look very nice, and I have done only a very limitted testing with GAS only and I didn't saw the problem any more. Maybe we should consider this or something similar for DJGPP port of binutils. Patch is against binutils-2.13.92. I was too lazy to handle SEEK_CURR, so only SEEK_SET is supported. Andris --Boundary-00=_dau5+w6nCylAMCb Content-Type: text/x-diff; charset="iso-8859-1"; name="bfd_seek.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bfd_seek.c.diff" --- binutl-2.1392/bfd/bfdio.c~1 2002-11-18 16:37:52.000000000 +0000 +++ binutl-2.1392/bfd/bfdio.c 2003-06-10 20:51:20.000000000 +0000 @@ -325,6 +325,25 @@ if (direction == SEEK_SET && abfd->my_archive != NULL) file_position += abfd->origin; +#ifdef __DJGPP__ + if (direction == SEEK_SET) + { + result = fseek (f, 0, SEEK_END); + if (result < file_position) + { + char tmp[128]; + int length, len2; + memset (tmp, 0, 128); + length = file_position - result; + while (length > 0) + { + int len2 = length>128 ? 128 : length; + fwrite (tmp, 1, len2, f); + length -= len2; + } + } + } +#endif result = fseek (f, file_position, direction); if (result != 0) { --Boundary-00=_dau5+w6nCylAMCb--