Mail Archives: djgpp-workers/2003/06/11/04:22:26
--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--
- Raw text -