bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/5105] x86_64-pc-mingw32 native ld.exe randomly failed to read th


From: drangon dot mail at gmail dot com
Subject: [Bug ld/5105] x86_64-pc-mingw32 native ld.exe randomly failed to read the archive file
Date: 5 Oct 2007 08:14:06 -0000

------- Additional Comments From drangon dot mail at gmail dot com  2007-10-05 
08:14 -------
Subject: Re:  x86_64-pc-mingw32 native ld.exe randomly failed to read the 
archive file

After some more log, I think this is a bug of mingw-crt,
After some special read, the "ftello64()" will has one less than "ftell()"

the code fragment is :

--------------------------------------
243 static file_ptr
244 cache_btell (struct bfd *abfd)
245 {
246   FILE *f = bfd_cache_lookup (abfd, CACHE_NO_OPEN);
247   if (f == NULL)
248     return abfd->where;
249   printf( "-6- btell begin, file %p, abfd->where %d ( %d, %d )\n",
f, (int)abfd->where, (int)ftell( f ), (int)ftello64( f ) );
250   int ret = real_ftell( f );
251   printf( "-6- btell end, file %p, abfd->where %d ( %d, %d ), ret
%d\n", f, (int)abfd->where, (int)ftell( f ), (int)ftello64( f ), ret
);
252   return ret;
253   // return real_ftell (f);
254 }
255
256 static int
257 cache_bseek (struct bfd *abfd, file_ptr offset, int whence)
258 {
259   FILE *f = bfd_cache_lookup (abfd, whence != SEEK_CUR ? CACHE_NO_SEEK : 0);
260   if (f == NULL)
261     return -1;
262   printf( "-6- bseek begin, file %p, abfd->where %d ( %d, %d ),
off %lld\n", f, (int)abfd->where, (int)ftell( f ), (int)ftello64( f ),
(long long)offset
    );
263   int ret = real_fseek (f, offset, whence);
264   printf( "-6- bseek snd, file %p, abfd->where %d ( %d, %d ), ret
%d\n", f, (int)abfd->where, (int)ftell( f ), (int)ftello64( f ), ret
);
265   return ret;
266   // return real_fseek (f, offset, whence);
267 }
------------------------------------

and the log output is :

-------------------------------------------
*** [bfd_generic_archive_p:645] begin read file
[..\target\x86_64-pc-mingw32\lib\libmingw32.a]
-5- read begin, abfd->where 8 ( 8 ), want 16 bytes
-5- read end, 16 bytes, got 16, abfd->where 24 ( 24 )
-5- seek begin, abfd->where 24 ( 24 ), arg pos -16
-6- bseek begin, file 000007FF7FC792F0, abfd->where 24 ( 24, 24 ), off -16
-6- bseek snd, file 000007FF7FC792F0, abfd->where 24 ( 8, 8 ), ret 0
-5- file_position -16, position -16, abfd->origin 0, result 0
-5- seek end, abfd->where 8 ( 8 )
-4- file pos 8
-5- read begin, abfd->where 8 ( 8 ), want 60 bytes
-5- read end, 60 bytes, got 60, abfd->where 68 ( 68 )
-4- parsed_size 1758, ar_name [47]
-5- read begin, abfd->where 68 ( 68 ), want 4 bytes
-5- read end, 4 bytes, got 4, abfd->where 72 ( 72 )
-5- read begin, abfd->where 72 ( 72 ), want 376 bytes
-5- read end, 376 bytes, got 376, abfd->where 448 ( 448 )
-5- read begin, abfd->where 448 ( 448 ), want 1378 bytes
-5- read end, 1378 bytes, got 1378, abfd->where 1826 ( 1826 )
-5- bfd_tell begin, abfd->where 1826 ( 1826 )
-6- btell begin, file 000007FF7FC792F0, abfd->where 1826 ( 1826, 1825 )
-6- btell end, file 000007FF7FC792F0, abfd->where 1826 ( 1826, 1825 ), ret 1825
-5- bfd_tell end, abfd->where 1825 ( 1826 ), ptr 1825, abfd->origin 0
-5- seek begin, abfd->where 1825 ( 1826 ), arg pos 1826
-6- bseek begin, file 000007FF7FC792F0, abfd->where 1825 ( 1826, 1825
), off 1826
-6- bseek snd, file 000007FF7FC792F0, abfd->where 1825 ( 1826, 1826 ), ret 0
-5- file_position 1826, position 1826, abfd->origin 0, result 0
-5- seek end, abfd->where 1826 ( 1826 )
-4- file pos 1826
-5- read begin, abfd->where 1826 ( 1826 ), want 60 bytes
-5- read end, 60 bytes, got 60, abfd->where 1886 ( 1886 )
-4- parsed_size 22, ar_name [47]
-2- slurp ok
-5- seek begin, abfd->where 1886 ( 1886 ), arg pos 1826
-6- bseek begin, file 000007FF7FC792F0, abfd->where 1886 ( 1886, 1886
), off 1826
-6- bseek snd, file 000007FF7FC792F0, abfd->where 1886 ( 1826, 1826 ), ret 0
-5- file_position 1826, position 1826, abfd->origin 0, result 0
-5- seek end, abfd->where 1826 ( 1826 )
-5- read begin, abfd->where 1826 ( 1826 ), want 16 bytes
-5- read end, 16 bytes, got 16, abfd->where 1842 ( 1842 )
-5- seek begin, abfd->where 1842 ( 1842 ), arg pos -16
-6- bseek begin, file 000007FF7FC792F0, abfd->where 1842 ( 1842, 1841 ), off -16
-6- bseek snd, file 000007FF7FC792F0, abfd->where 1842 ( 1825, 1825 ), ret 0
-5- file_position -16, position -16, abfd->origin 0, result 0
-5- seek end, abfd->where 1826 ( 1825 )
-4- file pos 1825
-5- read begin, abfd->where 1826 ( 1825 ), want 60 bytes
-5- read end, 60 bytes, got 60, abfd->where 1886 ( 1885 )
-3- namedata is NULL
*** slurp or extend failed
----------------------------------------------------

5 Oct 2007 04:48:44 -0000, hjl at lucon dot org
<address@hidden>:
>
> ------- Additional Comments From hjl at lucon dot org  2007-10-05 04:48 
> -------
> (In reply to comment #5)
> > Subject: Re:  x86_64-pc-mingw32 native ld.exe randomly failed to read the
> archive file
> >
> > your command works.
> >
> > I add some log in bfd_seek() and bfd_pread(),
> > it seems that the file offset suddenly minus by 1,
> > this is not caused by a seek(), it seem like some call return -1 and
> > then add to position.
> >
>
> It may be an interface or mingw issue. Please check if types used
> in bfd_seek and bfd_bread are correct.
>
> --
>
>
> http://sourceware.org/bugzilla/show_bug.cgi?id=5105
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=5105

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]