X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com From: "Pierre Muller" To: Cc: "'Eli Zaretskii'" Subject: Beta GNU binutils troubles solved Date: Thu, 14 May 2009 01:22:23 +0200 Message-ID: <001001c9d421$ac528bf0$04f7a3d0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcnUIatTiw2oiH50StGwFAuAV/I35w== Content-Language: en-us X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (mailhost.u-strasbg.fr [IPv6:2001:660:2402::152]); Thu, 14 May 2009 01:22:17 +0200 (CEST) X-Virus-Scanned: ClamAV 0.94.2/9357/Wed May 13 23:05:21 2009 on mr2.u-strasbg.fr X-Virus-Status: Clean X-Spam-Status: No, score=-99.9 required=5.0 tests=RDNS_DYNAMIC, USER_IN_WHITELIST autolearn=disabled version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mr2.u-strasbg.fr Reply-To: djgpp-workers AT delorie DOT com I was trying for a long time to use beta DJGPP libraries to compile binutils and gdb. 2.03 had the problem that scanf was not supported enough for gdb.. Eli, how did you solve this issue? objdump always failed miserably telling that it could not detect the object format. After some intense debugging I finally found the bug. It is located in fseeko64 function that is called from bfd_seek. fseeko64 uses llseek but forgets about the other fields of the FILE pointer _stream. Simply putting _cnt field to 0 was enough to solve the problems inside bfd and I got a working gdb from CVS source little time later :) Pierre Muller Pascal language support maintainer for GDB A real fix is to probably copy the code from fseek to fseeko64... Index: ansi/stdio/fflush.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fflush.c,v retrieving revision 1.11 diff -u -p -r1.11 fflush.c --- ansi/stdio/fflush.c 29 Jan 2003 01:28:34 -0000 1.11 +++ ansi/stdio/fflush.c 13 May 2009 23:13:41 -0000 @@ -77,5 +77,11 @@ fflush(FILE *f) f->_flag &= ~(_IOWRT|_IOREAD); f->_ptr = f->_base; } + if (f->_flag & _IOREAD) + { + f->_cnt = 0; + f->_ptr = f->_base; + } + return 0; } Index: compat/stdio/fseeko64.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/compat/stdio/fseeko64.c,v retrieving revision 1.1 diff -u -p -r1.1 fseeko64.c --- compat/stdio/fseeko64.c 11 Dec 2007 07:48:42 -0000 1.1 +++ compat/stdio/fseeko64.c 13 May 2009 23:13:42 -0000 @@ -17,6 +17,10 @@ fseeko64(FILE *_stream, off64_t _offset, o = llseek(fileno(_stream), _offset, _mode); if (o == -1) return -1; + if (_stream) + { + _stream->_cnt = 0; + } return 0; }