Can't read srec files without an end record
In binutils 2.18, the 'srec' BFD file format does not handle EOF correctly. This situation only comes up when the srec file does not contain an explicit "end" record (S7, S8, or S9). Here is a comparison of the native objdump on a RHEL system, which works OK on such a file, and a host=i386-redhat-linux target=powerpc-linux cross objdump built from binutils-2.18: | $ cat test.srec | S315090909090909090982 | S315001072727272727272724A4A4A4A4A4A4A4AFA | $ objdump --version | GNU objdump 2.14.90.0.4 20030523 | Copyright 2002 Free Software Foundation, Inc. | This program is free software; you may redistribute it under the terms of | the GNU General Public License. This program has absolutely no warranty. | $ xppc-objdump --version | GNU objdump (GNU Binutils) 2.18 | Copyright 2007 Free Software Foundation, Inc. | This program is free software; you may redistribute it under the terms of | the GNU General Public License version 3 or (at your option) any later version. | This program has absolutely no warranty. | $ objdump -x test.srec | | test.srec: file format srec | test.srec | architecture: UNKNOWN!, flags 0x: | | start address 0x | | Sections: | Idx Name Size VMA LMA File off Algn | 0 .sec1 0020 2**0 | CONTENTS, ALLOC, LOAD | SYMBOL TABLE: | no symbols | | | $ xppc-objdump -x test.srec | xppc-objdump: test.srec: File format not recognized The problem appears to be caused by the function srec_get_byte assuming that bfd_bread will set bfd_error to bfd_error_file_truncated when encountering EOF, though bfd_bread does not always do that -- in some cases it leaves bfd_error unchanged. One fix, assuming that bfd_bread is correct and srec_get_byte is at fault, is this: *** binutils-2.18/bfd/ORIGsrec.c2007-08-06 12:59:41.0 -0700 --- binutils-2.18/bfd/srec.c2008-09-11 17:52:23.0 -0700 *** *** 221,226 --- 221,227 { bfd_byte c; + bfd_set_error (bfd_error_file_truncated); if (bfd_bread (&c, (bfd_size_type) 1, abfd) != 1) { if (bfd_get_error () != bfd_error_file_truncated) -- -=] Mike [=- ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
Re: ***UNCHECKED*** Re: ***UNCHECKED*** Re: question about "invalid string offset" & "could not read symbols: Malformed archive" linker errors (fwd)
Hi Nick, I think I was having some problems before with the libxvtmapi.a file because I was mixing some of the XVT 5.50 code with the XVT 5.80 code. Please find on my web-site the complete archive with all source and object files, http://www.ece.ualberta.ca/~rmoore/linux.xvt5.8update.12.sept.2008.no.malformed.tar.bz2 Please find below the output from make. First you have to type, $ ccmake . To properly configure the project and set it up with the proper directories. Then in the text UI type 'c' and 'g' which should exit for you automatically if it was successfuly. Otherwise, if you don't want to bother with the ccmake, you can simply set you directory structure to be the following and place the files in there, /mnt/hgfs/pclinux/trunk/branches/xvt5.8update And simply type, $ make Here is the output I'm getting, g++ -g ../outdir/debug/vistawin/vistawin.o -o ../outdir/debug/vistawin.exe -L../outdir/debug -L../outdir/debug/xvtlib -L/usr/X11R6/lib -lvistawin -lxvtxmapid -lxvtxmhb580d -lxvtxmba580d -lxvtxmhi580d -lnxpro -lm -lGL -lGLU -lX11 -lXm -lpthread -lstdc++ /usr/local/bin/ld: skipping incompatible ../outdir/debug/xvtlib/libnxpro.so when searching for -lnxpro /usr/local/bin/ld: cannot find -lnxpro collect2: ld returned 1 exit status make[1]: *** [../outdir/debug/vistawin.exe] Error 1 make[1]: Leaving directory `/mnt/hgfs/pclinux/trunk/branches/xvt5.8update/vistawin' make: *** [debug] Error 2 [EMAIL PROTECTED] xvt5.8update]$ pushd /mnt/hgfs/pclinux/trunk/branches/xvt5.8update/outdir/debug/xvtlib /mnt/hgfs/pclinux/trunk/branches/xvt5.8update [EMAIL PROTECTED] xvtlib]$ !objd objdump -p libnxpro.so libnxpro.so: file format elf32-i386 Program Header: LOAD off0x vaddr 0x paddr 0x align 2**12 filesz 0x00068894 memsz 0x00068894 flags r-x LOAD off0x00069000 vaddr 0x00069000 paddr 0x00069000 align 2**12 filesz 0x2280 memsz 0x3920 flags rw- DYNAMIC off0x0006ab50 vaddr 0x0006ab50 paddr 0x0006ab50 align 2**2 filesz 0x00b8 memsz 0x00b8 flags rw- Dynamic Section: NEEDED libpthread.so.0 HASH 0x0094 STRTAB 0x558c SYMTAB 0x181c STRSZ0x2fe6 SYMENT 0x0010 PLTGOT 0x0006ac08 PLTRELSZ 0x0bb8 PLTREL 0x0011 JMPREL 0x00014838 REL 0x8d50 RELSZ0xbae8 RELENT 0x0008 TEXTREL 0x VERNEED 0x8d20 VERNEEDNUM 0x0001 VERSYM 0x8572 RELCOUNT 0x122a Version References: required from libpthread.so.0: 0x0d696911 0x00 03 GLIBC_2.1 0x0d696910 0x00 02 GLIBC_2.0 [EMAIL PROTECTED] xvtlib]$ Could you please tell me, how do I link in the libnxpro.so file found in outdir/debug/xvtlib? Sorry, I'm sure I'm missing something obvious. Thank you, Roger On Tue, 2 Sep 2008, Nick Clifton wrote: > Hi Roger, > > > Okay, you don't really need to reproduce the build process. Packed in the > > archive I sent you is the file libxvtxmapi.a. It should be located in > > both the ~/lib and the ~/outdir/debug directories. If you perform ar on > > this library, it should mention something about tapp.o. > > It does. ("Malformed archive" etc etc). > > Now - how do I build this library ? Ie I want to take an uncorrupt > tapp.o file and put it into a library and in the process corrupt it, so > that I can try to locate exactly where the corruption is happening. > > Cheers >Nick > ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils
Re: Can't read srec files without an end record
On Thu, Sep 11, 2008 at 10:42:14PM -0700, Mike Ditto wrote: > | $ cat test.srec > | S315090909090909090982 > | S315001072727272727272724A4A4A4A4A4A4A4AFA [snip] > | $ xppc-objdump -x test.srec > | xppc-objdump: test.srec: File format not recognized Looks like this has already been fixed on mainline and 2.19. 2008-02-11 Daniel Jacobowitz <[EMAIL PROTECTED]> * cache.c (cache_bread): Set bfd_error_file_truncated if EOF was reached. * srec.c (srec_scan): Calculate the checksum. Complain on mismatch. -- Alan Modra Australia Development Lab, IBM ___ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils