------- Additional Comments From drangon dot mail at gmail dot com 2007-10-04 15:50 ------- I add some printf in binutils/bfd/archive.c to print out some value.
---------------------------------------------------------------------- 380 if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) 381 { 382 if (bfd_get_error () != bfd_error_system_call) 383 bfd_set_error (bfd_error_no_more_archived_files); 384 return NULL; 385 } 386 printf( "-4- hdr.ar_mag [%s], ARFMAG [%s], mag [%s]\n", hdr.ar_fmag, ARFMAG, mag == NULL ? "(null)" : mag ); 387 if (strncmp (hdr.ar_fmag, ARFMAG, 2) != 0 388 && (mag == NULL 389 || strncmp (hdr.ar_fmag, mag, 2) != 0)) 390 { 391 bfd_set_error (bfd_error_malformed_archive); 392 return NULL; 393 } 394 395 errno = 0; 396 parsed_size = strtol (hdr.ar_size, NULL, 10); 397 printf( "-4- hdr.ar_size [%s], parsed_size %d, ar_name [%s]\n", hdr.ar_size, (int)parsed_size, hdr.ar_name ); 398 if (errno != 0) 399 { 400 bfd_set_error (bfd_error_malformed_archive); 401 return NULL; 402 } --------------------------------------------------------------- and from the log, the first some times, it reads the archive successfully : ---------------------------------------------------------- *** [bfd_generic_archive_p:644] begin read file [..\target\x86_64-pc-mingw32\lib\libmingw32.a] -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [1758 ` ], parsed_size 1758, ar_name [/ 1191037575 0 0 0 1758 ` ] -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [22 ` ], parsed_size 22, ar_name [// 22 ` ] -2- slurp ok -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [22 ` ], parsed_size 22, ar_name [// 22 ` ] -3- extended ok -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [2985 ` ], parsed_size 2985, ar_name [crt0_c.o/ 1191037555 500 501 100664 2985 ` ] *** has map and first object failed. ----------------------------------------------------------- but the last some times, it reads failed ------------------------------------------------------------ *** [bfd_generic_archive_p:644] begin read file [..\target\x86_64-pc-mingw32\lib\libmingw32.a] -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [1758 ` ], parsed_size 1758, ar_name [/ 1191037575 0 0 0 1758 ` ] -4- hdr.ar_mag [` ], ARFMAG [` ], mag [(null)] -4- hdr.ar_size [22 ` ], parsed_size 22, ar_name [// 22 ` ] -2- slurp ok -4- hdr.ar_mag [ `], ARFMAG [` ], mag [(null)] -3- namedata is NULL *** slurp or extend failed ---------------------------------------------------------- the hdr head reads " hdr.ar_mag [ `] ", it should be "`\012", I don't understand why this value suddenly goes wrong ... -- 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. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils