Problem with recent GNU ld packages
Edouard Gomez
ed.gomez@free.fr
Mon Oct 20 10:14:00 GMT 2003
Edouard Gomez (ed.gomez@free.fr) wrote:
> I tried to debug GNU ld to find where the
> (section_type_struct)->_raw_size field was set... but no luck. Is there
> in this list a GNU ld (coff) guru wanting to help me track the the bug ?
I found the change that is responsible of my bug.
2003-04-15 Brian Ford <ford@vss.fsi.com>
* peicode.h (coff_swap_scnhdr_in): If a section holds
uninitialized data and is from an object file or from an
executable image that has not initialized the s_size field, or if
the physical size is padded, use the virtual size (stored in
s_paddr) instead.
It concerns code in bfd/peicode.h, included in a #ifndef
COFF_NO_HACK_SCNHDR_SIZE preprocessor directive.
In my case, i have:
scnhdr_int->s_name = ".text\0";
scnhdr_int->s_vaddr = 0;
scnhdr_int->s_paddr = 12;
scnhdr_int->s_size = 243;
scnhdr_int->s_scnptr = 112;
scnhdr_int->s_relptr = 355;
scnhdr_int->s_lnnoptr = 0;
scnhdr_int->s_flags = 0x60500020
The "guilty" condition is that one:
if (scnhdr_int->s_paddr > 0
&& (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
&& (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
|| scnhdr_int->s_size > scnhdr_int->s_paddr))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
}
Old code used to be:
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
&& (scnhdr_int->s_paddr > 0))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
}
I hope this enough so a binutils hacker can fix the bug, or if it's not
a binutils bug, just tell me that nasm generates bad pe-i386 object
files.
--
Edouard Gomez
More information about the Binutils
mailing list