This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: PE bug: bad DataDirectory.
- From: "Donn Terry" <donnte at microsoft dot com>
- To: "Nick Clifton" <nickc at redhat dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Fri, 16 Aug 2002 10:32:46 -0700
- Subject: RE: PE bug: bad DataDirectory.
If I remember the code correctly, the initialization of entries 1 and 12
can only be (reasonably) done where it is (or "nearby") because the
information
needed to do it isn't available in ...swap_aouthdr_out. (It was the
case
at the time I last looked; things could have changed.)
The entries that are initialized in swap_aouthdr_out could (possibly) be
initialized
in ...final_link_postscript(?).
It appears that removing the memset completely introduces no "junk" into
the
Data Directory, so a selective memset may not be needed. (Or maybe the
memset
belongs in ...final_link_postscript.)
Based upon these and other comments, my current "feel" for the right
answer is
to do everything in ...final_link_postscript, but that presumes that the
information
to do so is available at that time. Anyone know that for sure (either
way) before
we go digging in the code?
Donn
-----Original Message-----
From: Nick Clifton [mailto:nickc@redhat.com]
Sent: Friday, August 16, 2002 9:14 AM
To: Donn Terry
Cc: binutils@sources.redhat.com
Subject: Re: PE bug: bad DataDirectory.
Hi Donn,
> Scenario: ldwrite calls _bfd_coff_final_link which calls
> _bfd_pei_final_link_postscript. _bfd_pei_final_link_postscript fills
> in the import table entries for the .idata section.
>
> *Subsequently* main calls bfd_close calls coff_write_object_contents
> calls _bfd_pei_swap_aouthdr_out. The memset in
> _bfd_pei_swap_aouthdr_out zeros out the work that
> _bfd_pei_final_link_postscript did. Oops.
It appears that _bfd_pei_final_link_postscript only fills in entries 1 &
12 of the DataDictionary, and that apart from the memset
_bfd_pei_swap_aouthdr_out only initialises entries 0, 1, 2, 3 & 5.
I am not sure if ..aouthdr_out's initialisation of entry 1 is correct,
but assuming that it is, then it would seem that the memset should be
restricted to entries 4, 6, 7, 8, 9, 10, 11, 13, 14, 15 & 16. Either
that or code to initialise entry 12 should be added to ...aouthdr_out().
What do you think ?
Cheers
Nick