pef.c:bfd_pef_object_p breaks other targets

Klee Dienes klee@apple.com
Sun Nov 10 20:28:00 GMT 2002


Sorry about that.  We have local patches to bfd_check_format_matches() 
that save and restore the target-specific parts of the bfd before 
calling each of the recognizers, and I neglected to check the 
ambiguous-match code on a version without this patch installed.

I've changed pef_object_p, pef_xlib_object_p, and sym_object_p to only 
trample abfd->tdata if the targets pass the magic-number check (in the 
case of pef, the first 8 bytes must be "Joy!peff"; for xsym, the first 
32 bytes must match "\013Version 3.x" followed by 20 nulls, both of 
which seem pretty safe).

2002-11-10  Klee Dienes  <kdienes@apple.com>

         * pef.c: Move version check out of bfd_pef_scan and into
         bfd_pef_object_p.  Only modify tdata if we have already 
recognized
         the file correctly.  Ditto for bfd_pef_xlib_scan and
         bfd_pef_xlib_object_p.
         * xsym.c (bfd_sym_scan): New function.  Does the real work of
         parsing an already-recognized xSYM file (moved from
         bfd_sym_object_p).
         (bfd_sym_object_p): Only modify tdata if we have already
         recognized the file correctly.
         * xsym.h (bfd_sym_scan): Add prototype.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pefsym.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20021110/e79fea14/attachment.txt>
-------------- next part --------------


On Thursday, November 7, 2002, at 06:13 PM, Alan Modra wrote:

> You can't just willy nilly assign to abfd->tdata.  It's a union and
> may contain valid tdata for some other format.  See elf_object_p
> for what needs to be done.


More information about the Binutils mailing list